Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Feature/glob brace fallback #983

Merged
merged 2 commits into from May 4, 2012
Merged

Feature/glob brace fallback #983

merged 2 commits into from May 4, 2012

Conversation

DASPRiD
Copy link
Member

@DASPRiD DASPRiD commented Mar 30, 2012

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.

@marc-mabe
Copy link
Member

Why not implement git in base of GlobIterator?

  • extend it and add a third argument to the constructor for glob-flags

@DASPRiD
Copy link
Member Author

DASPRiD commented Mar 30, 2012

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.

@marc-mabe
Copy link
Member

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)
Copy link
Member

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.

Copy link
Member Author

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.

@weierophinney
Copy link
Member

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?

@akrabat
Copy link
Contributor

akrabat commented Apr 19, 2012

Need to wrap up discussion on mailing list that @EvanDotPro started.

@ghost ghost assigned EvanDotPro May 1, 2012
@EvanDotPro
Copy link
Member

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)

@weierophinney weierophinney merged commit e73e1f9 into zendframework:master May 4, 2012
@weierophinney
Copy link
Member

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants