ZF2-243: ConfigListener relies on GLOB_BRACE which is not supported in all filesystems

Issue Type: Bug Created: 2012-03-29T07:30:26.000+0000 Last Updated: 2012-10-08T20:15:22.000+0000 Status: Closed Fix version(s): Reporter: Yonni Mendes (yonman) Assignee: Ben Scholzen (dasprid) Tags: - Zend\ModuleManager

  • ConfigListener
  • constant
  • glob

Related issues: Attachments:


GLOB_BRACE is used for a glob() call in the ConfigListener when merging configurations. This dependency cannot be met on all operating systems, particularly AIX (IBMi).

An application using the ConfigListener fails with a fatal error:

<pre class="literal">[27-Mar-2012 17:53:34] PHP Notice: Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE' in /usr/local/zendsvr/ on line 233
[27-Mar-2012 17:53:34] PHP Warning: glob() expects parameter 2 to be long, string given in /usr/local/zendsvr/ on line 233

[27-Mar-2012 17:53:34] PHP Catchable fatal error: Argument 1 passed to Zend\Config\Factory::fromFiles() must be an array, null given, called in /usr/local/zendsvr/ on line 233 and defined in /usr/local/zendsvr/ on line 93


Posted by Ben Scholzen (dasprid) on 2012-03-29T10:02:22.000+0000

This looks kinda old. Evan, didn't we switch to \GlobIterator for that reason?

By the way, Yonni, did you test with the current beta3 or an old version?

Posted by Yonni Mendes (yonman) on 2012-03-29T13:59:35.000+0000

Forked SkeletonApplication and Zf2 and sent pull requests:…

Posted by Yonni Mendes (yonman) on 2012-03-29T14:00:32.000+0000

Tested with beta3, found a TODO in ConfigListener so I took it up with Matthew. According to him globiterators were inapplicable, so I applied a simpler solution.

Posted by Evan Coury ( on 2012-03-29T14:07:10.000+0000

I had discussed this with Matthew and others on IRC. We discovered that \GlobIterator didn't solve the issue like we had anticipated it would (it doesn't support GLOB_BRACE at all, actually).

IIRC, Matthew was thinking GLOB_BRACE wouldn't work on Windows, but it turns out it does. It seems to only be non-GNU systems like Solaris that don't support it and I think the consensus was that people on those systems can easily change the glob pattern (and we could document such). Though, I'm unsure if passing GLOB_BRACE as a flag throws a warning or anything on non-GNU systems. Anyway, I suppose I don't mind changing this to two globs though simply to maintain a higher level of compatibility if there's no objections.

Posted by Ben Scholzen (dasprid) on 2012-03-29T14:08:38.000+0000

I could come up with a fallback solution so GLOB_BRACE can still be used, even on non-GNU systems.

Posted by Yonni Mendes (yonman) on 2012-04-01T12:05:51.000+0000

One more problematic point: AIX glob calls seem to ignore cwd - I can only get correct results when we use an absolute path. When testing, I verified with getcwd that we are in the document root, etc...

Posted by Evan Coury ( on 2012-04-13T10:35:08.000+0000

I'm not really sure there's much we can do to fix the AIX glob cwd issue...

It would seem to me that there are three options in this case:

  1. Simply adjust the glob paths to be absolute after cloning the skeleton. 2) Use Zend\Module\Listener\ConfigListener::addConfigStaticPaths() to add each config file explicitly instead of addConfigGlobPaths() to add glob patterns. 3) Re-implement glob() completely in PHP, which I'd prefer we not do.

Posted by Evan Coury ( on 2012-05-31T15:34:49.000+0000

This issue is resolved via PR 983 and PR 1419.

Posted by Yonni Mendes (yonman) on 2012-06-24T15:11:10.000+0000

The fix in PR 983 seem to work when I tested it in our IBMi machine but I had to create absolute paths for it to work. It seems that AIX glob works only with static paths - otherwise you get empty results and an empty configuration.

Should this issue be reopened for this? or should I create a new issue?

Posted by Evan Coury ( on 2012-06-28T06:19:36.000+0000

I'm re-opening and assigning to Ben Scholzen. Perhaps there is something he can add to our Zend\Stdlib\Glob class to account for this.

Posted by Ralph Schindler (ralph) on 2012-10-08T20:15:22.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.