[wp-trac] [WordPress Trac] #14160: PHP 4.4+ and PHP 5.0.5 fails on return/pass by reference

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 30 21:51:40 UTC 2010


#14160: PHP 4.4+ and PHP 5.0.5 fails on return/pass by reference
------------------------------+---------------------------------------------
 Reporter:  nacin             |       Owner:       
     Type:  defect (bug)      |      Status:  new  
 Priority:  normal            |   Milestone:  3.0.1
Component:  Warnings/Notices  |     Version:       
 Severity:  major             |    Keywords:       
------------------------------+---------------------------------------------
Description changed by nacin:

Old description:

> This code does not work in PHP 5.0.5:
> {{{
> $post = get_post( wp_insert_post( ... ) );
> }}}
>
> You get: Fatal error: Only variables can be passed by reference in wp-
> admin/includes/post.php on line 379
>
> According to the PHP 5 changelog, this was fixed in 5.1.0: "Allowed
> return by reference from internal functions. (Marcus, Andi, Dmitry)".
> Related (per my search; not referenced in the changelog):
> http://bugs.php.net/bug.php?id=34468,
> http://bugs.php.net/bug.php?id=34424.
>
> I have not tested this on 4.4 but I have not been able to find a mention
> that this was fixed in the 4.4 branch. Generally our PHP 4 testing is on
> 4.3, hence why this was missed.
>
> This was discovered as Earthlink uses 5.0.5 (release date 05-Sep-2005).
> Committing the fix, assigning first to a local variable as we do
> elsewhere, for 3.0.1, and recommending to Earthlink they upgrade to at
> least 5.2.
>
> Related, #13757.

New description:

 This code does not work in PHP 5.0.5:
 {{{
 $post = get_post( wp_insert_post( ... ) );
 }}}

 You get: Fatal error: Only variables can be passed by reference in wp-
 admin/includes/post.php on line 379

 According to the PHP 5 changelog, this was fixed in 5.1.0: "Allowed return
 by reference from internal functions. (Marcus, Andi, Dmitry)". Related
 (per my search; not referenced in the changelog):
 http://bugs.php.net/bug.php?id=34468,
 http://bugs.php.net/bug.php?id=34424.

 I have not tested this on 4.4 but I have not been able to find a mention
 that this was fixed later in the 4.4 branch. Generally our PHP 4 testing
 is on 4.3, hence why this was missed.

 This was discovered as Earthlink uses 5.0.5 (release date 05-Sep-2005).
 Committing the fix, assigning first to a local variable as we do
 elsewhere, for 3.0.1, and recommending to Earthlink they upgrade to at
 least 5.2.

 Related, #13757.

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14160#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list