$temp = self::jpegExtractMarker( $fh );
// check what type of app segment this is.
if ( substr( $temp, 0, 29 ) === "http://ns.adobe.com/xap/1.0/\x00" && $showXMP ) {
- $segments["XMP"] = substr( $temp, 29 );
+ // use trim to remove trailing \0 chars
+ $segments["XMP"] = trim( substr( $temp, 29 ) );
} elseif ( substr( $temp, 0, 35 ) === "http://ns.adobe.com/xmp/extension/\x00" && $showXMP ) {
- $segments["XMP_ext"][] = substr( $temp, 35 );
+ // use trim to remove trailing \0 chars
+ $segments["XMP_ext"][] = trim( substr( $temp, 35 ) );
} elseif ( substr( $temp, 0, 29 ) === "XMP\x00://ns.adobe.com/xap/1.0/\x00" && $showXMP ) {
// Some images (especially flickr images) seem to have this.
// I really have no idea what the deal is with them, but
// whatever...
- $segments["XMP"] = substr( $temp, 29 );
+ // use trim to remove trailing \0 chars
+ $segments["XMP"] = trim( substr( $temp, 29 ) );
wfDebug( __METHOD__ . ' Found XMP section with wrong app identifier '
. "Using anyways.\n" );
} elseif ( substr( $temp, 0, 6 ) === "Exif\0\0" ) {