Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Oclass 5.0.1 & Osclass 5.1beta2 -PHP Notice: getimagesize(): Read error! #370

Closed
eurobank opened this issue Sep 10, 2021 · 31 comments
Closed
Labels

Comments

@eurobank
Copy link

eurobank commented Sep 10, 2021

Osclass 5.0.2 and PHP 7.3.x

Several of those:

PHP Notice: getimagesize(): Read error! in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

Just updated the theme and may/could be the source of it.

@eurobank eurobank added the bug label Sep 10, 2021
@eurobank
Copy link
Author

@navjottomer Is there ANY possibility this to come from the 5 core?

@navjottomer
Copy link
Member

Yes, it is coming from osclass but nothing wrong with the code there.
The possible cause for this is if the uploaded image is corrupted. If this is happening on every 2-3rd request, then it's a case for inspection.
Don't worry about PHP Notices nothing fatal in it.

@eurobank
Copy link
Author

eurobank commented Sep 10, 2021

Well it happens a lot i think and i see now a new error:


[09-Sep-2021 21:35:04 America/Los_Angeles] PHP Notice:  getimagesize(): Read error! in /home/website/public_html/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[10-Sep-2021 03:20:05 America/Los_Angeles] PHP Notice:  getimagesize(): Read error! in /home/website/public_html/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[10-Sep-2021 05:50:18 America/Los_Angeles] PHP Notice:  getimagesize(): Read error! in /home/website/public_html/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[10-Sep-2021 09:57:34 America/Los_Angeles] PHP Fatal error:  Uncaught RuntimeException: /home/website/public_html/oc-content/uploads/temp/qqfile_613b8e7e631c09.26407958.jpg does not exist! in /home/website/public_html/oc-includes/osclass/classes/ImageProcessing.php:55
Stack trace:
# 0 /home/website/public_html/oc-includes/osclass/classes/ImageProcessing.php(135): ImageProcessing->__construct('/home/website/...')
# 1 /home/website/public_html/oc-includes/osclass/classes/controller/CWebAjax.php(372): ImageProcessing::fromFile('/home/website/...')
# 2 /home/website/public_html/index.php(137): CWebAjax->doModel()
# 3 {main}
  thrown in /home/website/public_html/oc-includes/osclass/classes/ImageProcessing.php on line 55

@navjottomer
Copy link
Member

once or 10 times a day is not suspicious on a running site, some image files have encoding issues and can cause these Notices.

I'll check the last error.

@eurobank
Copy link
Author

once or 10 times a day is not suspicious on a running site, some image files have encoding issues and can cause these Notices.

Ok, you know better, still this is a new error that i have never seen before. We will see how it goes.

@eurobank
Copy link
Author

This seems not to go away. In all 5 sites.

@eurobank
Copy link
Author

eurobank commented Sep 12, 2021

ok, i'm reopening this since i have a lot of them, in all sites, and also a NEW one related to this:

[12-Sep-2021 18:55:29 Europe/London] PHP Notice:  getimagesize(): Read error! in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[12-Sep-2021 19:53:23 Europe/London] PHP Notice:  getimagesize(): read of 8192 bytes failed with errno=21 Is a directory in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[12-Sep-2021 19:53:23 Europe/London] PHP Notice:  getimagesize(): Read error! in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[12-Sep-2021 19:57:41 Europe/London] PHP Notice:  getimagesize(): read of 8192 bytes failed with errno=21 Is a directory in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[12-Sep-2021 19:57:41 Europe/London] PHP Notice:  getimagesize(): Read error! in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[12-Sep-2021 20:00:35 Europe/London] PHP Notice:  getimagesize(): read of 8192 bytes failed with errno=21 Is a directory in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[12-Sep-2021 20:00:35 Europe/London] PHP Notice:  getimagesize(): Read error! in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

This:

[12-Sep-2021 19:53:23 Europe/London] PHP Notice: getimagesize(): read of 8192 bytes failed with errno=21 Is a directory in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

is something i have reported back and closed the issue the "is a directory" part. probably something is wrong in that code. And i think this is also more detailed because i switched the site to PHP 7.4.x.

#367

@eurobank eurobank reopened this Sep 12, 2021
@eurobank
Copy link
Author

@navjottomer Until this is debuged and fixed, do you know if it does pose any image issues when posting or any other? I haven't found any, still i dunno when it happens ...

