note 74648 deleted from function.preg-match by nlopess
| From: | nlopess@php.net | Date: | Tue, 01 May 2007 13:39:08 +0000 |
| Subject: | note 74648 deleted from function.preg-match by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126041@lists.php.net to get a copy of this message | ||
Note Submitter: robert at kajic dot com
----
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