SMF Development > Fixed or Bogus Bugs
call_integration_hook('integrate_bbc_codes', array(&$codes)) depr. sind PHP5.4?
spaulding2:
Hi folks,
adding custom buttons/codes to the editor via 'integrate_bbc_buttons'/'integrate_bbc_codes' is no longer working for me, because the call-time pass by reference doesn't work since php5.4:
--- Quote ---bkfake-php at yahoo dot com 14-Mar-2012 05:49
It should be noted that
call_user_func_array('function', array(&$a));
is effectively a call-time pass by reference
it should also be noted that it does not throw any error or warning in any version of php. PHP 5.4 continues to not throw a warning. Also, as of PHP 5.4, the var will not be passed by reference.
--- End quote ---
(Taken from php.net manual topic "Passing by reference")
I'm hacking additional codes/buttons into Subs.php/Subs-Editor.php right now. Are there any plans to change the API or is there a less painless workaround?
Thanks in advance,
Matt
Arantor:
As I understood it, call-time references don't work but if the function signature itself indicates it accepts references, that should be honoured?
[SiNaN]:
Yeah, I think that should work.
feline:
tested on 5.4.3 .. works
--- Code: ---function debug($data)
{
log_error($data);
}
$host = $_SERVER["SERVER_NAME"];
call_user_func_array('debug', array(&$host));
--- End code ---
Arantor:
Of course it works, you're using it by value. Do it by reference and you'll see that it won't work as expected.
--- Code: ---function test($value)
{
$value++;
}
$value = 1;
call_user_func_array('test', array(&$value));
--- End code ---
Even though you're indicating pass-by-reference, it won't be passed by reference and as such $value is 1 after the call is made.
Navigation
[0] Message Index
[#] Next page
Go to full version