Req #33891 [Bgs]: make array implements traversable, ArrayAccess and Countable
Edit report at http://bugs.php.net/bug.php?id=33891edit=1 ID: 33891 User updated by: marcos dot neves at gmail dot com Reported by: marcos dot neves at gmail dot com -Summary: make array a traversable +Summary: make array implements traversable, ArrayAccess and Countable Status: Bogus Type: Feature/Change Request Package: *General Issues Operating System: any -PHP Version: 5.1.0b3 +PHP Version: 5.2.13 5.3.2 New Comment: Still not working: ? function loop(Traversable $traversable) { foreach($traversable as $k = $v) echo $k = $v\n; } $primos = explode( , 1 2 3 5 7 11 13 17 19); // loop($primos); // does not work loop(new ArrayIterator($primos)); // works ? Previous Comments: [2010-03-13 18:17:57] f...@php.net Please try 5.3.2 or 5.2.13. [2010-03-13 18:08:24] wrzasq at gmail dot com It should also expose interfaces ArrayAccess and Countable. It's very frustrating when you use type hinting to force iterable structures or array-like accessible and it comes out that you can't pass array themselves. [2005-07-27 22:14:08] marcos dot neves at gmail dot com Description: Traversable is an internal interface that says I can be used in a foreach. Since array can be used too, would be nice if array be accepted internally in parameters that expect traversable. Reproduce code: --- ? function acceptArray(array $t) { echo \n.__FUNCTION__.\n; foreach($t as $k=$v) { echo $k=$v\n; } } function acceptTraversable(Traversable $t) { echo \n.__FUNCTION__.\n; foreach($t as $k=$v) { echo $k=$v\n; } } $test = array(is, array, traversable, too, ?); acceptArray($test); // ok acceptTraversable(new ArrayIterator($test)); // ok acceptTraversable($test); // would be nice ? Expected result: acceptTraversable($test); shoud accept an array, since it's too a Traversable structure(can be used in a foreach). Actual result: -- Fatal error: Argument 1 must be an object of class Traversable -- Edit this bug report at http://bugs.php.net/bug.php?id=33891edit=1
#48942 [NEW]: open_basedir no working with [PATH=] in php.ini
From: marcos dot neves at gmail dot com Operating system: debian PHP version: 5.3.0 PHP Bug Type: CGI related Bug description: open_basedir no working with [PATH=] in php.ini Description: I got No input file specified. from fcgi when used open_basedir inside [PATH=] php.ini Reproduce code: --- create an entry on php.ini with open_basedir pointing to your domain root, example: open_basedir=/var/www/my.domain.com restart fcgi and check if it all works fine. (it should) Now add this like above open_basedir: [PATH=/var/www/my.domain.com] open_basedir=/var/www/my.domain.com restart fcgi and now you will get No input file specified. Expected result: should work as before. Actual result: -- got No input file specified. fcgi response. -- Edit bug report at http://bugs.php.net/?id=48942edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48942r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48942r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48942r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48942r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48942r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48942r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48942r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48942r=needscript Try newer version: http://bugs.php.net/fix.php?id=48942r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48942r=support Expected behavior: http://bugs.php.net/fix.php?id=48942r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48942r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48942r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48942r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48942r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=48942r=dst IIS Stability: http://bugs.php.net/fix.php?id=48942r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48942r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48942r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48942r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48942r=mysqlcfg
#48942 [Com]: open_basedir no working with [PATH=] in php.ini
ID: 48942 Comment by: marcos dot neves at gmail dot com Reported By: marcos dot neves at gmail dot com Status: Feedback Bug Type: CGI related Operating System: debian PHP Version: 5.3.0 New Comment: the bug happens using both spawn-fcgi or php-fpm. The php is different for each other. For example, with spawn-fcgi, I am using dotdeb.org php5.3 version, installed using apt-get. With php-fpm, I am using php5.3 Build from source. For webserver, I am using nginx. I both ways, if I change to configuration to this one, every things back to normal: [PATH=/var/www/my.domain.com] open_basedir=/var/www Previous Comments: [2009-07-16 13:35:47] j...@php.net And exactly how is everything else configured? Like the path to the script you're accessing? [2009-07-16 12:16:19] marcos dot neves at gmail dot com Description: I got No input file specified. from fcgi when used open_basedir inside [PATH=] php.ini Reproduce code: --- create an entry on php.ini with open_basedir pointing to your domain root, example: open_basedir=/var/www/my.domain.com restart fcgi and check if it all works fine. (it should) Now add this like above open_basedir: [PATH=/var/www/my.domain.com] open_basedir=/var/www/my.domain.com restart fcgi and now you will get No input file specified. Expected result: should work as before. Actual result: -- got No input file specified. fcgi response. -- Edit this bug report at http://bugs.php.net/?id=48942edit=1
#48942 [Fbk-Opn]: open_basedir no working with [PATH=] in php.ini
ID: 48942 User updated by: marcos dot neves at gmail dot com Reported By: marcos dot neves at gmail dot com -Status: Feedback +Status: Open Bug Type: CGI related Operating System: debian PHP Version: 5.3.0 New Comment: playing more, I found that the same bug happens if I configure open_basedir on .user.ini file. It look likes that open_basedir can't be configured in a context way, only in a global way. If thats true, I would be very sad, cause that could be a great feature for hosting companies. Previous Comments: [2009-07-16 18:51:23] marcos dot neves at gmail dot com the bug happens using both spawn-fcgi or php-fpm. The php is different for each other. For example, with spawn-fcgi, I am using dotdeb.org php5.3 version, installed using apt-get. With php-fpm, I am using php5.3 Build from source. For webserver, I am using nginx. I both ways, if I change to configuration to this one, every things back to normal: [PATH=/var/www/my.domain.com] open_basedir=/var/www [2009-07-16 13:35:47] j...@php.net And exactly how is everything else configured? Like the path to the script you're accessing? [2009-07-16 12:16:19] marcos dot neves at gmail dot com Description: I got No input file specified. from fcgi when used open_basedir inside [PATH=] php.ini Reproduce code: --- create an entry on php.ini with open_basedir pointing to your domain root, example: open_basedir=/var/www/my.domain.com restart fcgi and check if it all works fine. (it should) Now add this like above open_basedir: [PATH=/var/www/my.domain.com] open_basedir=/var/www/my.domain.com restart fcgi and now you will get No input file specified. Expected result: should work as before. Actual result: -- got No input file specified. fcgi response. -- Edit this bug report at http://bugs.php.net/?id=48942edit=1
#39824 [Bgs-Opn]: mysql_free_result warning
ID: 39824 User updated by: marcos dot neves at gmail dot com Reported By: marcos dot neves at gmail dot com -Status: Bogus +Status: Open Bug Type: MySQL related Operating System: WINXP PHP Version: 5.2.0 New Comment: Hide the error msg doesn´t means the error has gone. Does this error still happens before 5.2? Why no warning before? The docs are very clear: only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script's execution I hope that this trick of hide error messages to fixes then, not be used at PHP core code :( Previous Comments: [2006-12-18 08:38:48] [EMAIL PROTECTED] Set mysql.trace_mode to Off in your php.ini. [2006-12-13 23:20:33] marcos dot neves at gmail dot com Description: Starting with mysql 5.2.0, mysql_free_result is required be called before end of script Reproduce code: --- ? mysql_connect(localhost, root, ); $result = mysql_query(SELECT 1 + 2); ? Expected result: no warnings, the results should be disposed at end of script, as documentantion saids and as like was before. Actual result: -- Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0 -- Edit this bug report at http://bugs.php.net/?id=39824edit=1
#39824 [NEW]: mysql_free_result warning
From: marcos dot neves at gmail dot com Operating system: WINXP PHP version: 5.2.0 PHP Bug Type: MySQL related Bug description: mysql_free_result warning Description: Starting with mysql 5.2.0, mysql_free_result is required be called before end of script Reproduce code: --- ? mysql_connect(localhost, root, ); $result = mysql_query(SELECT 1 + 2); ? Expected result: no warnings, the results should be disposed at end of script, as documentantion saids and as like was before. Actual result: -- Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0 -- Edit bug report at http://bugs.php.net/?id=39824edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39824r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39824r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39824r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39824r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39824r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39824r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=39824r=needscript Try newer version:http://bugs.php.net/fix.php?id=39824r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39824r=support Expected behavior:http://bugs.php.net/fix.php?id=39824r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39824r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39824r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39824r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39824r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39824r=dst IIS Stability:http://bugs.php.net/fix.php?id=39824r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39824r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39824r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39824r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=39824r=mysqlcfg
#39615 [NEW]: Exception code can�t be string
From: marcos dot neves at gmail dot com Operating system: ANY PHP version: 5.2.0 PHP Bug Type: Scripting Engine problem Bug description: Exception code can´t be string Description: The follow code is ok, cause 123, even as a string, it can be convert to number. new Exception(Message, 123); The follow is not ok. new Exception(Message, NotNumber); PHP is not a typed language, why Exception must have a number as code? The problem is that error code doesn´t means Number error code but could be a string error code, like mysql 5.1 uses. Check the follow reproduce able code. Reproduce code: --- ? error_reporting(E_ALL); $host = localhost; $dbName = test; $user = root; $passwd = ; $mysqlDsn = mysql:host=$host;$dbName; $pdo = new PDO($mysqlDsn, $user, $passwd); $pdo-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); try { $pdo-query(SELECT version); }catch(Exception $e){ $code = $e-getCode(); // 42S22 echo pre; var_dump($code); // string(5) 42S22 throw new Exception($e-getMessage(), $code); } ? Expected result: The follow line, should accept the $code var, but doesn´t. throw new Exception($e-getMessage(), $code); It´s not consistent, since the Exception object constructor can´t accept a non number as code, but it can return. See: $msg = $catchedPdoMysqlException-getMessage(); $code = $catchedPdoMysqlException-getCode(); new Exception($msg, $code); // $code is not valid one. Actual result: -- Exception code, should accept non numbers as a code value, as mysql does. -- Edit bug report at http://bugs.php.net/?id=39615edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39615r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39615r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39615r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39615r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39615r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39615r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=39615r=needscript Try newer version:http://bugs.php.net/fix.php?id=39615r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39615r=support Expected behavior:http://bugs.php.net/fix.php?id=39615r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39615r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39615r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39615r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39615r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39615r=dst IIS Stability:http://bugs.php.net/fix.php?id=39615r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39615r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39615r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39615r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=39615r=mysqlcfg
#39510 [NEW]: Error to Exception configuration
From: marcos dot neves at gmail dot com Operating system: ANY PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug description: Error to Exception configuration Description: A nice feature would be a php.ini configuration with access PHP_INI_ALL and with the name error_to_exception configured by following way: ini_set(error_to_exception, E_ALL); or in php.ini: error_to_exception = E_WARNING | E_FATAL The behavior would be that php error messages, would be converted to Exceptions. PHP could slowly create specific exception like, FileNotFoundException that is throw only when error_to_exception is enabled. Would be possible to do the follow code: Reproduce code: --- ? ini_set(error_to_exception, E_ALL); try { $contents = file_get_contents(path/to/file); }catch(WarningException $e){ ... } ? And on the future: ? ini_set(error_to_exception, E_ALL); try { $contents = file_get_contents(path/to/file); }catch(FileNotFoundException $e){ ... }catch(FileNotReadableException $e) { ... } ? -- Edit bug report at http://bugs.php.net/?id=39510edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39510r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39510r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39510r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39510r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39510r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39510r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=39510r=needscript Try newer version:http://bugs.php.net/fix.php?id=39510r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39510r=support Expected behavior:http://bugs.php.net/fix.php?id=39510r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39510r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39510r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39510r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39510r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39510r=dst IIS Stability:http://bugs.php.net/fix.php?id=39510r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39510r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39510r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39510r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=39510r=mysqlcfg
#39392 [NEW]: __toString back compatibility
From: marcos dot neves at gmail dot com Operating system: ANY PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug description: __toString back compatibility Description: Object that do not implement __toString, now stop the script with PHP Catchable fatal error: Object of class {className} could not be converted to string in ... But for backward compatibility, if __toString is not implemented, it should return the old object id value, or the name of class of the object for example. I agree that nobody can rely on old ObjectId string, but there´s thousand scripts that stringfy data for logging, like this: function log($vars) { foreach($vars as $var) echo $var; } function test($a, $b) { log(func_get_args()); } Reproduce code: --- class Foo { } echo new Foo; Expected result: Old behavior of conversion from object to string Actual result: -- Catchable fatal error: Object of class Foo could not be converted to string in ... -- Edit bug report at http://bugs.php.net/?id=39392edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39392r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39392r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39392r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39392r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39392r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39392r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=39392r=needscript Try newer version:http://bugs.php.net/fix.php?id=39392r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39392r=support Expected behavior:http://bugs.php.net/fix.php?id=39392r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39392r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39392r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39392r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39392r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39392r=dst IIS Stability:http://bugs.php.net/fix.php?id=39392r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39392r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39392r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39392r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=39392r=mysqlcfg
#39239 [NEW]: pconnect can�t reuse open connection
From: marcos dot neves at gmail dot com Operating system: FreeBSD 5.4-STABLE i386 PHP version: 5.1.6 PHP Bug Type: MySQL related Bug description: pconnect can´t reuse open connection Description: Probably it´s the same bug of 38283, but with a newer version and a different OS. I try the same version on windows, and mysql_pconnect reuse the connection as expected. But on two php instalations on two machines, pconnect works as a simple mysql_connect. The php.ini configuration are ok, and php is running as Apache Module, as required for pconnect works. FreeBSD 5.4-STABLE i386 apache-2.2.2_1 Version 2.2 of Apache web server with prefork MPM. php5-5.1.6_2 -- Edit bug report at http://bugs.php.net/?id=39239edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39239r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39239r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39239r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39239r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39239r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39239r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=39239r=needscript Try newer version:http://bugs.php.net/fix.php?id=39239r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39239r=support Expected behavior:http://bugs.php.net/fix.php?id=39239r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39239r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39239r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39239r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39239r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39239r=dst IIS Stability:http://bugs.php.net/fix.php?id=39239r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39239r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39239r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39239r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=39239r=mysqlcfg
#39239 [Fbk-Opn]: pconnect can�t reuse open connection
ID: 39239 User updated by: marcos dot neves at gmail dot com Reported By: marcos dot neves at gmail dot com -Status: Feedback +Status: Open Bug Type: MySQL related Operating System: FreeBSD 5.4-STABLE i386 PHP Version: 5.1.6 New Comment: ? mysql_pconnect(...); // just open a connection ? RUN the follow command on a mysql client: SHOW PROCESSLIST Since it´s persistent, that connection will be listed on PROCESSLIST. If you run the script again, the same opened connection should be used in place, and the timeout would be reset to zero. The problem is that a new connection has been opened. Please, tell me what more information can I give, cause the bug happens only under my server. Previous Comments: [2006-10-23 15:38:43] [EMAIL PROTECTED] Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to Open. Thank you for your interest in PHP. [2006-10-23 15:30:28] marcos dot neves at gmail dot com Description: Probably it´s the same bug of 38283, but with a newer version and a different OS. I try the same version on windows, and mysql_pconnect reuse the connection as expected. But on two php instalations on two machines, pconnect works as a simple mysql_connect. The php.ini configuration are ok, and php is running as Apache Module, as required for pconnect works. FreeBSD 5.4-STABLE i386 apache-2.2.2_1 Version 2.2 of Apache web server with prefork MPM. php5-5.1.6_2 -- Edit this bug report at http://bugs.php.net/?id=39239edit=1
#39239 [Bgs]: pconnect can�t reuse open connection
ID: 39239 User updated by: marcos dot neves at gmail dot com Reported By: marcos dot neves at gmail dot com Status: Bogus Bug Type: MySQL related Operating System: FreeBSD 5.4-STABLE i386 PHP Version: 5.1.6 New Comment: How can I configure Apache to reuse the same thread more as it can. Cause each request, it´s creating a new connection with the database. Could it be because I´m using Apache with prefork MPM? Previous Comments: [2006-10-23 15:57:55] [EMAIL PROTECTED] If you run the script again, the same opened connection should be used in place, and the timeout would be reset to zero. Only if your next request is server by THE VERY SAME Apache child as the previous one, 'cause persistent resources are per-process/per-thread. [2006-10-23 15:46:00] marcos dot neves at gmail dot com ? mysql_pconnect(...); // just open a connection ? RUN the follow command on a mysql client: SHOW PROCESSLIST Since it´s persistent, that connection will be listed on PROCESSLIST. If you run the script again, the same opened connection should be used in place, and the timeout would be reset to zero. The problem is that a new connection has been opened. Please, tell me what more information can I give, cause the bug happens only under my server. [2006-10-23 15:38:43] [EMAIL PROTECTED] Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to Open. Thank you for your interest in PHP. [2006-10-23 15:30:28] marcos dot neves at gmail dot com Description: Probably it´s the same bug of 38283, but with a newer version and a different OS. I try the same version on windows, and mysql_pconnect reuse the connection as expected. But on two php instalations on two machines, pconnect works as a simple mysql_connect. The php.ini configuration are ok, and php is running as Apache Module, as required for pconnect works. FreeBSD 5.4-STABLE i386 apache-2.2.2_1 Version 2.2 of Apache web server with prefork MPM. php5-5.1.6_2 -- Edit this bug report at http://bugs.php.net/?id=39239edit=1
#38829 [NEW]: $_SERVER[PARSE_TIME]
From: marcos dot neves at gmail dot com Operating system: ANY PHP version: 5.1.6 PHP Bug Type: Feature/Change Request Bug description: $_SERVER[PARSE_TIME] Description: I Would like to suggest a new $_SERVER variable called PARSE_TIME, that has the time the PHP takes to parse the file. And would like to suggest an other variable that has the time php takes to start running your code. For example, the start running of a cgi PHP is slower than running as Module. So this time would be on a variable at the $_SERVER. -- Edit bug report at http://bugs.php.net/?id=38829edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38829r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38829r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38829r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38829r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38829r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38829r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=38829r=needscript Try newer version:http://bugs.php.net/fix.php?id=38829r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38829r=support Expected behavior:http://bugs.php.net/fix.php?id=38829r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38829r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38829r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38829r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38829r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38829r=dst IIS Stability:http://bugs.php.net/fix.php?id=38829r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38829r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38829r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38829r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=38829r=mysqlcfg
#38325 [NEW]: spl_autoload_register() gaves wrong line for class not found
From: marcos dot neves at gmail dot com Operating system: WINXP PHP version: 5CVS-2006-08-04 (snap) PHP Bug Type: SPL related Bug description: spl_autoload_register() gaves wrong line for class not found Description: ? //spl_autoload_register(); new Foo(); ? The code above gives-me: Fatal error: Class 'Foo' not found in autoLoad.php on line 5 That´s ok, the line shows where the error occurs. Uncomment the spl_autoload_register() and the error will become: Fatal error: Class 'Foo' not found in autoLoad.php on line 7 The line error, goes to the last line of the script. Inside a big script, with many requires, can be very difficult to find where the errors really occurs Reproduce code: --- ? //spl_autoload_register(); // uncomment to test the bug new Foo(); ? Expected result: Fatal error: Class 'Foo' not found in autoLoad.php on line 5 Correct line Actual result: -- Fatal error: Class 'Foo' not found in autoLoad.php on line 7 Wrong line (always the last one) -- Edit bug report at http://bugs.php.net/?id=38325edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38325r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38325r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38325r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38325r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38325r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38325r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=38325r=needscript Try newer version:http://bugs.php.net/fix.php?id=38325r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38325r=support Expected behavior:http://bugs.php.net/fix.php?id=38325r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38325r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38325r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38325r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38325r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38325r=dst IIS Stability:http://bugs.php.net/fix.php?id=38325r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38325r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38325r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38325r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=38325r=mysqlcfg
#38303 [NEW]: spl_autoload_register() supress all errors silently
From: marcos dot neves at gmail dot com Operating system: WINXP PHP version: 5CVS-2006-08-03 (snap) PHP Bug Type: SPL related Bug description: spl_autoload_register() supress all errors silently Description: If an error happens inside the loaded class, it dies silently with no display. That is horrible to debugging. Reproduce code: --- ? echo foo class Abc {} ? ? // autoload.php spl_autoload_register(); //require_once abc.php; // uncomment to show error new Abc(); ? Expected result: Parse error: parse error, unexpected T_CLASS, expecting ',' or ';' in abc.php on line 5 Actual result: -- nothing is displayed -- Edit bug report at http://bugs.php.net/?id=38303edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38303r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38303r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38303r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38303r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38303r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38303r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=38303r=needscript Try newer version:http://bugs.php.net/fix.php?id=38303r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38303r=support Expected behavior:http://bugs.php.net/fix.php?id=38303r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38303r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38303r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38303r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38303r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38303r=dst IIS Stability:http://bugs.php.net/fix.php?id=38303r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38303r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38303r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38303r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=38303r=mysqlcfg
#34329 [NEW]: The bug #31675 is present in 5.04 and 5.1
From: marcos dot neves at gmail dot com Operating system: * PHP version: 5.1.0RC1 PHP Bug Type: Unknown/Other Function Bug description: The bug #31675 is present in 5.04 and 5.1 Description: The bug #31675 is closed and says its fixed, but the problem persist in 5.04 and 5.1. Reproduce code: --- ? function error_handler1() { echo [.__FUNCTION__.]; } function error_handler2() { echo [.__FUNCTION__.]; restore_error_handler();// does not restore } set_error_handler('error_handler1'); set_error_handler('error_handler2'); echo foo; ? Expected result: [error_handler1]foo Actual result: -- [error_handler2]foo -- Edit bug report at http://bugs.php.net/?id=34329edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34329r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34329r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34329r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=34329r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=34329r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34329r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34329r=needscript Try newer version: http://bugs.php.net/fix.php?id=34329r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34329r=support Expected behavior: http://bugs.php.net/fix.php?id=34329r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34329r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34329r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=34329r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34329r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=34329r=dst IIS Stability: http://bugs.php.net/fix.php?id=34329r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34329r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34329r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34329r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34329r=mysqlcfg
#34329 [Bgs-Opn]: The bug #31675 is present in 5.04 and 5.1
ID: 34329 User updated by: marcos dot neves at gmail dot com Reported By: marcos dot neves at gmail dot com -Status: Bogus +Status: Open Bug Type: Unknown/Other Function Operating System: * PHP Version: 5.1.0RC1 New Comment: Sorry, I did more tests and it's still no right. The documentation says: Calling restore_error_handler() from the error_handler function is ignored. This is bugged for 5.0.4 and is not true for 5.1.0RC1 The follow code works as I expect in 5.1.0RC1 on windows. But on 5.0.4 restore_error_handler is ignored inside error_handler, but calling restore_error_handler outside, will exec twice, as if the restore_error_handler was pushed on a stack. pre ? function error_handler1() { echo \n[.__FUNCTION__.]\n; } function error_handler2() { echo \n[.__FUNCTION__.]\n; } function error_handler3() { echo \n[.__FUNCTION__.]\n; // restore_error_handler(); } function error_handler4() { echo \n[.__FUNCTION__.]\n; restore_error_handler(); } set_error_handler('error_handler1'); set_error_handler('error_handler2'); set_error_handler('error_handler3'); set_error_handler('error_handler4'); echo foo; echo bar; restore_error_handler(); echo test; ? RESULT FOR 5.0.4 [error_handler4] foo [error_handler4] bar [error_handler1] test if the restore_error_handler is really ignored inside error handler, the result should be: [error_handler4] foo [error_handler4] bar [error_handler3] test RESULT FOR 5.1.0RC1 [error_handler4] foo [error_handler3] bar [error_handler1] test it seens that restore_error_handler is not ignored inside handler on 5.1.0RC1 Previous Comments: [2005-09-01 16:18:20] [EMAIL PROTECTED] Maybe you should read how the bug was resolved? It wasn't really bug in PHP itself but just missing documentation. [2005-09-01 16:06:40] marcos dot neves at gmail dot com Description: The bug #31675 is closed and says its fixed, but the problem persist in 5.04 and 5.1. Reproduce code: --- ? function error_handler1() { echo [.__FUNCTION__.]; } function error_handler2() { echo [.__FUNCTION__.]; restore_error_handler();// does not restore } set_error_handler('error_handler1'); set_error_handler('error_handler2'); echo foo; ? Expected result: [error_handler1]foo Actual result: -- [error_handler2]foo -- Edit this bug report at http://bugs.php.net/?id=34329edit=1
#33894 [Bgs-Opn]: __MAIN_FILE__ constant
ID: 33894 User updated by: marcos dot neves at gmail dot com Reported By: marcos dot neves at gmail dot com -Status: Bogus +Status: Open Bug Type: Feature/Change Request Operating System: any PHP Version: 5.1.0b3 New Comment: $_SERVER['PHP_SELF'] hasn't the same value using php with apache and php cli. Run ? echo $_SERVER['PHP_SELF'] ? in a browser and as command line, you'll see the difference. At browser works fine do the follow: if(__FILE__ == $_SERVER['PHP_SELF']) { } but does not work with cli. Tested with PHP 5.1.0b3 on windows XP Previous Comments: [2005-08-01 13:28:51] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. We've PHP_SELF for this. [2005-07-27 23:27:50] marcos dot neves at gmail dot com Description: Today we have __FILE__ constant, that has the string fileName of the current scrit. Would be nice a constant __MAIN_FILE__, wich has the file name of the first requested PHP file. So would be possible to do things like this, without use of external library, and is interesting to everyone: Reproduce code: --- ? // class File class Foo {} if(__MAIN_FILE__ == __FILE__) { // run some tests and usabe examples with Foo } ? or used to include relative paths to an application, without define constants ? // included script require_once dirname(__MAIN_FILE__) . DIRECTORY_SEPARATOR . path/to/include/file.php; ? -- Edit this bug report at http://bugs.php.net/?id=33894edit=1
#33903 [NEW]: spl_autoload_register class method
From: marcos dot neves at gmail dot com Operating system: any PHP version: 5.1.0b3 PHP Bug Type: SPL related Bug description: spl_autoload_register class method Description: What about spl_autoload_register accept class methods too, like usort and other php functions Reproduce code: --- ? class MyAutoLoader { function autoLoad($className) { // autload code } } spl_autoload_register(array('MyAutoLoader', 'autoLoad')); // and $myAutoLoader = new MyAutoLoader(); spl_autoload_register(array($myAutoLoader, 'autoLoad')); ? Expected result: works! Actual result: -- Warning: spl_autoload_register() expects parameter 1 to be string, array given in C:\wamp\include_path\tests\spl\spl_autoload_register_class.test.php on line 10 Warning: spl_autoload_register() expects parameter 1 to be string, array given in C:\wamp\include_path\tests\spl\spl_autoload_register_class.test.php on line 15 -- Edit bug report at http://bugs.php.net/?id=33903edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33903r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33903r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33903r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33903r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33903r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33903r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33903r=needscript Try newer version: http://bugs.php.net/fix.php?id=33903r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33903r=support Expected behavior: http://bugs.php.net/fix.php?id=33903r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33903r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33903r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33903r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33903r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33903r=dst IIS Stability: http://bugs.php.net/fix.php?id=33903r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33903r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33903r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33903r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33903r=mysqlcfg
#33891 [NEW]: make array a traversable
From: marcos dot neves at gmail dot com Operating system: any PHP version: 5.1.0b3 PHP Bug Type: Feature/Change Request Bug description: make array a traversable Description: Traversable is an internal interface that says I can be used in a foreach. Since array can be used too, would be nice if array be accepted internally in parameters that expect traversable. Reproduce code: --- ? function acceptArray(array $t) { echo \n.__FUNCTION__.\n; foreach($t as $k=$v) { echo $k=$v\n; } } function acceptTraversable(Traversable $t) { echo \n.__FUNCTION__.\n; foreach($t as $k=$v) { echo $k=$v\n; } } $test = array(is, array, traversable, too, ?); acceptArray($test); // ok acceptTraversable(new ArrayIterator($test)); // ok acceptTraversable($test); // would be nice ? Expected result: acceptTraversable($test); shoud accept an array, since it's too a Traversable structure(can be used in a foreach). Actual result: -- Fatal error: Argument 1 must be an object of class Traversable -- Edit bug report at http://bugs.php.net/?id=33891edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33891r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33891r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33891r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33891r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33891r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33891r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33891r=needscript Try newer version: http://bugs.php.net/fix.php?id=33891r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33891r=support Expected behavior: http://bugs.php.net/fix.php?id=33891r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33891r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33891r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33891r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33891r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33891r=dst IIS Stability: http://bugs.php.net/fix.php?id=33891r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33891r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33891r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33891r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33891r=mysqlcfg
#33892 [NEW]: serialize contains invalid chars
From: marcos dot neves at gmail dot com Operating system: any PHP version: 5.1.0b3 PHP Bug Type: Unknown/Other Function Bug description: serialize contains invalid chars Description: serialized string returned by serialize, contains invalid chars only when serializing an object with protected or private properties. Reproduce code: --- ? class Foo { protected $bar = 123; //public $bar = 123; } $f = new Foo(); echo serialize($f); ? Expected result: comment protected and uncomment public and the right result is given: [[O:3:Foo:1:{s:3:bar;i:123;}]] Actual result: -- [[O:3:Foo:1:{s:6: wich means: [[O:3:Foo:1:{s:6:NULL*NULLbar;i:123;}]] where NULL is the char \0 -- Edit bug report at http://bugs.php.net/?id=33892edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33892r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33892r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33892r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33892r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33892r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33892r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33892r=needscript Try newer version: http://bugs.php.net/fix.php?id=33892r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33892r=support Expected behavior: http://bugs.php.net/fix.php?id=33892r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33892r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33892r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33892r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33892r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33892r=dst IIS Stability: http://bugs.php.net/fix.php?id=33892r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33892r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33892r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33892r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33892r=mysqlcfg
#33893 [NEW]: $_SERVER['STARTUP_MICRO_TIME']
From: marcos dot neves at gmail dot com Operating system: any PHP version: 5.1.0b3 PHP Bug Type: Feature/Change Request Bug description: $_SERVER['STARTUP_MICRO_TIME'] Description: $_SERVER['REQUEST_TIME'] is a very nice feature, But since many scripts runs in less than 0.1 seconds, would be nice exists a $_SERVER['STARTUP_MICRO_TIME'], so would be possible do something like below: Reproduce code: --- ? $times['startup'] = $_SERVER['STARTUP_MICRO_TIME'] require_once 'any.php'; $times['require'] = microtime(true); ... // more code $times['more_code'] = microtime(true); printTimes($times); function printTimes($times) { ... // use $_SERVER['REQUEST_MICRO_TIME'] } ? Expected result: A fine grained time elapse calculation Actual result: -- not perfect time elapse calculation -- Edit bug report at http://bugs.php.net/?id=33893edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33893r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33893r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33893r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33893r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33893r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33893r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33893r=needscript Try newer version: http://bugs.php.net/fix.php?id=33893r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33893r=support Expected behavior: http://bugs.php.net/fix.php?id=33893r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33893r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33893r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33893r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33893r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33893r=dst IIS Stability: http://bugs.php.net/fix.php?id=33893r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33893r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33893r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33893r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33893r=mysqlcfg
#33894 [NEW]: __MAIN_FILE__ constant
From: marcos dot neves at gmail dot com Operating system: any PHP version: 5.1.0b3 PHP Bug Type: Feature/Change Request Bug description: __MAIN_FILE__ constant Description: Today we have __FILE__ constant, that has the string fileName of the current scrit. Would be nice a constant __MAIN_FILE__, wich has the file name of the first requested PHP file. So would be possible to do things like this, without use of external library, and is interesting to everyone: Reproduce code: --- ? // class File class Foo {} if(__MAIN_FILE__ == __FILE__) { // run some tests and usabe examples with Foo } ? or used to include relative paths to an application, without define constants ? // included script require_once dirname(__MAIN_FILE__) . DIRECTORY_SEPARATOR . path/to/include/file.php; ? -- Edit bug report at http://bugs.php.net/?id=33894edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33894r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33894r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33894r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33894r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33894r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33894r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33894r=needscript Try newer version: http://bugs.php.net/fix.php?id=33894r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33894r=support Expected behavior: http://bugs.php.net/fix.php?id=33894r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33894r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33894r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33894r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33894r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33894r=dst IIS Stability: http://bugs.php.net/fix.php?id=33894r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33894r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33894r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33894r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33894r=mysqlcfg