Ask a Question related to PHP Bugs, Design and Development.
-
hendlerman at yahoo dot com #1
#38974 [NEW]: array should throw warning
From: hendlerman at yahoo dot com
Operating system: windows XP
PHP version: 5.1.6
PHP Bug Type: Arrays related
Bug description: array should throw warning
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 bug report at [url]http://bugs.php.net/?id=38974&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=38974&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=38974&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=38974&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=38974&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=38974&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=38974&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=38974&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=38974&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=38974&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=38974&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=38974&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=38974&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=38974&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=38974&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=38974&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=38974&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=38974&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=38974&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=38974&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=38974&r=mysqlcfg[/url]
hendlerman at yahoo dot com Guest
-
#40793 [NEW]: xmlrpc_is_fault shows warning if parameter is not an array
From: camka at email dot ee Operating system: windows PHP version: 5.2.1 PHP Bug Type: XMLRPC-EPI related Bug description: ... -
#40793 [Opn->Bgs]: xmlrpc_is_fault shows warning if parameter is not an array
ID: 40793 Updated by: tony2001@php.net Reported By: camka at email dot ee -Status: Open +Status: ... -
#39915 [NEW]: Trying to access the index of an integer should throw a warning
From: thuejk at gmail dot com Operating system: Linux PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug... -
#38974 [Opn->Bgs]: array should throw warning
ID: 38974 Updated by: derick@php.net Reported By: hendlerman at yahoo dot com -Status: Open +Status: ... -
Warning: Cannot use a scalar value as an array in
Hi all This has just started coming up on a site I run. I haven't changed anything, it just started happening. Unfortunately, it's an adult... -
tony2001@php.net #2
#38974 [Bgs]: array should throw warning
ID: 38974
Updated by: [email]tony2001@php.net[/email]
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] [email]derick@php.net[/email]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
..
------------------------------------------------------------------------
[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 [url]http://bugs.php.net/?id=38974&edit=1[/url]
tony2001@php.net Guest
-
hendlerman at yahoo dot com #3
#38974 [Bgs]: array should throw warning
ID: 38974
User updated by: hendlerman at yahoo dot com
Reported By: hendlerman at yahoo dot com
Status: Bogus
Bug Type: Arrays related
Operating System: windows XP
PHP Version: 5.1.6
New Comment:
I understand that it's valid in PHP to overwrite the string with an
array. The problem is that the string is not actually overwritten by
the array. I thought that was clear from the sample code!
Doesn't seem like a feature if the array isn't overwritten. Perhaps I
should have titled = "String is not properly overwritten "
Previous Comments:
------------------------------------------------------------------------
[2006-09-27 14:54:23] [email]tony2001@php.net[/email]
$string[0] = 'c'; is perfectly valid code and that's what you get with
$string['otherstring'].
------------------------------------------------------------------------
[2006-09-27 14:53:23] [email]derick@php.net[/email]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
..
------------------------------------------------------------------------
[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 [url]http://bugs.php.net/?id=38974&edit=1[/url]
hendlerman at yahoo dot com Guest
-
hendlerman at yahoo dot com #4
#38974 [Bgs->Opn]: String is not properly overwritten in
ID: 38974
User updated by: hendlerman at yahoo dot com
-Summary: array should throw warning
Reported By: hendlerman at yahoo dot com
-Status: Bogus
+Status: Open
Bug Type: Arrays related
Operating System: windows XP
PHP Version: 5.1.6
New Comment:
Changing title and re-opening so it gets reviewed again.
Previous Comments:
------------------------------------------------------------------------
[2006-09-27 15:14:18] hendlerman at yahoo dot com
I understand that it's valid in PHP to overwrite the string with an
array. The problem is that the string is not actually overwritten by
the array. I thought that was clear from the sample code!
Doesn't seem like a feature if the array isn't overwritten. Perhaps I
should have titled = "String is not properly overwritten "
------------------------------------------------------------------------
[2006-09-27 14:54:23] [email]tony2001@php.net[/email]
$string[0] = 'c'; is perfectly valid code and that's what you get with
$string['otherstring'].
------------------------------------------------------------------------
[2006-09-27 14:53:23] [email]derick@php.net[/email]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
..
------------------------------------------------------------------------
[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 [url]http://bugs.php.net/?id=38974&edit=1[/url]
hendlerman at yahoo dot com Guest
-
hendlerman at yahoo dot com #5
#38974 [Opn]: String is not properly overwritten in Multi Dimensional Arrays
ID: 38974
User updated by: hendlerman at yahoo dot com
-Summary: String is not properly overwritten in
Reported By: hendlerman at yahoo dot com
Status: Open
Bug Type: Arrays related
Operating System: windows XP
PHP Version: 5.1.6
New Comment:
edit title
Previous Comments:
------------------------------------------------------------------------
[2006-09-27 15:32:43] hendlerman at yahoo dot com
Changing title and re-opening so it gets reviewed again.
------------------------------------------------------------------------
[2006-09-27 15:14:18] hendlerman at yahoo dot com
I understand that it's valid in PHP to overwrite the string with an
array. The problem is that the string is not actually overwritten by
the array. I thought that was clear from the sample code!
Doesn't seem like a feature if the array isn't overwritten. Perhaps I
should have titled = "String is not properly overwritten "
------------------------------------------------------------------------
[2006-09-27 14:54:23] [email]tony2001@php.net[/email]
$string[0] = 'c'; is perfectly valid code and that's what you get with
$string['otherstring'].
------------------------------------------------------------------------
[2006-09-27 14:53:23] [email]derick@php.net[/email]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
..
------------------------------------------------------------------------
[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 [url]http://bugs.php.net/?id=38974&edit=1[/url]
hendlerman at yahoo dot com Guest
-
tony2001@php.net #6
#38974 [Opn->Bgs]: String is not properly overwritten in
ID: 38974
Updated by: [email]tony2001@php.net[/email]
-Summary: String is not properly overwritten in Multi
Dimensional Arrays
Reported By: hendlerman at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: windows XP
PHP Version: 5.1.6
New Comment:
# php -r '$s = "string"; $s[0] = 3; var_dump($s);'
string(6) "3tring"
This is expected behaviour.
Previous Comments:
------------------------------------------------------------------------
[2006-09-27 15:34:04] hendlerman at yahoo dot com
edit title
------------------------------------------------------------------------
[2006-09-27 15:32:43] hendlerman at yahoo dot com
Changing title and re-opening so it gets reviewed again.
------------------------------------------------------------------------
[2006-09-27 15:14:18] hendlerman at yahoo dot com
I understand that it's valid in PHP to overwrite the string with an
array. The problem is that the string is not actually overwritten by
the array. I thought that was clear from the sample code!
Doesn't seem like a feature if the array isn't overwritten. Perhaps I
should have titled = "String is not properly overwritten "
------------------------------------------------------------------------
[2006-09-27 14:54:23] [email]tony2001@php.net[/email]
$string[0] = 'c'; is perfectly valid code and that's what you get with
$string['otherstring'].
------------------------------------------------------------------------
[2006-09-27 14:53:23] [email]derick@php.net[/email]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
..
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
[url]http://bugs.php.net/38974[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=38974&edit=1[/url]
tony2001@php.net Guest
-
hendlerman at yahoo dot com #7
#38974 [Bgs->Opn]: String is not properly overwritten in
ID: 38974
User updated by: hendlerman at yahoo dot com
Reported By: hendlerman at yahoo dot com
-Status: Bogus
+Status: Open
Bug Type: Arrays related
Operating System: windows XP
PHP Version: 5.1.6
New Comment:
the code you've outlined is not the same as the code I have.
what happens to the key in the array called "count"?
Previous Comments:
------------------------------------------------------------------------
[2006-09-27 15:34:44] [email]tony2001@php.net[/email]
# php -r '$s = "string"; $s[0] = 3; var_dump($s);'
string(6) "3tring"
This is expected behaviour.
------------------------------------------------------------------------
[2006-09-27 15:34:04] hendlerman at yahoo dot com
edit title
------------------------------------------------------------------------
[2006-09-27 15:32:43] hendlerman at yahoo dot com
Changing title and re-opening so it gets reviewed again.
------------------------------------------------------------------------
[2006-09-27 15:14:18] hendlerman at yahoo dot com
I understand that it's valid in PHP to overwrite the string with an
array. The problem is that the string is not actually overwritten by
the array. I thought that was clear from the sample code!
Doesn't seem like a feature if the array isn't overwritten. Perhaps I
should have titled = "String is not properly overwritten "
------------------------------------------------------------------------
[2006-09-27 14:54:23] [email]tony2001@php.net[/email]
$string[0] = 'c'; is perfectly valid code and that's what you get with
$string['otherstring'].
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
[url]http://bugs.php.net/38974[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=38974&edit=1[/url]
hendlerman at yahoo dot com Guest
-
tony2001@php.net #8
#38974 [Opn->Bgs]: String is not properly overwritten in
ID: 38974
Updated by: [email]tony2001@php.net[/email]
Reported By: hendlerman at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: windows XP
PHP Version: 5.1.6
New Comment:
It's autoconverted to integer, i.e. 0.
Previous Comments:
------------------------------------------------------------------------
[2006-09-27 15:37:37] hendlerman at yahoo dot com
the code you've outlined is not the same as the code I have.
what happens to the key in the array called "count"?
------------------------------------------------------------------------
[2006-09-27 15:34:44] [email]tony2001@php.net[/email]
# php -r '$s = "string"; $s[0] = 3; var_dump($s);'
string(6) "3tring"
This is expected behaviour.
------------------------------------------------------------------------
[2006-09-27 15:34:04] hendlerman at yahoo dot com
edit title
------------------------------------------------------------------------
[2006-09-27 15:32:43] hendlerman at yahoo dot com
Changing title and re-opening so it gets reviewed again.
------------------------------------------------------------------------
[2006-09-27 15:14:18] hendlerman at yahoo dot com
I understand that it's valid in PHP to overwrite the string with an
array. The problem is that the string is not actually overwritten by
the array. I thought that was clear from the sample code!
Doesn't seem like a feature if the array isn't overwritten. Perhaps I
should have titled = "String is not properly overwritten "
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
[url]http://bugs.php.net/38974[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=38974&edit=1[/url]
tony2001@php.net Guest
-
hendlerman at yahoo dot com #9
#38974 [Bgs]: String is not properly overwritten in
ID: 38974
User updated by: hendlerman at yahoo dot com
Reported By: hendlerman at yahoo dot com
Status: Bogus
Bug Type: Arrays related
Operating System: windows XP
PHP Version: 5.1.6
New Comment:
OK.
I can see how this is not a "bug" and expected.
But I think the behaviour should be different. Maybe just:
1. don't loose keys
I can't post to php-dev ATM, but is that the proper place to have this
discussion?
Previous Comments:
------------------------------------------------------------------------
[2006-09-27 15:45:14] [email]tony2001@php.net[/email]
It's autoconverted to integer, i.e. 0.
------------------------------------------------------------------------
[2006-09-27 15:37:37] hendlerman at yahoo dot com
the code you've outlined is not the same as the code I have.
what happens to the key in the array called "count"?
------------------------------------------------------------------------
[2006-09-27 15:34:44] [email]tony2001@php.net[/email]
# php -r '$s = "string"; $s[0] = 3; var_dump($s);'
string(6) "3tring"
This is expected behaviour.
------------------------------------------------------------------------
[2006-09-27 15:34:04] hendlerman at yahoo dot com
edit title
------------------------------------------------------------------------
[2006-09-27 15:32:43] hendlerman at yahoo dot com
Changing title and re-opening so it gets reviewed again.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
[url]http://bugs.php.net/38974[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=38974&edit=1[/url]
hendlerman at yahoo dot com Guest



Reply With Quote

