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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: atomo64 at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 01 12:00:03 2025 UTC