Bug #35090 [Com]: file i/o is not buffered
Edit report at http://bugs.php.net/bug.php?id=35090&edit=1 ID: 35090 Comment by: surfchen at gmail dot com Reported by:askalski at gmail dot com Summary:file i/o is not buffered Status: Bogus Type: Bug Package:Filesystem function related Operating System: linux PHP Version:5CVS-2005-11-03 (snap) Block user comment: N New Comment: So we need to add a note on the documentation say that this function not supported with filesystem wrapper, right? Previous Comments: [2005-11-03 23:40:24] askalski at gmail dot com > instead it uses the system's file io buffering function > to set the buffer. Assuming you're talking about setvbuf() and not kernel level write-behind caching, this statement is false. The file is opened by _php_stream_fopen(): fd = open(realpath, open_flags, 0666); (It is never subsequently wrapped with fdopen()) At this point, the stream is not buffered at all. When I later call stream_set_write_buffer(), it hits php_stdiop_set_option(): case PHP_STREAM_OPTION_WRITE_BUFFER: if (data->file == NULL) { return -1; } /* setvbuf happens down here */ Because there is no FILE* handle (data->file), setvbuf() is never called for the stream. One of either the documentation (http://us3.php.net/stream_set_write_buffer) or the PHP source is wrong. [2005-11-03 21:34:16] il...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php PHP does not do any buffering itself, instead it uses the system's file io buffering function to set the buffer. There is already a feature request open to enable in-php buffering. [2005-11-03 21:29:08] der...@php.net Can you please answer why this is not a bug Wez? I forgot the reason :) [2005-11-03 19:16:09] askalski at gmail dot com Description: The documentation for stream_set_write_buffer() says that fwrite()s are buffered at 8K by default. In reality, it does not buffer at all. Any attempt to call stream_set_write_buffer() on a regular file handle results in failure. Reproduce code: --- $fh = fopen("asdf", "w"); // write some data using the default buffering for ($i = 0; $i < 5; $i++) fwrite($fh, "test"); // demonstrate that stream_set_write_buffer fails $n = stream_set_write_buffer($fh, 8192); if ($n != 0) echo "stream_set_write_buffer failed\n"; // write some more data to demonstrate the failure for ($i = 0; $i < 5; $i++) fwrite($fh, "again"); fclose($fh); Expected result: PHP should buffer its I/O, and strace should log a single write(). stream_set_write_buffer() should not fail on regular files. Actual result: -- Output: stream_set_write_buffer failed Abridged strace output: open("/tmp/php5-200511031730/asdf", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3 fstat64(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 lseek(3, 0, SEEK_CUR) = 0 write(3, "test", 4) = 4 write(3, "test", 4) = 4 write(3, "test", 4) = 4 write(3, "test", 4) = 4 write(3, "test", 4) = 4 write(1, "stream_set_write_buffer failed\n", 31) = 31 write(3, "again", 5)= 5 write(3, "again", 5)= 5 write(3, "again", 5)= 5 write(3, "again", 5)= 5 write(3, "again", 5)= 5 close(3)= 0 -- Edit this bug report at http://bugs.php.net/bug.php?id=35090&edit=1
Bug #38929 [Com]: fputcsv() fgetcsv() inconsistency even number backslashes then enclosure char
Edit report at http://bugs.php.net/bug.php?id=38929&edit=1 ID: 38929 Comment by: surfchen at gmail dot com Reported by:mike at opendns dot com Summary:fputcsv() fgetcsv() inconsistency even number backslashes then enclosure char Status: Bogus Type: Bug Package:*Directory/Filesystem functions Operating System: Linux, debian sarge PHP Version:5.1.6 Block user comment: N New Comment: I confirm this with php 5.2.9 on windows: $arr=array('\\','"'); $h=fopen('test.csv',"w"); fputcsv($h,$arr); fclose($h); $h=fopen('test.csv',"r"); $line=fgetcsv($h); var_dump($line); result: array(1) { [0]=> string(6) "\","" " } Previous Comments: [2006-09-25 12:24:19] tony2...@php.net The same problem as #38918. [2006-09-22 20:05:05] mike at opendns dot com Description: If you write a string to file with fputcsv that contains an even number of backslashes follwed by the enclosure character, you don't get your enclosure character back when you read it back in with fgetcsv(). Then you'll get an extra trailing enclosure character at the end of your string. Reproduce code: --- $tmp_file = '/tmp/csv_f_up.tmp'; $data_to_write = array('string contains even number of backslashes " followed by enclosure char'); echo "data_to_write:\n"; var_dump($data_to_write); $h_w = fopen($tmp_file, 'w'); fputcsv($h_w, $data_to_write); fclose($h_w); $h_r = fopen($tmp_file, 'r'); $data_read_in = fgetcsv($h_r); fclose($h_r); echo "data_read_in:\n"; var_dump($data_read_in); Expected result: data_to_write: array(1) { [0]=> string(73) "string contains even number of backslashes \\" followed by enclosure char" } data_read_in: array(1) { [0]=> string(73) "string contains even number of backslashes \\" followed by enclosure char" } Actual result: -- data_to_write: array(1) { [0]=> string(73) "string contains even number of backslashes \\" followed by enclosure char" } data_read_in: array(1) { [0]=> string(73) "string contains even number of backslashes \\ followed by enclosure char"" } -- Edit this bug report at http://bugs.php.net/bug.php?id=38929&edit=1
#48795 [Com]: Building intl 64-bit fails on OS X
ID: 48795 Comment by: surfchen at gmail dot com Reported By: gwy...@php.net Status: Verified Bug Type: Compile Failure Operating System: Mac OS X 10.5.8, 10.6.2 PHP Version: 5.3SVN-2009-11-23 (SVN) New Comment: It is a linking problem, here is the simple workaround: edit Makefile and add -lstdc++ into EXTRA_LIBS. Previous Comments: [2010-01-10 11:54:55] harald dot lapp at gmail dot com same problem here: osx 10.5.8, php5.3-latest any ideas how to fix this issue? [2009-11-24 11:46:48] j...@php.net well, build system does handle C++ quite fine for me. OSX is "special".. [2009-11-24 01:23:26] gwy...@php.net No, upgrading the bundled libtool didn't fix it. The buildsystem isn't set up to deal with C++ files automatically. [2009-11-23 21:58:18] j...@php.net Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ [2009-09-15 15:25:13] ram...@php.net I'm having the same exact problem using --enable-intl --with-icu-dir=/path/to/icu I installed ICU with macports, and so I'm using /opt/local as my path to ICU. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/48795 -- Edit this bug report at http://bugs.php.net/?id=48795&edit=1
#47017 [Com]: mysqlnd does not work with MYSQL_CLIENT_COMPRESS flag
ID: 47017 Comment by: surfchen at gmail dot com Reported By: surfchen at gmail dot com Status: Open Bug Type: MySQL related Operating System: Mac OSX PHP Version: 5.3CVS-2009-01-06 (snap) New Comment: typo: there is error,warning => there is no error,warning Previous Comments: [2009-01-08 12:22:35] surfchen at gmail dot com > Is the bug that the connection cannot be used after setting the flag or that the compressed protocol is not supported? This is can be used for mysql_get_server_info()(maybe this function was getting these info on connecting) and similar functions,but can't be used for mysql_query().What's more,when using for mysql_set_charset(),a large memory was allocated(Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 807601282 bytes)),It's so strange.(memory problem is another topic, sorry for explaining here.) > Do you use the compression and how does it make your application run faster? I can't follow your meaning.This question seems not related to our topic. > Is your MySQL server on the local network or remote? I have tested both unix socket and tcp in my box.No "network".And my mysql server have compression enabled(it need to be enable?I forget.).It can be connected and used with php ext/mysql driven by lib libmysql with the MYSQL_CLIENT_COMPRESS.so it's not a server problem. Let me desc more detail. I don't know mysqlnd how to link and use compression lib,but I have compile with "./configure --with-mysql=mysqlnd --with-zlib --with-zlib-dir=/usr/local" and I can see "ZLib Support => enabled" in php -i(means that the zlib dir are correct.), and During the compilation,there is error ,warning or notice tell me that "you was doing incorrectly". This bug is raised whether enable zts or not. [2009-01-08 10:48:51] and...@php.net Is the bug that the connection cannot be used after setting the flag or that the compressed protocol is not supported? Do you use the compression and how does it make your application run faster? Is your MySQL server on the local network or remote? Thanks you! Andrey ---------------- [2009-01-06 10:45:39] surfchen at gmail dot com Description: If mysql_connect(use mysqlnd as driver) with MYSQL_CLIENT_COMPRESS,the script blocks on mysql_query calling for a while and output warning. Reproduce code: --- mysql_connect('127.0.0.1:3306','root','urpig',false,MYSQL_CLIENT_COMPRESS); mysql_query('SELECT 1'); Expected result: no warning Actual result: -- Warning: mysql_query(): Error while reading SET_OPTION's EOF packet. PID=20646 -- Edit this bug report at http://bugs.php.net/?id=47017&edit=1
#47017 [Fbk->Opn]: mysqlnd not works with MYSQL_CLIENT_COMPRESS flag
ID: 47017 User updated by: surfchen at gmail dot com Reported By: surfchen at gmail dot com -Status: Feedback +Status: Open Bug Type: MySQL related Operating System: Mac OSX PHP Version: 5.3CVS-2009-01-06 (snap) New Comment: > Is the bug that the connection cannot be used after setting the flag or that the compressed protocol is not supported? This is can be used for mysql_get_server_info()(maybe this function was getting these info on connecting) and similar functions,but can't be used for mysql_query().What's more,when using for mysql_set_charset(),a large memory was allocated(Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 807601282 bytes)),It's so strange.(memory problem is another topic, sorry for explaining here.) > Do you use the compression and how does it make your application run faster? I can't follow your meaning.This question seems not related to our topic. > Is your MySQL server on the local network or remote? I have tested both unix socket and tcp in my box.No "network".And my mysql server have compression enabled(it need to be enable?I forget.).It can be connected and used with php ext/mysql driven by lib libmysql with the MYSQL_CLIENT_COMPRESS.so it's not a server problem. Let me desc more detail. I don't know mysqlnd how to link and use compression lib,but I have compile with "./configure --with-mysql=mysqlnd --with-zlib --with-zlib-dir=/usr/local" and I can see "ZLib Support => enabled" in php -i(means that the zlib dir are correct.), and During the compilation,there is error ,warning or notice tell me that "you was doing incorrectly". This bug is raised whether enable zts or not. Previous Comments: [2009-01-08 10:48:51] and...@php.net Is the bug that the connection cannot be used after setting the flag or that the compressed protocol is not supported? Do you use the compression and how does it make your application run faster? Is your MySQL server on the local network or remote? Thanks you! Andrey ---------------- [2009-01-06 10:45:39] surfchen at gmail dot com Description: If mysql_connect(use mysqlnd as driver) with MYSQL_CLIENT_COMPRESS,the script blocks on mysql_query calling for a while and output warning. Reproduce code: --- mysql_connect('127.0.0.1:3306','root','urpig',false,MYSQL_CLIENT_COMPRESS); mysql_query('SELECT 1'); Expected result: no warning Actual result: -- Warning: mysql_query(): Error while reading SET_OPTION's EOF packet. PID=20646 -- Edit this bug report at http://bugs.php.net/?id=47017&edit=1
#47017 [NEW]: mysqlnd not works with MYSQL_CLIENT_COMPRESS flag
From: surfchen at gmail dot com Operating system: Mac OSX PHP version: 5.3CVS-2009-01-06 (snap) PHP Bug Type: MySQL related Bug description: mysqlnd not works with MYSQL_CLIENT_COMPRESS flag Description: If mysql_connect(use mysqlnd as driver) with MYSQL_CLIENT_COMPRESS,the script blocks on mysql_query calling for a while and output warning. Reproduce code: --- mysql_connect('127.0.0.1:3306','root','urpig',false,MYSQL_CLIENT_COMPRESS); mysql_query('SELECT 1'); Expected result: no warning Actual result: -- Warning: mysql_query(): Error while reading SET_OPTION's EOF packet. PID=20646 -- Edit bug report at http://bugs.php.net/?id=47017&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47017&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47017&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47017&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47017&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47017&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47017&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47017&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47017&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47017&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47017&r=support Expected behavior: http://bugs.php.net/fix.php?id=47017&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47017&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47017&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47017&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47017&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=47017&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47017&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47017&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47017&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47017&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47017&r=mysqlcfg
#46676 [NEW]: cannot define a method named lookup in ext
From: surfchen at gmail dot com Operating system: Red Hat/Mac OSX PHP version: 5.2.6 PHP Bug Type: Unknown/Other Function Bug description: cannot define a method named lookup in ext Description: I built a ext,which have a method named lookup.But after I built .so and run test,it said that method is undefined. Reproduce code: --- http://www.surfchen.org/tmp/lookup.tgz Download codes above and phpize && ./configure && make && make install,then run php s.php in that dir. Expected result: lookup() should work Actual result: -- lookup() not works -- Edit bug report at http://bugs.php.net/?id=46676&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46676&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46676&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46676&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46676&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46676&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46676&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46676&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46676&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46676&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46676&r=support Expected behavior: http://bugs.php.net/fix.php?id=46676&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46676&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46676&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46676&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46676&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=46676&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46676&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46676&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46676&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46676&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46676&r=mysqlcfg
#35061 [NEW]: imagegif,png,ipg.second parameter can not be set ''(null)
From: surfchen at gmail dot com Operating system: Redhat AS PHP version: 4.4.0 PHP Bug Type: GD related Bug description: imagegif,png,ipg.second parameter can not be set ''(null) Description: 1)the imagegif,imagejpg,imagepng can not be used with tow parameters which the 2nd parameter is ''(null).but if give the function more than 2 parameters,it works. 2)imagegif can give 4 parameters while the document just says it just have tow parameters. Reproduce code: --- Expected result: 1) should ouput correct. 2) should ouput a error because that it have 4 parameters Actual result: -- 1)output a incorrect image 2)ouput correctly -- Edit bug report at http://bugs.php.net/?id=35061&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35061&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35061&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35061&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=35061&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=35061&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35061&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35061&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35061&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35061&r=support Expected behavior: http://bugs.php.net/fix.php?id=35061&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35061&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35061&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=35061&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35061&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=35061&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35061&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35061&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35061&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35061&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35061&r=mysqlcfg