Bug #53460 [Fbk-Opn]: glob() returns false for a pattern that matches zero files
Edit report at https://bugs.php.net/bug.php?id=53460edit=1 ID: 53460 User updated by:cameel2+php at gmail dot com Reported by:cameel2+php at gmail dot com Summary:glob() returns false for a pattern that matches zero files -Status: Feedback +Status: Open Type: Bug Package:Filesystem function related Operating System: Arch Linux PHP Version:5.3.3 Block user comment: N Private report: N New Comment: OK, I'll check that and report back later. It's been three years and I no longer have PHP and Apache installed. I'll have to set it up again to check this. Previous Comments: [2013-10-01 15:52:12] m...@php.net Check your open_basedir. Arch has it enabled by default. Please enable error_reporting and display_errors before reporting a bug in the future. [2011-01-09 18:12:57] cameel2+php at gmail dot com Right. But in that case the script would be printing both 'false' and 'array'. It prints only 'false'. I have just added var_dump() at the end of the test case and now the output is: false bool(false) BTW: I am using PHP 5.3.5 now. [2011-01-09 17:56:43] 13550 at free dot fr array() == false is true because array is empty try var_dump($glob) to be sure that glob does not return an array [2010-12-03 17:41:27] cameel2+php at gmail dot com Yeah, I meant that since I tested it under Apache first and that directory is located in /srv/http, i.e. in the root directory of the server. But you're right - for php being run from command line I should have used relative path. Still, when I remove the leading slash and run cd /srv/http; php test.php the result is still false. This is a contrived example anyway. Originally I have noticed it in a more complex path. If I do touch /srv/http/phpMyAdmin/a.file the script starts printing 'array'. [2010-12-03 12:53:57] paj...@php.net Are you sure you mean $glob = glob('/phpMyAdmin/*'); and not $glob = glob('phpMyAdmin/*');? The sooner is an absolute path '/phpMyAdmin/', where the 2nd path is relative (to CWD). 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 https://bugs.php.net/bug.php?id=53460 -- Edit this bug report at https://bugs.php.net/bug.php?id=53460edit=1
Bug #53460 [Opn]: glob() returns false for a pattern that matches zero files
Edit report at http://bugs.php.net/bug.php?id=53460edit=1 ID: 53460 User updated by:cameel2+php at gmail dot com Reported by:cameel2+php at gmail dot com Summary:glob() returns false for a pattern that matches zero files Status: Open Type: Bug -Package:Filesystem function related +Package:*Directory Services problems Operating System: Arch Linux PHP Version:5.3.3 Block user comment: N Private report: N New Comment: Right. But in that case the script would be printing both 'false' and 'array'. It prints only 'false'. I have just added var_dump() at the end of the test case and now the output is: false bool(false) BTW: I am using PHP 5.3.5 now. Previous Comments: [2011-01-09 17:56:43] 13550 at free dot fr array() == false is true because array is empty try var_dump($glob) to be sure that glob does not return an array [2010-12-03 17:41:27] cameel2+php at gmail dot com Yeah, I meant that since I tested it under Apache first and that directory is located in /srv/http, i.e. in the root directory of the server. But you're right - for php being run from command line I should have used relative path. Still, when I remove the leading slash and run cd /srv/http; php test.php the result is still false. This is a contrived example anyway. Originally I have noticed it in a more complex path. If I do touch /srv/http/phpMyAdmin/a.file the script starts printing 'array'. [2010-12-03 12:53:57] paj...@php.net Are you sure you mean $glob = glob('/phpMyAdmin/*'); and not $glob = glob('phpMyAdmin/*');? The sooner is an absolute path '/phpMyAdmin/', where the 2nd path is relative (to CWD). [2010-12-03 05:56:59] cameel2+php at gmail dot com Description: On my system the glob() returns false if there are no files matching the pattern even though the documentation (http://php.net/manual/en/function.glob.php) states that it should return an empty array. PHP version: 5.3.3 The only things I have changed in php.ini are open_basedir (/srv/http/:/home/:/usr/share/webapps:/etc/webapps:/tmp/:/usr/share/pear/:/usr/share/symfony) and enabling of several extensions (mcrypt, mysql, pdo, pdo_sqlite). I've seen similar bugs reported and closed a few years ago: #29928 Test script: --- ?php // phpMyAdmin is an empty, existing directory located in Apache root $glob = glob('/phpMyAdmin/*'); echo $glob == false ? false\n : ; echo is_array($glob) ? array\n : ; ? Expected result: glob() should return an empty array if no files match the pattern. Actual result: -- The script prints 'false' when run on my box (both under Apache 2.2.17 and with php from command line). -- Edit this bug report at http://bugs.php.net/bug.php?id=53460edit=1
Bug #53460 [Fbk-Opn]: glob() returns false for a pattern that matches zero files
Edit report at http://bugs.php.net/bug.php?id=53460edit=1 ID: 53460 User updated by:cameel2+php at gmail dot com Reported by:cameel2+php at gmail dot com Summary:glob() returns false for a pattern that matches zero files -Status: Feedback +Status: Open Type: Bug Package:Filesystem function related Operating System: Arch Linux PHP Version:5.3.3 Block user comment: N Private report: N New Comment: Yeah, I meant that since I tested it under Apache first and that directory is located in /srv/http, i.e. in the root directory of the server. But you're right - for php being run from command line I should have used relative path. Still, when I remove the leading slash and run cd /srv/http; php test.php the result is still false. This is a contrived example anyway. Originally I have noticed it in a more complex path. If I do touch /srv/http/phpMyAdmin/a.file the script starts printing 'array'. Previous Comments: [2010-12-03 12:53:57] paj...@php.net Are you sure you mean $glob = glob('/phpMyAdmin/*'); and not $glob = glob('phpMyAdmin/*');? The sooner is an absolute path '/phpMyAdmin/', where the 2nd path is relative (to CWD). [2010-12-03 05:56:59] cameel2+php at gmail dot com Description: On my system the glob() returns false if there are no files matching the pattern even though the documentation (http://php.net/manual/en/function.glob.php) states that it should return an empty array. PHP version: 5.3.3 The only things I have changed in php.ini are open_basedir (/srv/http/:/home/:/usr/share/webapps:/etc/webapps:/tmp/:/usr/share/pear/:/usr/share/symfony) and enabling of several extensions (mcrypt, mysql, pdo, pdo_sqlite). I've seen similar bugs reported and closed a few years ago: #29928 Test script: --- ?php // phpMyAdmin is an empty, existing directory located in Apache root $glob = glob('/phpMyAdmin/*'); echo $glob == false ? false\n : ; echo is_array($glob) ? array\n : ; ? Expected result: glob() should return an empty array if no files match the pattern. Actual result: -- The script prints 'false' when run on my box (both under Apache 2.2.17 and with php from command line). -- Edit this bug report at http://bugs.php.net/bug.php?id=53460edit=1
[PHP-BUG] Bug #53460 [NEW]: glob() returns false for a pattern that matches zero files
From: Operating system: Arch Linux PHP version: 5.3.3 Package: Filesystem function related Bug Type: Bug Bug description:glob() returns false for a pattern that matches zero files Description: On my system the glob() returns false if there are no files matching the pattern even though the documentation (http://php.net/manual/en/function.glob.php) states that it should return an empty array. PHP version: 5.3.3 The only things I have changed in php.ini are open_basedir (/srv/http/:/home/:/usr/share/webapps:/etc/webapps:/tmp/:/usr/share/pear/:/usr/share/symfony) and enabling of several extensions (mcrypt, mysql, pdo, pdo_sqlite). I've seen similar bugs reported and closed a few years ago: #29928 Test script: --- ?php // phpMyAdmin is an empty, existing directory located in Apache root $glob = glob('/phpMyAdmin/*'); echo $glob == false ? false\n : ; echo is_array($glob) ? array\n : ; ? Expected result: glob() should return an empty array if no files match the pattern. Actual result: -- The script prints 'false' when run on my box (both under Apache 2.2.17 and with php from command line). -- Edit bug report at http://bugs.php.net/bug.php?id=53460edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53460r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53460r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53460r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53460r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53460r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53460r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53460r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53460r=needscript Try newer version: http://bugs.php.net/fix.php?id=53460r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53460r=support Expected behavior: http://bugs.php.net/fix.php?id=53460r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53460r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53460r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53460r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53460r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=53460r=dst IIS Stability: http://bugs.php.net/fix.php?id=53460r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53460r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53460r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53460r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53460r=mysqlcfg