From: Jason at hybd dot net
Operating system:
PHP version: 5.1.0b2
PHP Bug Type: Scripting Engine problem
Bug description: Fatal error: Only variables can be passed by reference
Description:
------------
This bug is a rehash of 33516, but I can't reopen as I'm not the original
author.
It seems like you can not pass tempories to function / method parameters.
<?php
class Foo {
public static function bar() {
return array('a' => '1234567890');
}
}
$tmp = Foo::bar();
$var = array_pop($tmp);
?>
Seems to work, but it shouldn't be down to the PHP user (imho) to
implement this as this change in PHP 5.1 breaks a lot of existing code.
Reproduce code:
---------------
<?php
class Foo {
public static function bar() {
return array('a' => '1234567890');
}
}
$var = array_pop(Foo::bar());
?>
Expected result:
----------------
$var = '1234567890';
Foo::bar() gets placed in temporary variable
Actual result:
--------------
Fatal error: Only variables can be passed by reference
--
Edit bug report at http://bugs.php.net/?id=33643&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33643&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33643&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33643&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33643&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33643&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33643&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33643&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33643&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33643&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33643&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33643&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33643&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33643&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33643&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33643&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33643&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33643&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33643&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33643&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33643&r=mysqlcfg