#47887 [NEW]: Permit custom error types with trigger_error()
From: aragon at phat dot za dot net Operating system: FreeBSD PHP version: 5.2.9 PHP Bug Type: Feature/Change Request Bug description: Permit custom error types with trigger_error() Description: It would be useful if trigger_error would accept custom error types. Although I can do this with Exceptions, I can't see a way of sending variable context from where an exception is thrown to the exception handler, and loosing variable context would be a deal breaker. Reproduce code: --- define('E_CUSTOM_1', -1); define('E_CUSTOM_2', -2); function error_handler ($errno, $errmsg, $scriptname, $scriptline, $errcontext) { if ($errno == E_CUSTOM_1) die('custom error type'); } set_error_handler('error_handler'); trigger_user('message', E_CUSTOM_1); Expected result: custom error type Actual result: -- PHP Warning: Invalid error type specified in - on line 7 -- Edit bug report at http://bugs.php.net/?id=47887edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47887r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47887r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47887r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47887r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47887r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47887r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47887r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47887r=needscript Try newer version: http://bugs.php.net/fix.php?id=47887r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47887r=support Expected behavior: http://bugs.php.net/fix.php?id=47887r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47887r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47887r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47887r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47887r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=47887r=dst IIS Stability: http://bugs.php.net/fix.php?id=47887r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47887r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47887r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47887r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47887r=mysqlcfg
#46636 [NEW]: feof() blocking on non-blocking socket
From: aragon at phat dot za dot net Operating system: FreeBSD 7.0-STABLE PHP version: 5.2.7RC4 PHP Bug Type: Streams related Bug description: feof() blocking on non-blocking socket Description: There was a change since 5.2.6 release that is causing feof() to block when testing a non-blocking socket for EOF. It happens if the socket has no data waiting in its buffer and is open. If I compare 5.2.6 and 5.2.7 code it looks like main/streams/streams.c:642: if (!stream-eof PHP_STREAM_OPTION_RETURN_ERR == php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, -1, NULL)) { stream-eof = 1; } In 5.2.6 php_stream_set_option is called with a value of 0, not -1. Reproduce code: --- ? $errno = 0; $errstr = ''; $socket = stream_socket_client('tcp://127.0.0.1:80', $errno, $errstr, 5, STREAM_CLIENT_CONNECT|STREAM_CLIENT_ASYNC_CONNECT); if (stream_set_blocking($socket, 0) === false) die('blah'); $state = $i = 1; while (1) { $read = $write = $except = null; switch ($state) { case 1: $write = array($socket); break; case 2: $read = array($socket); break; } echo $i.':'.time().chr(10); if (stream_select($read, $write, $except, 0, 50) 0) { echo $i.':'.time().chr(10); if (feof($socket)) break; echo $i++.':'.time().chr(10); switch ($state) { case 1: fwrite($socket, 'GET /blog HTTP/1.0' . chr(13).chr(10).chr(13).chr(10)); $state = 2; break; case 2: if (fread($socket, 8192)) echo 'ooo'.chr(10); break; } } } echo time().chr(10); ? Expected result: 1:0 1:0 1:0 2:0 2:0 2:0 ooo 3:0 3:0 0 Actual result: -- 1:0 1:0 1:5 2:5 2:5 2:5 ooo 3:5 3:5 5 -- Edit bug report at http://bugs.php.net/?id=46636edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46636r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46636r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46636r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46636r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46636r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46636r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46636r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46636r=needscript Try newer version: http://bugs.php.net/fix.php?id=46636r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46636r=support Expected behavior: http://bugs.php.net/fix.php?id=46636r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46636r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46636r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46636r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46636r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=46636r=dst IIS Stability: http://bugs.php.net/fix.php?id=46636r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46636r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46636r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46636r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46636r=mysqlcfg
#46636 [Opn]: feof() blocking on non-blocking socket
ID: 46636 User updated by: aragon at phat dot za dot net Reported By: aragon at phat dot za dot net Status: Open Bug Type: Streams related Operating System: FreeBSD 7.0-STABLE PHP Version: 5.2.7RC4 New Comment: Sorry, I pasted misleading reproduce code. It should be: ? $errno = 0; $errstr = ''; $socket = stream_socket_client('tcp://127.0.0.1:80', $errno, $errstr, 5, STREAM_CLIENT_CONNECT|STREAM_CLIENT_ASYNC_CONNECT); if (stream_set_blocking($socket, 0) === false) die('blah'); $state = $i = 1; $start = time(); while (1) { $read = $write = $except = null; switch ($state) { case 1: $write = array($socket); break; case 2: $read = array($socket); break; } echo $i.':'.(time()-$start).chr(10); if (stream_select($read, $write, $except, 0, 50) 0) { echo $i.':'.(time()-$start).chr(10); if (feof($socket)) break; echo $i++.':'.(time()-$start).chr(10); switch ($state) { case 1: fwrite($socket, 'GET /blog HTTP/1.0' . chr(13).chr(10).chr(13).chr(10)); $state = 2; break; case 2: if (fread($socket, 8192)) echo 'ooo'.chr(10); break; } } } echo (time()-$start).chr(10); ? Previous Comments: [2008-11-21 02:56:54] aragon at phat dot za dot net Description: There was a change since 5.2.6 release that is causing feof() to block when testing a non-blocking socket for EOF. It happens if the socket has no data waiting in its buffer and is open. If I compare 5.2.6 and 5.2.7 code it looks like main/streams/streams.c:642: if (!stream-eof PHP_STREAM_OPTION_RETURN_ERR == php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, -1, NULL)) { stream-eof = 1; } In 5.2.6 php_stream_set_option is called with a value of 0, not -1. Reproduce code: --- ? $errno = 0; $errstr = ''; $socket = stream_socket_client('tcp://127.0.0.1:80', $errno, $errstr, 5, STREAM_CLIENT_CONNECT|STREAM_CLIENT_ASYNC_CONNECT); if (stream_set_blocking($socket, 0) === false) die('blah'); $state = $i = 1; while (1) { $read = $write = $except = null; switch ($state) { case 1: $write = array($socket); break; case 2: $read = array($socket); break; } echo $i.':'.time().chr(10); if (stream_select($read, $write, $except, 0, 50) 0) { echo $i.':'.time().chr(10); if (feof($socket)) break; echo $i++.':'.time().chr(10); switch ($state) { case 1: fwrite($socket, 'GET /blog HTTP/1.0' . chr(13).chr(10).chr(13).chr(10)); $state = 2; break; case 2: if (fread($socket, 8192)) echo 'ooo'.chr(10); break; } } } echo time().chr(10); ? Expected result: 1:0 1:0 1:0 2:0 2:0 2:0 ooo 3:0 3:0 0 Actual result: -- 1:0 1:0 1:5 2:5 2:5 2:5 ooo 3:5 3:5 5 -- Edit this bug report at http://bugs.php.net/?id=46636edit=1
#46007 [Fbk-Opn]: PDO_Sqlite: PDOStatement::rowCount() and PDO::exec() always returns 0
ID: 46007 User updated by: aragon at phat dot za dot net Reported By: aragon at phat dot za dot net -Status: Feedback +Status: Open Bug Type: PDO related Operating System: FreeBSD 7.0-STABLE PHP Version: 5.2.6 New Comment: Just tried the latest snapshot. It appears to be fixed. Thanks a million! Previous Comments: [2008-10-28 22:09:53] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ [2008-09-06 05:45:07] aragon at phat dot za dot net Description: When executing an UPDATE query to a SQLite3 database, PDOStatement::rowCount() and PDO:exec() returns 0 instead of 1 or more when rows are updated in the database. Reproduce code: --- $db = new PDO('sqlite:crnl.db'); // PDO::exec() example $sql = 'SELECT tags FROM blog_entries WHERE docid = 1'; $statement = $db-query($sql); $row = $statement-fetch(); echo $row[0], \n; $sql = 'UPDATE blog_entries SET tags = \'test\' WHERE docid = 1'; echo $db-exec($sql), \n; $sql = 'SELECT tags FROM blog_entries WHERE docid = 1'; $statement = $db-query($sql); $row = $statement-fetch(); echo $row[0], \n; // PDO:rowCount() example $sql = 'UPDATE blog_entries SET tags = \'untest\' WHERE docid = 1'; echo $db-query($sql)-rowCount(), \n; $sql = 'SELECT tags FROM blog_entries WHERE docid = 1'; $statement = $db-query($sql); $row = $statement-fetch(); echo $row[0], \n; Expected result: untest 1 test 1 untest Actual result: -- untest 0 test 0 untest -- Edit this bug report at http://bugs.php.net/?id=46007edit=1
#46319 [NEW]: PHP sets default Content-Type header for HTTP 304 response code
From: aragon at phat dot za dot net Operating system: Linux PHP version: 5.2.6 PHP Bug Type: CGI related Bug description: PHP sets default Content-Type header for HTTP 304 response code Description: This bug is identical to 33057 from 2005, except it is particular to PHP in CGI mode. Reproduce code: --- Please see bug 33057. Expected result: Please see bug 33057. Actual result: -- Please see bug 33057. -- Edit bug report at http://bugs.php.net/?id=46319edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46319r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46319r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46319r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46319r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46319r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46319r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=46319r=needscript Try newer version:http://bugs.php.net/fix.php?id=46319r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46319r=support Expected behavior:http://bugs.php.net/fix.php?id=46319r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46319r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46319r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46319r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46319r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46319r=dst IIS Stability:http://bugs.php.net/fix.php?id=46319r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46319r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46319r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46319r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=46319r=mysqlcfg
#46200 [NEW]: Create XLTProcessor properties for access libxslt stylesheet output properties
From: aragon at phat dot za dot net Operating system: PHP version: 5.2.6 PHP Bug Type: Feature/Change Request Bug description: Create XLTProcessor properties for access libxslt stylesheet output properties Description: When performing an XSLT transformation it is useful to read the attributes of the xsl:output tag, most notably for me the media-type attribute. Libxslt provides an interface to these attributes in the xsltStylesheetPtr object returned by xsltStylesheetDoc(): xmlChar *method;/* the output method */ xmlChar *methodURI; /* associated namespace if any */ xmlChar *version; /* version string */ xmlChar *encoding; /* encoding string */ int omitXmlDeclaration; /* omit-xml-declaration = yes | no */ int standalone; /* standalone = yes | no */ xmlChar *doctypePublic; /* doctype-public string */ xmlChar *doctypeSystem; /* doctype-system string */ int indent; /* should output being indented */ xmlChar *mediaType; /* media-type string */ The only way to access them in PHP is to process the stylesheet document as an XML document. It'd be really useful if PHP's XSLTProcessor had a direct interface to these C properties. :) -- Edit bug report at http://bugs.php.net/?id=46200edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46200r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46200r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46200r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46200r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46200r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46200r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=46200r=needscript Try newer version:http://bugs.php.net/fix.php?id=46200r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46200r=support Expected behavior:http://bugs.php.net/fix.php?id=46200r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46200r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46200r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46200r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46200r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46200r=dst IIS Stability:http://bugs.php.net/fix.php?id=46200r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46200r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46200r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46200r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=46200r=mysqlcfg
#46007 [NEW]: PDOStatement::rowCount() and PDO::exec() always returns 0
From: aragon at phat dot za dot net Operating system: FreeBSD 7.0-STABLE PHP version: 5.2.6 PHP Bug Type: SQLite related Bug description: PDOStatement::rowCount() and PDO::exec() always returns 0 Description: When executing an UPDATE query to a SQLite3 database, PDOStatement::rowCount() and PDO:exec() returns 0 instead of 1 or more when rows are updated in the database. Reproduce code: --- $db = new PDO('sqlite:crnl.db'); // PDO::exec() example $sql = 'SELECT tags FROM blog_entries WHERE docid = 1'; $statement = $db-query($sql); $row = $statement-fetch(); echo $row[0], \n; $sql = 'UPDATE blog_entries SET tags = \'test\' WHERE docid = 1'; echo $db-exec($sql), \n; $sql = 'SELECT tags FROM blog_entries WHERE docid = 1'; $statement = $db-query($sql); $row = $statement-fetch(); echo $row[0], \n; // PDO:rowCount() example $sql = 'UPDATE blog_entries SET tags = \'untest\' WHERE docid = 1'; echo $db-query($sql)-rowCount(), \n; $sql = 'SELECT tags FROM blog_entries WHERE docid = 1'; $statement = $db-query($sql); $row = $statement-fetch(); echo $row[0], \n; Expected result: untest 1 test 1 untest Actual result: -- untest 0 test 0 untest -- Edit bug report at http://bugs.php.net/?id=46007edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46007r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46007r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46007r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46007r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46007r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46007r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=46007r=needscript Try newer version:http://bugs.php.net/fix.php?id=46007r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46007r=support Expected behavior:http://bugs.php.net/fix.php?id=46007r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46007r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46007r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46007r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46007r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46007r=dst IIS Stability:http://bugs.php.net/fix.php?id=46007r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46007r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46007r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46007r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=46007r=mysqlcfg
#45901 [NEW]: wddx_serialize_value crash with SimpleXMLElement object
From: aragon at phat dot za dot net Operating system: FreeBSD 7.0-STABLE PHP version: 5.2.6 PHP Bug Type: *XML functions Bug description: wddx_serialize_value crash with SimpleXMLElement object Description: If wddx_serialize_value is called on a SimpleXMLElement object that has at least one child, the PHP script enters an infinite loop consuming full CPU and allocating memory until the memory size limit is reached, after which the script dies. Reproduce code: --- ? $xml = new SimpleXMLElement('data/data'); $xml-addChild('test'); echo wddx_serialize_value($xml, 'Variables'); echo 'hello world'; ? Expected result: To see the WDDX output and 'hello world' :) Actual result: -- Potential DoS against web server and this log entry: [Sun Aug 24 06:44:19 2008] [error] [client 127.0.0.1] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 133955606 bytes) in /usr/home/aragon/dev/admin.infinite/test.php on line 5 -- Edit bug report at http://bugs.php.net/?id=45901edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45901r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45901r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45901r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45901r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45901r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45901r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=45901r=needscript Try newer version:http://bugs.php.net/fix.php?id=45901r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45901r=support Expected behavior:http://bugs.php.net/fix.php?id=45901r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45901r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45901r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45901r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45901r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45901r=dst IIS Stability:http://bugs.php.net/fix.php?id=45901r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45901r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45901r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45901r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=45901r=mysqlcfg