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

Glob::glob() should throw an exception on error #4353

Merged
merged 1 commit into from
Apr 29, 2013
Merged

Glob::glob() should throw an exception on error #4353

merged 1 commit into from
Apr 29, 2013

Conversation

marc-mabe
Copy link
Member

this fixes #3949.

It also makes the second argument $flags optional.

Please note: This could be a BC break as Glob::glob() no longer returns false on error and instead throws a Zend\Stdlib\Exception\RuntimeException but the ZF2 doesn't check against false.

ErrorHandler::start();
$res = glob($pattern, $globFlags);
$err = ErrorHandler::stop();
if ($res === false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

False may actually not directly be an error. Best is to just return an array() on false if no error is thrown. Just throw an exception if there was actually an error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glob returns false in cases of an error only. empty results, unreadable folders by permission ... are resulting in an empty array. tested with PHP-5.3.10 on Ubuntu12.

@ghost ghost assigned weierophinney Apr 29, 2013
weierophinney added a commit that referenced this pull request Apr 29, 2013
Glob::glob() should throw an exception on error

Conflicts:
	library/Zend/Stdlib/Glob.php
weierophinney added a commit that referenced this pull request Apr 29, 2013
@weierophinney weierophinney merged commit ef307f3 into zendframework:develop Apr 29, 2013
weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
…tfix/3949

Glob::glob() should throw an exception on error

Conflicts:
	library/Zend/Stdlib/Glob.php
weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
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.

3 participants