#38974 [Bgs]: array should throw warning
| From: | tony2001@php.net | Date: | Wed, 27 Sep 2006 14:54:23 +0000 |
| Subject: | #38974 [Bgs]: array should throw warning | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-102818@lists.php.net to get a copy of this message | ||
ID: 38974
Updated by: tony2001@php.net
Reported By: hendlerman at yahoo dot com
Status: Bogus
Bug Type: Arrays related
Operating System: windows XP
PHP Version: 5.1.6
New Comment:
$string[0] = 'c'; is perfectly valid code and that's what you get with
$string['otherstring'].
Previous Comments:
------------------------------------------------------------------------
[2006-09-27 14:53:23] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
------------------------------------------------------------------------
[2006-09-27 14:47:10] hendlerman at yahoo dot com
Description:
------------
The error is caused by a user error, but I believe PHP should be
throwing an error. PHP is not strongly typed, but I thought you get a
warning if you try to convert a string to an array.
Sorry I am not in 5.1.6
Reproduce code:
---------------
/**
* Output for me
* PHP version 5.1.4
* Array ( [name] => 2alue )
*
* */
function array_bug()
{
echo "PHP version ". phpversion().'<br />';
$test_array = array();
$test_array['name'] = 'value';
$test_array['name']['count'] = 2;
print_r($test_array);
}
array_bug(); exit;
Expected result:
----------------
I would expect an error or warning
Actual result:
--------------
Array ( [name] => 2alue )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38974&edit=1