#33081 [NEW]: T_OPEN_TAG eats whitespace
From: jaa at interflow dot dk Operating system: FreeBSD PHP version: 5.0.4 PHP Bug Type: Zend Engine 2 problem Bug description: T_OPEN_TAG eats whitespace Description: The PHP tokenizer includes the first whitespace character after the opening php tag as a part of the opening tag. That is, the following code with one whitespace in between will be tokenized into two tokens, a start tag and a closing tag: ?php ? While with two whitespaces in between will be tokenized into three tokens, an opening tag including one space character, a whitespace token with one space character and a closing tag: ?php ? I hope the whitespace doesn't get lost when I submit this ;-) Reproduce code: --- ?php $source = ?php ?; $tokens = token_get_all($source); if($tokens[1][0] == T_WHITESPACE) { print Whitespace found\n; } else { print Whitespace not found\n; } ? Expected result: Whitespace found Actual result: -- Whitespace not found -- Edit bug report at http://bugs.php.net/?id=33081edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33081r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33081r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33081r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33081r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33081r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33081r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33081r=needscript Try newer version: http://bugs.php.net/fix.php?id=33081r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33081r=support Expected behavior: http://bugs.php.net/fix.php?id=33081r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33081r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33081r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33081r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33081r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33081r=dst IIS Stability: http://bugs.php.net/fix.php?id=33081r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33081r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33081r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33081r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33081r=mysqlcfg
#33027 [NEW]: PHP thinks it gets a flock when it doesn't
From: jaa at interflow dot dk Operating system: Un*x PHP version: 5.0.4 PHP Bug Type: Filesystem function related Bug description: PHP thinks it gets a flock when it doesn't Description: flock($fp, LOCK_EX | LOCK_NB) returns true even when $fp is already locked. This happens both on FreeBSD 5.4 and Gentoo Linux and both PHP 5.0.2, 5.0.3 and 5.0.4 exhibits this behaviour but PHP 4.3.11 works as expected. The blocking version: flock($fp, LOCK_EX) works as expected. The workaround is to check the value of the wouldblock argument to flock() but this shouldn't be necessary and is not documented in the manual. Reproduce code: --- ?php $fp = fopen(/tmp/lock.txt, w+); if (flock($fp, LOCK_EX | LOCK_NB )) { print Got lock @ .date('H:i:s'); while(1) {} } else { echo Couldn't lock the file.; } fclose($fp); ? Expected result: When a file is already locked flock($fp, LOCK_EX | LOCK_NB) should return false. First terminal: % ~/php-5.0.4/sapi/cli/php flock.php 15:18:34 Got lock @ 15:18:34 Second terminal: % ~/php-5.0.4/sapi/cli/php flock.php 15:18:33 Couldn't lock the file. Actual result: -- First terminal: % ~/php-5.0.4/sapi/cli/php flock.php 15:18:34 Got lock @ 15:18:34 Second terminal: % ~/php-5.0.4/sapi/cli/php flock.php 15:18:33 Got lock @ 15:18:37 -- Edit bug report at http://bugs.php.net/?id=33027edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33027r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33027r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33027r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33027r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33027r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33027r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33027r=needscript Try newer version: http://bugs.php.net/fix.php?id=33027r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33027r=support Expected behavior: http://bugs.php.net/fix.php?id=33027r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33027r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33027r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33027r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33027r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33027r=dst IIS Stability: http://bugs.php.net/fix.php?id=33027r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33027r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33027r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33027r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33027r=mysqlcfg
#33027 [Fbk-Csd]: PHP thinks it gets a flock when it doesn't
ID: 33027 User updated by: jaa at interflow dot dk Reported By: jaa at interflow dot dk -Status: Feedback +Status: Closed Bug Type: Filesystem function related Operating System: Un*x PHP Version: 5.0.4 New Comment: I've run tests on both Linux and FreeBSD and flock() is working correctly on both platforms. I'm closing the bug. Thanks. Previous Comments: [2005-05-13 16:03:58] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip Something related to flock() was just fixed this week.. [2005-05-13 15:38:35] jaa at interflow dot dk Description: flock($fp, LOCK_EX | LOCK_NB) returns true even when $fp is already locked. This happens both on FreeBSD 5.4 and Gentoo Linux and both PHP 5.0.2, 5.0.3 and 5.0.4 exhibits this behaviour but PHP 4.3.11 works as expected. The blocking version: flock($fp, LOCK_EX) works as expected. The workaround is to check the value of the wouldblock argument to flock() but this shouldn't be necessary and is not documented in the manual. Reproduce code: --- ?php $fp = fopen(/tmp/lock.txt, w+); if (flock($fp, LOCK_EX | LOCK_NB )) { print Got lock @ .date('H:i:s'); while(1) {} } else { echo Couldn't lock the file.; } fclose($fp); ? Expected result: When a file is already locked flock($fp, LOCK_EX | LOCK_NB) should return false. First terminal: % ~/php-5.0.4/sapi/cli/php flock.php 15:18:34 Got lock @ 15:18:34 Second terminal: % ~/php-5.0.4/sapi/cli/php flock.php 15:18:33 Couldn't lock the file. Actual result: -- First terminal: % ~/php-5.0.4/sapi/cli/php flock.php 15:18:34 Got lock @ 15:18:34 Second terminal: % ~/php-5.0.4/sapi/cli/php flock.php 15:18:33 Got lock @ 15:18:37 -- Edit this bug report at http://bugs.php.net/?id=33027edit=1