#37070 [NEW]: SplFileObject::isDir() returns false for empty dirs
From: pornel at despammed dot com Operating system: OS X PHP version: 6CVS-2006-04-13 (snap) PHP Bug Type: SPL related Bug description: SplFileObject::isDir() returns false for empty dirs Description: I'm using RecursiveDirectoryIterator to scan directories. File objects returned by this iterator seem to threat isDir and hasChildren as the same thing. That is isDir returns true only when item has children. This assumption is invalid and causes empty directories to be reported as files. Reproduce code: --- ?php function scan(RecursiveDirectoryIterator $dir) { foreach($dir as $file) { var_dump($file-isDir()); if ($dir-hasChildren()) scan($dir-getChildren()); } } scan(new RecursiveDirectoryIterator('/some/path/that/has/empty/dirs')); Expected result: isDir should not act as alias of hasChildren Actual result: -- empty directories have isFile()==true and isDir()==false -- Edit bug report at http://bugs.php.net/?id=37070edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37070r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37070r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37070r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37070r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37070r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37070r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=37070r=needscript Try newer version:http://bugs.php.net/fix.php?id=37070r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37070r=support Expected behavior:http://bugs.php.net/fix.php?id=37070r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37070r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37070r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37070r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37070r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37070r=dst IIS Stability:http://bugs.php.net/fix.php?id=37070r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37070r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37070r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37070r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=37070r=mysqlcfg
#37070 [Opn-Bgs]: SplFileObject::isDir() returns false for empty dirs
ID: 37070 User updated by: pornel at despammed dot com Reported By: pornel at despammed dot com -Status: Open +Status: Bogus Bug Type: SPL related Operating System: OS X PHP Version: 6CVS-2006-04-13 (snap) New Comment: My bad. Confused getPath with getPathname. Previous Comments: [2006-04-13 12:19:28] pornel at despammed dot com Description: I'm using RecursiveDirectoryIterator to scan directories. File objects returned by this iterator seem to threat isDir and hasChildren as the same thing. That is isDir returns true only when item has children. This assumption is invalid and causes empty directories to be reported as files. Reproduce code: --- ?php function scan(RecursiveDirectoryIterator $dir) { foreach($dir as $file) { var_dump($file-isDir()); if ($dir-hasChildren()) scan($dir-getChildren()); } } scan(new RecursiveDirectoryIterator('/some/path/that/has/empty/dirs')); Expected result: isDir should not act as alias of hasChildren Actual result: -- empty directories have isFile()==true and isDir()==false -- Edit this bug report at http://bugs.php.net/?id=37070edit=1
#35434 [NEW]: func_get_args don't work as expected in assert
From: pornel at despammed dot com Operating system: * PHP version: 4CVS-2005-11-27 (snap) PHP Bug Type: Feature/Change Request Bug description: func_get_args don't work as expected in assert Description: func_get_args, func_num_args, func_get_arg functions executed inside assert('') work on assert's arguments, and not on arguments of function assert is in. Because assert transparently handles variables scope, one could expect that it works transparently on arguments as well. With all PHP functions accepting variable number of arguments and only basic type hints, such assertions are quite important. Reproduce code: --- function test() { assert('func_num_args()==2'); } test('one','two'); Expected result: nothing Actual result: -- assertion fails -- Edit bug report at http://bugs.php.net/?id=35434edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35434r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35434r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35434r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=35434r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=35434r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35434r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35434r=needscript Try newer version: http://bugs.php.net/fix.php?id=35434r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35434r=support Expected behavior: http://bugs.php.net/fix.php?id=35434r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35434r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35434r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=35434r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35434r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=35434r=dst IIS Stability: http://bugs.php.net/fix.php?id=35434r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35434r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35434r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35434r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35434r=mysqlcfg
#34703 [NEW]: late binding for static calls
From: pornel at despammed dot com Operating system: * PHP version: 5.1.0RC1 PHP Bug Type: Feature/Change Request Bug description: late binding for static calls Description: In PHP it is not possible to write base class for singleton and similar programming patterns. I know it is intended behavior and backwards compatibility may make changes difficult, but there is significant number of complaints about current implementation: http://bugs.php.net/bug.php?id=30235 http://bugs.php.net/bug.php?id=30934 http://bugs.php.net/bug.php?id=30423 http://bugs.php.net/bug.php?id=19376 http://bugs.php.net/bug.php?id=26930 http://bugs.php.net/bug.php?id=28442 http://bugs.php.net/bug.php?id=29647 and I'd like to add another one. I'm trying to write functionality that works similar to ActiveRow implementation in RubyOnRails, but the way in which PHP handles static methods and inheritance makes such implementation impossible. I hope you could implement late binding for static calls and fields. It could be used with this:: construct instead of self::, which may be emulated for backwards compatiblity. Reproduce code: --- class Base { static function test1() {self::test2();} static function test2() {echo 'failure';} } class Child { static function test2() {echo 'success';} } Child::test(); Expected result: success Actual result: -- failure backtrace doesn't contain reference to Child class (that would be enough for a workaround). -- Edit bug report at http://bugs.php.net/?id=34703edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34703r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34703r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34703r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=34703r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=34703r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34703r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34703r=needscript Try newer version: http://bugs.php.net/fix.php?id=34703r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34703r=support Expected behavior: http://bugs.php.net/fix.php?id=34703r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34703r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34703r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=34703r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34703r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=34703r=dst IIS Stability: http://bugs.php.net/fix.php?id=34703r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34703r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34703r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34703r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34703r=mysqlcfg
#34703 [Opn]: late binding for static calls
ID: 34703 User updated by: pornel at despammed dot com Reported By: pornel at despammed dot com Status: Open Bug Type: Feature/Change Request Operating System: * PHP Version: 5.1.0RC1 New Comment: Ooops, code example should have class Child extends Base and Child::test1(), ofcourse. Previous Comments: [2005-10-02 00:16:33] pornel at despammed dot com Description: In PHP it is not possible to write base class for singleton and similar programming patterns. I know it is intended behavior and backwards compatibility may make changes difficult, but there is significant number of complaints about current implementation: http://bugs.php.net/bug.php?id=30235 http://bugs.php.net/bug.php?id=30934 http://bugs.php.net/bug.php?id=30423 http://bugs.php.net/bug.php?id=19376 http://bugs.php.net/bug.php?id=26930 http://bugs.php.net/bug.php?id=28442 http://bugs.php.net/bug.php?id=29647 and I'd like to add another one. I'm trying to write functionality that works similar to ActiveRow implementation in RubyOnRails, but the way in which PHP handles static methods and inheritance makes such implementation impossible. I hope you could implement late binding for static calls and fields. It could be used with this:: construct instead of self::, which may be emulated for backwards compatiblity. Reproduce code: --- class Base { static function test1() {self::test2();} static function test2() {echo 'failure';} } class Child { static function test2() {echo 'success';} } Child::test(); Expected result: success Actual result: -- failure backtrace doesn't contain reference to Child class (that would be enough for a workaround). -- Edit this bug report at http://bugs.php.net/?id=34703edit=1
#33784 [NEW]: NUL allowed in file paths
From: pornel at despammed dot com Operating system: All? Win32 tested PHP version: 5CVS-2005-07-20 (dev) PHP Bug Type: *Directory/Filesystem functions Bug description: NUL allowed in file paths Description: NUL character (C string terminator) is allowed in file paths passed to OS functions, which causes unexpected truncation of string. This is a security risk for popular, sloppy code like: include($_GET['page'].'.i-feel-safe.php'); because ?page=/etc/passwd%00 circumvents such protection. IMHO PHP should throw an error if PHP string can't be safely converted to C string. Reproduce code: --- ?php fopen(urldecode(test%00.html),r); Expected result: Error: illegal path Actual result: -- Warning: fopen(test) [function.fopen]: failed to open stream: No such file or directory in c:\www\test.php5 on line 2 -- Edit bug report at http://bugs.php.net/?id=33784edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33784r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33784r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33784r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33784r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33784r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33784r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33784r=needscript Try newer version: http://bugs.php.net/fix.php?id=33784r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33784r=support Expected behavior: http://bugs.php.net/fix.php?id=33784r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33784r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33784r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33784r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33784r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33784r=dst IIS Stability: http://bugs.php.net/fix.php?id=33784r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33784r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33784r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33784r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33784r=mysqlcfg
#33710 [NEW]: ArrayAccess objects doen't initialize $this
From: pornel at despammed dot com Operating system: all PHP version: 5.1.0b2 PHP Bug Type: Class/Object related Bug description: ArrayAccess objects doen't initialize $this Description: In object that implements ArrayAccess and accesses itself as array inside its own method, $this is not available (Undefined variable: this) Reproduce code: --- ?php class Foo implements ArrayAccess { function offsetExists ($offset) {/*...*/} function offsetGet ($offset) {/*...*/} function offsetSet ($offset, $value) {/*...*/} function offsetUnset ($offset) {/*...*/} function fail() { $this['blah']; } function succeed() { $this; $this['blah']; } } $bar = new Foo(); $bar-succeed(); $bar-fail(); Expected result: No error. Both methods should work. Actual result: -- Notice: Undefined variable: this in c:\www\test.php5 on line 13 -- Edit bug report at http://bugs.php.net/?id=33710edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33710r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33710r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33710r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33710r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33710r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33710r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33710r=needscript Try newer version: http://bugs.php.net/fix.php?id=33710r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33710r=support Expected behavior: http://bugs.php.net/fix.php?id=33710r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33710r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33710r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33710r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33710r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33710r=dst IIS Stability: http://bugs.php.net/fix.php?id=33710r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33710r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33710r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33710r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33710r=mysqlcfg
#33427 [NEW]: php_odbc_includes.h:118: sql.h missing
From: pornel at despammed dot com Operating system: debian sta(b)le PHP version: 5.1.0b2 PHP Bug Type: Compile Failure Bug description: php_odbc_includes.h:118: sql.h missing Description: I apparently don't have package that provides sql.h, but configure didn't complain about that. Reproduce code: --- /tmp/php-5.1.0b1# './configure' '--with-apxs=/usr/bin/apxs' '--prefix=/usr' '--disable-debug' '--with-config-file-path=/etc/php5/apache' '--disable-rpath' '--with-regex=php' '--enable-memory-limit' '--disable-debug' '--with-layout=GNU' '--disable-pear' '--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--without-db2' '--enable-dbx' '--with-iconv' '--enable-exif' '--enable-filepro' '--enable-ftp' '--with-gettext' '--with-mime-magic' '--enable-mbstring' '--with-pcre-regex' '--enable-soap' '--enable-sockets' '--enable-simplexml' '--with-libxml-dir=/usr' '--with-dom=/usr' '--with-xsl=/usr' '--with-sqlite' '--enable-sqlite-utf8' '--enable-tokenizer' '--enable-yp' '--with-zlib' '--with-zlib-dir=/usr' '--with-kerberos=/usr' '--with-openssl=/usr' '--with-exec-dir=/usr/lib/php5/libexec' '--disable-static' '--without-pear' '--with-curl=shared,/usr' '--with-gd=shared' '--with-jpeg-dir=shared,/usr' '--without-xpm' '--with-png-dir=shared,/usr' '--with-freetype-dir=shared,/usr' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-mcrypt=shared,/usr' '--with-ming=shared,/usr' '--without-imap' '--with-imap-ssl' '--without-ldap' '--with-mhash=shared,/usr' '--with-mm' '--with-mysql=shared,/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysqli=shared,/usr/bin/mysql_config' '--without-pgsql' '--with-unixODBC=shared,/usr' '--with-tidy=shared' '--without-snmp' '--without-sybase' '--with-ttf=shared,/usr' '--with-xmlrpc=shared' --with-soap Expected result: binary. configure ran ok. Actual result: -- In file included from /tmp/php-5.1.0b1/ext/odbc/php_odbc.c:37: /tmp/php-5.1.0b1/ext/odbc/php_odbc_includes.h:118: sql.h: No such file or directory /tmp/php-5.1.0b1/ext/odbc/php_odbc_includes.h:119: sqlext.h: No such file or directory -- Edit bug report at http://bugs.php.net/?id=33427edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33427r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33427r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33427r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33427r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33427r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33427r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33427r=needscript Try newer version: http://bugs.php.net/fix.php?id=33427r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33427r=support Expected behavior: http://bugs.php.net/fix.php?id=33427r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33427r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33427r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33427r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33427r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33427r=dst IIS Stability: http://bugs.php.net/fix.php?id=33427r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33427r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33427r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33427r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33427r=mysqlcfg
#33318 [Fbk-Opn]: throw 1; results in Invalid opcode 108/1/8
ID: 33318 User updated by: pornel at despammed dot com Reported By: pornel at despammed dot com -Status: Feedback +Status: Open Bug Type: Zend Engine 2 problem Operating System: win? any PHP Version: 5.1.0b1 New Comment: ?php throw 1; ? results in: Fatal error: Invalid opcode 108/1/8. in c:\www\test.php5 on line 2 using PHP Version 5.1.0-dev Build Date Jun 15 2005 04:17:08 installed on Win32 Apache/1.3.33 as CGI. Previous Comments: [2005-06-13 10:32:15] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip I can not reproduce (the script you gave isn't really complete, is it?) [2005-06-12 22:45:31] pornel at despammed dot com Description: throw NULL; throw 1; and probably all non-object throws result in Invalid Opcode errors. if PHP isn't supposed to allow throwing of scalar values, error should be more precise. Reproduce code: --- function ERR() {throw 'x';} Expected result: C++-like throwing of anything or parse error. -- Edit this bug report at http://bugs.php.net/?id=33318edit=1
#33318 [NEW]: throw 1; results in Invalid opcode 108/1/8
From: pornel at despammed dot com Operating system: win? any PHP version: 5.1.0b1 PHP Bug Type: Zend Engine 2 problem Bug description: throw 1; results in Invalid opcode 108/1/8 Description: throw NULL; throw 1; and probably all non-object throws result in Invalid Opcode errors. if PHP isn't supposed to allow throwing of scalar values, error should be more precise. Reproduce code: --- function ERR() {throw 'x';} Expected result: C++-like throwing of anything or parse error. -- Edit bug report at http://bugs.php.net/?id=33318edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33318r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33318r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33318r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33318r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33318r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33318r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33318r=needscript Try newer version: http://bugs.php.net/fix.php?id=33318r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33318r=support Expected behavior: http://bugs.php.net/fix.php?id=33318r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33318r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33318r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33318r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33318r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33318r=dst IIS Stability: http://bugs.php.net/fix.php?id=33318r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33318r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33318r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33318r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33318r=mysqlcfg
#16079 [Com]: Allow '.' (concat) operator on static strings
ID: 16079 Comment by: pornel at despammed dot com Reported By: steve dot venable at lmco dot com Status: Open Bug Type: Feature/Change Request Operating System: All PHP Version: 4.1.1 New Comment: Not fixed in latest snapshot (PHP5.1.0-dev). I was about to file bugreport about: class Test1 { const test1 = 'foo'.'bar'; } class Test2 { static $test2 = array('foo'.'bar'); } define('foo','foo'); class Test3 { const test3 = foo.'bar'; } Workaround is to use define() for all string concatenation and then using these constants as initializers. Previous Comments: [2002-03-14 14:01:32] steve dot venable at lmco dot com I can understand requiring constants for static initialization. But can the parser be modified to support operators on constants for static initializations? This is especially true for long strings which I can't even break at the end of line for readability. (I almost submitted this as a bug :) Examples: $v = 1 + 2; // Okay static $s = 1 + 2; // Fails parse $v = this long .string; // Okay static $s = this long .string; // Fails parse Since only constants are involved the parser could collapse the expression without difficulty. This makes the code much more readable (again thinking of very long strings). In my case I'm building an array of error messages and don't want the array build to occur everytime the function is called, hence I made it static. -- Edit this bug report at http://bugs.php.net/?id=16079edit=1
#32505 [NEW]: Type hinting still a useless feature
From: pornel at despammed dot com Operating system: any PHP version: 5.0.3 PHP Bug Type: Feature/Change Request Bug description: Type hinting still a useless feature Description: Fatal error: Argument $n must (not be null|be an object of class $c) in $location_of_called_function These errros point to location of called function, but not to location *where it was called from*. In most cases fault is in calling code, not function declaration, so given file/line is irrelevant. The problem is that it is not possible to figure out where from the function has been called and actually makes type hinting more harmful than useful. Previous WONTFIX bug is wrong (#28001), because it's not possible to use debug_backtrace() it this situation. WONTFIX bug #31578, concludes that debug_backtrace() doesn't work here by design. One similar bug says it has been fixed long time ago (#27290), but actually the original problem is not yet fixed (see testcase). The solution is to make type hint error non-fatal (so handler and debug_backtrace can be used) or report location of calling function (back up one level on stack). Reproduce code: --- ?php function Foo(Bar $x) // definition, line 3 { } Foo(NULL); // call, line 7 Expected result: Fatal error: Argument 1 must not be null in test.php on line 7 Actual result: -- Fatal error: Argument 1 must not be null in test.php on line 3 -- Edit bug report at http://bugs.php.net/?id=32505edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32505r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32505r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32505r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=32505r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=32505r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32505r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32505r=needscript Try newer version: http://bugs.php.net/fix.php?id=32505r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32505r=support Expected behavior: http://bugs.php.net/fix.php?id=32505r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32505r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32505r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=32505r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32505r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=32505r=dst IIS Stability: http://bugs.php.net/fix.php?id=32505r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32505r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32505r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32505r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32505r=mysqlcfg
#32458 [NEW]: preg_split return only offsets
From: pornel at despammed dot com Operating system: all PHP version: Irrelevant PHP Bug Type: Feature/Change Request Bug description: preg_split return only offsets Description: PREG_SPLIT_OFFSET_CAPTURE is useful for creation of custom parsers - allows to find positions of matching strings. If offset is known - returned string is not needed, as it might be accessed in various other ways. I suggest adding flag PREG_SPLIT_OFFSETS_ONLY (or PREG_SPLIT_NO_CAPTURE) that would (hopefully) boost performance when preg_split is used to tokenize long strings. -- Edit bug report at http://bugs.php.net/?id=32458edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32458r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32458r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32458r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=32458r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=32458r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32458r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32458r=needscript Try newer version: http://bugs.php.net/fix.php?id=32458r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32458r=support Expected behavior: http://bugs.php.net/fix.php?id=32458r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32458r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32458r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=32458r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32458r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=32458r=dst IIS Stability: http://bugs.php.net/fix.php?id=32458r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32458r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32458r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32458r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32458r=mysqlcfg
#32458 [Opn]: preg_split return only offsets
ID: 32458 User updated by: pornel at despammed dot com Reported By: pornel at despammed dot com Status: Open Bug Type: Feature/Change Request Operating System: all PHP Version: Irrelevant New Comment: New parameter, start at, that causes command to ignore number of initial chars, would nicely complement this feature. Previous Comments: [2005-03-25 21:38:11] pornel at despammed dot com Description: PREG_SPLIT_OFFSET_CAPTURE is useful for creation of custom parsers - allows to find positions of matching strings. If offset is known - returned string is not needed, as it might be accessed in various other ways. I suggest adding flag PREG_SPLIT_OFFSETS_ONLY (or PREG_SPLIT_NO_CAPTURE) that would (hopefully) boost performance when preg_split is used to tokenize long strings. -- Edit this bug report at http://bugs.php.net/?id=32458edit=1
#32263 [Fbk-Opn]: Location sets 302 on HTTP/1.1+POST, should be 303
ID: 32263 User updated by: pornel at despammed dot com Reported By: pornel at despammed dot com -Status: Feedback +Status: Open Bug Type: HTTP related -Operating System: any +Operating System: win -PHP Version: 5.0.3 +PHP Version: 5.0.2/cgi, 4.3.3/mod tested New Comment: ?php header(Location: http://example.com;); ? HTTP dialog: POST /test.php5 HTTP/1.1 Host: localhost Content-Length: 0 HTTP/1.1 302 Date: Sat, 12 Mar 2005 15:28:40 GMT Server: Apache/1.3.27 (Win32) PHP/4.3.3 X-Powered-By: PHP/5.0.2 Location: http://example.com Transfer-Encoding: chunked Content-Type: text/html 0 POST /test.php HTTP/1.1 Host: localhost Content-Length: 0 HTTP/1.1 302 Found Date: Sat, 12 Mar 2005 15:26:03 GMT Server: Apache/1.3.27 (Win32) PHP/4.3.3 X-Powered-By: PHP/4.3.3 Cache-Control: no-cache Location: http://example.com Transfer-Encoding: chunked Content-Type: text/html 0 Previous Comments: [2005-03-12 14:44:51] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with ?php and ends with ?, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. [2005-03-10 14:21:20] pornel at despammed dot com Description: HTTP/1.1 user-agents should be redirected after POST request using 303 status. According to RFC2616 user-agents MUST NOT redirect POST on 302 status (unless confirmed by the user, AFAIK only Lynx does that), so 302 is not the best choice in this situation. In short: if (HTTP/1.1 POST) default_redirect_status=303. -- Edit this bug report at http://bugs.php.net/?id=32263edit=1
#32263 [NEW]: Location sets 302 on HTTP/1.1+POST, should be 303
From: pornel at despammed dot com Operating system: any PHP version: 5.0.3 PHP Bug Type: HTTP related Bug description: Location sets 302 on HTTP/1.1+POST, should be 303 Description: HTTP/1.1 user-agents should be redirected after POST request using 303 status. According to RFC2616 user-agents MUST NOT redirect POST on 302 status (unless confirmed by the user, AFAIK only Lynx does that), so 302 is not the best choice in this situation. In short: if (HTTP/1.1 POST) default_redirect_status=303. -- Edit bug report at http://bugs.php.net/?id=32263edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32263r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32263r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32263r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=32263r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=32263r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32263r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32263r=needscript Try newer version: http://bugs.php.net/fix.php?id=32263r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32263r=support Expected behavior: http://bugs.php.net/fix.php?id=32263r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32263r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32263r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=32263r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32263r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=32263r=dst IIS Stability: http://bugs.php.net/fix.php?id=32263r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32263r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32263r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32263r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32263r=mysqlcfg