php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29076 error_log(addslashes(string)) double escapes string
Submitted: 2004-07-09 17:24 UTC Modified: 2004-07-11 20:37 UTC
From: ross dot girshick at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.7 OS: Redhat Linux 2.4.20-20.9
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: ross dot girshick at gmail dot com
New email:
PHP Version: OS:

 

 [2004-07-09 17:24 UTC] ross dot girshick at gmail dot com
Description:
------------
error_log used with addslashes seems to double escape strings.

Other info about my setup:
--------------------------
magic_quotes_gpc	Off	Off
magic_quotes_runtime	Off	Off

Apache Version 	Apache/1.3.31 (Unix) PHP/4.3.7
Apache Release 	10331100
Apache API Version 	19990320
User/Group 	smarter(501)/110
Max Requests 	Per Child: 0 - Keep Alive: on - Max Per Connection: 10000
Timeouts 	Connection: 300 - Keep-Alive: 15
Server Root 	/usr/local/apache
Loaded Modules 	mod_auth_mysql, mod_php4, mod_setenvif, mod_so, mod_headers, mod_auth, mod_access, mod_rewrite, mod_alias, mod_userdir, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_status, mod_negotiation, mod_mime, mod_log_config, mod_env, mod_vhost_alias, http_core

Reproduce code:
---------------
print addslashes(' " ');
error_log(' " ');
error_log(addslashes(' " '));

Expected result:
----------------
code                            output
--                              --
print addslashes(' " ');        \"
error_log(' " ');               "
error_log(addslashes(' " '));   \"

Actual result:
--------------
code                            output
--                              --
print addslashes(' " ');        \"
error_log(' " ');               "
error_log(addslashes(' " '));   \\"   <-- Note the extra '\'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-11 19:09 UTC] sniper@php.net
I can not reproduce this with Apache 1.3.28 + PHP 4.3.8-dev.
(latest STABLE snapshot from http://snaps.php.net)

And your script as run as is does not output anything but the single " (rest goes to apache error_log for me, check your error_* settings in php.ini)

 [2004-07-11 20:37 UTC] ross dot girshick at gmail dot com
Of course the ouput of error_log() goes to the apache error log, that's the whole idea. I don't understand the point of your comment on this.

If it works fine in 4.3.8-dev, then I guess the bug has been fixed or else it's some strange interaction with 4.3.7 and my particular set up. I checked php.ini and there's nothing odd re: the error_* settings. When I have a chance I'll try 4.3.8-dev to verify that this has been fixed.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 08:01:29 2025 UTC