Skip to content

Conversation

@ping-yee
Copy link
Contributor

@ping-yee ping-yee commented Jun 13, 2023

Description
Fixes #7567.
It seems this is a bug of php.

Ref:

  1. https://stackoverflow.com/questions/70569197/imagecreatefrompng-gd-png-libpng-warning-interlace-handling-should-be-turne
  2. imagecreatefrompng() libpng warnings dompdf/dompdf#2718

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@ping-yee ping-yee changed the title fix: fix the image handler. fix: fix the imagecreatefrompng() error. Jun 13, 2023
@kenjis kenjis changed the title fix: fix the imagecreatefrompng() error. fix: imagecreatefrompng() error. Jun 13, 2023
@kenjis kenjis changed the title fix: imagecreatefrompng() error. fix: imagecreatefrompng() gd-png: libpng warning Jun 13, 2023
@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 13, 2023
@kenjis
Copy link
Member

kenjis commented Jun 14, 2023

Cannot reproduce the error. Can you give an sample image file?

@ping-yee
Copy link
Contributor Author

I use the any else field image file of the issue.

But I can reproduce the problem at PHP8.1 in few days ago. I'll try it again later.

@ping-yee
Copy link
Contributor Author

ping-yee commented Jun 15, 2023

image

@kenjis I still the error in the latest develop branch as the above image shows with the origin issue reproduce step.

@kenjis
Copy link
Member

kenjis commented Jun 16, 2023

@ping-yee Thank you for reproducing.

@michalsn
Copy link
Member

Before we just suppress the error reporting for this, can we try to figure out the real cause? It seems like this is related to libPNG version we're using.

@ping-yee Can you tell me what libpng version are you using?

libpng-config --version

If it's not the latest one, maybe upgrading would solve the issue?

@kenjis
Copy link
Member

kenjis commented Jun 17, 2023

@michalsn Even If it is a bug in libpng, devs may not be able to upgrade it when using a shared hosting or so.

@michalsn
Copy link
Member

@kenjis This is true, but I would like to check if this is a permanent problem or if it has been fixed.

Feedback with at least the libpng version in use would be appreciated. Because, as we can see, not every environment is affected and this error seems to be returned only under "specific conditions".

@kenjis
Copy link
Member

kenjis commented Jun 17, 2023

@michalsn Okay, I got your intention. Let's wait for feedback.

@michalsn
Copy link
Member

@kenjis Whether I receive feedback or not, it will not change the essence of the problem, so feel free to merge.

@ping-yee
Copy link
Contributor Author

Can you tell me what libpng version are you using?

I can't answer this immediately because I'm on vacation in Japan and don't have the computer.

But I actually command composer update before I reproduce that problem.

@michalsn
Copy link
Member

@ping-yee No worries, enjoy your vacation.

Although composer update has nothing to do with it, since libpng is a library installed in your system.

@kenjis kenjis added the waiting for info Issues or pull requests that need further clarification from the author label Jun 17, 2023
@kenjis kenjis merged commit 557b0ed into codeigniter4:develop Jun 17, 2023
@ping-yee ping-yee deleted the 230613_img branch June 19, 2023 13:39
@ping-yee
Copy link
Contributor Author

I may find out the problem, I use the webdevops/php-nginx-dev:8.1 docker image to build the codeigniter4 dev environment before.
https://dockerfile.readthedocs.io/en/latest/content/DockerImages/dockerfiles/php-nginx-dev.html

And I just enter it's env and get the result as below after command libpng-config --version.

root@3c0338463c16:/app# libpng-config --version
bash: libpng-config: command not found

Seems this image have some problem, but this PR change can actually fix that problem in this environment.

@michalsn
Copy link
Member

@ping-yee Can you run php_info() and see if the libPNG version is listed in the GD section?

@ping-yee
Copy link
Contributor Author

image

@michalsn like this?

@michalsn
Copy link
Member

@ping-yee Yes, thanks. It looks like you don't have the latest version, which is 1.6.39. IMO this might be the issue. But as Kenjis mentioned, the current approach is probably a good choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them waiting for info Issues or pull requests that need further clarification from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

imagecreatefrompng(): gd-png: libpng warning

4 participants