@navjottomer
Copy link
Member

These are PHP NOTICES they rarely create issues, But it's hard to debug without reproducing. If you're using an ajax uploader, try to disable that and see if this error is reduced.

@eurobank
Copy link
Author

@navjottomer So if i understand correctly you do not see those on your website? Or anybody else in his site?

If so, then it could be the theme i use (Osclasswizards)?

@eurobank
Copy link
Author

I tried to upload high rez images, no issues or no errors.

I tried to upload a corrupted image and i got hxr error 500 and some error log about "PHP Warning: getimagesize(): corrupt JPEG data" and an exception. Nothing to do with the original error i posted.

So i guess this error doesn't happen when a poster uploads an image.

@eurobank
Copy link
Author

I have enabled the "keep original images" so i can check if those are special or something.

@navjottomer
Copy link
Member

In few days I'll upload the first beta of 5.1 from develop branch, it will fix many bugs, I hope it'll be resolved.

@eurobank
Copy link
Author

After some changes in Media max size to 16384 at Osclass and PHP and also PHP max_post_size to 32mb, it has been 3 days without that error (5.0.2).

@eurobank
Copy link
Author

I'm closing this since i do not see it any more, with 5.0.1 or 5.1 but i will keep an eye open.

If anybody will experience this, he can check the php options allowed sizes and also Osclass media sizes.

@eurobank
Copy link
Author

I spoke toooo soon.

[24-Sep-2021 06:49:14 Europe/London] PHP Notice: getimagesize(): read of 8192 bytes failed with errno=21 Is a directory in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

[24-Sep-2021 06:49:14 Europe/London] PHP Notice: getimagesize(): Read error! in /home/oc-includes/osclass/classes/actions/ItemActions.php on line 346

5.0.2

@eurobank eurobank reopened this Sep 24, 2021
@eurobank eurobank changed the title Osclass 5.0.2 -PHP Notice: getimagesize(): Read error! Oclass 5.0.1 & Osclass 5.1beta2 -PHP Notice: getimagesize(): Read error! Sep 30, 2021
@eurobank
Copy link
Author

eurobank commented Sep 30, 2021

This is not fixed, at least not in my system (live 5.1beta2 from develop branch).

