Skip to content

Wrong place... #498

Closed
Closed
@hcngac

Description

@hcngac

array_push is showing error. Details are following:

PHP version 5.5.37

test.php

<?php
TESTCPP();
?>

TESTCPP()

void TESTCPP() {
    Php::Value a;
    a["b"]["c"] = "a[\"b\"][\"c\"]";
    Php::out << a["b"]["c"] << std::endl;
    Php::out << std::endl;
    a["d"] = Php::Array();
    Php::array_push(a["d"], "0");
    Php::array_push(a["d"], "1");
    Php::out << a["d"][0] << std::endl;
    Php::out << a["d"][1] << std::endl;
    Php::out << std::endl;
}

Output:

a["b"]["c"]

PHP Warning:  Parameter 1 to array_push() expected to be a reference, value given in /home/benng/test.php on line 2
PHP Stack trace:
PHP   1. {main}() /home/benng/test.php:0
PHP   2. testcpp() /home/benng/test.php:2
PHP Fatal error:  Uncaught exception 'Exception' with message 'Invalid call to array_push' in /home/benng/test.php:2
Stack trace:
#0 /home/benng/test.php(2): testcpp()
#1 {main}
  thrown in /home/benng/test.php on line 2

Thank you for your hard-working in this project and please be noticed about this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions