Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP::Array ByRef #350

Open
vadbes46 opened this issue Aug 29, 2017 · 3 comments
Open

PHP::Array ByRef #350

vadbes46 opened this issue Aug 29, 2017 · 3 comments

Comments

@vadbes46
Copy link

Hi,
Let me first say thank you for a such great software!!!

The problem which I have is related to passing PHP arrays, let's say [string=>string], into extension as a parameter and changing it inside some function. But when returning back to PHP the value is unchanged, no matter adding items to array or modifying existing ones. This issue does not happen with string or numeric variables. There is a workaround of returning an array from function (changing void to Php::Value) but then PHP code looks ugly, e.g.:
$x1=["temp"=>"change_me"];
$x1=someExtFunction($x1); // declaration in cpp: Php::Value someExtFunction(Php::Parameters& params){...}

The obvious usage seems to be like this:
$x1=["temp"=>"change_me"];
someExtFunction($x1); // declaration in cpp: void someExtFunction(Php::Parameters& params){...}

Is there a way to change Array variable passed ByRef?

Thanks & Regards,
Vadim.

@grimsonmarc
Copy link

I'm having this same issue. Has anyone found a fix for this? I was trying to create a function similar to how preg_match works (http://php.net/manual/en/function.preg-match.php) by passing in the $matches array by reference, but any updates to the Array being made in the CPP file does not get returned to PHP.

@diskerror
Copy link

It's not working for me either. I came back to this project after a couple of years, and now ByRef using an array does not work. This is with PHP-CPP 2.0.0.

@amitabh-georadius
Copy link

Has anybody been able to solve this? I am having the same problems with PHP-CPP 2.2.0 also .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants