# tail /var/log/messages
May 29 22:17:03 web020 kernel: pid 1214 (httpd), uid 80: exited on signal 4
May 29 22:17:03 web020 kernel: pid 1214 (httpd), uid 80: exited on signal 11
I have found out that the regexp that was striping out the comments wasn't so well crafted, and that's why it was segfaulting PHP through endless recursion.
This code would produces Segmentation fault (core dumped):
<?php $contents = '/*' . str_repeat('a', 60000) . '*/ Test1'; $contents = preg_replace('< \s*([@{}:;,]|\)\s|\s\()\s* | # Remove whitespace around separators, but keep space around parentheses. /\*([^*\\\\]|\*(?!/))+\*/ | # Remove comments that are not CSS hacks. [\n\r] # Remove line breaks. >x', '\1', $contents); print $contents; ?>
while this code would not:
<?php $contents = '/*' . str_repeat('a', 60000) . '*/ Test1'; $contents = preg_replace('< \s*([@{}:;,]|\)\s|\s\()\s* | # Remove whitespace around separators, but keep space around parentheses. /\*[^*\\\\]*\*+([^/*][^*]*\*+)*/ | # Remove comments that are not CSS hacks. [\n\r] # Remove line breaks. >x', '\1', $contents); print $contents; ?>
Reference: http://drupal.org/node/444228
No comments:
Post a Comment