#49284 [Opn->Bgs]: explode or array_pop throws worning on error_reporting(E_ALL|E_STRICT)

From: Date: Tue, 18 Aug 2009 11:58:52 +0000
Subject: #49284 [Opn->Bgs]: explode or array_pop throws worning on error_reporting(E_ALL|E_STRICT)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-141188@lists.php.net to get a copy of this message
ID: 49284 Updated by: jani@php.net Reported By: dhaval4linux at yahoo dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.2.10 New Comment: Thank you for not searching before submitting another duplicate bogus report. This is not a bug. Previous Comments: ------------------------------------------------------------------------ [2009-08-18 08:08:07] dhaval4linux at yahoo dot com 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 this bug report at http://bugs.php.net/?id=49284&edit=1

« previous php.bugs (#141188) next »