-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix for bug #77184 #3673
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
Fix for bug #77184 #3673
Conversation
The fix looks good to me. It would be good to also add a test with a reduced image. Not sure if there's a tool to only keep the exif metadata and discard the image data. Maybe @KalleZ knows? |
@nikic The ExifTool[1] allows such, in the past I have created a 1x1 JPG, erased the meta data that the editor I made it with may have added and propogated it with relevant test data using -tagsFromFile or similar options. |
I'll put a test together and amend the PR. |
I'm trying to compile PHP from source on my MacOS Mojave, but am unable to do it When running
I keep getting this error:
I don't know why it's searching for sqlite3 when I explicitly set P.S. I have actually already installed |
@cmbasnett sqlite and PDO sqlite are separate extensions, so something like |
@cmbasnett alternatively you can do --disable-all --enable-cli for minimal builds thats usually good enough for testing things like that :) Edit: For ext/exif, you will also need ext/mbstring so something like: |
Alright that got me to the point where I can actually run
I had a look, and indeed, |
@cmbasnett That file is one of those auto-generated by RE2C, not sure if doing a new clean build will fix it and regenerate it as I only develop on Windows, perhaps @nikic knows how it works there, for me usually I end up doing this on Windows:
Alternatively try touch the scanner files and see if RE2C picks it up, but again, I'm not familar with the Unix build system at all, I'm afraid. |
It might be that you don't have re2c installed at all. It recently became a required dependency for builds from git and I suspect we might not have the necessary checks in place to ensure it's available yet (cc @petk). |
@nikic I thought it was a requirement for source builds of PHP on Unix? It's been on Windows since 5.3.0 when we moved from Flex to RE2C |
@KalleZ Yeah, I was referring to @cmbasnett's issue on macos here. On Unix/BSD you can call |
@nikic Ah right, I just expected |
The re2c is missing yes and also additionally you'll need Currently check for re2c raises only warning: https://github.com/php/php-src/blob/master/acinclude.m4#L2100 |
Alright I got it compiled and I can run tests (I installed |
@cmbasnett Have you looked at the ExifTool commands? There is a fair few to define I/O formatting[1], mainly looking at [1] https://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html |
Very bizarre, the test passes on my machine: Perhaps this is some sort of issue with line-endings or a text-encoding error (there are some non-standard characters in the EXIF data)?
|
Testing it locally, I can confirm your fix works, however what causes the fail is that the FileDateTime value of the returned array is different (its allocated to the st_mtime member of the stat struct), which should simply be:
Similar to what other tests does, for example ext/exif/tests/bug34704.phpt. Edit: Alternatively, you can choose to simply just dump the value you are testing, like:
(Nitpick: The .phpt file is marked as binary in your commit, it should just be text/plain) |
@KalleZ I was looking at the repo's |
@cmbasnett Actually thats a good point, I think the All in all, I think the PR is good enough to be merged :) |
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> | ||
--INI-- | ||
output_handler= | ||
zlib.output_compression=0 |
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.
I realize these are also present in some other exit test cases -- does someone know why? They don't look immediately exif related to me.
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.
I was just cargo-culting those into the test since I assumed they were important; I'm unfamiliar with the PHP testing ecosystem.
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.
@nikic I'm pretty sure they are a leftover from a copy-paste from another test. I guess they would origin from some test that was printing binary data or similar to compare it with something else. But they should most likely be removed, but thats something we can do in a separate commit after this PR
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.
Yeah, I agree that we should handle that separately.
Merged as 9ec519e into PHP 7.2+. Thanks for fixing this and going through the trouble of creating a test case! |
Bug #77184