View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
12992Bug reportsOtherpublic2019-05-10 15:36
Reporteralex2k Assigned Todominikvitt 
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version4.0.0dev 
Fixed in Version3.15.x 
Summary12992: PHP-function each() has been deprecated
Description

The PHP-function each() has been deprecated as of PHP 7.2.0 (https://wiki.php.net/rfc/deprecations_php_7_2#each), but is still used in Limesurvey:

application/views/admin/survey/printablesurvey_view.php: while (list ($key, $val) = each($survey_output))
application/views/admin/quotas/newanswertwo_view.php: while (list($key,$value) = each($question_answers))
application/helpers/Zend/XmlRpc/Value.php: list($type, $value) = each($xml);
application/helpers/Zend/XmlRpc/Value.php: list($type, $value) = each($namespaceXml);
application/third_party/pear/PEAR.php: while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
application/third_party/phpmailer/extras/htmlfilter.php: while (list($attname, $attvalue) = each($attary)) {
application/third_party/phpmailer/extras/htmlfilter.php: while (list($attname, $attvalue) = each($attary)) {
application/third_party/tcpdf/tcpdf.php: while (list($key, $val) = each($prop)) {
application/third_party/tcpdf/tcpdf.php: while (list($id, $name) = each($attr_array[1])) {
application/third_party/tcpdf/tcpdf.php: while (list($id, $name) = each($style_array[1])) {
application/controllers/admin/quotas.php: while (list($key, $value) = each($slangs))
application/controllers/admin/questiongroups.php: while (list($key, $value) = each($grplangs))
application/controllers/admin/questions.php: while (list($key, $value) = each($questlangs))

framework/gii/components/Pear/Text/Diff/Engine/native.php: while (list(, $y) = each($matches)) {
framework/gii/components/Pear/Text/Diff/Engine/native.php: while (list(, $y) = each($matches)) {
framework/web/widgets/CTabView.php: list($this->activeTab, )=each($this->tabs);

third_party/kcfinder/lib/class_image.php: list($key, $width) = each($image);
third_party/kcfinder/lib/class_image.php: list($key, $height) = each($image);

So each() should be replaced by foreach() which is also 10 times faster or key()/current()/next().

TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)2.72.5+171121
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMariaDB 10.2
Server OS (if known)RHEL 7
Webserver software & version (if known)Apache 2.4
PHP Version7.2.0

Users monitoring this issue

There are no users monitoring this issue.

Activities

jelo

jelo

2019-01-16 19:55

partner   ~50246

3.15.6+190108 is still containing each(), which e.g break upload of images via KCFinder (when GD is used).

https://github.com/LimeSurvey/LimeSurvey/blob/7c67c5bdf55450d4603e52d733afd63d0a5f52d6/third_party/kcfinder/lib/class_image.php#L113

The corrupted image is then preventing from showing the directory at all in KCFinder.

2019kcfinderupload_each.png (25,175 bytes)   
2019kcfinderupload_each.png (25,175 bytes)   
dominikvitt

dominikvitt

2019-02-11 17:10

developer   ~50504

This issue is fixed.
https://github.com/LimeSurvey/LimeSurvey/commit/79324b3fe1284f67c2849d6c407bc20e94f022b4

c_schmitz

c_schmitz

2019-05-10 15:36

administrator   ~51886

4.0beta1 released

Issue History

Date Modified Username Field Change
2017-12-06 09:51 alex2k New Issue
2018-05-23 11:25 LouisGac Product Version 2.7x.x => 4.0.0dev
2019-01-16 19:55 jelo File Added: 2019kcfinderupload_each.png
2019-01-16 19:55 jelo Note Added: 50246
2019-01-16 19:57 jelo Assigned To => dominikvitt
2019-01-16 19:57 jelo Status new => assigned
2019-02-11 17:10 dominikvitt Status assigned => resolved
2019-02-11 17:10 dominikvitt Resolution open => fixed
2019-02-11 17:10 dominikvitt Fixed in Version => 3.15.x
2019-02-11 17:10 dominikvitt Note Added: 50504
2019-05-10 15:36 c_schmitz Note Added: 51886
2019-05-10 15:36 c_schmitz Status resolved => closed