php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66057 strtr converts unused variables to strings
Submitted: 2013-11-08 07:45 UTC Modified: 2017-09-20 10:48 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:1 (25.0%)
From: themylogin at gmail dot com Assigned: cataphract (profile)
Status: Closed Package: Strings related
PHP Version: 5.5.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: themylogin at gmail dot com
New email:
PHP Version: OS:

 

 [2013-11-08 07:45 UTC] themylogin at gmail dot com
Description:
------------
With PHP 5.5.5 when I call

php > strtr("a", array("a" => "b", "c" => new stdclass));

I get

PHP Catchable fatal error:  Object of class stdClass could not be converted to string in php shell code on line 1

This used to work with PHP 5.4 and there is no reason why it shouldn't work now (haystack does not contain "c", so variable with appropriate key should not be used anyway).

Test script:
---------------
strtr("a", array("a" => "b", "c" => new stdclass));

Expected result:
----------------
No error

Actual result:
--------------
PHP Catchable fatal error:  Object of class stdClass could not be converted to string in php shell code on line 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-11-08 07:46 UTC] themylogin at gmail dot com
-Summary: strt converts unused variables to strings +Summary: strtr converts unused variables to strings
 [2013-11-08 07:46 UTC] themylogin at gmail dot com
fix typo
 [2013-11-13 08:36 UTC] laruence@php.net
confirm this bc break, it starts from 5.4.12
http://3v4l.org/0fFcj


and it was introduced in https://github.com/php/php-src/commit/2111ee3d
 [2013-11-13 08:42 UTC] laruence@php.net
-Assigned To: +Assigned To: cataphract
 [2013-11-13 08:42 UTC] laruence@php.net
@cataphract could you please look into this? thanks
 [2017-09-20 10:45 UTC] tim_siebels_aurich at yahoo dot de
This seems to be fixed in PHP7.0 onwards.

http://3v4l.org/0fFcj
 [2017-09-20 10:48 UTC] requinix@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 10:01:31 2024 UTC