Page 1 of 1

:warning: PHP 7.3 Critical Bug Warning + X3.27.2

Posted: 09 Feb 2019, 05:50
by mjau-mjau
Hi folks. After testing X3 on latest PHP 7.3, I discovered a PHP-7.3 bug which affects X3. The PHP bug may potentially corrupt JPG images when using the iptcembed() function, which is used in X3 when saving data (titles, descriptions etc) into images from the X3 control panel. The PHP bug is officially reported on 30. Jan 2019:

The bug affects PHP versions 7.3.0, 7.3.1 and 7.3.2, and will be fixed in PHP 7.3.3 according to official comments.

How is the bug produced?
If A) your server is using PHP 7.3, and B ) you are editing image data (titles, descriptions etc) [screenshot], and C) you have Settings > Advanced > "Store image settings in image as IPTC" enabled (enabled by default) [screenshot], you are in risk that PHP iptcembed() function will corrupt the images you are editing. The error does not always happen, and is related to the amount of characters in total across the image data input fields. Once an image gets corrupted, there will be ERRORS on the X3 page that contains the images, and the affected image will become irreversibly corrupted ... If this happens, you would have to DELETE the affected image(s), and re-upload.

Follow ONE (or more) of the options below to remain safe.
  • Update to latest X3.27.2 *See note below
  • Or don't use PHP 7.3 yet (7.2 and lower is safe, and the issue will be fixed in PHP 7.3.3).
  • Or disable Settings > Advanced > "Store image settings in image as IPTC" [screenshot] (while using PHP 7.3).
  • Or don't edit image data (titles, descriptions etc) [screenshot] (while using PHP 7.3).
* X3.27.2 PATCH
Even after updating to X3.27.2, the bug (which is native to PHP 7.3) will still remain, but is BYPASSED in X3 by validating the image stream before attempting to write new IPTC data into the image. This will prevent errors, and protect your images from becoming corrupted, although it might also block IPTC data from being stored into the image (if the edited image data is detected as corrupt). This itself is not a critical issue, because X3 will still store all your image data in the page.json data file, but the data will not inherit if you MOVE or COPY images.
// PHP 7.3 bug
// detect if image is corrupt before writing
if(version_compare(PHP_VERSION, '7.3') >= 0 && version_compare(PHP_VERSION, '7.3.3') < 0 && [email protected]($content)) return;
Just to be clear, as long as you are using PHP 7.3, even if you have bypassed the bug by updating to X3.27.2 (or disabled Settings > Advanced > "Store image settings in image as IPTC"), X3 may not be able to store all image data inside the image as IPTC. This means that if you move or copy images into new locations, the stored image data will not be moved with the image. Therefore, you may want to consider solution #2 also.

X3.26 / X3.27 Release
On a related note, we are very much looking forward to official release post (coming soon) for combined release of X3.26 [panorama plugin] and X3.27  :punch:

Re: :warning: PHP 7.3 Critical Bug Warning + X3.27.2

Posted: 14 Feb 2019, 09:47
by mjau-mjau
X3.27.3 was released, with more fixes for IPTC.

Re: :warning: PHP 7.3 Critical Bug Warning + X3.27.2

Posted: 09 Mar 2019, 04:08
by mjau-mjau
This bug was fixed in PHP 7.3.3 released a couple of days ago, 07 March 2019.

If you were on the affected PHP 7.3 branch, most servers automatically update their PHP to latest minor version.