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

From: Date: Sat, 18 Jul 2015 19:50:15 +0000
Subject: Bug #70097 [Opn]: weird string auto casting to array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194544@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:         cmb@php.net
 Reported by:        icestarsnowy at gmail dot com
 Summary:            weird string auto casting to array
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   windows 8
 PHP Version:        7.0Git-2015-07-18 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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 (#194544) next »