PHP 4.4+ and PHP 5.0.5 fails on return/pass by reference
|Reported by:||nacin||Owned by:|
Description (last modified by nacin)
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.