Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
Description
After upgradeing php from 5.3.13 to 5.3.14
the image browse function in ezoe not working correctly.
eZ Version 4.4.0
jscore 1.2.0
ezoe 5.4.0-dev
(to include an image into the ezxmltext - press image button - go to browse - select an folder where images are located => here the ajax call which gets all image data as json is broken
i got the following xdebug warning:
Warning: json_encode(): Invalid UTF-8 sequence in argument in .../extension/ezjscore/classes/ezjscajaxcontent.php on line <i>112</i>
the json_encode function has been changed in php 5.3.14 !!!!
http://www.php.net/ChangeLog-5.php
We used the same image. On php 5.3.13 all was fine and on php 5.3.14 it is broken!!!!
—
The problem we have some images where the exif data is not correct UTF8 encoded!!
Workaround: remove the wrong encoded exif data from ajax call so json_encode is working correctly.
extension/ezjscore/classes/ezjscajaxcontent.php
here is a diff from our local repository to fix this issue for us
Index: ezjscajaxcontent.php =================================================================== --- ezjscajaxcontent.php (revision 16370) +++ ezjscajaxcontent.php (revision 20997) @@ -1,5 +1,6 @@ <?php // patch http://issues.ez.no/17701 #017701: Removing user breaks the Administration Interface (eZJSCore issue) +// patch patch remove idn0 array in response because (encoding issues) // // Definition of ezjscAjaxContent class @@ -433,7 +434,23 @@ if ( in_array( $size, $params['imagePreGenerateSizes'], true ) ) { if ( $content->hasAttribute( $size ) ) - $imageArray[ $size ] = $content->attribute( $size ); + { + // hot fix jan 11.07.2012 + $contentAttributeSize = $content->attribute( $size ); + if ( is_array( $contentAttributeSize['info'] ) ) + { + if ( array_key_exists( 'ifd0', $contentAttributeSize['info'] ) ) + unset( $contentAttributeSize['info']['ifd0'] ); + + if ( array_key_exists( 'exif', $contentAttributeSize['info'] ) ) + unset( $contentAttributeSize['info']['exif'] ); + } + + //unset( $contentAttributeSize['info'] ); + + $imageArray[ $size ] = $contentAttributeSize; + // $imageArray[ $size ] = $content->attribute( $size ); + } else eZDebug::writeError( "Image alias does not exist: '$size', missing from image.ini?", __METHOD__ ); @@ -443,8 +460,21 @@ } if ( !isset( $imageArray['original'] ) ) - $imageArray['original'] = $content->attribute( 'original' ); + { + // hot fix jan 11.07.2012 + $contentAttributeOriginal = $content->attribute( 'original' ); + if ( is_array( $contentAttributeOriginal['info'] ) ) + { + if ( array_key_exists( 'ifd0', $contentAttributeOriginal['info'] ) ) + unset( $contentAttributeOriginal['info']['ifd0'] ); + if ( array_key_exists( 'exif', $contentAttributeOriginal['info'] ) ) + unset( $contentAttributeOriginal['info']['exif'] ); + } + $imageArray['original'] = $contentAttributeOriginal; + // $imageArray['original'] = $content->attribute( 'original' ); + } + $attrtibuteArray[ $key ]['content'] = $imageArray; } }
I attached an image with wrong encoded exif data for testing.
- So upload this image to mediafolder
- create a new article
- try to embed this image to the ezxmltext field - image buttong - browse to your mediafolder => no image is shown => ajax call is broken