#49284 [NEW]: explode or array_pop throws worning on error_reporting(E_ALL|E_STRICT)

From: Date: Tue, 18 Aug 2009 08:08:08 +0000
Subject: #49284 [NEW]: explode or array_pop throws worning on error_reporting(E_ALL|E_STRICT)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-141182@lists.php.net to get a copy of this message
From: dhaval4linux at yahoo dot com Operating system: Linux PHP version: 5.2.10 PHP Bug Type: Scripting Engine problem Bug description: explode or array_pop throws worning on error_reporting(E_ALL|E_STRICT) Description: ------------ Look at below code. on E_STRICT error_reporting either explode or array_pop is throwing warning about passed by reference. explode may returning something odd which causes array_pop to throw this warning. else explode may have problem which throws this warning. Below example shows both way with explode and without explode. with explode it shows warning while without that it works fine. Tested same thing on PHP version 5.2.10 and 5.2.6 Reproduce code: --------------- <?php error_reporting(E_ALL|E_STRICT); $stack2 = array("orange", "banana", "apple", "raspberry"); $stack = "orange_banana_apple_raspberry"; var_dump(strtolower(array_pop(explode('_',$stack)))); var_dump(strtolower(array_pop($stack2))); ?> Expected result: ---------------- string(9) "raspberry" string(9) "raspberry" Actual result: -------------- Strict Standards: Only variables should be passed by reference in /root/test.php on line 5 string(9) "raspberry" string(9) "raspberry" -- Edit bug report at http://bugs.php.net/?id=49284&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49284&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49284&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49284&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49284&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49284&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49284&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49284&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49284&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49284&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49284&r=support Expected behavior: http://bugs.php.net/fix.php?id=49284&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49284&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49284&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49284&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49284&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49284&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49284&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49284&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49284&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49284&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49284&r=mysqlcfg

« previous php.bugs (#141182) next »