php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46860 invalid code is being executed
Submitted: 2008-12-13 17:53 UTC Modified: 2008-12-15 13:43 UTC
From: atomo64 at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.8 OS: GNU/Linux
Private report: No CVE-ID: None
 [2008-12-13 17:53 UTC] atomo64 at gmail dot com
Description:
------------
The following piece of code does not contain the expected ending string delimiter but is executed anyway.

Reproduce code:
---------------
<?php
preg_replace('/^(.+)$/e','var_dump(\'\\1\')\',$d)
?>

Expected result:
----------------
some sort of parsing error

Actual result:
--------------
Warning: Unexpected character in input:  ''' (ASCII=39) state=1 in fun.php on line 2

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in fun.php on line 2

Warning: Unexpected character in input:  ''' (ASCII=39) state=1 in fun.php on line 2

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in fun.php on line 2

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in fun.php on line 2

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in fun.php on line 2

Warning: Unexpected character in input:  ''' (ASCII=39) state=1 in fun.php on line 2

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in fun.php on line 2

Warning: Unexpected character in input:  ''' (ASCII=39) state=1 in fun.php on line 2
int(1)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-15 13:43 UTC] bjori@php.net
bjori@jessica:~$ /usr/src/php/5.3/sapi/cli/php 
<?php
preg_replace('/^(.+)$/e','var_dump(\'\\1\')\',$d)
?>
PHP Parse error:  syntax error, unexpected $end in /home/bjori/- on line 2


Fixed in 5.3
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 15:01:31 2024 UTC