#46159 [NEW]: DOMDocument::loadHTMLFile() fails with some inputs.
From: alexander dot v at zend dot com Operating system: Linux PHP version: 5.2.6 PHP Bug Type: DOM XML related Bug description: DOMDocument::loadHTMLFile() fails with some inputs. Description: DOMDocument::loadHTMLFile() generates warnings with some input files. E.g. -- Warning: DOMDocument::loadHTMLFile(): Input is not proper UTF-8, indicate encoding ! in /home/cawa/./zend.db.select.html, line: 232 in /home/cawa//test.php on line 4 -- File is actualy correct and is loaded correctly by the following code: -- $htmlData = file_get_contents($fname); DOMDocument::loadHTML($htmlData); -- Reproduce code: --- DOMDocument::loadHTMLFile($fname); Expected result: File is loaded without warning message. Actual result: -- File is loaded with warning message. -- Edit bug report at http://bugs.php.net/?id=46159&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46159&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46159&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46159&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46159&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46159&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46159&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=46159&r=needscript Try newer version:http://bugs.php.net/fix.php?id=46159&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46159&r=support Expected behavior:http://bugs.php.net/fix.php?id=46159&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46159&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46159&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46159&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46159&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46159&r=dst IIS Stability:http://bugs.php.net/fix.php?id=46159&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46159&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46159&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46159&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=46159&r=mysqlcfg
#46159 [Com]: DOMDocument::loadHTMLFile() fails with some inputs.
ID: 46159 Comment by: alexander dot v at zend dot com Reported By: alexander dot v at zend dot com Status: Open Bug Type: DOM XML related Operating System: Linux PHP Version: 5.2.6 New Comment: HTML example can be taken here: documentation/manual/core/ru/zend.db.select.html file of ZF 1.6.1 package (http://framework.zend.com/releases/ZendFramework-1.6.1/ZendFramework-1.6.1.tar.gz) Previous Comments: [2008-09-23 11:33:26] alexander dot v at zend dot com Description: DOMDocument::loadHTMLFile() generates warnings with some input files. E.g. -- Warning: DOMDocument::loadHTMLFile(): Input is not proper UTF-8, indicate encoding ! in /home/cawa/./zend.db.select.html, line: 232 in /home/cawa//test.php on line 4 -- File is actualy correct and is loaded correctly by the following code: -- $htmlData = file_get_contents($fname); DOMDocument::loadHTML($htmlData); -- Reproduce code: --- DOMDocument::loadHTMLFile($fname); Expected result: File is loaded without warning message. Actual result: -- File is loaded with warning message. -- Edit this bug report at http://bugs.php.net/?id=46159&edit=1
#36759 [NEW]: Objects destructors are invoked in wrong order when script is finished
From: alexander dot v at zend dot com Operating system: all PHP version: 5CVS-2006-03-16 (snap) PHP Bug Type: Scripting Engine problem Bug description: Objects destructors are invoked in wrong order when script is finished Description: Object destructors are invoked in an arbitrarily order. Objects from a global_symbol_table should be destructed first. Reproduce code: --- too large and not deterministic Expected result: none Actual result: -- none -- Edit bug report at http://bugs.php.net/?id=36759&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36759&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36759&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36759&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36759&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36759&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36759&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=36759&r=needscript Try newer version:http://bugs.php.net/fix.php?id=36759&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36759&r=support Expected behavior:http://bugs.php.net/fix.php?id=36759&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36759&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36759&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36759&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36759&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36759&r=dst IIS Stability:http://bugs.php.net/fix.php?id=36759&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36759&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36759&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36759&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=36759&r=mysqlcfg
#34743 [NEW]: fread doesn't move internal "position" pointer. fseek fails as a result
From: alexander dot v at zend dot com Operating system: Linux PHP version: 6CVS-2005-10-05 (CVS) PHP Bug Type: Filesystem function related Bug description: fread doesn't move internal "position" pointer. fseek fails as a result Description: fread() doesn't move internal file pointer "stream->position" (could be retrived by ftell()). fseek(...,...,SEEK_CUR) fails if crosses buffer boundary as a result. Reproduce code: --- // 'testdata.dat' is a binary file. // Each byte contains value equal to offset % 256 $f = fopen('testdata.dat', 'r'); printf( "offset (before read): 0x%X\n", ftell($f) ); $bin_str = fread($f, 16); for ($count = 0; $count < 16; $count++) { printf( "0x%02X ", ord($bin_str{$count}) ); } printf( "\noffset (after read): 0x%X\n.\n", ftell($f) ); fseek( $f, 16*1024, SEEK_CUR); printf( "offset (before read): 0x%X\n", ftell($f) ); $bin_str = fread($f, 16); for ($count = 0; $count < 16; $count++) { printf( "0x%02X ", ord($bin_str{$count}) ); } printf( "\noffset (after read): 0x%X\n", ftell($f) ); fclose( $f ); Expected result: offset (before read): 0x0 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F offset (after read): 0x10 . offset (before read): 0x4010 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F offset (after read): 0x4020 Actual result: -- offset (before read): 0x0 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F offset (after read): 0x0 . offset (before read): 0x4000 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F offset (after read): 0x4000 -- Edit bug report at http://bugs.php.net/?id=34743&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34743&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34743&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34743&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=34743&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=34743&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34743&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34743&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34743&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34743&r=support Expected behavior: http://bugs.php.net/fix.php?id=34743&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34743&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34743&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=34743&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34743&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=34743&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34743&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34743&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34743&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34743&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34743&r=mysqlcfg
#34743 [Opn]: fread doesn't move internal "position" pointer. fseek fails as a result
ID: 34743 User updated by: alexander dot v at zend dot com Reported By: alexander dot v at zend dot com Status: Open Bug Type: Filesystem function related Operating System: Linux PHP Version: 6CVS-2005-10-05 (CVS) New Comment: Patch: -- Index: main/streams/streams.c === RCS file: /repository/php-src/main/streams/streams.c,v retrieving revision 1.87 diff -u -r1.87 streams.c --- main/streams/streams.c 22 Aug 2005 14:48:25 - 1.87 +++ main/streams/streams.c 5 Oct 2005 16:06:53 - @@ -855,6 +855,8 @@ *pnum_chars = num_chars; *pis_unicode = is_unicode; + stream->position += num_bytes; + if (num_chars == 0 && grow_mode) { efree(buf); buf = NULL; Previous Comments: [2005-10-05 18:21:28] alexander dot v at zend dot com Description: fread() doesn't move internal file pointer "stream->position" (could be retrived by ftell()). fseek(...,...,SEEK_CUR) fails if crosses buffer boundary as a result. Reproduce code: --- // 'testdata.dat' is a binary file. // Each byte contains value equal to offset % 256 $f = fopen('testdata.dat', 'r'); printf( "offset (before read): 0x%X\n", ftell($f) ); $bin_str = fread($f, 16); for ($count = 0; $count < 16; $count++) { printf( "0x%02X ", ord($bin_str{$count}) ); } printf( "\noffset (after read): 0x%X\n.\n", ftell($f) ); fseek( $f, 16*1024, SEEK_CUR); printf( "offset (before read): 0x%X\n", ftell($f) ); $bin_str = fread($f, 16); for ($count = 0; $count < 16; $count++) { printf( "0x%02X ", ord($bin_str{$count}) ); } printf( "\noffset (after read): 0x%X\n", ftell($f) ); fclose( $f ); Expected result: offset (before read): 0x0 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F offset (after read): 0x10 . offset (before read): 0x4010 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F offset (after read): 0x4020 Actual result: -- offset (before read): 0x0 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F offset (after read): 0x0 . offset (before read): 0x4000 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F offset (after read): 0x4000 -- Edit this bug report at http://bugs.php.net/?id=34743&edit=1