SMF Development > Fixed or Bogus Bugs

call_integration_hook('integrate_bbc_codes', array(&$codes)) depr. sind PHP5.4?

<< < (2/3) > >>

spaulding2:
Hi all,

thanks for the replies.

@Arantor:
Yeah, changing the functions signature is the solution, thanks!

@feline:
To come closer to the problems nature:

--- Code: ---function worker() {
$log = array();
$log[] = 'top of log';

call_user_func_array('log_error', array(&$log)); //call by reference
show_log($log); /*call by value!*/ }

/*function log_error($db)*/ // - works up to PHP5.3!
function log_error(&$db) /* right signature under PHP5.4 */ {
$db[] = 'Oh Matt, what are you doin?'; }

function show_log($db) {
foreach ($db as $rec) { printf("%s<br />", $rec); } }

echo 'running php5.4<br />'; worker();
--- End code ---

emanuele:
So, if I understand it correctly, the only solution to this "bug" is to instruct modders to use in their functions the & in front of the variables.
Am I right?

Arantor:
Yes.

Though SMF should really alter calls not to pass by reference anyway...

emanuele:
That would make sense too, but probably it will be worked out in 3.0...

Arantor:
At this stage it's not really a big deal, it just means it won't work. Future versions of PHP will undoubtedly set things up to throw errors.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version