#40004 [Opn]: preg_match() with /u flag corrupts memory

From: Date: Wed, 03 Jan 2007 00:16:40 +0000
Subject: #40004 [Opn]: preg_match() with /u flag corrupts memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107111@lists.php.net to get a copy of this message
ID: 40004 User updated by: php at koterov dot ru Reported By: php at koterov dot ru Status: Open Bug Type: PCRE related Operating System: Windows XP PHP Version: 4.4.4 New Comment: This is also reproducible in command-line php.exe PHP 4.4.4 PHP 5.1.6 (!) Cannot reproduce on PHP 5.2.0. Previous Comments: ------------------------------------------------------------------------ [2007-01-03 00:10:57] php at koterov dot ru Description: ------------ Seems preg_match with /u modifier corrupts process memory or returns pointer to nirvana instead of pointer to a string. Reproduce code: --------------- <? preg_match('/(.{0,20})$/us', " ", $m); var_export($m); ?> Expected result: ---------------- space Actual result: -------------- something like array ( 0 => ' kjwekwjn', 1 => ' wereinoiu', ) where "kjwekwjn" and "wereinoiu" are random strings with random binary data (useless to copy-paste them here). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40004&edit=1

« previous php.bugs (#107111) next »