Skip to content

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/exif/exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,7 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
break;

case TAG_FMT_URATIONAL:
snprintf(buffer, sizeof(buffer), "%i/%i", info_value->ur.num, info_value->ur.den);
snprintf(buffer, sizeof(buffer), "%u/%u", info_value->ur.num, info_value->ur.den);
if (l==1) {
add_assoc_string(&tmpi, name, buffer);
} else {
Expand Down
Binary file added ext/exif/tests/bug77184/DJI_0245_tiny.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions ext/exif/tests/bug77184/bug77184.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
Bug #74428 (Unsigned rational numbers are written out as signed rationals)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--INI--
output_handler=
zlib.output_compression=0
Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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

Copy link
Member

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.

--FILE--
<?php
$infile = dirname(__FILE__).'/DJI_0245_tiny.JPG';
$tags = exif_read_data($infile);
echo $tags['GPSLatitude'][2], PHP_EOL;
echo $tags['GPSLongitude'][2], PHP_EOL;
?>
===DONE===
--EXPECTF--
156691934/70000000
2672193571/70000000
===DONE===