Simple Machines Community Forum

General Community => Site Comments, Issues and Concerns => Topic started by: Antechinus on August 07, 2021, 06:16:14 PM

Title: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Antechinus on August 07, 2021, 06:16:14 PM
NOTE: This may actually belong in Site Comments, Issues and Concerns.
Turns out it's an issue with the RC4 downloads hosted on this site. :)



Here's some fun and games. I just go around to updating a local test site to RC4.
Subs-Graphics.php was overwritten by the large upgrade pack anyway. It's a fresh copy, straight from the zip on the downloads section of this site.
Complete error essage is:
( ! ) Fatal error: Uncaught Error: Call to undefined function exif_read_data() in B:\VertrigoServ\www\SMF_21x\Sources\Subs-Graphics.php on line 369
( ! ) Error: Call to undefined function exif_read_data() in B:\VertrigoServ\www\SMF_21x\Sources\Subs-Graphics.php on line 369


Line 369 is this:
if (($exif_data = @exif_read_data($destination)) !== false)
Anyone have some popcorn? :D



ETA: Just took a look at the .gz version of the download. That's an odd one too. It has a .tar, insiade a .tar, inside the .gz. IOW, an extra layer of .tar over the usual. Same code on lIne 369 of Subs-Graphics.php too.

ETA2: Aha! I just took a look in the Github repo, and the offending block of code is no longer in Subs-Graphics.php in the repo.

Code from downloads on this site:
elseif ($fp_destination)
{
$mime_valid = check_mime_type($source, implode('|', array_map('image_type_to_mime_type', array_keys($default_formats))), true);
if (empty($mime_valid))
return false;

$sizes = @getimagesize($source);

$fp_source = fopen($source, 'rb');
if ($fp_source !== false)
{
while (!feof($fp_source))
fwrite($fp_destination, fread($fp_source, 8192));
fclose($fp_source);
}
else
$sizes = array(-1, -1, -1);
fclose($fp_destination);
}

$rotate = 0;
if (($exif_data = @exif_read_data($destination)) !== false)
{
if (!empty($exif_data['Orientation']))
{
switch($exif_data['Orientation'])
{
case 8:
$rotate = 90;
break;
case 3:
$rotate = 180;
break;
case 6:
$rotate = -90;
break;
}
}
}

// We can't get to the file. or a previous getimagesize failed.
if (empty($sizes))
$sizes = array(-1, -1, -1);


Code from current GitHub repo:
elseif ($fp_destination)
{
$mime_valid = check_mime_type($source, implode('|', array_map('image_type_to_mime_type', array_keys($default_formats))), true);
if (empty($mime_valid))
return false;

$sizes = @getimagesize($source);

$fp_source = fopen($source, 'rb');
if ($fp_source !== false)
{
while (!feof($fp_source))
fwrite($fp_destination, fread($fp_source, 8192));
fclose($fp_source);
}
else
$sizes = array(-1, -1, -1);
fclose($fp_destination);
}

// We can't get to the file. or a previous getimagesize failed.
if (empty($sizes))
$sizes = array(-1, -1, -1);


ETA3: Replacing the file from this site's downloads with the file from the current GitHub repo fixes the issue. :)
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Antechinus on August 08, 2021, 05:40:38 PM
Is anyone looking into this? You do realise you are hosting screwed RC4 upgrade packs on this site?
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Illori on August 08, 2021, 07:37:17 PM
even if we are, technically we dont fix them until we do another release as it causes a lot of confusion.

we recommend most to download 2.1 from github anyway.
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Antechinus on August 08, 2021, 08:22:13 PM
There is no "even if" about it. You are. Definitely.

Recommendations are all very well, but those upgrade packs are stil available for download here, and if anyone is on this site and looking for RC4 it is logical that some of them will try the official downloads. Which, as mentioned, will immediately kill any site they are uploaded to.

This has no effect on me. I could not particularly give a damn. I know exactly what causes the issue and how to fix it. However, I think it would be of concern to the Project Manager. It is not going to make this project look good if you can't even get your official upgrade packs right, and can't be bothered fixing them.

Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: vbgamer45 on August 08, 2021, 08:26:22 PM
You are missing exif support in your php install.

On windows you have to edit the php.ini and include the php_exif extension
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: lurkalot on August 09, 2021, 03:39:00 AM
Quote from: Antechinus on August 07, 2021, 06:16:14 PM

I just go around to updating a local test site to RC4.


I had the same error back in June 25th when testing on my local setup which is running Laragon.  Turned out the exif module was turned off .  Turned it back on and all was good.
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Douglas on August 09, 2021, 06:03:30 AM
I gotta agree with Ant here (shock of all shocks). Fixing the existing packages will head off potential additional workload issues for the support teamies.

Logically, it makes sense to fix the current downloads on this site if the issue is a pretty sizable one. I do think this one qualifies.

Not everyone has the ability to manipulate their php.ini settings, so it makes sense to get the issue addressed within your own zip file to address this, ASAP.
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Steve on August 09, 2021, 12:02:50 PM
Quote from: Illori on August 08, 2021, 07:37:17 PM
even if we are, technically we dont fix them until we do another release as it causes a lot of confusion.

we recommend most to download 2.1 from github anyway.

For a lot of us (myself included) it's github that is confusing.

I have to agree with Antechinus and Douglas, the download site should have the latest and correct versions.
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Illori on August 09, 2021, 12:40:06 PM
We can't update the download site daily for every fix. I do believe there is a link to a daily install and upgrade package that the users can use. We can't make sure an rc release will not have any bugs.
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Kindred on August 09, 2021, 12:43:54 PM
Thing is, Steve,  the RC4 RELEASE is a snapshot.
Anything fixed after that snapshotis not RC4.... and you've seen the semicomplicated process we have to go through to actually MAKE a release.
Additionally,  we can't upload a "new" version of rc4 to our site. That would break all sorts of stuff, and just cinfuse users.  We'd have to make an RC5 release.

Incidentally,  I do not see this error, because my php already has existed compiled in...
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Steve on August 09, 2021, 01:03:04 PM
I see. Thanks Kindred and Illori. :)
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Sesquipedalian on August 09, 2021, 01:55:23 PM
Quote from: Kindred on August 09, 2021, 12:43:54 PM
Additionally,  we can't upload a "new" version of rc4 to our site. That would break all sorts of stuff, and just cinfuse users.  We'd have to make an RC5 release.

This is correct, and we currently have no plan to release an RC5. As can be seen in the SMF 2.1 milestones (https://github.com/SimpleMachines/SMF2.1/milestones), our next target is SMF 2.1.0. Obviously, I make no promises about the future, but that's the current situation.

If people can't wait for 2.1.0, they are encouraged to grab the latest from GitHub.

Quote from: Steve on August 09, 2021, 12:02:50 PM
For a lot of us (myself included) it's github that is confusing.

Please see the attached image for instructions on how to get the latest from GitHub. :)

Alternatively, see Download for nightly(github) smf2.1 (https://www.simplemachines.org/community/index.php?topic=558451.0) to get prebuilt nightly packages.
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: Steve on August 09, 2021, 06:56:01 PM
Thanks for the image Mad Dr. ... very helpful. :)
Title: Re: undefined function exif_read_data() inSubs-Graphics.php on line 369
Post by: LiroyvH on August 09, 2021, 07:24:56 PM
Thanks Ant for reporting this and the effort of checking out what's going on/what's wrong. :)