|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70097 weird string auto casting to array
Submitted: 2015-07-18 19:33 UTC Modified: 2016-02-15 13:09 UTC
Avg. Score:2.6 ± 1.5
Reproduced:2 of 3 (66.7%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: icestarsnowy at gmail dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 7.0Git-2015-07-18 (snap) OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: icestarsnowy at gmail dot com
New email:
PHP Version: OS:


 [2015-07-18 19:33 UTC] icestarsnowy at gmail dot com
I am using the charter position for doing something with string and for some reason when a string is empty it will automatic cast to array which i am not sure is it supposed to happen.

Test script:
$str = "";
$str[0] = "b";

$str = "a";
$str[0] = "b";

Expected result:
string(1) "b"
string(1) "b"

Actual result:
array(1) {
  string(1) "b"
string(1) "b"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-18 19:50 UTC]
See also <>.
 [2016-02-15 13:09 UTC]
-Status: Open +Status: Duplicate -Operating System: windows 8 +Operating System: any
 [2016-02-15 13:09 UTC]
Duplicate of bug #53432
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 02 01:05:53 2022 UTC