Call time pass-by-reference for PHP 5.4
What is going to be the best way to handle the removal of call time pass-by-reference as noted at http://www.php.net/manual/en/migration54.incompatible.php? This affects a lot of code. Based on http://drupal.org/node/1498574 D8 will not be ready for PHP 5.4 but some WAMP and LAMP are already delivering it. My query here though is more looking at preparing for any new modules or converting older modules and getting them ready for PHP 5.4. How do others plan to handle this offensive change? -- Earnie -- https://sites.google.com/site/earnieboyd
Call time pass by reference has produced a deprecated warning since PHP 5.3 and as far as I know has been removed entirely from Drupal 7 and I'm pretty sure it's not even found in Drupal 6. Note that contrib obviously varies wildly and could still have call time pass by reference issues. -Mike __________________ Michael Prasuhn http://mikeyp.net On Oct 26, 2012, at 8:45 AM, Earnie Boyd <earnie@users.sourceforge.net> wrote:
What is going to be the best way to handle the removal of call time pass-by-reference as noted at http://www.php.net/manual/en/migration54.incompatible.php?
This affects a lot of code. Based on http://drupal.org/node/1498574 D8 will not be ready for PHP 5.4 but some WAMP and LAMP are already delivering it. My query here though is more looking at preparing for any new modules or converting older modules and getting them ready for PHP 5.4. How do others plan to handle this offensive change?
-- Earnie -- https://sites.google.com/site/earnieboyd
Call time pass-by-reference has been deprecated for a while now, and PHP before 5.4 throws a warning when it is used. So, most code has already been updated to eliminate call time pass-by-references. Note: This ONLY applies to fuction calls. It does NOT apply to function definition. So, pass-by-reference CAN continue to be used in function defenitions. Thus, the following code IS valid: <?php function foo(&$var){ $var++; } $a = 0; foo($a); ?> But, the following code IS NOT valid: <?php function foo($var){ $var++; } $a = 0; foo(&$a); ?> On Fri, Oct 26, 2012 at 10:45 AM, Earnie Boyd <earnie@users.sourceforge.net>wrote:
What is going to be the best way to handle the removal of call time pass-by-reference as noted at http://www.php.net/manual/en/migration54.incompatible.php?
This affects a lot of code. Based on http://drupal.org/node/1498574 D8 will not be ready for PHP 5.4 but some WAMP and LAMP are already delivering it. My query here though is more looking at preparing for any new modules or converting older modules and getting them ready for PHP 5.4. How do others plan to handle this offensive change?
-- Earnie -- https://sites.google.com/site/earnieboyd
It's my understanding that as long as the reference is a variable or a function, the only difference is the removal of the '&' symbol when calling a function that receives the reference: logic that remains the same: function foo( &$some_var ) { // receives reference $some_var = 'some value'; } allowed old calling syntax: $my_var = 'original value'; foo( &$my_var ); // obvious it's being passed as a reference New syntax: $my_var = 'original value'; foo( $my_var ); // still a reference, just no special syntax when calling I've been running Drupal 6 in php 5.4, and only had to make a few adjustments like the above to run the latest D6 version. (I get a number of other warnings from other php changes, but this one seems fixed by the above.) Sincerely, -Blake Senftner On Oct 26, 2012, at 8:45 AM, Earnie Boyd wrote:
What is going to be the best way to handle the removal of call time pass-by-reference as noted at http://www.php.net/manual/en/migration54.incompatible.php?
This affects a lot of code. Based on http://drupal.org/node/1498574 D8 will not be ready for PHP 5.4 but some WAMP and LAMP are already delivering it. My query here though is more looking at preparing for any new modules or converting older modules and getting them ready for PHP 5.4. How do others plan to handle this offensive change?
-- Earnie -- https://sites.google.com/site/earnieboyd
Ah, yes, yes, I was reading the notice incorrectly. Thanks. On Fri, Oct 26, 2012 at 12:47 PM, Blake Senftner <bsenftner@earthlink.net> wrote:
It's my understanding that as long as the reference is a variable or a function, the only difference is the removal of the '&' symbol when calling a function that receives the reference:
logic that remains the same: function foo( &$some_var ) { // receives reference $some_var = 'some value'; }
allowed old calling syntax: $my_var = 'original value'; foo( &$my_var ); // obvious it's being passed as a reference
New syntax: $my_var = 'original value'; foo( $my_var ); // still a reference, just no special syntax when calling
I've been running Drupal 6 in php 5.4, and only had to make a few adjustments like the above to run the latest D6 version. (I get a number of other warnings from other php changes, but this one seems fixed by the above.)
Sincerely, -Blake Senftner
On Oct 26, 2012, at 8:45 AM, Earnie Boyd wrote:
What is going to be the best way to handle the removal of call time pass-by-reference as noted at http://www.php.net/manual/en/migration54.incompatible.php?
This affects a lot of code. Based on http://drupal.org/node/1498574 D8 will not be ready for PHP 5.4 but some WAMP and LAMP are already delivering it. My query here though is more looking at preparing for any new modules or converting older modules and getting them ready for PHP 5.4. How do others plan to handle this offensive change?
-- Earnie -- https://sites.google.com/site/earnieboyd
-- Earnie -- https://sites.google.com/site/earnieboyd
participants (4)
-
Arlin Sandbulte -
Blake Senftner -
Earnie Boyd -
Michael Prasuhn