php.net |  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
Description:
------------
Improper string handling of "<" and "&" characters.

Refer to test code below.

Reproduce code:
---------------
$test1a='/(?<!\\)/';
echo $test1a;

$test1b='/(?<!\\)/';
echo $test1b;
var_dump($test1b);

$test1c='/(?<!\\)/';
var_dump($test1c);

$test2a='<';
echo $test2a;

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

$test2c='<';
var_dump($test2c);

$test2f='<';
echo $test2f;
var_dump($test2f);

$test3f='&';
echo $test3f;
var_dump($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) "&"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-13 09:12 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. 

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.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC