#23327 [NEW]: Crash / Strange beahaviour when using file() and preg_match()

From: Date: Thu, 24 Apr 2003 13:35:18 +0000
Subject: #23327 [NEW]: Crash / Strange beahaviour when using file() and preg_match()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38298@lists.php.net to get a copy of this message
From: sysadmin at alexdupre dot com Operating system: FreeBSD 4-STABLE PHP version: 4CVS-2003-04-24 (stable) PHP Bug Type: Unknown/Other Function Bug description: Crash / Strange beahaviour when using file() and preg_match() Working script (using fopen/fgets/fclose): <?php if ($stats2 = fopen('http://194.183.89.2/uptime.php', 'r')) { preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",fgets($stats2),$regs2); fclose($stats2); } if ($stats3 = fopen('http://194.183.89.3/uptime.php', 'r')) { preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",fgets($stats3),$regs3); fclose($stats3); } if ($stats4 = fopen('http://194.183.89.4/uptime.php', 'r')) { preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",fgets($stats4),$regs4); fclose($stats4); } echo "www2: $regs2[1], $regs2[2], $regs2[3]\n" . "www3: $regs3[1], $regs3[2], $regs3[3]\n" . "www4: $regs4[1], $regs4[2], $regs4[3]\n"; ?> $ php work.php www2: 2.29, 2.73, 2.94 www3: 0.86, 0.77, 0.82 www4: 0.66, 0.72, 0.70 Not working script (using file): <?php if ($stats2 = file('http://194.183.89.2/uptime.php')) { preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",$stats2[0],$regs2); } if ($stats3 = file('http://194.183.89.3/uptime.php')) { preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",$stats3[0],$regs3); } if ($stats4 = file('http://194.183.89.4/uptime.php')) { preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",$stats4[0],$regs4); } echo "www2: $regs2[1], $regs2[2], $regs2[3]\n" . "www3: $regs3[1], $regs3[2], $regs3[3]\n" . "www4: $regs4[1], $regs4[2], $regs4[3]\n"; ?> $ php fail.php www2: , , www3: T, T, P www4: 0.38, 0.62, 0.66 php in free(): warning: chunk is already free php in free(): warning: chunk is already free php in free(): warning: chunk is already free php in free(): warning: chunk is already free php in free(): warning: chunk is already free php in free(): warning: chunk is already free -- Edit bug report at http://bugs.php.net/?id=23327&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23327&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23327&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23327&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23327&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23327&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23327&r=support Expected behavior: http://bugs.php.net/fix.php?id=23327&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23327&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23327&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23327&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23327&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23327&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23327&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23327&r=gnused

« previous php.bugs (#38298) next »