From:             software at whatsonyourbrain dot com
Operating system: Win XP SP3
PHP version:      5.3.0
PHP Bug Type:     Arrays related
Bug description:  Strict standards: Only variables should be passed by reference

Description:
------------
Using PHP Strict Error Reporting, per Development-mode recommendation, I
encounter a so-called "pass-by-reference" error, yet such a construct
exists neither explicitly, nor apparently in my code. The Strict Standards
Error occurs using the INI directive "error_reporting = E_ALL | E_STRICT".
Extended error data shown below is as available through the Xdebug
extension "php_xdebug-2.0.5-5.3-vc6.dll", the recommended version for
Apache2, win32.

The cause of the error is the use of the internal PHP Programming Data
Structures function, end() [ php.net/end ]. The function takes an array as
a parameter. Although an ampersand is indicated in the prototype of "end()"
in The Manual", there is no cautionary documentation following in the
extended definition of that function, nor is there any apparent explanation
that the parameter is in fact passed by reference. Perhaps this is
/understood/. I did not understand, however, so it was difficult for me to
detect the cause of the error. 

With the deprecation of call-time pass-by-reference, the pass-by-reference
quality of the end() parameter should be indicated in the Manual (in
bold-type) to warn programmers that an error WILL occur. 

Reproduce code:
---------------
/*
( ! ) Strict standards: Only variables should be passed by reference in
C:\Apache2\htdocs\ww2\class\cwthumbs.class.php on line 15
Call Stack
#       Time    Memory  Function        Location
1       1.1758  371912  {main}( )       ..\index.php:0
2       1.1776  449024  require( '..\dochead.inc.php' ) ..\index.php:3
3       1.1965  564360  cwThumbs->getThumbs( $dir = 'css' )     
..\dochead.inc.php:151
*/
// END XDEBUG REPORT
// Line 15:
<?php 
//...
$itemsArray[]= end(explode('/',$item));
//...
?>



Expected result:
----------------
The contents of a container on the filesystem are passed to the function,
"end()", as an array.

Actual result:
--------------
The contents of a container on the filesystem are passed to the function,
"end()", as an array-- BY REFERENCE-- resulting in a Strict Standards
Error, in "Development" mode*.

*"Development" mode: that which is described in php.ini as the recommended
setting(s) for use in "Development", "Production", or etc.

-- 
Edit bug report at http://bugs.php.net/?id=48937&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48937&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48937&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48937&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48937&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48937&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48937&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48937&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48937&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48937&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48937&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48937&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48937&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48937&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48937&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48937&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48937&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48937&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48937&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48937&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48937&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48937&r=mysqlcfg

Reply via email to