#50098 [Opn->Fbk]: preg_replace cause Apache error and retart.

From: Date: Sat, 07 Nov 2009 21:31:37 +0000
Subject: #50098 [Opn->Fbk]: preg_replace cause Apache error and retart.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144338@lists.php.net to get a copy of this message
ID: 50098 Updated by: felipe@php.net Reported By: zhongxueming at gmail dot com -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: Windows XP, Windows Server 2003 PHP Version: 5.2.11 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2009-11-06 09:18:23] zhongxueming at gmail dot com Description: ------------ When I execute a sql by Zend DB, I got a connection error, and found an error in apache error log. After tracking, I found the problem is preg_replace function. I think you can replay this problem by the test code. Env: Windows XP, Windows Server 2003 Apache 2.2.13 PHP php-5.2.11 Reproduce code: --------------- function testPregReplace() { $sql = "SELECT \"t_skill_label\".\"c_name\" FROM \"t_skill_label\" WHERE (\"c_name\" = '‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨') AND (\"c_id\" != '3') LIMIT 1"; echo preg_replace("/'(''|\\\\{2}|[^'])*'/", '', $sql); } testPregReplace(); Expected result: ---------------- Apache not be restarted. Actual result: -------------- This test code will cause apache error. You can confirm it in the apache error log. The browser display a connection error. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50098&edit=1

« previous php.bugs (#144338) next »