Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

php-xml package required for PNGs to work #2013

Open
thetuningspoon opened this issue Aug 31, 2016 · 4 comments
Open

php-xml package required for PNGs to work #2013

thetuningspoon opened this issue Aug 31, 2016 · 4 comments

Comments

@thetuningspoon
Copy link

I ran into an issue where my php7 installation didn't have php-xml installed, which caused the following error if I tried to output a PNG file into my template from a file field:

Fatal error: Uncaught Error: Call to undefined function ProcessWire\utf8_encode() in /.../wire/core/PWPNG.php:117

I don't remember php-xml being noted as a required package during the PW installation.

PW 3.0.29

@teppokoivula
Copy link

teppokoivula commented Sep 2, 2016

This is one of the features that seem to be, as far as I can tell, disabled by default as of PHP 7. In other words: before PHP 7 they were always available (or at least enabled by default), while in PHP 7 the php-xml package is indeed required.

For the record, I can't think of any sane reason to bundle utf8_encode() with the languages XML features (php-xml), but I guess that's just how PHP is :)

Here's one thread discussing the issue: http://stackoverflow.com/questions/35701730/utf8-endecode-removed-from-php7.

@ryancramerdesign
Copy link
Owner

@horst-n since this is in the PWPNG class you made, I wanted to ask if this utf8_encode() is something that we need at all? I see it's creating a $this->info['palette'] property, but can't find any code that is actually using it. As a result, I'm wondering if maybe we can just delete this line to solve the problem?

@evanmcd
Copy link

evanmcd commented Mar 26, 2017

Came across this issue as well, but with PHP 5.6. Might be related to the fact that I am using a Docker image (centos6), that may have a different default configuration than other variants.

For now, I just commented out line 117 of PWPNG.php to solve the problem.

This is with the 3.0.57 of PW from the dev branch.

@kbreynck
Copy link

kbreynck commented Oct 4, 2019

Hey @ryancramerdesign and @horst-n, I (well, my client) ran into the same issue with this utf8_encode() and couldn't edit the affected page anymore due to the fatal error.

I "deleted" the utf8_encode() call in line 117 and reloaded the corresponding "/page/edit?id=1234" in the PW backend. Then I changed the line back again because I didn't knew what I was doing there in this core module - not a good feeling

Can you please fix this? My client wasn't able to edit his page anymore. Meanwhile I try to contact the sysadmin to install the module php xml. but I bet others will run into this issue aswell.

here is the full error code:

Fatal Error: Uncaught Error: Call to undefined function ProcessWire\utf8_encode() in /var/www/a.secret.domain.de/www2/htdocs/wire/core/PWPNG.php:117
Stack trace: #0 /var/www/a.secret.domain.de/www2/htdocs/wire/core/PWPNG.php(31): ProcessWire\PWPNG->_parsepngstream(Resource id #57, 'file-name...')
#1 /var/www/a.secret.domain.de/www2/htdocs/wire/core/ImageInspector.php(209): ProcessWire\PWPNG->loadFile('/var/www/a.secret.domain.de...')
#2 /var/www/a.secret.domain.de/www2/htdocs/wire/core/ImageInspector.php(129): ProcessWire\ImageInspector->loadImageInfoPng()
#3 /var/www/a.secret.domain.de/www2/htdocs/wire/core/ImageSizer.php(445): ProcessWire\ImageInspector->inspect('/var/www/a.secret.domain.de...', true)
#4 /var/www/a.secret.domain.de/www2/htdocs/wire/core/Pageimage.php(839): ProcessWire\ImageSizer->getEngine()
#5 /var/www/a.secret.domain.de/www2/htdocs/wire/core/Pageimage.php(646): ProcessWire\Pageimage->___size(0, 260, Array)
#6 /var/www/a.secret.domain.de/www2/htdocs/wire/core/Pageimage.php(1045): ProcessWire\Pageimage->size(0, 260, Array)
#7 /var/www/a.secret.domain.de/www2/htdocs/wire/modules/Inputfield/InputfieldI (line 117 of /var/www/a.secret.domain.de/www2/htdocs/wire/core/PWPNG.php)

PW: 3.0.138
Linux a.secret.domain.de 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) x86_64
PHP Version 7.0.33-1~dotdeb+8.1

thank you so much for your support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants