View Issue Details

IDProjectCategoryView StatusLast Update
14436Bug reports[All Projects] Survey designpublic2019-03-26 19:59
ReporterjeloAssigned Todominikvitt 
PrioritynoneSeverityminor 
Status assignedResolutionopen 
Product Version3.15.x 
Target VersionFixed in Version 
Summary14436: KCFinder breaks under PHP 7.2 via graphic library to create thumbs
Description

When uploading a file via KCFinder under PHP 7.1 everything works as expected.
When switching to PHP 7.2. the uploading will still end in the attached error message.

"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Internal Server Error
The each() function is deprecated. This message will be suppressed on further calls
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem. Thank you.

The script /third_party/kcfinder/core/class/browser.php is not working correctly under PHP 7.2 in combination with certain graphic libraries. I guess it is GD. When I comment out the thumb creation part in browser.php the error message with stil be shown but KCFinder still be usable.
If you e.g. upload PDF documents the error is not triggered.

The error is limited to images and thumbs, when the browser.php scanning through the files.
Since KCFinder is able to use different imagesdrivers, it might be not reproducible with every php 7.2 setup
KCFinder is choosing the graphic library via 'imageDriversPriority' => "imagick gmagick gd".

Additional Information

When you comment out the part to create thumbs, the error message will still come but you can work on.
/* if (is_array($size) && count($size)) {
$thumb_file = "$thumbDir/" . basename($file);
if (!is_file($thumb_file))
$this->makeThumb($file, false);
$smallThumb =
($size[0] <= $this->config['thumbWidth']) &&
($size[1] <= $this->config['thumbHeight']) &&
in_array($type, array("gif", "jpeg", "png"));
} else
$smallThumb = false;
/

TagsNo tags attached.
Complete LimeSurvey version number (& build)3.15.6+190108
I will donate to the project if issue is resolvedNo
BrowserFirefox
Database & DB-VersionMySQL
Server OS (if known)
Webserver software & version (if known)
PHP Version7.2.14

Activities

jelo

jelo

2019-01-17 16:23

reporter  

DenisChenu

DenisChenu

2019-01-17 18:09

developer   ~50258

KCFinder is choosing the graphic library via 'imageDriversPriority' => "imagick gmagick gd".

Wher is this link ? To test ?

jelo

jelo

2019-01-17 18:49

reporter   ~50259

https://github.com/LimeSurvey/LimeSurvey/blob/master/third_party/kcfinder/conf/config.php#L45

Not sure if it is really used in the modified LS KCFinder.
Just a sign for me that KCFinder might behave differently when only one graphic library is available via PHP.

DenisChenu

DenisChenu

2019-01-17 18:55

developer   ~50260

Maybe, but since i have imagick + gd : i can remove imagick from this line to force gs.

I set this line to 'imageDriversPriority' => "gd", and don't have issue …

This is my current gd settings

gd
GD Support  enabled
GD headers Version  2.2.5
GD library Version  2.2.5
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.9.1
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version     6b
PNG Support     enabled
libPNG Version  1.6.34
WBMP Support    enabled
XPM Support     enabled
libXpm Version  30411
XBM Support     enabled
WebP Support    enabled
Directive   Local Value Master Value
gd.jpeg_ignore_warning  1   1
jelo

jelo

2019-01-17 20:15

reporter   ~50261

But I don't see any impact in terms of disabling a library via removing the entry from that line.

If I remove GD extension directly from PHP , KCFinder will display:
Cannot find any of the supported PHP image extensions!
Which is correct, since no imagick gmagick is available and PHP isn't having GD.

When I remove GD just from 'imageDriversPriority' => "imagick gmagick" I get no warning and KCFinder tries to create the thumb in PHP 7.1 (with the error).

If I use PHP 7.1 with 'imageDriversPriority' => "imagick gmagick", it still creates the thumbnail via GD.

DenisChenu

DenisChenu

2019-01-18 08:29

developer   ~50262

I don't look at code, but if i have gd, and gd is 1st in priority : kcfinder take gd, no ?

jelo

jelo

2019-01-18 09:22

reporter   ~50263

I have no debugger on the PHP code running.

To test impact of 'imageDriversPriority'. I did the following.
I used a PHP 7.1 with GD as the only available available graphic library.
I removed GD from 'imageDriversPriority'.
If 'imageDriversPriority' would control the usage of the graphic library, KCFinder shouldn't create a thumb.
But KCFinder creates a thumb, even though GD is NOT in 'imageDriversPriority' at all.

DenisChenu

DenisChenu

2019-02-07 12:54

developer   ~50436

Last edited: 2019-03-26 18:14

View 2 revisions

I can not reproduce on PHP7.2.9 + IIS server + gd bundle (2.1.0 compatible)

DenisChenu

DenisChenu

2019-02-07 12:55

developer   ~50437

Maybe start by : https://github.com/sunhater/kcfinder/issues/169

DenisChenu

DenisChenu

2019-02-07 13:05

developer   ~50438

Last edited: 2019-02-07 13:05

View 2 revisions

Same server type : Windows IIS + PHP7.2.12 (same gd version) : it's OK. Maybe an issue in php version ?
OR : debug : 1/2

Mazi

Mazi

2019-03-26 17:13

partner   ~51140

@jelo, Will you get that error message from the screenshot all the time or only if debug mode is enabled?

DenisChenu

DenisChenu

2019-03-26 18:15

developer   ~51141

Last edited: 2019-03-26 18:17

View 3 revisions

@dominikvitt : This commit https://github.com/LimeSurvey/LimeSurvey/commit/79324b3fe1284f67c2849d6c407bc20e94f022b4#diff-6a6097871a7a28a752d81e9451763259 fix this issue , no ?

Maybe need a bad image in the images upload dir ?

jelo

jelo

2019-03-26 19:59

reporter   ~51144

@Mazi: Debugmode was off.

But I haven't tested the newer LS releases under PHP 7.2 and CentOS 7.

Issue History

Date Modified Username Field Change
2019-01-17 16:23 jelo New Issue
2019-01-17 16:23 jelo File Added: 20191117kcfinderuploadthumb.PNG
2019-01-17 18:09 DenisChenu Note Added: 50258
2019-01-17 18:49 jelo Note Added: 50259
2019-01-17 18:55 DenisChenu Note Added: 50260
2019-01-17 20:15 jelo Note Added: 50261
2019-01-18 08:29 DenisChenu Note Added: 50262
2019-01-18 09:22 jelo Note Added: 50263
2019-02-07 12:54 DenisChenu Note Added: 50436
2019-02-07 12:55 DenisChenu Note Added: 50437
2019-02-07 13:05 DenisChenu Note Added: 50438
2019-02-07 13:05 DenisChenu Note Edited: 50438 View Revisions
2019-03-26 17:13 Mazi Note Added: 51140
2019-03-26 18:14 DenisChenu Note Edited: 50436 View Revisions
2019-03-26 18:15 DenisChenu Note Added: 51141
2019-03-26 18:15 DenisChenu Note Edited: 51141 View Revisions
2019-03-26 18:15 DenisChenu Assigned To => dominikvitt
2019-03-26 18:15 DenisChenu Status new => feedback
2019-03-26 18:17 DenisChenu Note Edited: 51141 View Revisions
2019-03-26 19:59 jelo Note Added: 51144
2019-03-26 19:59 jelo Status feedback => assigned