php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14160 associative arrays - cannot use exclamation mark in key!
Submitted: 2001-11-21 10:04 UTC Modified: 2002-06-03 12:48 UTC
From: davidfelton at codemasters dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.0.6 OS: Windows 2000
Private report: No CVE-ID: None
 [2001-11-21 10:04 UTC] davidfelton at codemasters dot com
if you have an array where the key is a string like
$arrayname["a string here!"]. You will not be able to pull the value for that key from the array. Removing the exclamation mark in the key fixes this bug.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-21 10:08 UTC] mfischer@php.net
Works for me on 4.0.6 , Linux.

Please give the shortest reproduceable script.

Feedback.
 [2001-11-21 10:15 UTC] davidfelton at codemasters dot com
$translations=Array();
$translations["Register Now for Free!"]="?Reg?strate ya gratis!";
echo $translations["Register Now for Free!"];


will print nothing, or an error about undefined index, depending on your error settings in php.ini. As I said before, removing the exclamation mark in the key fixes the problem.
 [2001-11-21 10:20 UTC] mfischer@php.net
Works for me:
[chroot] mfischer@ficken:~/src/php/bugtest$ php
<?
$translations=Array();                                                                                   $translations["Register Now for Free!"]="?Reg?strate ya gratis!";                                        echo $translations["Register Now for Free!"];
?>
X-Powered-By: PHP/4.0.6-dev
Content-type: text/html

?Reg?strate ya gratis![chroot] mfischer@ficken:~/src/php/bugtest$ 

Hmm.... probably dumb question, are you really running 4.0.6?

Can you try latest RC

http://www.php.net/~zeev/php-4.1.0RC3.tar.gz

Feedback.
 [2001-11-21 10:22 UTC] mfischer@php.net
Sorry, of course I meant

http://phpuk.org/~james/php-4.1.0RC3-win32.zip


 [2001-11-21 10:22 UTC] jan@php.net
Can't reproduce this on FreeBSD 4.2-Stable and PHP 4.1.0RC3 as cgi or RC2 as mod_php. maybe a windows thingie ?

 [2001-11-21 10:27 UTC] davidfelton at codemasters dot com
Maybe it is a windows thingie, specifically windows 2000, I don't have the same problem with 4.0.4pl1 and IIS4. If it helps, I'm using the PHP Installer version of 4.0.6 (CGI)
 [2001-11-21 10:31 UTC] mfischer@php.net
Can't reproduce this under win32 (but only have some 4.0.8-dev).

Lets wait what he reports back with RC
 [2001-11-21 10:32 UTC] davidfelton at codemasters dot com
Maybe it is a windows thingie, specifically windows 2000, I don't have the same problem with 4.0.4pl1 and IIS4. If it helps, I'm using the PHP Installer version of 4.0.6 (CGI)
 [2001-11-21 10:32 UTC] davidfelton at codemasters dot com
Maybe it is a windows thingie, specifically windows 2000, I don't have the same problem with 4.0.4pl1 and IIS4. If it helps, I'm using the PHP Installer version of 4.0.6 (CGI)
 [2001-11-21 10:38 UTC] mfischer@php.net
Mixep up name, sorry :)

You can test RC please

http://phpuk.org/~james/php-4.1.0RC3-win32.zip
 [2001-11-21 10:46 UTC] davidfelton at codemasters dot com
Sorry, I am working to a strict (and rapidly approaching) deadline on this website and cannot afford to be installing new versions of PHP on the server. If the machine was in my office or my personal machine it would be fine but I'm sorry fellas!
I have found a workaround for the moment (leaving the exclamation mark out) and I am happy with that for the moment.
 [2002-01-17 06:17 UTC] lobbin@php.net
Works for me in CVS, can someone still reproduce this on windows?
 [2002-06-03 12:48 UTC] edink@php.net
The example works fine on Windows 2000 and 4.2.1. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC