|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29642 Incorrect string handling of "<" and "&"
Submitted: 2004-08-13 05:13 UTC Modified: 2004-08-13 13:49 UTC
From: webdevguy1 at yahoo dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.9RC1 OS: Win2k
Private report: No CVE-ID: None
 [2004-08-13 05:13 UTC] webdevguy1 at yahoo dot com
Improper string handling of "<" and "&" characters.

Refer to test code below.

Reproduce code:
echo $test1a;

echo $test1b;


echo $test2a;

$test2b='<<br />';
echo $test2b;


echo $test2f;

echo $test3f;

Expected result:
test1a: /(?<!\\)/

test1b: /(?<!\\)/

test1c: string(9) "/(?<!\\)/"

test2a: <

test2b: <

test2c: string(1) "<"

test2f: <string(1) "<"

tests 3a-3e: replace "<" with "&": same results

test3f: &string(1) "&"

Actual result:
test1a outputs: /(?

test1b outputs: /(?

test1c outputs: string(8) "/(?

test2a outputs:

test2b outputs: <

test2c outputs: string(1) "<"

test2f outputs: <"

tests 3a-3e: replace "<" with "&": same results

test3f outputs: &string(1) "&"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-13 09:12 UTC]
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 as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

This works fine, do a \"view-source\" in your browser.
 [2004-08-13 13:49 UTC] webdevguy1 at yahoo dot com
I submitted the bug report after testing only in Firefox 0.9.2. Viewing the source didn't matter, but then I tested in IE 6, and it was fine. It appears to be a Firefox problem.

The only PHP mistake appears to be that I needed four backslashes instead of two in tests 1a-1c.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 02:01:28 2024 UTC