-
Notifications
You must be signed in to change notification settings - Fork 8k
ext/fileinfo: Various refactorings #18197
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
Conversation
|
Build failure is legit |
589a8f3 to
622cc2c
Compare
622cc2c to
e94d1ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok but see my two nits
ext/fileinfo/fileinfo.c
Outdated
| /* }}} */ | ||
| const char *ret_val; | ||
| if (path) { | ||
| php_stream_context *context = php_stream_context_from_zval(NULL, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could use the php_stream_context_get_default API
| try { | ||
| var_dump(finfo_file($fp, "\0")); | ||
| } catch (\TypeError $e) { | ||
| } catch (\ValueError $e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs an upgrading mention?
The only way this function returns -1 is if: > magic_setflags() returns -1 on systems that don't support utime(3), or utimes(2) when MAGIC_PRESERVE_ATIME is set. This is extremely unlikely and if this would happen we currently have a return type violation.
Instead of relying on a "god" function
e94d1ce to
5458223
Compare
Somewhat supersedes #6189