Skip to content

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Mar 30, 2025

Somewhat supersedes #6189

@nielsdos
Copy link
Member

Build failure is legit

@Girgias Girgias force-pushed the fileinfo-minor-refactoring branch from 589a8f3 to 622cc2c Compare March 30, 2025 20:01
@Girgias Girgias force-pushed the fileinfo-minor-refactoring branch from 622cc2c to e94d1ce Compare March 30, 2025 21:24
@Girgias Girgias marked this pull request as ready for review March 31, 2025 16:04
Copy link
Member

@nielsdos nielsdos left a 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

/* }}} */
const char *ret_val;
if (path) {
php_stream_context *context = php_stream_context_from_zval(NULL, false);
Copy link
Member

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) {
Copy link
Member

Choose a reason for hiding this comment

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

Needs an upgrading mention?

Girgias added 2 commits April 1, 2025 19:01
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
@Girgias Girgias force-pushed the fileinfo-minor-refactoring branch from e94d1ce to 5458223 Compare April 1, 2025 18:07
@Girgias Girgias merged commit fabee4e into php:master Apr 3, 2025
9 checks passed
@Girgias Girgias deleted the fileinfo-minor-refactoring branch April 3, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants