Doc #60204 [Opn->Fbk]: glob() function parameter string limited to 50 characters

From: Date: Wed, 21 Dec 2011 15:37:11 +0000
Subject: Doc #60204 [Opn->Fbk]: glob() function parameter string limited to 50 characters
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7695@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60204&edit=1 ID: 60204 Updated by: bjori@php.net Reported by: fred dot demers at gmail dot com Summary: glob() function parameter string limited to 50 characters -Status: Open +Status: Feedback Type: Documentation Problem Package: Documentation problem Operating System: Windows XP SP2 PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. └─▪ mkdir "this is a very long directory name, which definetly exceeds 50 chars to test the bug"┌─[bjori][][~] └─▪ php -r '$n = sql_regcase("this is a very long directory name, which definetly exceeds 50 chars to test the bug"); var_dump(glob("./$n", GLOB_BRACE|GLOB_ONLYDIR));' array(1) { [0] => string(86) './this is a very long directory name, which definetly exceeds 50 chars to test the bug' } Works fine for me? Previous Comments: ------------------------------------------------------------------------ [2011-11-02 18:49:08] fred dot demers at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.glob --- Documentation shortcoming for glob(). glob() does not seem to find any pattern that is longer than 50 characters. In particular, if one expands the search pattern to remove case sensitivity using sql_regcase() or an equivalent function as available the glob() manual page, (eg. which transforms "cake*" into "[cC][aA][kK][eE]*"), the number of characters is reduced four times to about 12 characters. This 50 character limitation should be documented in my opinion. Test script: --------------- //recursive glob() find function find($dir, $pattern){ //get a list of all matching files in the current directory $files = glob("$dir/".$pattern); //find a list of all directories in the current directory //directories beginning with a dot are also included foreach (glob("$dir/{.[^.]*,*}", GLOB_BRACE|GLOB_ONLYDIR) as $sub_dir){ $arr = find($sub_dir, $pattern); // resursive call $files = array_merge($files, $arr); // merge array with files from subdirectory } //return all found files return $files; } Expected result: ---------------- Nil. Alternatively, users can use preg_find (http://www.pgregg.com/projects/php/preg_find/preg_find.phps) which does not have a 50 character limitation. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60204&edit=1

« previous php.doc.bugs (#7695) next »