Mantis - Quercus
Viewing Issue Advanced Details
1922 minor always 08-02-07 02:18 08-02-07 17:42
nam  
nam  
normal  
closed 3.1.2  
fixed  
none    
none 3.1.3  
0001922: glob() returning wrong value on NO MATCH
(rep by AzMoo)

Hi there. I've been playing around with Quercus for a couple of days now because I've been looking for a combined Java and PHP solution for our Intranet server. Aside from this one issue I'm having I'm very happy with it and I totally commend your efforts. But (there's always a but ;)), it seems that there's a small problem with the return values of the glob function. The PHP Manual (glob) states that it "Returns an array containing the matched files/directories, an empty array if no file matched or FALSE on error," but Quercus returns false on no match. I confirmed this by looking at the code starting on line 1799 of FileModule.java and ending on line 1811.

The globImpl method returns false on no match, resulting in the success variable being false, resulting in glob returning false. The expected return value is an empty array. This is breaking a few apps we have that rely on that empty array being returned during an autoload function. I can rectify it on our end by simply checking for false instead of count(glob($pattern)) > 0, but if I do that and it's implemented properly in the future then it will break again!

Notes
(0002174)
nam   
08-02-07 17:42   
php/164a