[PHP-BUG] Bug #60679 [NEW]: FILEINFO_MIME_TYPE is not defined as a constant
From: Operating system: FreeBSD 8.2 i386 PHP version: 5.3.8 Package: *General Issues Bug Type: Bug Bug description:FILEINFO_MIME_TYPE is not defined as a constant Description: FILEINFO_MIME_TYPE is not defined as a constant error message when used with finfo_file(FILEINFO_MIME_TYPE, $string) it says something like this: "expected Int, string given" using 16 instead makes it work as should. -- Edit bug report at https://bugs.php.net/bug.php?id=60679&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60679&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60679&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60679&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60679&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60679&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60679&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60679&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60679&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60679&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60679&r=support Expected behavior: https://bugs.php.net/fix.php?id=60679&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60679&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60679&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60679&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60679&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=60679&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60679&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60679&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60679&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60679&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60679&r=mysqlcfg
Bug #60679 [Com]: FILEINFO_MIME_TYPE is not defined as a constant
Edit report at https://bugs.php.net/bug.php?id=60679&edit=1 ID: 60679 Comment by: tomse at tomse dot dk Reported by:tomse at tomse dot dk Summary:FILEINFO_MIME_TYPE is not defined as a constant Status: Open Type: Bug Package:*General Issues Operating System: FreeBSD 8.2 i386 PHP Version:5.3.8 Block user comment: N Private report: N New Comment: using FILEINFO_MIME gives no errors and works as intended. php / pecl was added with pkg_add -r from stable branch Previous Comments: [2012-01-07 11:10:11] tomse at tomse dot dk Description: FILEINFO_MIME_TYPE is not defined as a constant error message when used with finfo_file(FILEINFO_MIME_TYPE, $string) it says something like this: "expected Int, string given" using 16 instead makes it work as should. -- Edit this bug report at https://bugs.php.net/bug.php?id=60679&edit=1
Bug #60666 [Opn]: scandir doesn''t return entries on GlusterFS (redHat's) file system
Edit report at https://bugs.php.net/bug.php?id=60666&edit=1 ID: 60666 User updated by:hunter at yessoftware dot com Reported by:hunter at yessoftware dot com Summary:scandir doesn''t return entries on GlusterFS (redHat's) file system Status: Open Type: Bug Package:Directory function related Operating System: CentOS 5.7 PHP Version:5.3.8 Block user comment: N Private report: N New Comment: PHP strace: 10458 open("/sites/cache", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3 10458 fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 10458 getdents(3, 0x9d0640c, 32768) = -1 EINVAL (Invalid argument) 10458 close(3) = 0 10458 write(1, "0\r\n", 3) = 3 10458 open("/nonglustered/dir", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3 10458 fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 10458 getdents(3, 0x9d0640c, 32768) = 120 10458 getdents(3, 0x9d0640c, 32768) = 0 10458 close(3) = 0 10458 write(1, "3\r\n", 3) = 3 10458 close(0) = 0 Perl strace open("/sites/other", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3 fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 brk(0x8608000) = 0x8608000 getdents64(3, /* 24 entries */, 32768) = 1352 write(1, "12548855754ef9fb85723261.9149936"..., 38) = 38 So goal is to use getdents64 instead of getdents. The original Linux getdents() system call did not handle large file systems and large file offsets. Consequently, Linux 2.4 added getdents64(), with wider types for the d_ino and d_off fields employed in the linux_dirent structure. Previous Comments: [2012-01-05 22:13:27] hunter at yessoftware dot com Description: When I'm trying to scandir or opendir/readdir on GlusterFS Distributed volumes (mounted to some folder) I got something but not I'm expecting to obtainan: empty array even without . and .. entries, only . entry, 2-3 entries instead of >100 and so on. Other ways (bash ls or perl opendir) works correctly. for example: distributed GlusterFS volume mounted to /sites/blog folder. scandir("/sites/blog"); array(0) { } distributed GlusterFS volume mounted to /sites/other folder: scandir("/sites/other"); array(1) { [0]=> string(1) "." } scandir("/sites/other/old"); array(3) { [0]=> string(1) "." [1]=> string(11) "1.2.0.2540" [2]=> string(11) "1.5.0.2559" } Test script: --- -- Edit this bug report at https://bugs.php.net/bug.php?id=60666&edit=1
Bug #60675 [Opn->Bgs]: htmlentities(ENT_COMPAT, windows-1251) for ISO-8859-1 encoded scripts
Edit report at https://bugs.php.net/bug.php?id=60675&edit=1 ID: 60675 Updated by: cataphr...@php.net Reported by:dani...@php.net Summary:htmlentities(ENT_COMPAT, windows-1251) for ISO-8859-1 encoded scripts -Status: Open +Status: Bogus Type: Bug Package:*General Issues Operating System: ubuntu 10.0.4 / lucid PHP Version:5.4SVN-2012-01-06 (SVN) Block user comment: N Private report: N New Comment: htmlentities replaces characters with their *named* entities, for those characters that have it, with the exception of ' (apos): «This function is identical to htmlspecialchars() in all ways, except with htmlentities(), *all characters which have HTML character entity equivalents* are translated into these entities.» (doc for htmlentities(), emphasis mine) It is true that, for some encodings, htmlentities used to provide numerical entities for some characters. I removed such functionality because 1) it's inconsistent with the other encodings and 2) it was never documented behavior. Please remove the failing test you've added. Thanks! Previous Comments: [2012-01-06 22:11:00] dani...@php.net The test script is in PHP_5_4 and trunk as ext/standard/tests/strings/bug60675.phpt [2012-01-06 22:09:36] dani...@php.net Automatic comment from SVN on behalf of danielc Revision: http://svn.php.net/viewvc/?view=revision&revision=321841 Log: Test for bug 60675. [2012-01-06 22:08:47] dani...@php.net Automatic comment from SVN on behalf of danielc Revision: http://svn.php.net/viewvc/?view=revision&revision=321840 Log: Test for bug 60675. [2012-01-06 21:58:01] dani...@php.net Description: The behavior htmlentities() (or PHP's parser/whatever) has changed between 5.3 and 5.4. I will put a phpt file in svn once the bug number is known. Test script: --- $in = 'Ãåñòèðóåì'; echo htmlentities($in, ENT_COMPAT, 'windows-1251'); Expected result: Тестируем Actual result: -- illegible -- Edit this bug report at https://bugs.php.net/bug.php?id=60675&edit=1
[PHP-BUG] Bug #60682 [NEW]: Infinite recursion through call_user_func causes segmentation fault
From: Operating system: Irrelevant PHP version: 5.3.8 Package: Reproducible crash Bug Type: Bug Bug description:Infinite recursion through call_user_func causes segmentation fault Description: The PHP interpreter crashes when a call_user_func recurses too deep, rather than dying with a memory error. Test script: --- https://bugs.php.net/bug.php?id=60682&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60682&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60682&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60682&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60682&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60682&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60682&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60682&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60682&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60682&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60682&r=support Expected behavior: https://bugs.php.net/fix.php?id=60682&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60682&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60682&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60682&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60682&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=60682&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60682&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60682&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60682&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60682&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60682&r=mysqlcfg
Bug #60671 [Com]: fread does not fail when operating on a write only stream
Edit report at https://bugs.php.net/bug.php?id=60671&edit=1 ID: 60671 Comment by: phpmpan at mpan dot pl Reported by:james dot turner dot phpninja at gmail dot com Summary:fread does not fail when operating on a write only stream Status: Bogus Type: Bug Package:Streams related Operating System: Ubuntu 11.04 PHP Version:5.3.8 Block user comment: N Private report: N New Comment: Let me change your code just a bit: --- #include int main(void) { FILE *f = fopen("/tmp/foobaz", "w"); printf("feof: %d\n", feof(f)); printf("ferror: %d\n", ferror(f)); // <- HERE printf("read: %zd\n", fread((char[100]) {}, 1, 100, f)); printf("feof: %d\n", feof(f)); printf("ferror: %d\n", ferror(f)); // <- AND HERE return 0; } gcc --std=c99 h.c && ./a.out feof: 0 ferror: 0 read: 0 feof: 0 ferror: 1 --- In PHP there is no `ferror`. `feof` does work of both stdio's `feof` and `ferror`, as described in the documentation [1]: "Returns TRUE if the file pointer is at EOF or an error occurs". Therefore, if we use analogy to stdio, `feof` should return `TRUE` in this case. [1] http://pl.php.net/manual/en/function.feof.php Previous Comments: [2012-01-06 21:17:49] cataphr...@php.net This is not a bug. fread only returns false if given invalid arguments. The bug is that you try to read from a stream that's write-only. This C program has analogous behavior: #include int main(void) { FILE *f = fopen("/tmp/foobaz", "w"); printf("feof: %d\n", feof(f)); printf("read: %zd\n", fread((char[100]) {}, 1, 100, f)); printf("feof: %d\n", feof(f)); return 0; } gcc --std=c99 h.c && ./a.out feof: 0 read: 0 feof: 0 [2012-01-06 16:01:07] phpmpan at mpan dot pl CONFIRMED for both 5.3.8 and 5.3.7 on Arch64, and for 5.3.4 on an unknown Linux. Note however, that the test script provided by OP is wrong. It should be: BEGIN CODE $tmp = tempnam(sys_get_temp_dir(), 'test_'); $stream = fopen($tmp, 'w'); $data = ""; while(!feof($stream)){ if(false === ($data = fread($stream, 8192))){ break; // ^ no dot here }; } - END CODE - OP's code will fail regardless of the bug, because .= always produces a string. [2012-01-06 14:29:43] james dot turner dot phpninja at gmail dot com Description: fread does not throw or generate any error when attempting to read from a write only file stream. Test script: --- Expected result: Either feof to return false indicating end of file Or fread erroring or returning false as a result of attempting to read a write-only stream. Actual result: -- An infinite loop will occur. feof will never end (doesn't reach the end of the file because it's in write mode) fread will never error despite attempting to read from a write only stream. -- Edit this bug report at https://bugs.php.net/bug.php?id=60671&edit=1
[PHP-BUG] Bug #60683 [NEW]: Interactive Mode doesn't reach prompt
From: davey Operating system: OSX 10.7.2 & Ubuntu 11.04 PHP version: 5.4.0RC5 Package: CGI/CLI related Bug Type: Bug Bug description:Interactive Mode doesn't reach prompt Description: * Using OS X Lion 10.7.2 or Ubuntu 11.04 (Natty), and basic "./configure". If you run php -a, you never reach the prompt, and nothing entered will work. All you can do is ^C to kill it. Setting cli.prompt does not help. Test script: --- $ php -a Expected result: $ php -a Interactive mode enabled php > Actual result: -- $ php -a Interactive mode enabled (wait. wait. wait.) ^C Backtrace if helpful: #0 0x7fff87f6ad52 in read$NOCANCEL () #1 0x7fff86883c25 in _sread () #2 0x7fff86884166 in __srefill1 () #3 0x7fff86884cb2 in __fread () #4 0x7fff86884b34 in fread () #5 0x00010028744c in zend_stream_getc [inlined] () at /Users/davey/src/php- 5.4.0RC5/Zend/zend_stream.c:148 #6 0x00010028744c in zend_stream_read (file_handle=0x0, buf=0x1009356a0 "? V?", len=4096) at zend_stream.c:168 #7 0x0001002878fb in zend_stream_fixup (file_handle=0x0, buf=0x7fff5fbfecc0, len=0x7fff5fbfecb8) at zend_stream.c:262 #8 0x0001002493be in open_file_for_scanning (file_handle=0x7fff5fbff958) at zend_language_scanner.l:483 #9 0x00010024a190 in compile_file (file_handle=0x7fff5fbff958, type=8) at zend_language_scanner.l:566 #10 0x000100159ba2 in phar_compile_file (file_handle=0x0, type=1606414144) at phar.c:3391 #11 0x000100272b57 in zend_execute_scripts (type=8, retval=0x7fff5fbff0a0, file_count=1606414496) at zend.c:1264 #12 0x0001002170e2 in php_execute_script (primary_file=0x7fff5fbff958) at main.c:2476 #13 0x0001002ff3e5 in do_cli [inlined] () at /Users/davey/src/php- 5.4.0RC5/sapi/cli/php_cli.c:983 #14 0x0001002ff3e5 in main (argc=1606417184, argv=0x0) at php_cli.c:1356 -- Edit bug report at https://bugs.php.net/bug.php?id=60683&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60683&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60683&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60683&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60683&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60683&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60683&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60683&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60683&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60683&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60683&r=support Expected behavior: https://bugs.php.net/fix.php?id=60683&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60683&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60683&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60683&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60683&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=60683&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60683&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60683&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60683&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60683&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60683&r=mysqlcfg
Bug #60683 [Com]: Interactive Mode doesn't reach prompt
Edit report at https://bugs.php.net/bug.php?id=60683&edit=1 ID: 60683 Comment by: dragoo...@php.net Reported by:da...@php.net Summary:Interactive Mode doesn't reach prompt Status: Open Type: Bug Package:CGI/CLI related Operating System: OSX 10.7.2 & Ubuntu 11.04 PHP Version:5.4.0RC5 Block user comment: N Private report: N New Comment: I confirmed this case with davey on Mac OSX Lion Darwin Paul-Dragooniss-MacBook-Pro.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64 05:10 macosx lion.. My build details are: -- bash-3.2$ ../build/bin/php -v PHP 5.4.0RC6-dev (cli) (built: Jan 8 2012 03:03:04) (DEBUG) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies Thanks. Previous Comments: [2012-01-08 05:31:44] da...@php.net Description: * Using OS X Lion 10.7.2 or Ubuntu 11.04 (Natty), and basic "./configure". If you run php -a, you never reach the prompt, and nothing entered will work. All you can do is ^C to kill it. Setting cli.prompt does not help. Test script: --- $ php -a Expected result: $ php -a Interactive mode enabled php > Actual result: -- $ php -a Interactive mode enabled (wait. wait. wait.) ^C Backtrace if helpful: #0 0x7fff87f6ad52 in read$NOCANCEL () #1 0x7fff86883c25 in _sread () #2 0x7fff86884166 in __srefill1 () #3 0x7fff86884cb2 in __fread () #4 0x7fff86884b34 in fread () #5 0x00010028744c in zend_stream_getc [inlined] () at /Users/davey/src/php- 5.4.0RC5/Zend/zend_stream.c:148 #6 0x00010028744c in zend_stream_read (file_handle=0x0, buf=0x1009356a0 "? V?", len=4096) at zend_stream.c:168 #7 0x0001002878fb in zend_stream_fixup (file_handle=0x0, buf=0x7fff5fbfecc0, len=0x7fff5fbfecb8) at zend_stream.c:262 #8 0x0001002493be in open_file_for_scanning (file_handle=0x7fff5fbff958) at zend_language_scanner.l:483 #9 0x00010024a190 in compile_file (file_handle=0x7fff5fbff958, type=8) at zend_language_scanner.l:566 #10 0x000100159ba2 in phar_compile_file (file_handle=0x0, type=1606414144) at phar.c:3391 #11 0x000100272b57 in zend_execute_scripts (type=8, retval=0x7fff5fbff0a0, file_count=1606414496) at zend.c:1264 #12 0x0001002170e2 in php_execute_script (primary_file=0x7fff5fbff958) at main.c:2476 #13 0x0001002ff3e5 in do_cli [inlined] () at /Users/davey/src/php- 5.4.0RC5/sapi/cli/php_cli.c:983 #14 0x0001002ff3e5 in main (argc=1606417184, argv=0x0) at php_cli.c:1356 -- Edit this bug report at https://bugs.php.net/bug.php?id=60683&edit=1
[PHP-BUG] Req #60684 [NEW]: Add 'last' & 'first' blocks next to 'foreach' block
From: Operating system: All PHP version: 5.4.0RC5 Package: Arrays related Bug Type: Feature/Change Request Bug description:Add 'last' & 'first' blocks next to 'foreach' block Description: There are a lot of situations that we want our foreach loop act different for first and/or last item. It will be so easy if php add these to concepts as blocks next to foreach. Compiler will run 'first' block for first item, and 'last' block for last item, and normal 'foreach' block for anything in between. The only special case is when array has only one item, in this situation only 'first' block will act. See example at test script. Test script: --- foreach($array as $key => $value) { $str .= $key . ' = "'.$value.'",'; } first { $str .= '(' . $key . ' = "'.$value.'",'; } last { $str .= $key . ' = "'.$value.'")'; } -- Edit bug report at https://bugs.php.net/bug.php?id=60684&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60684&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60684&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60684&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60684&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60684&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60684&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60684&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60684&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60684&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60684&r=support Expected behavior: https://bugs.php.net/fix.php?id=60684&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60684&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60684&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60684&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60684&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=60684&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60684&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60684&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60684&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60684&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60684&r=mysqlcfg