php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26569 Backslash \ is removed with eval
Submitted: 2003-12-09 17:10 UTC Modified: 2003-12-14 21:15 UTC
From: webmaster at acecoolco dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.3.3 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-12-09 17:10 UTC] webmaster at acecoolco dot com
Description:
------------
Ive finally traced this bug.

If you have a page generated with EVAL

Ok, I have a form, when you submit it, it adds code to mysql database, it works, but using EVAL, it removes \s

I saw the other bug report saying highlight_string removes the backslashes, this is NOT the case.
sites using EVAL, eval removes the backslash, vbb uses eval, it removes the \ on submission.
I used to use eval, it removed the backslash on submit.

Reproduce code:
---------------
$patterns[] = "/{ACWB_DISPLAYPAGELOADTIME}/"; $contents[] = "$DisplayPageLoadTime";

$Template_IT = @preg_replace($patterns, $contents, $string);
echo $Template_IT;

// I have taken out Eval due to possible security flaws...
/* @eval("?>" .  $Template_IT . "<?"); */

Expected result:
----------------
Nothing, its just a small snippet

Actual result:
--------------
.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-09 17:42 UTC] eru@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.
 [2003-12-09 17:47 UTC] webmaster at acecoolco dot com
Well, to template my pages, I use file_get_contents of the file, next I preg replace everything, then
eval("?>" .  $Template_IT . "<?");

$Template_IT = preg_replace(...

Next, just a simple simple form, have it submit to the same page, no need to even insert it anywhere, the page will show up blank, and if the code had backslashes they will be stripped.

Heres what I tried inserting:

http://www.acecoolco.com/media_tutorialshow.php?id=28
It inserted fine, stripped the slashes even though it wasnt supposed to, and the resulting page, instead of a thank you page, I got a blank page.

I will work on a basic script to show exactly what I mean, it will be in the next reply
 [2003-12-09 17:53 UTC] eru@php.net
Ok, we'll leave it at feedback, you can set it to open again when you provide the script.

 [2003-12-14 21:15 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Sep 24 23:05:52 2022 UTC