ID: 36463
Updated by: [EMAIL PROTECTED]
Reported By: sthapa at site5 dot com
-Status: Open
+Status: Feedback
Bug Type: Strings related
Operating System: Linux
PHP Version: 5.1.2
New Comment:
Can you provide both the script and the text file in a zip archive and
add the link to this report?
Previous Comments:
------------------------------------------------------------------------
[2006-02-20 16:26:43] sthapa at site5 dot com
Description:
------------
is_utf8() crashes on text
Reproduce code:
---------------
<?php
echo "Start Test, the data follows.<br><br>\n";
if ($fp = fopen("text.txt", "r")) {
$contents = fread($fp, filesize("text.txt"));
echo "$contents";
fclose($fp);
}
echo "\n<br><br>The data is about to be passed to preg_match(). If you
do not see the word 'Success' after this line, the program has
crashed.<br>\n";
$truefalsetest=preg_match('%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs', $contents);
echo "Success. Return value of preg_match() = $truefalsetest.";
?>
Expected result:
----------------
Output with the success message. Error appears when using either php
5.1.1 or php 4.4.2 both using suExec. Testing this on freebsd systems
don't cause the crash and do work correctly.
Actual result:
--------------
Core file and output doesn't have the success message.
[EMAIL PROTECTED] [/user/dir]# gdb php5.bin core.11662
GNU gdb Red Hat Linux (6.3.0.0-1.63rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...php5.bin: No such
file or directory.
Core was generated by `php5.bin'.
Program terminated with signal 11, Segmentation fault.
#0 0x080a5c4c in ?? ()
(gdb) bt
#0 0x080a5c4c in ?? ()
Error accessing memory address 0xbf523ef0: No such file or directory.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36463&edit=1