#14160 closed defect (bug) (fixed)
PHP 4.4+ and PHP 5.0.5 fails on return/pass by reference
Reported by: | nacin | Owned by: | |
---|---|---|---|
Milestone: | 3.0.1 | Priority: | normal |
Severity: | major | Version: | |
Component: | Warnings/Notices | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
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.
Change History (11)
#7
@
15 years ago
Found two more:
./wp-admin/includes/nav-menu.php:327: echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( get_the_ID() ) ) ), 0, (object) $args ); ./wp-includes/query.php:2741: $this->queried_object = & get_page(get_option('page_for_posts'));
Interestingly, while the latter just came up in the Earthlink thread, http://wordpress.org/support/topic/411708, it's actually four years and five days old -- [4023].
I'm going to get access to an install on PHP 5.0.5 to confirm whether #13757 also breaks anything.
(In [15358]) Curses on PHP 5.0.5. see #14160 for trunk.