note 74648 added to function.preg-match

From: Date: Sat, 21 Apr 2007 19:14:32 +0000
Subject: note 74648 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-125756@lists.php.net to get a copy of this message
I have found a solution to a Segmentation fault caused by preg_match. Please keep in mind I have not done any extensive testing to confirm this solution indeed is a general one but it may prove valuable to someone. Here is the code that caused the fault for me: <?php $correctsyntax = preg_match('/^(?:\((?:\x27[^\x27]*\x27,){5}\x27[^\x27]{32}\x27,\x27' . $userid . '\x27\),)+$/u', $sqldata); ?> At first I was using Php 5.2.0 and when I upgraded to Php 5.2.1 the Segmentation fault persisted. I then upgraded PCRE from 6.7 to 7.0 which actually got rid of the Segmentation fault. I can't be sure it was solely the upgrade of PCRE that fixed it all as I didn't try upgrading PCRE without upgrading Php. I.e. it could be the combined upgrade that did the trick. By the way, all of this happened on a LAMP machine. I must add I have another machine (WAMP) with Php 5.2.1 and PCRE 6.7 that does NOT crash on the code above. I am not quite sure how to interpret that as I would expect it to crash just as it did on the LAMP machine. /Robert Kajic ---- Server IP: 69.147.83.197 Probable Submitter: 130.243.170.144 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- https://master.php.net/note/edit/74648 Del: integrated -- https://master.php.net/note/delete/74648/integrated Del: useless -- https://master.php.net/note/delete/74648/useless Del: bad code -- https://master.php.net/note/delete/74648/bad+code Del: spam -- https://master.php.net/note/delete/74648/spam Del: non-english -- https://master.php.net/note/delete/74648/non-english Del: in docs -- https://master.php.net/note/delete/74648/in+docs Del: other reasons-- https://master.php.net/note/delete/74648 Reject -- https://master.php.net/note/reject/74648 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125756) next »