php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21851 bizarre!: status replaced with foo1 or nothing
Submitted: 2003-01-23 19:17 UTC Modified: 2003-01-27 22:46 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: keith at lucidts dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.0 OS: debian linux
Private report: No CVE-ID: None
 [2003-01-23 19:17 UTC] keith at lucidts dot com
The word "status" was replace by foo1 and sometimes just spaces within & outside of <? ?> tags!

snippets from my page

html ....
<select name='      ' size="1">
<option value="" <?= $_SESSION['status'] ? "" : "selected" ?>>All</option>

output via view source in IE ....
<select name='    ' size="1">
<option value="" selected>All</option>

php
<?
if ($_SESSION['cat_id']) $sql .= " and cat_id = {$_SESSION['cat_id']}";
if ($_SESSION['status']) $sql .= " and foo1   = {$_SESSION['status']}";
echo "$sql";
?>

relevant php output ....
 ... and cat_id = 8 and foo1 = 'pending'

I have never seen anything like this before.  It's replacing words outside of the php, too. Furthermore, I've used status in parts of the same page in other sql statements (albeit for different tables), and they were not replaced. Insight would be greatly appreciated!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-23 19:24 UTC] keith at lucidts dot com
OMG! It just did it to this post! Am I missing something or just dumb? 
I wrote
<select name='s t a t u s' without the space and look what happened!

Same thing for the first foo1. That was actually a 's t a t u s' when I submitted this bug report.

I feel so lost right now.
 [2003-01-24 03:06 UTC] derick@php.net
Looks fine here:

<select name='status' size="1">

Derick
 [2003-01-24 03:19 UTC] keith at lucidts dot com
update ...
ok this may not be a php problem afterall ... although i can reproduce it on every windows machine i've tried but on every lynx and conquerer it comes out as expected ... the mystery continues ....

additional note ... i've tried with both netscape and ie on xp and 98 problem persists from 4 different computers (2 at the office 2 at home)
 [2003-01-24 03:26 UTC] keith at lucidts dot com
derick in your email that i received when you posted i could see
<select name='s t a t u s' size="1">
using squirrelmail ... a php imap client 

BUT browsing this thread online (same computer and same browser as the imap client, XP home and IE respectively) ... no "s t a t u s"!

anyone browsing this thread on a mac using IE perchance?
 [2003-01-24 03:27 UTC] sniper@php.net
Try changing your error_reporting to E_ALL and you'll
see the problem.

And what use is it to have empty name for select tag?

 [2003-01-27 22:46 UTC] keith at lucidts dot com
can't figure this one out ... but i'm closing it b/c it appears to be a windows problem and/or virus and/or someone having fun at my expense ... i can't reproduce it only any other platform and only on computers that i have been using recently ...
 [2003-06-25 19:57 UTC] php at glaciersoftware dot com
I'd like to bring this issue up again as I've ran into it many times when dealing with the creating of SQL statements which evaluate a common database/table/column called "status". Below is the error report and how to duplicate it.

Problem
=======
For some unknown reason, the PHP scripting engine seems to replacing the word "status" with "foo1"
when an equal-sign, 0x3d, appears within 6 characters of the word "status".

Bug was reported on http://bugs.php.net as Bug #21851, but status was changed to CLOSED after
someone was not able to duplicate the problem.


Environment
===========
The following webservers were used to test the below code for the existance of this problem:
PHP 4.2.1 with Apache/1.3.24 running on Linux 2.4.18-3 RedHat 7.3
PHP 4.3.1 with Apache/2.0.43 running on Linux 2.4.20-18.8 RedHat 8.0


Code
====
The following code should replicate the problem. The "<br>\n" appended to the echo() call is used
only for readability, the problem will still exist without this string added.

***** START PHP FILE ******
<?php
   // *** Note the 6 spaces, 0x20, between the word status and the equal-sign
   // *** the word "status" will be replaced with "foo1"
   $buf = "status      = 'C' ";
   echo($buf . "<br>\n");

   // *** The number of spaces has been changed from 6 to 7
   // *** now it doesn't replace "status" with "foo1"
   $buf = "status       = 'C' ";
   echo($buf . "<br>\n");
?>
***** END PHP FILE ********
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 23:01:26 2024 UTC