#33495 [Opn->Bgs]: Fatal error: Only variables can be passed by reference with array_shift
| From: | tony2001@php.net | Date: | Mon, 27 Jun 2005 20:02:35 +0000 |
| Subject: | #33495 [Opn->Bgs]: Fatal error: Only variables can be passed by reference with array_shift | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81095@lists.php.net to get a copy of this message | ||
ID: 33495
Updated by: tony2001@php.net
Reported By: jsheets at idahoimageworks dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: FreeBSD
PHP Version: 5CVS-2005-06-27 (dev)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The error message is quite informative, isn't it ?
array_shift() modifies specified variable and "explode('.',
'file.txt')" is definitely not a variable, but an expression.
Previous Comments:
------------------------------------------------------------------------
[2005-06-27 21:16:37] jsheets at idahoimageworks dot com
Description:
------------
Starting with PHP 5.1 beta #2 PHP dies with a
PHP Configuration:
'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs'
'--with-pgsql=/usr/local/pgsql''--enable-ftp' '--with-zlib-dir=/usr'
'--with-config-file-path=/usr/local/apache2/conf'
'--with-jpeg-dir=/usr/local'
PHP Versions: 5.1 BETA #2 and PHP 5.1 latest CVS
Reproduce code:
---------------
/**
* Returns the part of the filename before the .
* @param string $file
* @return string
*/
function GetBaseName($file)
{
if (empty($file)) {
return false;
}
// simplified, $file replaced with file.txt
return array_shift(explode('.', 'file.txt')));
}
Expected result:
----------------
The expected result is that PHP returns the portion of the filename
before the .,
Actual result:
--------------
Results in Fatal error: Only variables can be passed by reference
Error seems to have been introduced between beta 5.1 beta #1 and #2, it
works in PHP 4 as well as PHP 5.0.x and PHP 5.1 beta #1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33495&edit=1