summaryrefslogtreecommitdiff
path: root/ext/exif
diff options
context:
space:
mode:
Diffstat (limited to 'ext/exif')
-rw-r--r--ext/exif/config.w3218
-rw-r--r--ext/exif/exif.c697
-rw-r--r--ext/exif/tests/bug50660/bug50660-1.jpgbin0 -> 24646 bytes
-rw-r--r--ext/exif/tests/bug50660/bug50660-2.jpgbin0 -> 26796 bytes
-rw-r--r--ext/exif/tests/bug50660/bug50660.phpt19
-rw-r--r--ext/exif/tests/bug62523_1.jpgbin304 -> 18393 bytes
-rw-r--r--ext/exif/tests/bug62523_1.phpt6
-rw-r--r--ext/exif/tests/bug62523_2.jpgbin516533 -> 15606 bytes
-rw-r--r--ext/exif/tests/bug62523_2.phpt6
-rw-r--r--ext/exif/tests/bug62523_3.phpt4
-rw-r--r--ext/exif/tests/bug68547.jpgbin0 -> 713 bytes
-rw-r--r--ext/exif/tests/bug68547.phpt12
-rw-r--r--ext/exif/tests/bug68799.phpt4
-rw-r--r--ext/exif/tests/bug71534.phpt12
-rw-r--r--ext/exif/tests/bug71534.tiffbin0 -> 3932 bytes
-rw-r--r--ext/exif/tests/bug72094.phpt4
-rw-r--r--ext/exif/tests/bug72735/bug72682.phpt17
-rw-r--r--ext/exif/tests/bug72735/bug72735.phpt24
-rw-r--r--ext/exif/tests/bug72735/nokia.jpgbin0 -> 13714 bytes
-rw-r--r--ext/exif/tests/bug72735/panasonic.jpgbin0 -> 16629 bytes
-rw-r--r--ext/exif/tests/bug72735/samsung.jpgbin0 -> 29075 bytes
-rw-r--r--ext/exif/tests/bug72819/bug72819.jpgbin0 -> 32764 bytes
-rw-r--r--ext/exif/tests/bug72819/bug72819.phpt16
-rw-r--r--ext/exif/tests/bug73115/bug73115.jpgbin0 -> 12365 bytes
-rw-r--r--ext/exif/tests/bug73115/bug73115.phpt16
-rw-r--r--ext/exif/tests/bug73737.phpt2
-rw-r--r--ext/exif/tests/bug74428/bug74428.jpgbin0 -> 1902 bytes
-rw-r--r--ext/exif/tests/bug74428/bug74428.phpt50
-rw-r--r--ext/exif/tests/exif_read_data_streams.phpt1634
-rw-r--r--ext/exif/tests/exif_read_data_streams_seek.phpt21
-rw-r--r--ext/exif/tests/exif_read_exif_data_basic-mb.phpt2
-rw-r--r--ext/exif/tests/exif_read_exif_data_basic.phpt2
-rw-r--r--ext/exif/tests/exif_tagname_variation1-64bit.phpt183
-rw-r--r--ext/exif/tests/exif_tagname_variation1.phpt38
-rw-r--r--ext/exif/tests/exif_thumbnail_streams.phpt17
-rw-r--r--ext/exif/tests/redhat-bug1362571.jpgbin0 -> 16629 bytes
-rw-r--r--ext/exif/tests/redhat-bug1362571.phpt10
-rw-r--r--ext/exif/tests/sony.jpgbin0 -> 35859 bytes
-rw-r--r--ext/exif/tests/sony.phpt23
39 files changed, 2695 insertions, 142 deletions
diff --git a/ext/exif/config.w32 b/ext/exif/config.w32
index 595e71bda0..ad000c4251 100644
--- a/ext/exif/config.w32
+++ b/ext/exif/config.w32
@@ -1,14 +1,14 @@
// $Id$
// vim:ft=javascript
-ARG_ENABLE("exif", "exif", "no");
+ARG_ENABLE('exif', 'Exchangeable image information (EXIF) Support', 'no');
-if (PHP_EXIF == "yes") {
- if (ADD_EXTENSION_DEP('exif', 'mbstring')) {
- EXTENSION("exif", "exif.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
- AC_DEFINE('HAVE_EXIF', 1, 'Have exif');
- } else {
- WARNING("exif support can't be enabled, libxml is not enabled")
- PHP_EXIF = "no"
+if(PHP_EXIF != 'no')
+{
+ if(ADD_EXTENSION_DEP('exif', 'mbstring'))
+ {
+ AC_DEFINE('HAVE_EXIF', 1, 'Have EXIF Support');
+
+ EXTENSION('exif', 'exif.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
}
-}
+} \ No newline at end of file
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 4525fb3553..306b94dbe2 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -89,7 +89,7 @@ typedef unsigned char uchar;
#define EFREE_IF(ptr) if (ptr) efree(ptr)
-#define MAX_IFD_NESTING_LEVEL 100
+#define MAX_IFD_NESTING_LEVEL 150
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0)
@@ -120,7 +120,7 @@ ZEND_END_ARG_INFO()
*/
const zend_function_entry exif_functions[] = {
PHP_FE(exif_read_data, arginfo_exif_read_data)
- PHP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data)
+ PHP_DEP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data)
PHP_FE(exif_tagname, arginfo_exif_tagname)
PHP_FE(exif_thumbnail, arginfo_exif_thumbnail)
PHP_FE(exif_imagetype, arginfo_exif_imagetype)
@@ -136,8 +136,17 @@ PHP_MINFO_FUNCTION(exif)
php_info_print_table_row(2, "EXIF Support", "enabled");
php_info_print_table_row(2, "EXIF Version", PHP_EXIF_VERSION);
php_info_print_table_row(2, "Supported EXIF Version", "0220");
- php_info_print_table_row(2, "Supported filetypes", "JPEG,TIFF");
+ php_info_print_table_row(2, "Supported filetypes", "JPEG, TIFF");
+
+ if (zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)) {
+ php_info_print_table_row(2, "Multibyte decoding support using mbstring", "enabled");
+ } else {
+ php_info_print_table_row(2, "Multibyte decoding support using mbstring", "disabled");
+ }
+
+ php_info_print_table_row(2, "Extended EXIF tag formats", "Canon, Casio, Fujifilm, Nikon, Olympus, Samsung, Panasonic, DJI, Sony, Pentax, Minolta, Sigma, Foveon, Kyocera, Ricoh, AGFA, Epson");
php_info_print_table_end();
+
DISPLAY_INI_ENTRIES();
}
/* }}} */
@@ -171,7 +180,7 @@ ZEND_INI_MH(OnUpdateEncode)
php_error_docref(NULL, E_WARNING, "Illegal encoding ignored: '%s'", ZSTR_VAL(new_value));
return FAILURE;
}
- efree(return_list);
+ pefree((void *) return_list, 0);
}
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
@@ -186,7 +195,7 @@ ZEND_INI_MH(OnUpdateDecode)
php_error_docref(NULL, E_WARNING, "Illegal encoding ignored: '%s'", ZSTR_VAL(new_value));
return FAILURE;
}
- efree(return_list);
+ pefree((void *) return_list, 0);
}
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
@@ -218,7 +227,7 @@ static PHP_GINIT_FUNCTION(exif)
/* }}} */
/* {{{ PHP_MINIT_FUNCTION(exif)
- Get the size of an image as 4-element array */
+ */
PHP_MINIT_FUNCTION(exif)
{
REGISTER_INI_ENTRIES();
@@ -955,6 +964,374 @@ static tag_info_array tag_table_VND_OLYMPUS = {
TAG_TABLE_END
};
+static tag_info_array tag_table_VND_SAMSUNG = {
+ { 0x0001, "Version"},
+ { 0x0021, "PictureWizard"},
+ { 0x0030, "LocalLocationName"},
+ { 0x0031, "LocationName"},
+ { 0x0035, "Preview"},
+ { 0x0043, "CameraTemperature"},
+ { 0xa001, "FirmwareName"},
+ { 0xa003, "LensType"},
+ { 0xa004, "LensFirmware"},
+ { 0xa010, "SensorAreas"},
+ { 0xa011, "ColorSpace"},
+ { 0xa012, "SmartRange"},
+ { 0xa013, "ExposureBiasValue"},
+ { 0xa014, "ISO"},
+ { 0xa018, "ExposureTime"},
+ { 0xa019, "FNumber"},
+ { 0xa01a, "FocalLengthIn35mmFormat"},
+ { 0xa020, "EncryptionKey"},
+ { 0xa021, "WB_RGGBLevelsUncorrected"},
+ { 0xa022, "WB_RGGBLevelsAuto"},
+ { 0xa023, "WB_RGGBLevelsIlluminator1"},
+ { 0xa024, "WB_RGGBLevelsIlluminator2"},
+ { 0xa028, "WB_RGGBLevelsBlack"},
+ { 0xa030, "ColorMatrix"},
+ { 0xa031, "ColorMatrixSRGB"},
+ { 0xa032, "ColorMatrixAdobeRGB"},
+ { 0xa040, "ToneCurve1"},
+ { 0xa041, "ToneCurve2"},
+ { 0xa042, "ToneCurve3"},
+ { 0xa043, "ToneCurve4"},
+ TAG_TABLE_END
+};
+
+static tag_info_array tag_table_VND_PANASONIC = {
+ { 0x0001, "Quality"},
+ { 0x0002, "FirmwareVersion"},
+ { 0x0003, "WhiteBalance"},
+ { 0x0004, "0x0004"},
+ { 0x0007, "FocusMode"},
+ { 0x000f, "AFMode"},
+ { 0x001a, "ImageStabilization"},
+ { 0x001c, "Macro"},
+ { 0x001f, "ShootingMode"},
+ { 0x0020, "Audio"},
+ { 0x0021, "DataDump"},
+ { 0x0022, "0x0022"},
+ { 0x0023, "WhiteBalanceBias"},
+ { 0x0024, "FlashBias"},
+ { 0x0025, "InternalSerialNumber"},
+ { 0x0026, "ExifVersion"},
+ { 0x0027, "0x0027"},
+ { 0x0028, "ColorEffect"},
+ { 0x0029, "TimeSincePowerOn"},
+ { 0x002a, "BurstMode"},
+ { 0x002b, "SequenceNumber"},
+ { 0x002c, "Contrast"},
+ { 0x002d, "NoiseReduction"},
+ { 0x002e, "SelfTimer"},
+ { 0x002f, "0x002f"},
+ { 0x0030, "Rotation"},
+ { 0x0031, "AFAssistLamp"},
+ { 0x0032, "ColorMode"},
+ { 0x0033, "BabyAge1"},
+ { 0x0034, "OpticalZoomMode"},
+ { 0x0035, "ConversionLens"},
+ { 0x0036, "TravelDay"},
+ { 0x0039, "Contrast"},
+ { 0x003a, "WorldTimeLocation"},
+ { 0x003b, "TextStamp1"},
+ { 0x003c, "ProgramISO"},
+ { 0x003d, "AdvancedSceneType"},
+ { 0x003e, "TextStamp2"},
+ { 0x003f, "FacesDetected"},
+ { 0x0040, "Saturation"},
+ { 0x0041, "Sharpness"},
+ { 0x0042, "FilmMode"},
+ { 0x0044, "ColorTempKelvin"},
+ { 0x0045, "BracketSettings"},
+ { 0x0046, "WBAdjustAB"},
+ { 0x0047, "WBAdjustGM"},
+ { 0x0048, "FlashCurtain"},
+ { 0x0049, "LongShutterNoiseReduction"},
+ { 0x004b, "ImageWidth"},
+ { 0x004c, "ImageHeight"},
+ { 0x004d, "AFPointPosition"},
+ { 0x004e, "FaceDetInfo"},
+ { 0x0051, "LensType"},
+ { 0x0052, "LensSerialNumber"},
+ { 0x0053, "AccessoryType"},
+ { 0x0054, "AccessorySerialNumber"},
+ { 0x0059, "Transform1"},
+ { 0x005d, "IntelligentExposure"},
+ { 0x0060, "LensFirmwareVersion"},
+ { 0x0061, "FaceRecInfo"},
+ { 0x0062, "FlashWarning"},
+ { 0x0065, "Title"},
+ { 0x0066, "BabyName"},
+ { 0x0067, "Location"},
+ { 0x0069, "Country"},
+ { 0x006b, "State"},
+ { 0x006d, "City"},
+ { 0x006f, "Landmark"},
+ { 0x0070, "IntelligentResolution"},
+ { 0x0077, "BurstSheed"},
+ { 0x0079, "IntelligentDRange"},
+ { 0x007c, "ClearRetouch"},
+ { 0x0080, "City2"},
+ { 0x0086, "ManometerPressure"},
+ { 0x0089, "PhotoStyle"},
+ { 0x008a, "ShadingCompensation"},
+ { 0x008c, "AccelerometerZ"},
+ { 0x008d, "AccelerometerX"},
+ { 0x008e, "AccelerometerY"},
+ { 0x008f, "CameraOrientation"},
+ { 0x0090, "RollAngle"},
+ { 0x0091, "PitchAngle"},
+ { 0x0093, "SweepPanoramaDirection"},
+ { 0x0094, "PanoramaFieldOfView"},
+ { 0x0096, "TimerRecording"},
+ { 0x009d, "InternalNDFilter"},
+ { 0x009e, "HDR"},
+ { 0x009f, "ShutterType"},
+ { 0x00a3, "ClearRetouchValue"},
+ { 0x00ab, "TouchAE"},
+ { 0x0e00, "PrintIM"},
+ { 0x4449, "0x4449"},
+ { 0x8000, "MakerNoteVersion"},
+ { 0x8001, "SceneMode"},
+ { 0x8004, "WBRedLevel"},
+ { 0x8005, "WBGreenLevel"},
+ { 0x8006, "WBBlueLevel"},
+ { 0x8007, "FlashFired"},
+ { 0x8008, "TextStamp3"},
+ { 0x8009, "TextStamp4"},
+ { 0x8010, "BabyAge2"},
+ { 0x8012, "Transform2"},
+ TAG_TABLE_END
+};
+
+static tag_info_array tag_table_VND_DJI = {
+ { 0x0001, "Make"},
+ { 0x0003, "SpeedX"},
+ { 0x0004, "SpeedY"},
+ { 0x0005, "SpeedZ"},
+ { 0x0006, "Pitch"},
+ { 0x0007, "Yaw"},
+ { 0x0008, "Roll"},
+ { 0x0009, "CameraPitch"},
+ { 0x000a, "CameraYaw"},
+ { 0x000b, "CameraRoll"},
+ TAG_TABLE_END
+};
+
+static tag_info_array tag_table_VND_SONY = {
+ { 0x0102, "Quality"},
+ { 0x0104, "FlashExposureComp"},
+ { 0x0105, "Teleconverter"},
+ { 0x0112, "WhiteBalanceFineTune"},
+ { 0x0114, "CameraSettings"},
+ { 0x0115, "WhiteBalance"},
+ { 0x0116, "0x0116"},
+ { 0x0e00, "PrintIM"},
+ { 0x1000, "MultiBurstMode"},
+ { 0x1001, "MultiBurstImageWidth"},
+ { 0x1002, "MultiBurstImageHeight"},
+ { 0x1003, "Panorama"},
+ { 0x2000, "0x2000"},
+ { 0x2001, "PreviewImage"},
+ { 0x2002, "0x2002"},
+ { 0x2003, "0x2003"},
+ { 0x2004, "Contrast"},
+ { 0x2005, "Saturation"},
+ { 0x2006, "0x2006"},
+ { 0x2007, "0x2007"},
+ { 0x2008, "0x2008"},
+ { 0x2009, "0x2009"},
+ { 0x200a, "AutoHDR"},
+ { 0x3000, "ShotInfo"},
+ { 0xb000, "FileFormat"},
+ { 0xb001, "SonyModelID"},
+ { 0xb020, "ColorReproduction"},
+ { 0xb021, "ColorTemperature"},
+ { 0xb022, "ColorCompensationFilter"},
+ { 0xb023, "SceneMode"},
+ { 0xb024, "ZoneMatching"},
+ { 0xb025, "DynamicRangeOptimizer"},
+ { 0xb026, "ImageStabilization"},
+ { 0xb027, "LensID"},
+ { 0xb028, "MinoltaMakerNote"},
+ { 0xb029, "ColorMode"},
+ { 0xb02b, "FullImageSize"},
+ { 0xb02c, "PreviewImageSize"},
+ { 0xb040, "Macro"},
+ { 0xb041, "ExposureMode"},
+ { 0xb042, "FocusMode"},
+ { 0xb043, "AFMode"},
+ { 0xb044, "AFIlluminator"},
+ { 0xb047, "JPEGQuality"},
+ { 0xb048, "FlashLevel"},
+ { 0xb049, "ReleaseMode"},
+ { 0xb04a, "SequenceNumber"},
+ { 0xb04b, "AntiBlur"},
+ { 0xb04e, "LongExposureNoiseReduction"},
+ { 0xb04f, "DynamicRangeOptimizer"},
+ { 0xb052, "IntelligentAuto"},
+ { 0xb054, "WhiteBalance2"},
+ TAG_TABLE_END
+};
+
+static tag_info_array tag_table_VND_PENTAX = {
+ { 0x0000, "Version"},
+ { 0x0001, "Mode"},
+ { 0x0002, "PreviewResolution"},
+ { 0x0003, "PreviewLength"},
+ { 0x0004, "PreviewOffset"},
+ { 0x0005, "ModelID"},
+ { 0x0006, "Date"},
+ { 0x0007, "Time"},
+ { 0x0008, "Quality"},
+ { 0x0009, "Size"},
+ { 0x000c, "Flash"},
+ { 0x000d, "Focus"},
+ { 0x000e, "AFPoint"},
+ { 0x000f, "AFPointInFocus"},
+ { 0x0012, "ExposureTime"},
+ { 0x0013, "FNumber"},
+ { 0x0014, "ISO"},
+ { 0x0016, "ExposureCompensation"},
+ { 0x0017, "MeteringMode"},
+ { 0x0018, "AutoBracketing"},
+ { 0x0019, "WhiteBalance"},
+ { 0x001a, "WhiteBalanceMode"},
+ { 0x001b, "BlueBalance"},
+ { 0x001c, "RedBalance"},
+ { 0x001d, "FocalLength"},
+ { 0x001e, "DigitalZoom"},
+ { 0x001f, "Saturation"},
+ { 0x0020, "Contrast"},
+ { 0x0021, "Sharpness"},
+ { 0x0022, "Location"},
+ { 0x0023, "Hometown"},
+ { 0x0024, "Destination"},
+ { 0x0025, "HometownDST"},
+ { 0x0026, "DestinationDST"},
+ { 0x0027, "DSPFirmwareVersion"},
+ { 0x0028, "CPUFirmwareVersion"},
+ { 0x0029, "FrameNumber"},
+ { 0x002d, "EffectiveLV"},
+ { 0x0032, "ImageProcessing"},
+ { 0x0033, "PictureMode"},
+ { 0x0034, "DriveMode"},
+ { 0x0037, "ColorSpace"},
+ { 0x0038, "ImageAreaOffset"},
+ { 0x0039, "RawImageSize"},
+ { 0x003e, "PreviewImageBorders"},
+ { 0x003f, "LensType"},
+ { 0x0040, "SensitivityAdjust"},
+ { 0x0041, "DigitalFilter"},
+ { 0x0047, "Temperature"},
+ { 0x0048, "AELock"},
+ { 0x0049, "NoiseReduction"},
+ { 0x004d, "FlashExposureCompensation"},
+ { 0x004f, "ImageTone"},
+ { 0x0050, "ColorTemperature"},
+ { 0x005c, "ShakeReduction"},
+ { 0x005d, "ShutterCount"},
+ { 0x0069, "DynamicRangeExpansion"},
+ { 0x0071, "HighISONoiseReduction"},
+ { 0x0072, "AFAdjustment"},
+ { 0x0200, "BlackPoint"},
+ { 0x0201, "WhitePoint"},
+ { 0x0205, "ShotInfo"},
+ { 0x0206, "AEInfo"},
+ { 0x0207, "LensInfo"},
+ { 0x0208, "FlashInfo"},
+ { 0x0209, "AEMeteringSegments"},
+ { 0x020a, "FlashADump"},
+ { 0x020b, "FlashBDump"},
+ { 0x020d, "WB_RGGBLevelsDaylight"},
+ { 0x020e, "WB_RGGBLevelsShade"},
+ { 0x020f, "WB_RGGBLevelsCloudy"},
+ { 0x0210, "WB_RGGBLevelsTungsten"},
+ { 0x0211, "WB_RGGBLevelsFluorescentD"},
+ { 0x0212, "WB_RGGBLevelsFluorescentN"},
+ { 0x0213, "WB_RGGBLevelsFluorescentW"},
+ { 0x0214, "WB_RGGBLevelsFlash"},
+ { 0x0215, "CameraInfo"},
+ { 0x0216, "BatteryInfo"},
+ { 0x021f, "AFInfo"},
+ { 0x0222, "ColorInfo"},
+ { 0x0229, "SerialNumber"},
+ TAG_TABLE_END
+};
+
+static tag_info_array tag_table_VND_MINOLTA = {
+ { 0x0000, "Version"},
+ { 0x0001, "CameraSettingsStdOld"},
+ { 0x0003, "CameraSettingsStdNew"},
+ { 0x0004, "CameraSettings7D"},
+ { 0x0018, "ImageStabilizationData"},
+ { 0x0020, "WBInfoA100"},
+ { 0x0040, "CompressedImageSize"},
+ { 0x0081, "Thumbnail"},
+ { 0x0088, "ThumbnailOffset"},
+ { 0x0089, "ThumbnailLength"},
+ { 0x0100, "SceneMode"},
+ { 0x0101, "ColorMode"},
+ { 0x0102, "Quality"},
+ { 0x0103, "0x0103"},
+ { 0x0104, "FlashExposureComp"},
+ { 0x0105, "Teleconverter"},
+ { 0x0107, "ImageStabilization"},
+ { 0x0109, "RawAndJpgRecording"},
+ { 0x010a, "ZoneMatching"},
+ { 0x010b, "ColorTemperature"},
+ { 0x010c, "LensID"},
+ { 0x0111, "ColorCompensationFilter"},
+ { 0x0112, "WhiteBalanceFineTune"},
+ { 0x0113, "ImageStabilizationA100"},
+ { 0x0114, "CameraSettings5D"},
+ { 0x0115, "WhiteBalance"},
+ { 0x0e00, "PrintIM"},
+ { 0x0f00, "CameraSettingsZ1"},
+ TAG_TABLE_END
+};
+
+static tag_info_array tag_table_VND_SIGMA = {
+ { 0x0002, "SerialNumber"},
+ { 0x0003, "DriveMode"},
+ { 0x0004, "ResolutionMode"},
+ { 0x0005, "AutofocusMode"},
+ { 0x0006, "FocusSetting"},
+ { 0x0007, "WhiteBalance"},
+ { 0x0008, "ExposureMode"},
+ { 0x0009, "MeteringMode"},
+ { 0x000a, "LensRange"},
+ { 0x000b, "ColorSpace"},
+ { 0x000c, "Exposure"},
+ { 0x000d, "Contrast"},
+ { 0x000e, "Shadow"},
+ { 0x000f, "Highlight"},
+ { 0x0010, "Saturation"},
+ { 0x0011, "Sharpness"},
+ { 0x0012, "FillLight"},
+ { 0x0014, "ColorAdjustment"},
+ { 0x0015, "AdjustmentMode"},
+ { 0x0016, "Quality"},
+ { 0x0017, "Firmware"},
+ { 0x0018, "Software"},
+ { 0x0019, "AutoBracket"},
+ TAG_TABLE_END
+};
+
+static tag_info_array tag_table_VND_KYOCERA = {
+ { 0x0001, "FormatThumbnail"},
+ { 0x0E00, "PrintImageMatchingInfo"},
+ TAG_TABLE_END
+};
+
+static tag_info_array tag_table_VND_RICOH = {
+ { 0x0001, "MakerNoteDataType"},
+ { 0x0002, "Version"},
+ { 0x0E00, "PrintImageMatchingInfo"},
+ { 0x2001, "RicohCameraInfoMakerNoteSubIFD"},
+ TAG_TABLE_END
+};
+
typedef enum mn_byte_order_t {
MN_ORDER_INTEL = 0,
MN_ORDER_MOTOROLA = 1,
@@ -963,8 +1340,10 @@ typedef enum mn_byte_order_t {
typedef enum mn_offset_mode_t {
MN_OFFSET_NORMAL,
- MN_OFFSET_MAKER,
- MN_OFFSET_GUESS
+ MN_OFFSET_MAKER
+#ifdef KALLE_0
+ , MN_OFFSET_GUESS
+#endif
} mn_offset_mode_t;
typedef struct {
@@ -978,14 +1357,29 @@ typedef struct {
mn_offset_mode_t offset_mode;
} maker_note_type;
+/* Remember to update PHP_MINFO if updated */
static const maker_note_type maker_note_array[] = {
- { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_INTEL, MN_OFFSET_GUESS},
-/* { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},*/
- { tag_table_VND_CASIO, "CASIO", NULL, NULL, 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL},
- { tag_table_VND_FUJI, "FUJIFILM", NULL, "FUJIFILM\x0C\x00\x00\x00", 12, 12, MN_ORDER_INTEL, MN_OFFSET_MAKER},
- { tag_table_VND_NIKON, "NIKON", NULL, "Nikon\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
- { tag_table_VND_NIKON_990, "NIKON", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
- { tag_table_VND_OLYMPUS, "OLYMPUS OPTICAL CO.,LTD", NULL, "OLYMP\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_INTEL, MN_OFFSET_NORMAL},
+ { tag_table_VND_CASIO, "CASIO", NULL, NULL, 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL},
+ { tag_table_VND_FUJI, "FUJIFILM", NULL, "FUJIFILM\x0C\x00\x00\x00", 12, 12, MN_ORDER_INTEL, MN_OFFSET_MAKER},
+ { tag_table_VND_NIKON, "NIKON", NULL, "Nikon\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_NIKON_990, "NIKON", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_OLYMPUS, "OLYMPUS OPTICAL CO.,LTD", NULL, "OLYMP\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_SAMSUNG, "SAMSUNG", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_PANASONIC, "Panasonic", NULL, "Panasonic\x00\x00\x00", 12, 12, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_DJI, "DJI", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_SONY, "SONY", NULL, "SONY DSC \x00\x00\x00", 12, 12, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_PENTAX, "PENTAX", NULL, "AOC\x00", 6, 6, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_MINOLTA, "Minolta, KONICA MINOLTA", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_SIGMA, "SIGMA, FOVEON", NULL, "SIGMA\x00\x00\x00", 10, 10, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_SIGMA, "SIGMA, FOVEON", NULL, "FOVEON\x00\x00\x00", 10, 10, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_KYOCERA, "KYOCERA, CONTAX", NULL, "KYOCERA \x00\x00\x00", 22, 22, MN_ORDER_NORMAL, MN_OFFSET_MAKER},
+ { tag_table_VND_RICOH, "RICOH", NULL, "Ricoh", 5, 5, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL},
+ { tag_table_VND_RICOH, "RICOH", NULL, "RICOH", 5, 5, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL},
+
+ /* These re-uses existing formats */
+ { tag_table_VND_OLYMPUS, "AGFA", NULL, "AGFA \x00\x01", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
+ { tag_table_VND_OLYMPUS, "EPSON", NULL, "EPSON\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}
};
/* }}} */
@@ -1158,7 +1552,7 @@ char * exif_dump_data(int *dump_free, int format, int components, int length, in
return value_ptr ? value_ptr : "<no data>";
}
if (format == TAG_FMT_UNDEFINED) {
- return "<undefined>\n";
+ return "<undefined>";
}
if (format == TAG_FMT_IFD) {
return "";
@@ -1270,6 +1664,20 @@ static double exif_convert_any_format(void *value, int format, int motorola_inte
}
/* }}} */
+/* {{{ exif_rewrite_tag_format_to_unsigned
+ * Rewrite format tag so that it specifies an unsigned type for a tag */
+static int exif_rewrite_tag_format_to_unsigned(int format)
+{
+ switch(format) {
+ case TAG_FMT_SBYTE: return TAG_FMT_BYTE;
+ case TAG_FMT_SRATIONAL: return TAG_FMT_URATIONAL;
+ case TAG_FMT_SSHORT: return TAG_FMT_USHORT;
+ case TAG_FMT_SLONG: return TAG_FMT_ULONG;
+ }
+ return format;
+}
+/* }}} */
+
/* {{{ exif_convert_any_to_int
* Evaluate number, be it int, rational, or float from directory. */
static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel)
@@ -1565,11 +1973,11 @@ static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_ty
char *buf;
spprintf(&buf, 0, "%s(%d): %s", _file, _line, format);
- php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"", type, buf, args);
+ php_verror(docref, ImageInfo && ImageInfo->FileName ? ImageInfo->FileName:"", type, buf, args);
efree(buf);
}
#else
- php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"", type, format, args);
+ php_verror(docref, ImageInfo && ImageInfo->FileName ? ImageInfo->FileName:"", type, format, args);
#endif
va_end(args);
}
@@ -1704,7 +2112,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
case TAG_FMT_UNDEFINED:
if (value) {
if (tag == TAG_MAKER_NOTE) {
- length = MIN(length, strlen(value));
+ length = MIN(length, (int) strlen(value));
}
/* do not recompute length here */
@@ -2271,7 +2679,7 @@ static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result)
/* }}} */
/* forward declarations */
-static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index);
+static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag);
static int exif_process_IFD_TAG( image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table);
/* {{{ exif_get_markername
@@ -2603,7 +3011,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
{
int a;
char *decode;
- size_t len;;
+ size_t len;
*pszEncoding = NULL;
/* Copy the comment */
@@ -2712,10 +3120,13 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
{
size_t i;
int de, section_index = SECTION_MAKERNOTE;
- int NumDirEntries, old_motorola_intel, offset_diff;
+ int NumDirEntries, old_motorola_intel;
+#ifdef KALLE_0
+ int offset_diff;
+#endif
const maker_note_type *maker_note;
char *dir_start;
-
+
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
#ifdef EXIF_DEBUG
@@ -2736,7 +3147,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
continue;
break;
}
-
+
if (maker_note->offset >= value_len) {
/* Do not go past the value end */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X offset 0x%04X", value_len, maker_note->offset);
@@ -2770,6 +3181,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
case MN_OFFSET_MAKER:
offset_base = value_ptr;
break;
+#ifdef KALLE_0
case MN_OFFSET_GUESS:
if (maker_note->offset + 10 + 4 >= value_len) {
/* Can not read dir_start+10 since it's beyond value end */
@@ -2786,6 +3198,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
}
offset_base = value_ptr + offset_diff;
break;
+#endif
default:
case MN_OFFSET_NORMAL:
break;
@@ -2844,7 +3257,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
/*return TRUE;*/
}
- if (components < 0) {
+ if (components <= 0) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal components(%d)", tag, exif_get_tagname(tag, tagname, -12, tag_table), components);
return FALSE;
}
@@ -2933,18 +3346,18 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
switch(tag) {
case TAG_IMAGEWIDTH:
case TAG_COMP_IMAGE_WIDTH:
- ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel);
+ ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_IMAGEHEIGHT:
case TAG_COMP_IMAGE_HEIGHT:
- ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel);
+ ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_STRIP_OFFSETS:
case TAG_JPEG_INTERCHANGE_FORMAT:
/* accept both formats */
- ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel);
+ ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_STRIP_BYTE_COUNTS:
@@ -2954,13 +3367,13 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
/* motorola is easier to read */
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_TIFF_MM;
}
- ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel);
+ ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_JPEG_INTERCHANGE_FORMAT_LEN:
if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) {
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG;
- ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel);
+ ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
}
break;
}
@@ -3032,7 +3445,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
break;
case TAG_COMP_IMAGE_WIDTH:
- ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel);
+ ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_FOCALPLANE_X_RES:
@@ -3118,7 +3531,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD Pointer");
return FALSE;
}
- if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index)) {
+ if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index, tag)) {
return FALSE;
}
#ifdef EXIF_DEBUG
@@ -3135,11 +3548,11 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
/* {{{ exif_process_IFD_in_JPEG
* Process one of the nested IFDs directories. */
-static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index)
+static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag)
{
int de;
int NumDirEntries;
- int NextDirOffset;
+ int NextDirOffset = 0;
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s (x%04X(=%d))", exif_get_sectionname(section_index), IFDlength, IFDlength);
@@ -3147,7 +3560,7 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
ImageInfo->sections_found |= FOUND_IFD0;
- if ((dir_start + 2) >= (offset_base+IFDlength)) {
+ if ((dir_start + 2) > (offset_base+IFDlength)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
return FALSE;
}
@@ -3175,11 +3588,15 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
* Hack to make it process IDF1 I hope
* There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
*/
- if ((dir_start+2+12*de + 4) >= (offset_base+IFDlength)) {
+ if ((dir_start+2+12*de + 4) > (offset_base+IFDlength)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
return FALSE;
}
- NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
+
+ if (tag != TAG_EXIF_IFD_POINTER && tag != TAG_GPS_IFD_POINTER) {
+ NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
+ }
+
if (NextDirOffset) {
/* the next line seems false but here IFDlength means length of all IFDs */
if (offset_base + NextDirOffset < offset_base || offset_base + NextDirOffset > offset_base+IFDlength) {
@@ -3190,7 +3607,7 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Expect next IFD to be thumbnail");
#endif
- if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL)) {
+ if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL, 0)) {
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail size: 0x%04X", ImageInfo->Thumbnail.size);
#endif
@@ -3245,7 +3662,7 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
ImageInfo->sections_found |= FOUND_IFD0;
/* First directory starts at offset 8. Offsets starts at 0. */
- exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0);
+ exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0, 0);
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process TIFF in JPEG done");
@@ -3306,7 +3723,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo)
unsigned int ll, lh;
uchar *Data;
size_t fpos, size, got, itemlen;
- jpeg_sof_info sof_info;
+ jpeg_sof_info sof_info;
for(section=0;;section++) {
#ifdef EXIF_DEBUG
@@ -3725,6 +4142,7 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
if (fgot < ImageInfo->Thumbnail.size) {
EXIF_ERRLOG_THUMBEOF(ImageInfo)
efree(ImageInfo->Thumbnail.data);
+
ImageInfo->Thumbnail.data = NULL;
} else {
exif_thumbnail_build(ImageInfo);
@@ -3887,33 +4305,35 @@ static int exif_discard_imageinfo(image_info_type *ImageInfo)
}
/* }}} */
-/* {{{ exif_read_file
+/* {{{ exif_read_from_impl
*/
-static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all)
+static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, int read_thumbnail, int read_all)
{
int ret;
zend_stat_t st;
- zend_string *base;
/* Start with an empty image information structure. */
memset(ImageInfo, 0, sizeof(*ImageInfo));
- ImageInfo->motorola_intel = -1; /* flag as unknown */
-
- ImageInfo->infile = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK|IGNORE_PATH, NULL);
- if (!ImageInfo->infile) {
- exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Unable to open file");
- return FALSE;
- }
+ ImageInfo->motorola_intel = -1; /* flag as unknown */
+ ImageInfo->infile = stream;
+ ImageInfo->FileName = NULL;
if (php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) {
- if (VCWD_STAT(FileName, &st) >= 0) {
+ if (VCWD_STAT(stream->orig_path, &st) >= 0) {
+ zend_string *base;
if ((st.st_mode & S_IFMT) != S_IFREG) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Not a file");
php_stream_close(ImageInfo->infile);
return FALSE;
}
+ /* Store file name */
+ base = php_basename(stream->orig_path, strlen(stream->orig_path), NULL, 0);
+ ImageInfo->FileName = estrndup(ZSTR_VAL(base), ZSTR_LEN(base));
+
+ zend_string_release(base);
+
/* Store file date/time. */
ImageInfo->FileDateTime = st.st_mtime;
ImageInfo->FileSize = st.st_size;
@@ -3927,51 +4347,97 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t
}
}
- base = php_basename(FileName, strlen(FileName), NULL, 0);
- ImageInfo->FileName = estrndup(ZSTR_VAL(base), ZSTR_LEN(base));
- zend_string_release(base);
- ImageInfo->read_thumbnail = read_thumbnail;
- ImageInfo->read_all = read_all;
- ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
+ ImageInfo->read_thumbnail = read_thumbnail;
+ ImageInfo->read_all = read_all;
+ ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
- ImageInfo->encode_unicode = estrdup(EXIF_G(encode_unicode));
- ImageInfo->decode_unicode_be = estrdup(EXIF_G(decode_unicode_be));
- ImageInfo->decode_unicode_le = estrdup(EXIF_G(decode_unicode_le));
- ImageInfo->encode_jis = estrdup(EXIF_G(encode_jis));
- ImageInfo->decode_jis_be = estrdup(EXIF_G(decode_jis_be));
- ImageInfo->decode_jis_le = estrdup(EXIF_G(decode_jis_le));
+ ImageInfo->encode_unicode = estrdup(EXIF_G(encode_unicode));
+ ImageInfo->decode_unicode_be = estrdup(EXIF_G(decode_unicode_be));
+ ImageInfo->decode_unicode_le = estrdup(EXIF_G(decode_unicode_le));
+ ImageInfo->encode_jis = estrdup(EXIF_G(encode_jis));
+ ImageInfo->decode_jis_be = estrdup(EXIF_G(decode_jis_be));
+ ImageInfo->decode_jis_le = estrdup(EXIF_G(decode_jis_le));
ImageInfo->ifd_nesting_level = 0;
- /* Scan the JPEG headers. */
+ /* Scan the headers */
ret = exif_scan_FILE_header(ImageInfo);
- php_stream_close(ImageInfo->infile);
return ret;
}
/* }}} */
-/* {{{ proto array exif_read_data(string filename [, string sections_needed [, bool sub_arrays[, bool read_thumbnail]]])
- Reads header data from the JPEG/TIFF image filename and optionally reads the internal thumbnails */
-PHP_FUNCTION(exif_read_data)
+/* {{{ exif_read_from_stream
+ */
+static int exif_read_from_stream(image_info_type *ImageInfo, php_stream *stream, int read_thumbnail, int read_all)
+{
+ int ret;
+ off_t old_pos = php_stream_tell(stream);
+
+ if (old_pos) {
+ php_stream_seek(stream, 0, SEEK_SET);
+ }
+
+ ret = exif_read_from_impl(ImageInfo, stream, read_thumbnail, read_all);
+
+ if (old_pos) {
+ php_stream_seek(stream, old_pos, SEEK_SET);
+ }
+
+ return ret;
+}
+/* }}} */
+
+/* {{{ exif_read_from_file
+ */
+static int exif_read_from_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all)
{
- char *p_name, *p_sections_needed = NULL;
- size_t p_name_len, p_sections_needed_len = 0;
- zend_bool sub_arrays=0, read_thumbnail=0, read_all=0;
+ int ret;
+ php_stream *stream;
+
+ stream = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK | IGNORE_PATH, NULL);
+
+ if (!stream) {
+ memset(&ImageInfo, 0, sizeof(ImageInfo));
+
+ exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Unable to open file");
+
+ return FALSE;
+ }
+
+ ret = exif_read_from_stream(ImageInfo, stream, read_thumbnail, read_all);
+
+ php_stream_close(stream);
- int i, ret, sections_needed=0;
+ return ret;
+}
+/* }}} */
+
+/* {{{ proto array exif_read_data(mixed stream [, string sections_needed [, bool sub_arrays[, bool read_thumbnail]]])
+ Reads header data from an image and optionally reads the internal thumbnails */
+PHP_FUNCTION(exif_read_data)
+{
+ zend_string *z_sections_needed = NULL;
+ zend_bool sub_arrays = 0, read_thumbnail = 0, read_all = 0;
+ zval *stream;
+ int i, ret, sections_needed = 0;
image_info_type ImageInfo;
char tmp[64], *sections_str, *s;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|sbb", &p_name, &p_name_len, &p_sections_needed, &p_sections_needed_len, &sub_arrays, &read_thumbnail) == FAILURE) {
- return;
- }
+ /* Parse arguments */
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_ZVAL(stream)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STR(z_sections_needed)
+ Z_PARAM_BOOL(sub_arrays)
+ Z_PARAM_BOOL(read_thumbnail)
+ ZEND_PARSE_PARAMETERS_END();
memset(&ImageInfo, 0, sizeof(ImageInfo));
- if (p_sections_needed) {
- spprintf(&sections_str, 0, ",%s,", p_sections_needed);
+ if (z_sections_needed) {
+ spprintf(&sections_str, 0, ",%s,", ZSTR_VAL(z_sections_needed));
/* sections_str DOES start with , and SPACES are NOT allowed in names */
s = sections_str;
while (*++s) {
@@ -3991,19 +4457,39 @@ PHP_FUNCTION(exif_read_data)
#ifdef EXIF_DEBUG
sections_str = exif_get_sectionlist(sections_needed);
if (!sections_str) {
+ zend_string_release(z_sections_needed);
RETURN_FALSE;
}
exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections needed: %s", sections_str[0] ? sections_str : "None");
EFREE_IF(sections_str);
#endif
+ zend_string_release(z_sections_needed);
+ }
+
+ if (Z_TYPE_P(stream) == IS_RESOURCE) {
+ php_stream *p_stream = NULL;
+
+ php_stream_from_res(p_stream, Z_RES_P(stream));
+
+ ret = exif_read_from_stream(&ImageInfo, p_stream, read_thumbnail, read_all);
+ } else {
+ convert_to_string(stream);
+
+ if (!Z_STRLEN_P(stream)) {
+ exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_WARNING, "Filename cannot be empty");
+
+ RETURN_FALSE;
+ }
+
+ ret = exif_read_from_file(&ImageInfo, Z_STRVAL_P(stream), read_thumbnail, read_all);
}
- ret = exif_read_file(&ImageInfo, p_name, read_thumbnail, read_all);
sections_str = exif_get_sectionlist(ImageInfo.sections_found);
#ifdef EXIF_DEBUG
- if (sections_str)
+ if (sections_str) {
exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections found: %s", sections_str[0] ? sections_str : "None");
+ }
#endif
ImageInfo.sections_found |= FOUND_COMPUTED|FOUND_FILE;/* do not inform about in debug*/
@@ -4125,7 +4611,7 @@ PHP_FUNCTION(exif_read_data)
exif_discard_imageinfo(&ImageInfo);
#ifdef EXIF_DEBUG
- php_error_docref1(NULL, p_name, E_NOTICE, "done");
+ php_error_docref1(NULL, (Z_TYPE_P(stream) == IS_RESOURCE ? "<stream>" : Z_STRVAL_P(stream)), E_NOTICE, "Done");
#endif
}
/* }}} */
@@ -4134,24 +4620,41 @@ PHP_FUNCTION(exif_read_data)
Reads the embedded thumbnail */
PHP_FUNCTION(exif_thumbnail)
{
- zval *p_width = 0, *p_height = 0, *p_imagetype = 0;
- char *p_name;
- size_t p_name_len;
int ret, arg_c = ZEND_NUM_ARGS();
image_info_type ImageInfo;
+ zval *stream;
+ zval *z_width = NULL, *z_height = NULL, *z_imagetype = NULL;
+
+ /* Parse arguments */
+ ZEND_PARSE_PARAMETERS_START(1, 4)
+ Z_PARAM_ZVAL(stream)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_ZVAL_DEREF(z_width)
+ Z_PARAM_ZVAL_DEREF(z_height)
+ Z_PARAM_ZVAL_DEREF(z_imagetype)
+ ZEND_PARSE_PARAMETERS_END();
memset(&ImageInfo, 0, sizeof(ImageInfo));
- if (arg_c!=1 && arg_c!=3 && arg_c!=4) {
- WRONG_PARAM_COUNT;
- }
+ if (Z_TYPE_P(stream) == IS_RESOURCE) {
+ php_stream *p_stream = NULL;
- if (zend_parse_parameters(arg_c, "p|z/z/z/", &p_name, &p_name_len, &p_width, &p_height, &p_imagetype) == FAILURE) {
- return;
+ php_stream_from_res(p_stream, Z_RES_P(stream));
+
+ ret = exif_read_from_stream(&ImageInfo, p_stream, 1, 0);
+ } else {
+ convert_to_string(stream);
+
+ if (!Z_STRLEN_P(stream)) {
+ exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_WARNING, "Filename cannot be empty");
+
+ RETURN_FALSE;
+ }
+
+ ret = exif_read_from_file(&ImageInfo, Z_STRVAL_P(stream), 1, 0);
}
- ret = exif_read_file(&ImageInfo, p_name, 1, 0);
- if (ret==FALSE) {
+ if (ret == FALSE) {
exif_discard_imageinfo(&ImageInfo);
RETURN_FALSE;
}
@@ -4173,14 +4676,14 @@ PHP_FUNCTION(exif_thumbnail)
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(&ImageInfo);
}
- zval_dtor(p_width);
- zval_dtor(p_height);
- ZVAL_LONG(p_width, ImageInfo.Thumbnail.width);
- ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
+ zval_dtor(z_width);
+ zval_dtor(z_height);
+ ZVAL_LONG(z_width, ImageInfo.Thumbnail.width);
+ ZVAL_LONG(z_height, ImageInfo.Thumbnail.height);
}
if (arg_c >= 4) {
- zval_dtor(p_imagetype);
- ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
+ zval_dtor(z_imagetype);
+ ZVAL_LONG(z_imagetype, ImageInfo.Thumbnail.filetype);
}
#ifdef EXIF_DEBUG
@@ -4190,7 +4693,7 @@ PHP_FUNCTION(exif_thumbnail)
exif_discard_imageinfo(&ImageInfo);
#ifdef EXIF_DEBUG
- php_error_docref1(NULL, p_name, E_NOTICE, "Done");
+ php_error_docref1(NULL, (Z_TYPE_P(stream) == IS_RESOURCE ? "<stream>" : Z_STRVAL_P(stream)), E_NOTICE, "Done");
#endif
}
/* }}} */
diff --git a/ext/exif/tests/bug50660/bug50660-1.jpg b/ext/exif/tests/bug50660/bug50660-1.jpg
new file mode 100644
index 0000000000..4bcd5e17b4
--- /dev/null
+++ b/ext/exif/tests/bug50660/bug50660-1.jpg
Binary files differ
diff --git a/ext/exif/tests/bug50660/bug50660-2.jpg b/ext/exif/tests/bug50660/bug50660-2.jpg
new file mode 100644
index 0000000000..59ccc0fd98
--- /dev/null
+++ b/ext/exif/tests/bug50660/bug50660-2.jpg
Binary files differ
diff --git a/ext/exif/tests/bug50660/bug50660.phpt b/ext/exif/tests/bug50660/bug50660.phpt
new file mode 100644
index 0000000000..00a83ce4b0
--- /dev/null
+++ b/ext/exif/tests/bug50660/bug50660.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #50660 (exif_read_data(): Illegal IFD offset (works fine with other exif readers))
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--INI--
+output_handler=
+zlib.output_compression=0
+--FILE--
+<?php
+$infile = dirname(__FILE__).'/bug50660-1.jpg';
+var_dump(exif_read_data($infile) !== false);
+$infile = dirname(__FILE__).'/bug50660-2.jpg';
+var_dump(exif_read_data($infile) !== false);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(true)
+===DONE===
diff --git a/ext/exif/tests/bug62523_1.jpg b/ext/exif/tests/bug62523_1.jpg
index 9a63d1e84d..306e33ad20 100644
--- a/ext/exif/tests/bug62523_1.jpg
+++ b/ext/exif/tests/bug62523_1.jpg
Binary files differ
diff --git a/ext/exif/tests/bug62523_1.phpt b/ext/exif/tests/bug62523_1.phpt
index 28d42f021d..e4d0cd84ef 100644
--- a/ext/exif/tests/bug62523_1.phpt
+++ b/ext/exif/tests/bug62523_1.phpt
@@ -10,9 +10,7 @@ echo "Test\n";
var_dump(count(exif_read_data(__DIR__."/bug62523_1.jpg")));
?>
Done
---EXPECTF--
+--EXPECT--
Test
-
-Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d
-int(1)
+int(84)
Done
diff --git a/ext/exif/tests/bug62523_2.jpg b/ext/exif/tests/bug62523_2.jpg
index 8d7fc6c5f4..da08b48787 100644
--- a/ext/exif/tests/bug62523_2.jpg
+++ b/ext/exif/tests/bug62523_2.jpg
Binary files differ
diff --git a/ext/exif/tests/bug62523_2.phpt b/ext/exif/tests/bug62523_2.phpt
index 689ed0679d..2aa328a9dc 100644
--- a/ext/exif/tests/bug62523_2.phpt
+++ b/ext/exif/tests/bug62523_2.phpt
@@ -10,9 +10,7 @@ echo "Test\n";
var_dump(count(exif_read_data(__DIR__."/bug62523_2.jpg")));
?>
Done
---EXPECTF--
+--EXPECT--
Test
-
-Warning: exif_read_data(bug62523_2.jpg): IFD data bad offset: 0xADB23672 length 0x0D94 in %s%ebug62523_2.php on line %d
-int(30)
+int(72)
Done
diff --git a/ext/exif/tests/bug62523_3.phpt b/ext/exif/tests/bug62523_3.phpt
index 6e11354c5a..c94872a3bf 100644
--- a/ext/exif/tests/bug62523_3.phpt
+++ b/ext/exif/tests/bug62523_3.phpt
@@ -7,12 +7,12 @@ extension_loaded("exif") or die("skip need exif");
--FILE--
<?php
echo "Test\n";
-var_dump(count(exif_read_data(__DIR__."/bug62523_3.jpg")));
+var_dump(exif_read_data(__DIR__."/bug62523_3.jpg"));
?>
Done
--EXPECTF--
Test
Warning: exif_read_data(bug62523_3.jpg): File not supported in %sbug62523_3.php on line %d
-int(1)
+bool(false)
Done
diff --git a/ext/exif/tests/bug68547.jpg b/ext/exif/tests/bug68547.jpg
new file mode 100644
index 0000000000..2a328b76a8
--- /dev/null
+++ b/ext/exif/tests/bug68547.jpg
Binary files differ
diff --git a/ext/exif/tests/bug68547.phpt b/ext/exif/tests/bug68547.phpt
new file mode 100644
index 0000000000..894c76806d
--- /dev/null
+++ b/ext/exif/tests/bug68547.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #68547 (Exif Header component value check error)
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--FILE--
+<?php
+exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . 'bug68547.jpg');
+?>
+===DONE===
+--EXPECTF--
+Warning: exif_read_data(bug68547.jpg): Process tag(x9C9E=Keywords ): Illegal components(%d) in %sbug68547.php on line %d
+===DONE=== \ No newline at end of file
diff --git a/ext/exif/tests/bug68799.phpt b/ext/exif/tests/bug68799.phpt
index f50a41b402..a24664109d 100644
--- a/ext/exif/tests/bug68799.phpt
+++ b/ext/exif/tests/bug68799.phpt
@@ -39,6 +39,7 @@ print_r(exif_read_data(__DIR__.'/bug68799.jpg'));
?>
--EXPECTF--
+Warning: exif_read_data(bug68799.jpg): Process tag(x9C9D=Author ): Illegal components(%d) in %s on line %d
Array
(
[FileName] => bug68799.jpg
@@ -46,7 +47,7 @@ Array
[FileSize] => 735
[FileType] => 2
[MimeType] => image/jpeg
- [SectionsFound] => ANY_TAG, IFD0, WINXP
+ [SectionsFound] => ANY_TAG, IFD0
[COMPUTED] => Array
(
[html] => width="1" height="1"
@@ -59,5 +60,4 @@ Array
[XResolution] => 96/1
[YResolution] => 96/1
[ResolutionUnit] => 2
- [Author] =>
)
diff --git a/ext/exif/tests/bug71534.phpt b/ext/exif/tests/bug71534.phpt
new file mode 100644
index 0000000000..1f5fc9db04
--- /dev/null
+++ b/ext/exif/tests/bug71534.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #71534 (Type confusion in exif_read_data() leading to heap overflow in debug mode)
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--FILE--
+<?php
+// This is kinda bad, I know! But, this generates about 200+ warnings due to its
+// broken TIFF format
+var_dump(@exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . 'bug71534.tiff') === false);
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/exif/tests/bug71534.tiff b/ext/exif/tests/bug71534.tiff
new file mode 100644
index 0000000000..1a224d54c9
--- /dev/null
+++ b/ext/exif/tests/bug71534.tiff
Binary files differ
diff --git a/ext/exif/tests/bug72094.phpt b/ext/exif/tests/bug72094.phpt
index 611faf9152..486c3732a1 100644
--- a/ext/exif/tests/bug72094.phpt
+++ b/ext/exif/tests/bug72094.phpt
@@ -23,7 +23,7 @@ Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal
Warning: exif_read_data(bug72094_1.jpg): Process tag(x8298=Copyright ): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
-Warning: exif_read_data(bug72094_1.jpg): Illegal IFD offset in %s%ebug72094.php on line %d
+Warning: exif_read_data(bug72094_1.jpg): Illegal IFD offset in %sbug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): File structure corrupted in %s%ebug72094.php on line %d
@@ -47,7 +47,7 @@ Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
-Warning: exif_read_data(bug72094_3.jpg): Illegal IFD size in %s%ebug72094.php on line %d
+Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal components(%d) in %s%ebug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): File structure corrupted in %s%ebug72094.php on line %d
diff --git a/ext/exif/tests/bug72735/bug72682.phpt b/ext/exif/tests/bug72735/bug72682.phpt
new file mode 100644
index 0000000000..b3f17791a3
--- /dev/null
+++ b/ext/exif/tests/bug72735/bug72682.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #72735 MakerNote regression
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--FILE--
+<?php
+foreach (['nokia.jpg', 'samsung.jpg', 'panasonic.jpg'] as $picture) {
+ echo $picture . ': ';
+
+ $info = exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . $picture);
+ var_dump($info['MakerNote']);
+}
+?>
+--EXPECTF--
+nokia.jpg: string(5) "Nikon"
+samsung.jpg: NULL
+panasonic.jpg: string(9) "Panasonic"
diff --git a/ext/exif/tests/bug72735/bug72735.phpt b/ext/exif/tests/bug72735/bug72735.phpt
new file mode 100644
index 0000000000..38d9ed2199
--- /dev/null
+++ b/ext/exif/tests/bug72735/bug72735.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #72735 (Samsung picture thumb not read (zero size))
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--FILE--
+<?php
+foreach (['nokia.jpg', 'samsung.jpg', 'panasonic.jpg'] as $picture) {
+ echo $picture . ': ';
+
+ $len = strlen(exif_thumbnail(__DIR__ . DIRECTORY_SEPARATOR . $picture));
+
+ if (!$len) {
+ echo 'Error, no length returned', PHP_EOL;
+
+ continue;
+ }
+
+ echo 'int(' . $len . ')', PHP_EOL;
+}
+?>
+--EXPECTF--
+nokia.jpg: int(5899)
+samsung.jpg: int(5778)
+panasonic.jpg: int(651)
diff --git a/ext/exif/tests/bug72735/nokia.jpg b/ext/exif/tests/bug72735/nokia.jpg
new file mode 100644
index 0000000000..6faa84b1a5
--- /dev/null
+++ b/ext/exif/tests/bug72735/nokia.jpg
Binary files differ
diff --git a/ext/exif/tests/bug72735/panasonic.jpg b/ext/exif/tests/bug72735/panasonic.jpg
new file mode 100644
index 0000000000..35713e63a1
--- /dev/null
+++ b/ext/exif/tests/bug72735/panasonic.jpg
Binary files differ
diff --git a/ext/exif/tests/bug72735/samsung.jpg b/ext/exif/tests/bug72735/samsung.jpg
new file mode 100644
index 0000000000..1ec51eaf0c
--- /dev/null
+++ b/ext/exif/tests/bug72735/samsung.jpg
Binary files differ
diff --git a/ext/exif/tests/bug72819/bug72819.jpg b/ext/exif/tests/bug72819/bug72819.jpg
new file mode 100644
index 0000000000..933719d1cf
--- /dev/null
+++ b/ext/exif/tests/bug72819/bug72819.jpg
Binary files differ
diff --git a/ext/exif/tests/bug72819/bug72819.phpt b/ext/exif/tests/bug72819/bug72819.phpt
new file mode 100644
index 0000000000..f71fa31663
--- /dev/null
+++ b/ext/exif/tests/bug72819/bug72819.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #72819 (EXIF thumbnails not read anymore)
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--INI--
+output_handler=
+zlib.output_compression=0
+--FILE--
+<?php
+$infile = dirname(__FILE__).'/bug72819.jpg';
+var_dump(strlen(exif_thumbnail($infile)));
+?>
+===DONE===
+--EXPECT--
+int(5448)
+===DONE===
diff --git a/ext/exif/tests/bug73115/bug73115.jpg b/ext/exif/tests/bug73115/bug73115.jpg
new file mode 100644
index 0000000000..86dec0b0f9
--- /dev/null
+++ b/ext/exif/tests/bug73115/bug73115.jpg
Binary files differ
diff --git a/ext/exif/tests/bug73115/bug73115.phpt b/ext/exif/tests/bug73115/bug73115.phpt
new file mode 100644
index 0000000000..969ddebe9f
--- /dev/null
+++ b/ext/exif/tests/bug73115/bug73115.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #73115 (exif_read_data triggers warning on reading binary strings)
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--INI--
+output_handler=
+zlib.output_compression=0
+--FILE--
+<?php
+$infile = dirname(__FILE__).'/bug73115.jpg';
+var_dump(count(exif_read_data($infile)));
+?>
+===DONE===
+--EXPECT--
+int(80)
+===DONE===
diff --git a/ext/exif/tests/bug73737.phpt b/ext/exif/tests/bug73737.phpt
index 21eaf80585..c61e8faf65 100644
--- a/ext/exif/tests/bug73737.phpt
+++ b/ext/exif/tests/bug73737.phpt
@@ -8,5 +8,7 @@ Bug #73737 (Crash when parsing a tag format)
var_dump($exif);
?>
--EXPECTF--
+Warning: exif_thumbnail(bug73737.tiff): Process tag(x0100=ImageWidth ): Illegal components(0) in %s on line %d
+
Warning: exif_thumbnail(bug73737.tiff): Error in TIFF: filesize(x0030) less than start of IFD dir(x10102) in %s line %d
bool(false)
diff --git a/ext/exif/tests/bug74428/bug74428.jpg b/ext/exif/tests/bug74428/bug74428.jpg
new file mode 100644
index 0000000000..73c7805cec
--- /dev/null
+++ b/ext/exif/tests/bug74428/bug74428.jpg
Binary files differ
diff --git a/ext/exif/tests/bug74428/bug74428.phpt b/ext/exif/tests/bug74428/bug74428.phpt
new file mode 100644
index 0000000000..b2beca3f21
--- /dev/null
+++ b/ext/exif/tests/bug74428/bug74428.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #74428 (exif_read_data(): "Illegal IFD size" warning occurs with correct exif format)
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--INI--
+output_handler=
+zlib.output_compression=0
+--FILE--
+<?php
+$infile = dirname(__FILE__).'/bug74428.jpg';
+var_dump(exif_read_data($infile));
+?>
+===DONE===
+--EXPECTF--
+array(11) {
+ ["FileName"]=>
+ string(12) "bug74428.jpg"
+ ["FileDateTime"]=>
+ int(%d)
+ ["FileSize"]=>
+ int(1902)
+ ["FileType"]=>
+ int(2)
+ ["MimeType"]=>
+ string(10) "image/jpeg"
+ ["SectionsFound"]=>
+ string(19) "ANY_TAG, IFD0, EXIF"
+ ["COMPUTED"]=>
+ array(5) {
+ ["html"]=>
+ string(22) "width="88" height="28""
+ ["Height"]=>
+ int(28)
+ ["Width"]=>
+ int(88)
+ ["IsColor"]=>
+ int(1)
+ ["ByteOrderMotorola"]=>
+ int(0)
+ }
+ ["Orientation"]=>
+ int(1)
+ ["Exif_IFD_Pointer"]=>
+ int(38)
+ ["ExifImageWidth"]=>
+ int(88)
+ ["ExifImageLength"]=>
+ int(28)
+}
+===DONE===
diff --git a/ext/exif/tests/exif_read_data_streams.phpt b/ext/exif/tests/exif_read_data_streams.phpt
new file mode 100644
index 0000000000..59353e7f81
--- /dev/null
+++ b/ext/exif/tests/exif_read_data_streams.phpt
@@ -0,0 +1,1634 @@
+--TEST--
+exif_read_data() with streams test
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--INI--
+output_handler=
+zlib.output_compression=0
+--FILE--
+<?php
+$fp = fopen(__DIR__ . '/image027.tiff', 'rb');
+
+var_dump(exif_read_data($fp));
+
+fclose($fp);
+?>
+--EXPECTF--
+array(31) {
+ ["FileName"]=>
+ string(13) "image027.tiff"
+ ["FileDateTime"]=>
+ int(%d)
+ ["FileSize"]=>
+ int(%d)
+ ["FileType"]=>
+ int(8)
+ ["MimeType"]=>
+ string(10) "image/tiff"
+ ["SectionsFound"]=>
+ string(28) "ANY_TAG, IFD0, EXIF, INTEROP"
+ ["COMPUTED"]=>
+ array(8) {
+ ["html"]=>
+ string(20) "width="1" height="1""
+ ["Height"]=>
+ int(1)
+ ["Width"]=>
+ int(1)
+ ["IsColor"]=>
+ int(1)
+ ["ByteOrderMotorola"]=>
+ int(1)
+ ["Copyright"]=>
+ string(24) "Eric Stewart, Hex Editor"
+ ["Copyright.Photographer"]=>
+ string(12) "Eric Stewart"
+ ["Copyright.Editor"]=>
+ string(10) "Hex Editor"
+ }
+ ["ImageWidth"]=>
+ int(1)
+ ["ImageLength"]=>
+ int(1)
+ ["BitsPerSample"]=>
+ int(8)
+ ["Compression"]=>
+ int(5)
+ ["PhotometricInterpretation"]=>
+ int(3)
+ ["ImageDescription"]=>
+ string(15) "My description."
+ ["Make"]=>
+ string(11) "OpenShutter"
+ ["Model"]=>
+ string(8) "OS 1.0.0"
+ ["StripOffsets"]=>
+ int(1980)
+ ["SamplesPerPixel"]=>
+ int(1)
+ ["RowsPerStrip"]=>
+ int(8)
+ ["StripByteCounts"]=>
+ int(4)
+ ["XResolution"]=>
+ string(17) "381681664/2097152"
+ ["YResolution"]=>
+ string(17) "381681664/2097152"
+ ["PlanarConfiguration"]=>
+ int(1)
+ ["ResolutionUnit"]=>
+ int(2)
+ ["Artist"]=>
+ string(12) "Eric Stewart"
+ ["ColorMap"]=>
+ array(768) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(65280)
+ [2]=>
+ int(32512)
+ [3]=>
+ int(49152)
+ [4]=>
+ int(99)
+ [5]=>
+ int(115)
+ [6]=>
+ int(116)
+ [7]=>
+ int(101)
+ [8]=>
+ int(119)
+ [9]=>
+ int(97)
+ [10]=>
+ int(114)
+ [11]=>
+ int(116)
+ [12]=>
+ int(0)
+ [13]=>
+ int(0)
+ [14]=>
+ int(0)
+ [15]=>
+ int(0)
+ [16]=>
+ int(0)
+ [17]=>
+ int(0)
+ [18]=>
+ int(0)
+ [19]=>
+ int(0)
+ [20]=>
+ int(0)
+ [21]=>
+ int(0)
+ [22]=>
+ int(0)
+ [23]=>
+ int(0)
+ [24]=>
+ int(0)
+ [25]=>
+ int(0)
+ [26]=>
+ int(0)
+ [27]=>
+ int(0)
+ [28]=>
+ int(0)
+ [29]=>
+ int(0)
+ [30]=>
+ int(0)
+ [31]=>
+ int(0)
+ [32]=>
+ int(0)
+ [33]=>
+ int(0)
+ [34]=>
+ int(0)
+ [35]=>
+ int(0)
+ [36]=>
+ int(0)
+ [37]=>
+ int(0)
+ [38]=>
+ int(0)
+ [39]=>
+ int(0)
+ [40]=>
+ int(0)
+ [41]=>
+ int(0)
+ [42]=>
+ int(0)
+ [43]=>
+ int(0)
+ [44]=>
+ int(0)
+ [45]=>
+ int(0)
+ [46]=>
+ int(0)
+ [47]=>
+ int(0)
+ [48]=>
+ int(0)
+ [49]=>
+ int(0)
+ [50]=>
+ int(0)
+ [51]=>
+ int(0)
+ [52]=>
+ int(0)
+ [53]=>
+ int(0)
+ [54]=>
+ int(0)
+ [55]=>
+ int(0)
+ [56]=>
+ int(0)
+ [57]=>
+ int(0)
+ [58]=>
+ int(0)
+ [59]=>
+ int(0)
+ [60]=>
+ int(0)
+ [61]=>
+ int(0)
+ [62]=>
+ int(0)
+ [63]=>
+ int(0)
+ [64]=>
+ int(0)
+ [65]=>
+ int(0)
+ [66]=>
+ int(0)
+ [67]=>
+ int(0)
+ [68]=>
+ int(0)
+ [69]=>
+ int(0)
+ [70]=>
+ int(0)
+ [71]=>
+ int(0)
+ [72]=>
+ int(0)
+ [73]=>
+ int(0)
+ [74]=>
+ int(0)
+ [75]=>
+ int(0)
+ [76]=>
+ int(0)
+ [77]=>
+ int(0)
+ [78]=>
+ int(0)
+ [79]=>
+ int(0)
+ [80]=>
+ int(0)
+ [81]=>
+ int(0)
+ [82]=>
+ int(0)
+ [83]=>
+ int(0)
+ [84]=>
+ int(0)
+ [85]=>
+ int(0)
+ [86]=>
+ int(0)
+ [87]=>
+ int(0)
+ [88]=>
+ int(0)
+ [89]=>
+ int(0)
+ [90]=>
+ int(0)
+ [91]=>
+ int(0)
+ [92]=>
+ int(0)
+ [93]=>
+ int(0)
+ [94]=>
+ int(0)
+ [95]=>
+ int(0)
+ [96]=>
+ int(0)
+ [97]=>
+ int(0)
+ [98]=>
+ int(0)
+ [99]=>
+ int(0)
+ [100]=>
+ int(0)
+ [101]=>
+ int(0)
+ [102]=>
+ int(0)
+ [103]=>
+ int(0)
+ [104]=>
+ int(0)
+ [105]=>
+ int(0)
+ [106]=>
+ int(0)
+ [107]=>
+ int(0)
+ [108]=>
+ int(0)
+ [109]=>
+ int(0)
+ [110]=>
+ int(0)
+ [111]=>
+ int(0)
+ [112]=>
+ int(0)
+ [113]=>
+ int(0)
+ [114]=>
+ int(0)
+ [115]=>
+ int(0)
+ [116]=>
+ int(0)
+ [117]=>
+ int(0)
+ [118]=>
+ int(0)
+ [119]=>
+ int(0)
+ [120]=>
+ int(0)
+ [121]=>
+ int(0)
+ [122]=>
+ int(0)
+ [123]=>
+ int(0)
+ [124]=>
+ int(0)
+ [125]=>
+ int(0)
+ [126]=>
+ int(0)
+ [127]=>
+ int(0)
+ [128]=>
+ int(0)
+ [129]=>
+ int(0)
+ [130]=>
+ int(0)
+ [131]=>
+ int(0)
+ [132]=>
+ int(0)
+ [133]=>
+ int(0)
+ [134]=>
+ int(0)
+ [135]=>
+ int(0)
+ [136]=>
+ int(0)
+ [137]=>
+ int(0)
+ [138]=>
+ int(0)
+ [139]=>
+ int(0)
+ [140]=>
+ int(0)
+ [141]=>
+ int(0)
+ [142]=>
+ int(0)
+ [143]=>
+ int(0)
+ [144]=>
+ int(0)
+ [145]=>
+ int(0)
+ [146]=>
+ int(0)
+ [147]=>
+ int(0)
+ [148]=>
+ int(0)
+ [149]=>
+ int(0)
+ [150]=>
+ int(0)
+ [151]=>
+ int(0)
+ [152]=>
+ int(0)
+ [153]=>
+ int(0)
+ [154]=>
+ int(0)
+ [155]=>
+ int(0)
+ [156]=>
+ int(0)
+ [157]=>
+ int(0)
+ [158]=>
+ int(0)
+ [159]=>
+ int(0)
+ [160]=>
+ int(0)
+ [161]=>
+ int(0)
+ [162]=>
+ int(0)
+ [163]=>
+ int(0)
+ [164]=>
+ int(0)
+ [165]=>
+ int(0)
+ [166]=>
+ int(0)
+ [167]=>
+ int(0)
+ [168]=>
+ int(0)
+ [169]=>
+ int(0)
+ [170]=>
+ int(0)
+ [171]=>
+ int(0)
+ [172]=>
+ int(0)
+ [173]=>
+ int(0)
+ [174]=>
+ int(0)
+ [175]=>
+ int(0)
+ [176]=>
+ int(0)
+ [177]=>
+ int(0)
+ [178]=>
+ int(0)
+ [179]=>
+ int(0)
+ [180]=>
+ int(0)
+ [181]=>
+ int(0)
+ [182]=>
+ int(0)
+ [183]=>
+ int(0)
+ [184]=>
+ int(0)
+ [185]=>
+ int(0)
+ [186]=>
+ int(0)
+ [187]=>
+ int(0)
+ [188]=>
+ int(0)
+ [189]=>
+ int(0)
+ [190]=>
+ int(0)
+ [191]=>
+ int(0)
+ [192]=>
+ int(0)
+ [193]=>
+ int(0)
+ [194]=>
+ int(0)
+ [195]=>
+ int(0)
+ [196]=>
+ int(0)
+ [197]=>
+ int(0)
+ [198]=>
+ int(0)
+ [199]=>
+ int(0)
+ [200]=>
+ int(0)
+ [201]=>
+ int(0)
+ [202]=>
+ int(0)
+ [203]=>
+ int(0)
+ [204]=>
+ int(0)
+ [205]=>
+ int(0)
+ [206]=>
+ int(0)
+ [207]=>
+ int(0)
+ [208]=>
+ int(0)
+ [209]=>
+ int(0)
+ [210]=>
+ int(0)
+ [211]=>
+ int(0)
+ [212]=>
+ int(0)
+ [213]=>
+ int(0)
+ [214]=>
+ int(0)
+ [215]=>
+ int(0)
+ [216]=>
+ int(0)
+ [217]=>
+ int(0)
+ [218]=>
+ int(0)
+ [219]=>
+ int(0)
+ [220]=>
+ int(0)
+ [221]=>
+ int(0)
+ [222]=>
+ int(0)
+ [223]=>
+ int(0)
+ [224]=>
+ int(0)
+ [225]=>
+ int(0)
+ [226]=>
+ int(0)
+ [227]=>
+ int(0)
+ [228]=>
+ int(0)
+ [229]=>
+ int(0)
+ [230]=>
+ int(0)
+ [231]=>
+ int(0)
+ [232]=>
+ int(0)
+ [233]=>
+ int(0)
+ [234]=>
+ int(0)
+ [235]=>
+ int(0)
+ [236]=>
+ int(0)
+ [237]=>
+ int(0)
+ [238]=>
+ int(0)
+ [239]=>
+ int(0)
+ [240]=>
+ int(0)
+ [241]=>
+ int(0)
+ [242]=>
+ int(0)
+ [243]=>
+ int(0)
+ [244]=>
+ int(0)
+ [245]=>
+ int(0)
+ [246]=>
+ int(0)
+ [247]=>
+ int(0)
+ [248]=>
+ int(0)
+ [249]=>
+ int(0)
+ [250]=>
+ int(0)
+ [251]=>
+ int(0)
+ [252]=>
+ int(0)
+ [253]=>
+ int(0)
+ [254]=>
+ int(0)
+ [255]=>
+ int(1)
+ [256]=>
+ int(0)
+ [257]=>
+ int(65280)
+ [258]=>
+ int(32512)
+ [259]=>
+ int(49152)
+ [260]=>
+ int(0)
+ [261]=>
+ int(0)
+ [262]=>
+ int(0)
+ [263]=>
+ int(0)
+ [264]=>
+ int(0)
+ [265]=>
+ int(0)
+ [266]=>
+ int(0)
+ [267]=>
+ int(0)
+ [268]=>
+ int(0)
+ [269]=>
+ int(0)
+ [270]=>
+ int(0)
+ [271]=>
+ int(0)
+ [272]=>
+ int(11945)
+ [273]=>
+ int(1914)
+ [274]=>
+ int(0)
+ [275]=>
+ int(24609)
+ [276]=>
+ int(1088)
+ [277]=>
+ int(960)
+ [278]=>
+ int(0)
+ [279]=>
+ int(0)
+ [280]=>
+ int(20000)
+ [281]=>
+ int(8414)
+ [282]=>
+ int(65436)
+ [283]=>
+ int(0)
+ [284]=>
+ int(47655)
+ [285]=>
+ int(8)
+ [286]=>
+ int(37936)
+ [287]=>
+ int(8406)
+ [288]=>
+ int(0)
+ [289]=>
+ int(0)
+ [290]=>
+ int(0)
+ [291]=>
+ int(0)
+ [292]=>
+ int(0)
+ [293]=>
+ int(0)
+ [294]=>
+ int(0)
+ [295]=>
+ int(0)
+ [296]=>
+ int(0)
+ [297]=>
+ int(64652)
+ [298]=>
+ int(50264)
+ [299]=>
+ int(0)
+ [300]=>
+ int(0)
+ [301]=>
+ int(64887)
+ [302]=>
+ int(50264)
+ [303]=>
+ int(0)
+ [304]=>
+ int(25714)
+ [305]=>
+ int(26220)
+ [306]=>
+ int(17235)
+ [307]=>
+ int(19777)
+ [308]=>
+ int(65535)
+ [309]=>
+ int(65535)
+ [310]=>
+ int(65535)
+ [311]=>
+ int(65535)
+ [312]=>
+ int(65535)
+ [313]=>
+ int(65535)
+ [314]=>
+ int(65535)
+ [315]=>
+ int(65535)
+ [316]=>
+ int(501)
+ [317]=>
+ int(0)
+ [318]=>
+ int(20)
+ [319]=>
+ int(0)
+ [320]=>
+ int(0)
+ [321]=>
+ int(0)
+ [322]=>
+ int(16877)
+ [323]=>
+ int(0)
+ [324]=>
+ int(3)
+ [325]=>
+ int(0)
+ [326]=>
+ int(0)
+ [327]=>
+ int(0)
+ [328]=>
+ int(0)
+ [329]=>
+ int(0)
+ [330]=>
+ int(0)
+ [331]=>
+ int(0)
+ [332]=>
+ int(65535)
+ [333]=>
+ int(65535)
+ [334]=>
+ int(65535)
+ [335]=>
+ int(65535)
+ [336]=>
+ int(65535)
+ [337]=>
+ int(65535)
+ [338]=>
+ int(65535)
+ [339]=>
+ int(65535)
+ [340]=>
+ int(0)
+ [341]=>
+ int(0)
+ [342]=>
+ int(52840)
+ [343]=>
+ int(2025)
+ [344]=>
+ int(16)
+ [345]=>
+ int(57377)
+ [346]=>
+ int(1024)
+ [347]=>
+ int(960)
+ [348]=>
+ int(0)
+ [349]=>
+ int(0)
+ [350]=>
+ int(27136)
+ [351]=>
+ int(8414)
+ [352]=>
+ int(65436)
+ [353]=>
+ int(0)
+ [354]=>
+ int(47655)
+ [355]=>
+ int(8)
+ [356]=>
+ int(62400)
+ [357]=>
+ int(8407)
+ [358]=>
+ int(0)
+ [359]=>
+ int(0)
+ [360]=>
+ int(0)
+ [361]=>
+ int(0)
+ [362]=>
+ int(0)
+ [363]=>
+ int(0)
+ [364]=>
+ int(0)
+ [365]=>
+ int(0)
+ [366]=>
+ int(0)
+ [367]=>
+ int(64857)
+ [368]=>
+ int(50264)
+ [369]=>
+ int(0)
+ [370]=>
+ int(0)
+ [371]=>
+ int(64892)
+ [372]=>
+ int(50264)
+ [373]=>
+ int(0)
+ [374]=>
+ int(25714)
+ [375]=>
+ int(26220)
+ [376]=>
+ int(17235)
+ [377]=>
+ int(19777)
+ [378]=>
+ int(65535)
+ [379]=>
+ int(65535)
+ [380]=>
+ int(65535)
+ [381]=>
+ int(65535)
+ [382]=>
+ int(65535)
+ [383]=>
+ int(65535)
+ [384]=>
+ int(65535)
+ [385]=>
+ int(65535)
+ [386]=>
+ int(501)
+ [387]=>
+ int(0)
+ [388]=>
+ int(20)
+ [389]=>
+ int(0)
+ [390]=>
+ int(0)
+ [391]=>
+ int(0)
+ [392]=>
+ int(16877)
+ [393]=>
+ int(0)
+ [394]=>
+ int(3)
+ [395]=>
+ int(0)
+ [396]=>
+ int(0)
+ [397]=>
+ int(0)
+ [398]=>
+ int(0)
+ [399]=>
+ int(0)
+ [400]=>
+ int(0)
+ [401]=>
+ int(0)
+ [402]=>
+ int(65535)
+ [403]=>
+ int(65535)
+ [404]=>
+ int(65535)
+ [405]=>
+ int(65535)
+ [406]=>
+ int(65535)
+ [407]=>
+ int(65535)
+ [408]=>
+ int(65535)
+ [409]=>
+ int(65535)
+ [410]=>
+ int(0)
+ [411]=>
+ int(0)
+ [412]=>
+ int(53440)
+ [413]=>
+ int(2025)
+ [414]=>
+ int(16)
+ [415]=>
+ int(57377)
+ [416]=>
+ int(1024)
+ [417]=>
+ int(960)
+ [418]=>
+ int(0)
+ [419]=>
+ int(0)
+ [420]=>
+ int(41120)
+ [421]=>
+ int(9024)
+ [422]=>
+ int(65436)
+ [423]=>
+ int(0)
+ [424]=>
+ int(47655)
+ [425]=>
+ int(8)
+ [426]=>
+ int(24480)
+ [427]=>
+ int(8404)
+ [428]=>
+ int(0)
+ [429]=>
+ int(0)
+ [430]=>
+ int(0)
+ [431]=>
+ int(0)
+ [432]=>
+ int(0)
+ [433]=>
+ int(0)
+ [434]=>
+ int(0)
+ [435]=>
+ int(0)
+ [436]=>
+ int(0)
+ [437]=>
+ int(21315)
+ [438]=>
+ int(50294)
+ [439]=>
+ int(0)
+ [440]=>
+ int(0)
+ [441]=>
+ int(53635)
+ [442]=>
+ int(50294)
+ [443]=>
+ int(0)
+ [444]=>
+ int(25714)
+ [445]=>
+ int(26220)
+ [446]=>
+ int(17235)
+ [447]=>
+ int(19777)
+ [448]=>
+ int(65535)
+ [449]=>
+ int(65535)
+ [450]=>
+ int(65535)
+ [451]=>
+ int(65535)
+ [452]=>
+ int(65535)
+ [453]=>
+ int(65535)
+ [454]=>
+ int(65535)
+ [455]=>
+ int(65535)
+ [456]=>
+ int(501)
+ [457]=>
+ int(0)
+ [458]=>
+ int(20)
+ [459]=>
+ int(0)
+ [460]=>
+ int(0)
+ [461]=>
+ int(0)
+ [462]=>
+ int(16877)
+ [463]=>
+ int(0)
+ [464]=>
+ int(3)
+ [465]=>
+ int(0)
+ [466]=>
+ int(0)
+ [467]=>
+ int(0)
+ [468]=>
+ int(0)
+ [469]=>
+ int(0)
+ [470]=>
+ int(0)
+ [471]=>
+ int(0)
+ [472]=>
+ int(65535)
+ [473]=>
+ int(65535)
+ [474]=>
+ int(65535)
+ [475]=>
+ int(65535)
+ [476]=>
+ int(65535)
+ [477]=>
+ int(65535)
+ [478]=>
+ int(65535)
+ [479]=>
+ int(65535)
+ [480]=>
+ int(0)
+ [481]=>
+ int(0)
+ [482]=>
+ int(54028)
+ [483]=>
+ int(2772)
+ [484]=>
+ int(16)
+ [485]=>
+ int(57377)
+ [486]=>
+ int(1024)
+ [487]=>
+ int(960)
+ [488]=>
+ int(0)
+ [489]=>
+ int(0)
+ [490]=>
+ int(42384)
+ [491]=>
+ int(8408)
+ [492]=>
+ int(65436)
+ [493]=>
+ int(0)
+ [494]=>
+ int(47655)
+ [495]=>
+ int(8)
+ [496]=>
+ int(1136)
+ [497]=>
+ int(8348)
+ [498]=>
+ int(0)
+ [499]=>
+ int(0)
+ [500]=>
+ int(0)
+ [501]=>
+ int(0)
+ [502]=>
+ int(0)
+ [503]=>
+ int(0)
+ [504]=>
+ int(0)
+ [505]=>
+ int(0)
+ [506]=>
+ int(0)
+ [507]=>
+ int(12326)
+ [508]=>
+ int(50261)
+ [509]=>
+ int(0)
+ [510]=>
+ int(0)
+ [511]=>
+ int(12326)
+ [512]=>
+ int(0)
+ [513]=>
+ int(65280)
+ [514]=>
+ int(32512)
+ [515]=>
+ int(49152)
+ [516]=>
+ int(0)
+ [517]=>
+ int(0)
+ [518]=>
+ int(22663)
+ [519]=>
+ int(2)
+ [520]=>
+ int(0)
+ [521]=>
+ int(0)
+ [522]=>
+ int(24576)
+ [523]=>
+ int(2)
+ [524]=>
+ int(0)
+ [525]=>
+ int(0)
+ [526]=>
+ int(501)
+ [527]=>
+ int(0)
+ [528]=>
+ int(20)
+ [529]=>
+ int(0)
+ [530]=>
+ int(0)
+ [531]=>
+ int(0)
+ [532]=>
+ int(33188)
+ [533]=>
+ int(0)
+ [534]=>
+ int(0)
+ [535]=>
+ int(0)
+ [536]=>
+ int(0)
+ [537]=>
+ int(0)
+ [538]=>
+ int(0)
+ [539]=>
+ int(0)
+ [540]=>
+ int(0)
+ [541]=>
+ int(0)
+ [542]=>
+ int(0)
+ [543]=>
+ int(0)
+ [544]=>
+ int(0)
+ [545]=>
+ int(0)
+ [546]=>
+ int(0)
+ [547]=>
+ int(0)
+ [548]=>
+ int(0)
+ [549]=>
+ int(0)
+ [550]=>
+ int(0)
+ [551]=>
+ int(0)
+ [552]=>
+ int(51766)
+ [553]=>
+ int(1946)
+ [554]=>
+ int(0)
+ [555]=>
+ int(24609)
+ [556]=>
+ int(1088)
+ [557]=>
+ int(960)
+ [558]=>
+ int(0)
+ [559]=>
+ int(0)
+ [560]=>
+ int(0)
+ [561]=>
+ int(0)
+ [562]=>
+ int(25116)
+ [563]=>
+ int(2012)
+ [564]=>
+ int(0)
+ [565]=>
+ int(0)
+ [566]=>
+ int(0)
+ [567]=>
+ int(0)
+ [568]=>
+ int(0)
+ [569]=>
+ int(0)
+ [570]=>
+ int(0)
+ [571]=>
+ int(0)
+ [572]=>
+ int(0)
+ [573]=>
+ int(0)
+ [574]=>
+ int(0)
+ [575]=>
+ int(0)
+ [576]=>
+ int(0)
+ [577]=>
+ int(0)
+ [578]=>
+ int(0)
+ [579]=>
+ int(0)
+ [580]=>
+ int(0)
+ [581]=>
+ int(0)
+ [582]=>
+ int(0)
+ [583]=>
+ int(0)
+ [584]=>
+ int(0)
+ [585]=>
+ int(0)
+ [586]=>
+ int(0)
+ [587]=>
+ int(0)
+ [588]=>
+ int(0)
+ [589]=>
+ int(0)
+ [590]=>
+ int(0)
+ [591]=>
+ int(0)
+ [592]=>
+ int(0)
+ [593]=>
+ int(0)
+ [594]=>
+ int(0)
+ [595]=>
+ int(0)
+ [596]=>
+ int(0)
+ [597]=>
+ int(0)
+ [598]=>
+ int(0)
+ [599]=>
+ int(0)
+ [600]=>
+ int(0)
+ [601]=>
+ int(0)
+ [602]=>
+ int(0)
+ [603]=>
+ int(0)
+ [604]=>
+ int(0)
+ [605]=>
+ int(0)
+ [606]=>
+ int(0)
+ [607]=>
+ int(0)
+ [608]=>
+ int(0)
+ [609]=>
+ int(0)
+ [610]=>
+ int(0)
+ [611]=>
+ int(0)
+ [612]=>
+ int(0)
+ [613]=>
+ int(0)
+ [614]=>
+ int(0)
+ [615]=>
+ int(0)
+ [616]=>
+ int(0)
+ [617]=>
+ int(0)
+ [618]=>
+ int(0)
+ [619]=>
+ int(0)
+ [620]=>
+ int(0)
+ [621]=>
+ int(0)
+ [622]=>
+ int(0)
+ [623]=>
+ int(0)
+ [624]=>
+ int(0)
+ [625]=>
+ int(0)
+ [626]=>
+ int(0)
+ [627]=>
+ int(0)
+ [628]=>
+ int(0)
+ [629]=>
+ int(0)
+ [630]=>
+ int(0)
+ [631]=>
+ int(0)
+ [632]=>
+ int(0)
+ [633]=>
+ int(0)
+ [634]=>
+ int(0)
+ [635]=>
+ int(0)
+ [636]=>
+ int(0)
+ [637]=>
+ int(0)
+ [638]=>
+ int(0)
+ [639]=>
+ int(0)
+ [640]=>
+ int(0)
+ [641]=>
+ int(0)
+ [642]=>
+ int(0)
+ [643]=>
+ int(0)
+ [644]=>
+ int(0)
+ [645]=>
+ int(0)
+ [646]=>
+ int(0)
+ [647]=>
+ int(0)
+ [648]=>
+ int(0)
+ [649]=>
+ int(0)
+ [650]=>
+ int(0)
+ [651]=>
+ int(0)
+ [652]=>
+ int(0)
+ [653]=>
+ int(0)
+ [654]=>
+ int(0)
+ [655]=>
+ int(0)
+ [656]=>
+ int(0)
+ [657]=>
+ int(0)
+ [658]=>
+ int(0)
+ [659]=>
+ int(0)
+ [660]=>
+ int(0)
+ [661]=>
+ int(0)
+ [662]=>
+ int(0)
+ [663]=>
+ int(0)
+ [664]=>
+ int(0)
+ [665]=>
+ int(0)
+ [666]=>
+ int(0)
+ [667]=>
+ int(0)
+ [668]=>
+ int(0)
+ [669]=>
+ int(0)
+ [670]=>
+ int(0)
+ [671]=>
+ int(0)
+ [672]=>
+ int(0)
+ [673]=>
+ int(0)
+ [674]=>
+ int(0)
+ [675]=>
+ int(0)
+ [676]=>
+ int(0)
+ [677]=>
+ int(0)
+ [678]=>
+ int(0)
+ [679]=>
+ int(0)
+ [680]=>
+ int(0)
+ [681]=>
+ int(0)
+ [682]=>
+ int(0)
+ [683]=>
+ int(0)
+ [684]=>
+ int(0)
+ [685]=>
+ int(0)
+ [686]=>
+ int(0)
+ [687]=>
+ int(0)
+ [688]=>
+ int(0)
+ [689]=>
+ int(0)
+ [690]=>
+ int(0)
+ [691]=>
+ int(0)
+ [692]=>
+ int(0)
+ [693]=>
+ int(0)
+ [694]=>
+ int(0)
+ [695]=>
+ int(0)
+ [696]=>
+ int(0)
+ [697]=>
+ int(0)
+ [698]=>
+ int(0)
+ [699]=>
+ int(0)
+ [700]=>
+ int(0)
+ [701]=>
+ int(0)
+ [702]=>
+ int(0)
+ [703]=>
+ int(0)
+ [704]=>
+ int(0)
+ [705]=>
+ int(0)
+ [706]=>
+ int(0)
+ [707]=>
+ int(0)
+ [708]=>
+ int(0)
+ [709]=>
+ int(0)
+ [710]=>
+ int(0)
+ [711]=>
+ int(0)
+ [712]=>
+ int(0)
+ [713]=>
+ int(0)
+ [714]=>
+ int(0)
+ [715]=>
+ int(0)
+ [716]=>
+ int(0)
+ [717]=>
+ int(0)
+ [718]=>
+ int(0)
+ [719]=>
+ int(0)
+ [720]=>
+ int(0)
+ [721]=>
+ int(0)
+ [722]=>
+ int(0)
+ [723]=>
+ int(0)
+ [724]=>
+ int(0)
+ [725]=>
+ int(0)
+ [726]=>
+ int(0)
+ [727]=>
+ int(0)
+ [728]=>
+ int(0)
+ [729]=>
+ int(0)
+ [730]=>
+ int(0)
+ [731]=>
+ int(0)
+ [732]=>
+ int(0)
+ [733]=>
+ int(0)
+ [734]=>
+ int(0)
+ [735]=>
+ int(0)
+ [736]=>
+ int(0)
+ [737]=>
+ int(0)
+ [738]=>
+ int(0)
+ [739]=>
+ int(0)
+ [740]=>
+ int(0)
+ [741]=>
+ int(0)
+ [742]=>
+ int(0)
+ [743]=>
+ int(0)
+ [744]=>
+ int(0)
+ [745]=>
+ int(0)
+ [746]=>
+ int(0)
+ [747]=>
+ int(0)
+ [748]=>
+ int(0)
+ [749]=>
+ int(0)
+ [750]=>
+ int(0)
+ [751]=>
+ int(0)
+ [752]=>
+ int(0)
+ [753]=>
+ int(0)
+ [754]=>
+ int(0)
+ [755]=>
+ int(0)
+ [756]=>
+ int(0)
+ [757]=>
+ int(0)
+ [758]=>
+ int(0)
+ [759]=>
+ int(0)
+ [760]=>
+ int(0)
+ [761]=>
+ int(0)
+ [762]=>
+ int(0)
+ [763]=>
+ int(0)
+ [764]=>
+ int(0)
+ [765]=>
+ int(0)
+ [766]=>
+ int(0)
+ [767]=>
+ int(0)
+ }
+ ["Copyright"]=>
+ string(12) "Eric Stewart"
+ ["InterOperabilityIndex"]=>
+ string(3) "R98"
+ ["InterOperabilityVersion"]=>
+ string(4) "0100"
+ ["RelatedFileFormat"]=>
+ string(13) "image027.tiff"
+ ["RelatedImageWidth"]=>
+ int(1)
+ ["RelatedImageHeight"]=>
+ int(1)
+} \ No newline at end of file
diff --git a/ext/exif/tests/exif_read_data_streams_seek.phpt b/ext/exif/tests/exif_read_data_streams_seek.phpt
new file mode 100644
index 0000000000..a9476b4353
--- /dev/null
+++ b/ext/exif/tests/exif_read_data_streams_seek.phpt
@@ -0,0 +1,21 @@
+--TEST--
+exif_read_data() with streams seeking test
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--INI--
+output_handler=
+zlib.output_compression=0
+--FILE--
+<?php
+$fp = fopen(__DIR__ . '/image027.tiff', 'rb');
+
+fseek($fp, 100, SEEK_SET);
+
+exif_read_data($fp);
+
+var_dump(ftell($fp) === 100);
+
+fclose($fp);
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt b/ext/exif/tests/exif_read_exif_data_basic-mb.phpt
index 2f6a1a4103..b70be24278 100644
--- a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt
+++ b/ext/exif/tests/exif_read_exif_data_basic-mb.phpt
@@ -19,6 +19,8 @@ print_r(read_exif_data(dirname(__FILE__).'/test2私はガラスを食べられ
===Done===
--EXPECTF--
*** Testing read_exif_data() : basic functionality ***
+
+Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic-mb.php on line 9
Array
(
[FileName] => test2私はガラスを食べられます.jpg
diff --git a/ext/exif/tests/exif_read_exif_data_basic.phpt b/ext/exif/tests/exif_read_exif_data_basic.phpt
index 435f13752a..ddf847de05 100644
--- a/ext/exif/tests/exif_read_exif_data_basic.phpt
+++ b/ext/exif/tests/exif_read_exif_data_basic.phpt
@@ -19,6 +19,8 @@ print_r(read_exif_data(dirname(__FILE__).'/test2.jpg'));
===Done===
--EXPECTF--
*** Testing read_exif_data() : basic functionality ***
+
+Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic.php on line 9
Array
(
[FileName] => test2.jpg
diff --git a/ext/exif/tests/exif_tagname_variation1-64bit.phpt b/ext/exif/tests/exif_tagname_variation1-64bit.phpt
new file mode 100644
index 0000000000..22298af2ae
--- /dev/null
+++ b/ext/exif/tests/exif_tagname_variation1-64bit.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test exif_tagname() function : usage variations - different types for index argument
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';
+if (PHP_INT_SIZE != 8) die('skip 64-bit only');
+?>
+--FILE--
+<?php
+
+/* Prototype : string exif_tagname ( string $index )
+ * Description: Get the header name for an index
+ * Source code: ext/exif/exif.c
+*/
+
+echo "*** Testing exif_tagname() : different types for index argument ***\n";
+// initialize all required variables
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj'ct";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+ "",
+ '',
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ NULL,
+ null
+);
+
+
+// loop through each element of the array and check the working of exif_tagname()
+// when $index argument is supplied with different values
+
+echo "\n--- Testing exif_tagname() by supplying different values for 'index' argument ---\n";
+$counter = 1;
+foreach($values as $index) {
+ echo "-- Iteration $counter --\n";
+ var_dump( exif_tagname($index) );
+ $counter ++;
+}
+
+// closing the file
+fclose($file_handle);
+
+echo "Done\n";
+?>
+
+?>
+===Done===
+--EXPECTF--
+*** Testing exif_tagname() : different types for index argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing exif_tagname() by supplying different values for 'index' argument ---
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
+NULL
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, string given in %s on line %d
+NULL
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, object given in %s on line %d
+NULL
+-- Iteration 24 --
+
+Warning: exif_tagname() expects parameter 1 to be integer, resource given in %s on line %d
+NULL
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+Done
+
+?>
+===Done===
+
diff --git a/ext/exif/tests/exif_tagname_variation1.phpt b/ext/exif/tests/exif_tagname_variation1.phpt
index 22298af2ae..44d2568f49 100644
--- a/ext/exif/tests/exif_tagname_variation1.phpt
+++ b/ext/exif/tests/exif_tagname_variation1.phpt
@@ -2,7 +2,7 @@
Test exif_tagname() function : usage variations - different types for index argument
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';
-if (PHP_INT_SIZE != 8) die('skip 64-bit only');
+if (PHP_INT_SIZE != 4) die('skip 32-bit only');
?>
--FILE--
<?php
@@ -41,8 +41,6 @@ $values = array (
// float values
10.5,
-10.5,
- 10.1234567e10,
- 10.7654321E-10,
.5,
// array values
@@ -121,60 +119,56 @@ bool(false)
-- Iteration 7 --
bool(false)
-- Iteration 8 --
-bool(false)
--- Iteration 9 --
-bool(false)
--- Iteration 10 --
Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
NULL
--- Iteration 11 --
+-- Iteration 9 --
Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
NULL
--- Iteration 12 --
+-- Iteration 10 --
Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
NULL
--- Iteration 13 --
+-- Iteration 11 --
Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
NULL
--- Iteration 14 --
+-- Iteration 12 --
Warning: exif_tagname() expects parameter 1 to be integer, array given in %s on line %d
NULL
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
-- Iteration 15 --
bool(false)
-- Iteration 16 --
bool(false)
-- Iteration 17 --
-bool(false)
--- Iteration 18 --
-bool(false)
--- Iteration 19 --
Warning: exif_tagname() expects parameter 1 to be integer, string given in %s on line %d
NULL
--- Iteration 20 --
+-- Iteration 18 --
Warning: exif_tagname() expects parameter 1 to be integer, string given in %s on line %d
NULL
--- Iteration 21 --
+-- Iteration 19 --
bool(false)
--- Iteration 22 --
+-- Iteration 20 --
bool(false)
--- Iteration 23 --
+-- Iteration 21 --
Warning: exif_tagname() expects parameter 1 to be integer, object given in %s on line %d
NULL
--- Iteration 24 --
+-- Iteration 22 --
Warning: exif_tagname() expects parameter 1 to be integer, resource given in %s on line %d
NULL
--- Iteration 25 --
+-- Iteration 23 --
bool(false)
--- Iteration 26 --
+-- Iteration 24 --
bool(false)
Done
diff --git a/ext/exif/tests/exif_thumbnail_streams.phpt b/ext/exif/tests/exif_thumbnail_streams.phpt
new file mode 100644
index 0000000000..6895a10017
--- /dev/null
+++ b/ext/exif/tests/exif_thumbnail_streams.phpt
@@ -0,0 +1,17 @@
+--TEST--
+exif_thumbnail() with streams test
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--INI--
+output_handler=
+zlib.output_compression=0
+--FILE--
+<?php
+$fp = fopen(__DIR__ . '/sony.jpg', 'rb');
+
+var_dump(strlen(exif_thumbnail($fp)));
+
+fclose($fp);
+?>
+--EXPECT--
+int(4150) \ No newline at end of file
diff --git a/ext/exif/tests/redhat-bug1362571.jpg b/ext/exif/tests/redhat-bug1362571.jpg
new file mode 100644
index 0000000000..35713e63a1
--- /dev/null
+++ b/ext/exif/tests/redhat-bug1362571.jpg
Binary files differ
diff --git a/ext/exif/tests/redhat-bug1362571.phpt b/ext/exif/tests/redhat-bug1362571.phpt
new file mode 100644
index 0000000000..ec69e38c91
--- /dev/null
+++ b/ext/exif/tests/redhat-bug1362571.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Redhat bug #1362571 (PHP not returning full results for exif_read_data function)
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--FILE--
+<?php
+var_dump(strlen(exif_thumbnail(__DIR__ . DIRECTORY_SEPARATOR . 'redhat-bug1362571.jpg')) > 0);
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/exif/tests/sony.jpg b/ext/exif/tests/sony.jpg
new file mode 100644
index 0000000000..8f50b181f0
--- /dev/null
+++ b/ext/exif/tests/sony.jpg
Binary files differ
diff --git a/ext/exif/tests/sony.phpt b/ext/exif/tests/sony.phpt
new file mode 100644
index 0000000000..683d58d4ac
--- /dev/null
+++ b/ext/exif/tests/sony.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Sony test
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--FILE--
+<?php
+$data = exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . 'sony.jpg');
+
+if (!$data) {
+ exit('Error: Unable to parse EXIF data');
+}
+
+// Perhaps we should just test for SonyModelID since it seems to be
+// the most specific tag name that should be found in any Sony generated
+// picture
+foreach (['SonyModelID', 'Panorama', 'AntiBlur'] as $sony_tag) {
+ printf('%s was %sfound' . PHP_EOL, $sony_tag, (!isset($data[$sony_tag]) ? 'NOT ' : ''));
+}
+?>
+--EXPECT--
+SonyModelID was found
+Panorama was found
+AntiBlur was found