php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49284 explode or array_pop throws worning on error_reporting(E_ALL|E_STRICT)
Submitted: 2009-08-18 08:08 UTC Modified: 2009-08-19 08:10 UTC
Votes:2
Avg. Score:3.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: dhaval4linux at yahoo dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.10 OS: Linux
Private report: No CVE-ID: None
 [2009-08-18 08:08 UTC] 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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-18 11:58 UTC] jani@php.net
Thank you for not searching before submitting another duplicate bogus report. This is not a bug. 
 [2009-08-19 08:04 UTC] dhaval4linux at yahoo dot com
Can I ask Why it is Bogus?
although its showing warning.
 [2009-08-19 08:10 UTC] dhaval4linux at yahoo dot com
Got it from Bug http://bugs.php.net/bug.php?id=48937
Thanks
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 08 16:00:01 2025 UTC