https://bugs.php.net/bug.php?id=77546
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.
Solutions
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).
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.
Code
// PHP 7.3 bug https://bugs.php.net/bug.php?id=77546
// detect if image is corrupt before writing
if(version_compare(PHP_VERSION, '7.3') >= 0 && version_compare(PHP_VERSION, '7.3.3') < 0 && !@getimagesizefromstring($content)) return;
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: