php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43414 Surprising array bug found with special word "lang"
Submitted: 2007-11-26 17:12 UTC Modified: 2007-11-27 14:19 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: cappytoi at yahoo dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.2.5 OS: Windows Xp
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cappytoi at yahoo dot com
New email:
PHP Version: OS:

 

 [2007-11-26 17:12 UTC] cappytoi at yahoo dot com
Description:
------------
Hi,

I have found the following problem. I try to produce a query string and I found that using lang as a key makes problem with implode.

Reproduce code:
---------------
<?php
$all = array(
	'turkce',
	'english',
	'german'
);

$t = array();
foreach ($all as $al) {
	$t[] = 'lang[]='.$al;
}

echo implode('&',$t);
?>

Expected result:
----------------
lang[]=turkce&lang[]=english&lang[]=german

Actual result:
--------------
lang[]=turkce&#9001;[]=english&#9001;[]=german

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-26 17:28 UTC] cappytoi at yahoo dot com
also found that using "times" instead of "lang" causes a similar result.
 [2007-11-27 13:05 UTC] jani@php.net
I tried with CLI:
# src/build/php_5_2/sapi/cli/php t.php
lang[]=turkce&lang[]=english&lang[]=german

And no problems there. In what browser does it give you that? Have you got some weird locale set on your machine or what?
 [2007-11-27 14:00 UTC] cappytoi at yahoo dot com
I am using apache 2.59, and my Windows Locale is Turkish. But I think it is not about locale. Because when I test it with the enviroment on Centos apache 2.59 with php5.2.4 it gives me the same result and the locale is en_US.

It may be caused by apache sapi. But the problem function is "implode()". It works normally when I parse the results with "foreach"
 [2007-11-27 14:08 UTC] cappytoi at yahoo dot com
It only shows in firefox, in internet explorer it gives me the result, but i couldn't understand why when I do not use implode(); it works normally. The results are same, doesn't it mean that browser execute the same code?
 [2007-11-27 14:12 UTC] cappytoi at yahoo dot com
sorry for bothering, it is all about firefox. thanks anyway.
 [2007-11-27 14:19 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Do a view source... IE probably uses &lang as an HTML entity even though there is no required ; preceeding it.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 16:08:09 2025 UTC