-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Feature/glob brace fallback #983
Feature/glob brace fallback #983
Conversation
Why not implement git in base of GlobIterator?
|
Using GlobIterator would be a bad idea here, since it knows nothing about the GLOB flags, so we'd have to implement all of them in PHP. |
There are only 1 or 2 flags that are interesting GLOB_BRACE & GLOB_ONLYDIR and if one of it was passed (and will be supported by the current system) it's simple the use the glob function within the GlobIterator else we have to do it in PHP in both cases. Additionally the GlobIterator itself allocates less RAM than the function ;) |
* @param integer $flags | ||
* @return array|false | ||
*/ | ||
protected static function fallbackGlob($pattern, $flags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we perhaps split this method up? It's currently 70 lines long, making it hard to extend and comprehend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could split it up. The reason for not doing it was to have a one to one mapping of the glibc part here, which allows for easier comparision between the two codes and thus easier enhancements when something in glibc changes.
Question: I know that this is primarily for use with the ConfigListener in Zend\Module. With that in mind, perhaps we could omit glob_brace emulation, and simply merge paths in the order in which they are added: $listener->addConfigGlobPath('config/autoload/*global.php')
->addConfigGlobPath('config/autoload/*local.php'); This would require no code changes in the framework itself at this point, retains reasonable performance, and is cross-platform. Thoughts? @EvanDotPro want to weigh in on this? |
Need to wrap up discussion on mailing list that @EvanDotPro started. |
We really need a community consensus on how we want to handle the default glob (braces or not) in the skeleton. The mailing list discussion I started pretty much stalled, so I think we should slate this as a topic at this weeks meeting so we can get this taken care of once and for all and decide how to move forward here. (Assigned myself to this PR) |
Merged, per the IRC meeting on 2 May 2012. @EvanDotPro -- can you alter the skeleton application and/or Zend\Module code to utilize this now? |
This fallback will provide GLOB_BRACE functionallity (ported of original glibc) for systems where it is not naturally available. Calls in other components to glob() where GLOB_BRACE is used have to be adjusted to use Zend\Stdlib\Glob::glob() instead.