WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#1583 closed defect (bug) (fixed)

WP 1.6 and PHP 5 (call-time pass-by-reference is depreciated)

Reported by: ch0de Owned by: markjaquith
Milestone: Priority: high
Severity: blocker Version: 1.6
Component: General Keywords: bg|dev-feedback bg|2nd-opinion
Focuses: Cc:

Description

After installing WP 1.6 on a PHP 5 server, The errors are:

"Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of do_action(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in D:\WEBSITES_APACHE\xxxxx\wp16\wp-includes\comment-functions.php on line 450"

It has to do with & and the functions. I heard from a friend that this is being talked about in IRC, but this is just a reminder.

Change History (12)

comment:1 EvilBeAr9 years ago

  • Priority changed from high to normal
  • Version changed from 1.2 to 1.6

This is not an issue with wordpress but rather with server configuration. I had the same bug earlier.

See: #1547

You need to modify your php.ini and do what the error says.

allow_call_time_pass_reference = True

This must be put in php.ini.

comment:3 ch0de9 years ago

So I guess the only way is to tell my host to change it/add it or whatever? How about the code that was in the link you mentioned above?

<?php
function varargs_by_ref($arg_list = null) {

if (is_array($arg_list)) {

foreach ($arg_list as &$arg) {

# do whatever you want with $arg...

}

}

}

$by_ref = 'to_be_midified_inside_func';
$by_val = 'to_be_passed_by_value';

varargs_by_ref(array('baba', &$by_ref, $by_value));

?>

Exept it would need to be modified but i wish i knew how too do it.

comment:4 EvilBeAr9 years ago

Yeah I couldn't figure out how to use the code above so I went ahead and just modified my php.ini

comment:5 markjaquith9 years ago

  • Keywords bg|dev-feedback bg|2nd-opinion added
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

This part worries me:


If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer.


That rather suggests that it won't be a "server problem" for long, and that we're going to have to change our practices.

comment:6 masquerade9 years ago

  • Keywords bg|dev-feedback bg|2nd-opinion removed

Contrary to what EvilBeAr said, this is a WordPress issue and not a PHP server configuration issue. The setting is off by default and WordPress should adhere to that, especially considering that the feature will be completely removed later on. A temporary fix may be to ini_set it for what we need in the case this can't be fixed for 1.6.

comment:7 masquerade9 years ago

  • Keywords bg|dev-feedback bg|2nd-opinion added

comment:8 markjaquith9 years ago

  • Summary changed from Wordpress 1.6 not supporting PHP 5 to WP 1.6 and PHP 5 (call-time pass-by-reference is depreciated)

comment:9 josephscott9 years ago

It should be noted that this is not just a PHP5 issue, the warning comes up in PHP4 using the recommended php.ini. I'm still looking through the code, but an initial glance looks like it would be better to fix the comment-functions.php file (line 450) than changing the way do_action() works.

comment:10 skeltoac9 years ago

Brief research at php.net uncovered this tidbit: you CAN pass by an array of references. The do_action declaration already handles this beautifully so I have simply changed line 450 to pass an array:
do_action('pre_ping', array(&$post_links, &$pung));
The warning is gone. The pings need testing.

comment:11 skeltoac9 years ago

  • Priority changed from normal to high

comment:12 ryan9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [2798]) Call time pass by reference not allowed. Use the array trick. fixes #1583

Note: See TracTickets for help on using tickets.