Bug #70097 [Opn->Dup]: weird string auto casting to array

From: Date: Mon, 15 Feb 2016 13:09:44 +0000
Subject: Bug #70097 [Opn->Dup]: weird string auto casting to array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199229@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70097&edit=1

 ID:                 70097
 Updated by:         francois@php.net
 Reported by:        icestarsnowy at gmail dot com
 Summary:            weird string auto casting to array
-Status:             Open
+Status:             Duplicate
 Type:               Bug
 Package:            *General Issues
-Operating System:   windows 8
+Operating System:   any
 PHP Version:        7.0Git-2015-07-18 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

Duplicate of bug #53432


Previous Comments:
------------------------------------------------------------------------
[2015-07-18 19:50:15] cmb@php.net

See also <http://3v4l.org/S7Hv9>.

------------------------------------------------------------------------
[2015-07-18 19:33:21] icestarsnowy at gmail dot com

Description:
------------
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";
var_dump($str);

$str = "a";
$str[0] = "b";
var_dump($str);

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

Actual result:
--------------
array(1) {
  [0]=>
  string(1) "b"
}
string(1) "b"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70097&edit=1


Thread (3 messages)

« previous php.bugs (#199229) next »