|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-05-22 19:38 UTC] peter dot chen at itg dot com
Description: ------------ I am trying to use glob() to display the contents of a directory I store the path in a variable ($path). When I give $path as an argument to glob($path), it returns an empty array. When I give it to scandir($path), it returns all the files in that path. Reproduce code: --------------- --- From manual page: function.glob --- Expected result: ---------------- Array ( [0] => . [1] => .. [2] => authtest [3] => globtest.php [4] => globtest.php.LCK [5] => globtest2.php [6] => home.php.LCK ) Actual result: -------------- Array ( ) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 13:00:01 2025 UTC |
Exactly what Solaris version are you on? Try this on command line: # php -r 'var_dump(glob("/home/apache/htdocs/testkt/"));'My mistake. Upon closer inspection, I realized that the path I specified was incorrect. This is the result after I corrected the path: array(0) { }Try compile and run this small C program: ------------------------ #include <glob.h> #include <stdio.h> int main() { glob_t globbuf; int i; globbuf.gl_offs = 15; glob("/home/apache/htdocs/testkt/*", GLOB_MARK, NULL, &globbuf); for(i = 0; i < globbuf.gl_pathc; i++) printf("%s\n",globbuf.gl_pathv[i]); globfree(&globbuf); return(0); } ------------------------ See also bug #22641