2021-09-30 11:12:17 - NOTICE: getimagesize(): read of 8192 bytes failed with errno=21 Is a directory in /home/**********com/public_html/oc-includes/osclass/classes/actions/ItemActions.php on line no 309 Error Code:8

2021-09-30 11:12:17 - NOTICE: getimagesize(): Read error! in /home/**********com/public_html/oc-includes/osclass/classes/actions/ItemActions.php on line no 309 Error Code:8

navjottomer added a commit that referenced this issue Oct 4, 2021
@navjottomer
Copy link
Member

Recent commits will fix or minimize these warnings.

@eurobank
Copy link
Author

eurobank commented Oct 4, 2021

Just pls leave this open for a while, i'm uploading today's develop branch to a live site and i will update here in 2-3 days from now.

@eurobank
Copy link
Author

eurobank commented Oct 4, 2021

Not fixed yet. I already had 5 in less than an hour.

I think this doesn't come from new ads image uploading. Because the last hour, i had NO ads posted.

It must come (for some reason) from user profiles.

Also the timing of Notices below maybe mean something.

2021-10-04 14:57:50 - NOTICE: getimagesize(): read of 8192 bytes failed with errno=21 Is a directory in /home/oc-includes/osclass/classes/actions/ItemActions.php on line no 312 Error Code:8

2021-10-04 14:57:50 - NOTICE: getimagesize(): Read error! in /home/oc-includes/osclass/classes/actions/ItemActions.php on line no 312 Error Code:8

2021-10-04 14:57:53 - NOTICE: Undefined index: en_US in /home/oc-content/themes/osclasswizards/user-profile.php on line no 139 Error Code:8

2021-10-04 14:57:53 - NOTICE: Trying to access array offset on value of type null in /home/oc-content/themes/osclasswizards/user-profile.php on line no 139 Error Code:8

2021-10-04 14:57:55 - NOTICE: Undefined index: en_US in /home/oc-content/themes/osclasswizards/user-profile.php on line no 139 Error Code:8

2021-10-04 14:57:55 - NOTICE: Trying to access array offset on value of type null in /home/oc-content/themes/osclasswizards/user-profile.php on line no 139 Error Code:8

@dev-101
Copy link
Contributor

dev-101 commented Oct 4, 2021

You need to deep debug this issue, all the way up in the code for image processing.

What happens with images on those items that have this warning? Are they properly processed and shown? Is everything otherwise all right? Or the images are missing?

New devices use newer compression algorithms and features for images (namely, JPEG), which might not be fully supported yet by GD/imagick. You mentioned you keep originals, it would be smart to test them on different systems and examine their format closely. For e.g. older image viewers cannot open some pictures from new phones, despite having jpeg extension, it's not the problem in extension itself, but the file content / structure. If the image is not properly recognized, it could generate null object, hence this warning. I hope I'm wrong, though.

@dev-101
Copy link
Contributor

dev-101 commented Oct 4, 2021

I think this doesn't come from new ads image uploading. Because the last hour, i had NO ads posted.

It must come (for some reason) from user profiles.

It's definitely from the theme, then. And it could be not just for the image, but also other User fields.
First line indicates that instead of image file it received a directory path, other errors might be because of changed array structure in user fields.
I haven't been testing new 5x branch, and most likely won't be of much help in the future, but I track all the changes superficially now.

@eurobank
Copy link
Author

eurobank commented Oct 4, 2021

You need to deep debug this issue, all the way up in the code for image processing.

What happens with images on those items that have this warning? Are they properly processed and shown? Is everything otherwise all right? Or the images are missing?

New devices use newer compression algorithms and features for images (namely, JPEG), which might not be fully supported yet by GD/imagick. You mentioned you keep originals, it would be smart to test them on different systems and examine their format closely. For e.g. older image viewers cannot open some pictures from new phones, despite having jpeg extension, it's not the problem in extension itself, but the file content / structure. If the image is not properly recognized, it could generate null object, hence this warning. I hope I'm wrong, though.

Well, i have tried to replicate this, making a user and uploading whatever i could as ads images. No errors. JPG,Jpeg, PNG, you name it.

Also note that i NEVER had this issue before (with 3.9 and an other release channel 4.4)

@eurobank
Copy link
Author

eurobank commented Oct 4, 2021

One last thing i want to try is to switch to GD lib instead of Imagik. Does that make any sense?

@dev-101
Copy link
Contributor

dev-101 commented Oct 4, 2021

That shouldn't fix this issue according to your latest description and debug log. It's not related to image processing during item post/edit, but from other sections (e.g. user profile image, and user profile fields).

@eurobank
Copy link
Author

eurobank commented Oct 4, 2021

Maybe someone who knows and has little time to devote, could bring OsclassWizards back to life for Osclass 5.x and also do the same for some Drizzle themes i see for free here:

https://osclasscommunity.com/themes/

Otherwise it will take a lot of time (if ever) to have a good installed base for 5, without themes (and plugins) free or paid.

@eurobank
Copy link
Author

eurobank commented Oct 4, 2021

@navjottomer Feel free to close this issue (if you want to do so). I can't spend any more time for it and apparently you did your best.

We will see in in time when more people will be using vs 5.x.

@dev-101
Copy link
Contributor

dev-101 commented Oct 4, 2021

2021-10-04 14:57:55 - NOTICE: Undefined index: en_US in /home/oc-content/themes/osclasswizards/user-profile.php on line no 139 Error Code:8

What code is on line 139 in your theme? Try removing it and observe the log.
Also, there seems to be user profile picture somewhere, or from a plugin, try removing that code as well.

@eurobank
Copy link
Author

eurobank commented Oct 4, 2021

Line 139 is:

<?php UserForm::info_textarea('s_info', osc_current_user_locale(), @$osc_user['locale'][osc_current_user_locale()]['s_info']); ?>

and has 3 notices !!

@navjottomer
Copy link
Member

I tried to fix this as much as possible, but there is no way to be sure as I can't reproduce this error in any way. BTW it's a PHP Notice, it is not preventing the script to run normally, so we can ignore it till someone found a way to reproduce it.

@eurobank
Copy link
Author

eurobank commented Oct 6, 2021

@navjottomer

Ok, i think i found it. it has to do with the GRAVATAR photo of the profile.

@eurobank eurobank closed this as completed Oct 7, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants