php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75888 imagecreatefromstring function throws uncatchable error.
Submitted: 2018-01-30 10:48 UTC Modified: 2018-01-30 17:03 UTC
From: grothentor at gmail dot com Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 7.1.13 OS: Linux 4.4.0-1032-aws x86_64
Private report: No CVE-ID: None
 [2018-01-30 10:48 UTC] grothentor at gmail dot com
Description:
------------
documentation says that imagecreatefromstring function trows only E_WARNING lavel errors but if image is broken it throws fatal error.

on local machine with apache2 + php (with same php version and Linux 4.4.0-53-generic) it works fine. (expected result copied from local machine).

In differences of phpinfo() I found that on local machine GD library Version 2.2.5 and on server it has 2.2.3 version. but header versions are same and running apt-get install php7.1-gb says that "already up to date"

p.s. i got that errors from ~7.1.9, mb earlier after update php on local machine it were fixed, but on server it doesn't help. 

Test script:
---------------
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$image = file_get_contents('http://novostoy.com.ua/files/obekti/974144_3.jpg');
$image = imagecreatefromstring($image);

echo 'image processed';

Expected result:
----------------
Warning: imagecreatefromstring(): gd-jpeg: JPEG library reports unrecoverable error: Unsupported marker type 0x8e in index.php on line 7

Warning: imagecreatefromstring(): Passed data is not in 'JPEG' format in index.php on line 7

Warning: imagecreatefromstring(): Couldn't create GD Image Stream out of Data in index.php on line 7
image processed

Actual result:
--------------
Fatal error: imagecreatefromstring(): gd-jpeg: JPEG library reports unrecoverable error: Unsupported marker type 0x8e in index.php on line 7

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-30 13:06 UTC] cmb@php.net
-Status: Open +Status: Closed -Package: FPM related +Package: GD related -Assigned To: +Assigned To: cmb
 [2018-01-30 13:06 UTC] cmb@php.net
> […] I found that on local machine GD library Version 2.2.5 and
> on server it has 2.2.3 version.  […]

And that's the problem, since this issue has only be resolved in
GD 2.2.5, see <https://github.com/libgd/libgd/issues/338>.  Either
update to GD 2.2.5, or use the bundled libgd which didn't have
this issue.
 [2018-01-30 16:40 UTC] grothentor at gmail dot com
can you please give me any suggestions why i can't update that library?

all my tries says "php7.1-gd is already the newest version (7.1.13-1+ubuntu16.04.1+deb.sury.org+1).", but i still have 2.2.3 version of library and 2.2.5 of headers.

i restart php-fpm and even nginx and machine.
also i try reinstall php7.1-gb, it install the same version.
 [2018-01-30 17:03 UTC] cmb@php.net
> can you please give me any suggestions why i can't update that
> library?

You may need to get libgd2
2.2.5-4+ubuntu16.04.1+deb.sury.org+1[1].

Anyhow, for a list of more appropriate places to ask for help
using PHP, please visit http://www.php.net/support.php as this bug
system is not the appropriate forum for asking support questions.

[1] <https://launchpad.net/~ondrej/+archive/ubuntu/php/+index?batch=75>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 05:01:33 2024 UTC