Skip to content

RFC: Constructor behaviour of internal classes #1178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Prev Previous commit
Next Next commit
Fixed fileinfo behaviour.
  • Loading branch information
Danack committed Mar 15, 2015
commit 78ebf83ad3299bdb2617da60c9be68ce2cf33fb4
12 changes: 11 additions & 1 deletion ext/fileinfo/fileinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,18 @@ PHP_FUNCTION(finfo_open)
php_fileinfo *finfo;
FILEINFO_DECLARE_INIT_OBJECT(object)
char resolved_path[MAXPATHLEN];
zend_error_handling zeh;
int rv;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
if (object) {
zend_replace_error_handling(EH_THROW, NULL, &zeh TSRMLS_CC);
rv = zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len);
zend_restore_error_handling(&zeh TSRMLS_CC);
} else {
rv = zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len);
}

if (rv == FAILURE) {
FILEINFO_DESTROY_OBJECT(object);
RETURN_FALSE;
}
Expand Down