diff options
Diffstat (limited to 'ext/standard/dir.c')
-rw-r--r-- | ext/standard/dir.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 9a26458321..b1d211a9c8 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -85,14 +85,19 @@ static zend_class_entry *dir_class_entry_ptr; php_error_docref(NULL, E_WARNING, "Unable to find my handle property"); \ RETURN_FALSE; \ } \ - ZEND_FETCH_RESOURCE(dirp, php_stream *, tmp, -1, "Directory", php_file_le_stream()); \ + if ((dirp = (php_stream *)zend_fetch_resource_ex(tmp, "Directory", php_file_le_stream())) == NULL) { \ + RETURN_FALSE; \ + } \ } else { \ - ZEND_FETCH_RESOURCE(dirp, php_stream *, 0, (int)DIRG(default_dir)->handle, "Directory", php_file_le_stream()); \ + if (!DIRG(default_dir) || \ + (dirp = (php_stream *)zend_fetch_resource(DIRG(default_dir), "Directory", php_file_le_stream())) == NULL) { \ + RETURN_FALSE; \ + } \ } \ } else { \ - dirp = (php_stream *) zend_fetch_resource(id, -1, "Directory", NULL, 1, php_file_le_stream()); \ - if (!dirp) \ + if ((dirp = (php_stream *)zend_fetch_resource(Z_RES_P(id), "Directory", php_file_le_stream())) == NULL) { \ RETURN_FALSE; \ + } \ } /* {{{ arginfo */ |