View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
17347Bug reportsData Entry (non public)public2021-07-12 11:53
ReporterFoxyHutch Assigned Togabrieljenik  
PrioritynoneSeveritycrash 
Status closedResolutionfixed 
Product Version3.25.20 
Summary17347: 3.27.1: "Class 'Twig_Environment' not found" when uploading an image
Description

When uploading an Image in the texelements section (attachment 1 & 2) inside any of the textboxes (for example welcome message) it throws a "Class 'Twig_Environment' not found" error message.

Steps To Reproduce
  1. Create and save new survey
  2. Go to "Textelements" (In german its "Texteelemente", i hope its the right translation)
  3. Edit survey description
  4. Click on "Upload Image" button
  5. Pick image in dialog per button (attachment 2)
    6.It opens a new modal window with the error (attachment 3)
Additional Information

After that we tested it with version 3.25.20-210330, which suprisingly works fine.
We didn't test on any newer LTS builds prior to 3.27.

The same error exists in version 5.0.1

TagsNo tags attached.
Attached Files
1.png (246,661 bytes)
2.png (147,150 bytes)
3.png (86,772 bytes)   
3.png (86,772 bytes)   
Bug heat8
Complete LimeSurvey version number (& build)3.27.1+210531
I will donate to the project if issue is resolvedNo
BrowserFirefox
Database type & versionMariaDB 10.05.10
Server OS (if known)Windows Server 2019 Version 1809
Webserver software & version (if known)IIS 10
PHP Version7.4.13

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2021-06-01 19:37

administrator   ~64693

This works locally for me, PHP 7.4, LS 5.0.1. How did you install LimeSurvey?

FoxyHutch

FoxyHutch

2021-06-01 22:17

reporter   ~64700

Last edited: 2021-06-07 21:07

First I unpacked LS under wwwroot. PHP was already installed with iis web platform installer.
Then I set up the site in iis with fastcgi. For testing purposes without ssl on localhost:80.
After that I created a new database in mariadb with a dedicated user and set the folder permissions for tmp, upload and config.
Last step was starting up the iis and following the instructions for a fresh LS installation.
I had no problems with the installation and after that everything ran smooth besides the image upload.

ollehar

ollehar

2021-06-01 22:18

administrator   ~64701

Last edited: 2021-06-07 21:07

OK, but you got the zip file from our web page? And it was a new install, not an upgrade?

ollehar

ollehar

2021-06-02 14:14

administrator   ~64712

Last edited: 2021-06-07 21:07

Seems like this error only happens on Windows for some reason.

ollehar

ollehar

2021-06-02 18:41

administrator   ~64722

Last edited: 2021-06-07 21:07

Can you enable debug => 2 in application/config/config.php and show us the new error, please?

gabrieljenik

gabrieljenik

2021-06-07 21:06

manager   ~64775

Last edited: 2021-06-07 21:07

Master: https://github.com/LimeSurvey/LimeSurvey/pull/1911
LTS: https://github.com/LimeSurvey/LimeSurvey/pull/1912

Using autloader from composer.
Previous to 3.25.22 it wasn't required as internal.php didn't preload ETwigViewRenderer.
Since then, ETwigViewRenderer is preloaded and it tries to load its dependencies, their dependencies are not found and fails.

ollehar

ollehar

2021-06-08 12:46

administrator   ~64781

Since then, ETwigViewRenderer is preloaded and it tries to load its dependencies, their dependencies are not found and fails.

But only on Windows Server for some reason? o0

gabrieljenik

gabrieljenik

2021-06-08 20:55

manager   ~64789

Updated after @ollehar comments.

LTS: https://github.com/LimeSurvey/LimeSurvey/pull/1912
Master: https://github.com/LimeSurvey/LimeSurvey/pull/1913

This happened only on windows, as:
1) When ETwigViewRenderer was loaded Twig_Environment was required.
2) ETwigViewRenderer used its owne autoloader.
3) Twig Autoloader succesfully loaded lib/Twig/Environment.php
4) lib/Twig/Environment.php was an epty shell for loading "Twig\Environment"
5) Twig Autoloader was finding a matching file for "Twig\Environment" (same from item 4), but which wasn't the expected one, hence failing.
This happened only on windows as per the "\" on the class and a faulty autoloader.

Fixed by adding the composer autoloader before the twig autoloader.

gabrieljenik

gabrieljenik

2021-06-09 17:28

manager   ~64818

Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=31995

c_schmitz

c_schmitz

2021-07-12 11:53

administrator   ~65311

Release done.

Related Changesets

LimeSurvey: master 4246f446

2021-06-08 12:41:38

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 17347: 'Class Twig_Environment not found' when uploading an image (#1911)

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Affected Issues
17347
mod - third_party/kcfinder/core/bootstrap.php Diff File
mod - third_party/yiiext/twig-renderer/ETwigViewRenderer.php Diff File

LimeSurvey: master 5aff35f2

2021-06-08 12:42:12

ollehar

Details Diff
Revert "Fixed issue 17347: 'Class Twig_Environment not found' when uploading an image (#1911)"

This reverts commit 4246f446c3ef8dffec74418cd6f7a2bdd54ea558.
Affected Issues
17347
mod - third_party/kcfinder/core/bootstrap.php Diff File
mod - third_party/yiiext/twig-renderer/ETwigViewRenderer.php Diff File

LimeSurvey: 3.x-LTS 02bf28d3

2021-06-09 11:30:23

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 17347: 'Class Twig_Environment not found' when uploading an image (#1912)

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Affected Issues
17347
mod - third_party/kcfinder/core/bootstrap.php Diff File

LimeSurvey: master b463c91e

2021-06-09 11:30:46

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 17347: 'Class Twig_Environment not found' when uploading an image (#1913)

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Affected Issues
17347
mod - third_party/kcfinder/core/bootstrap.php Diff File

Issue History

Date Modified Username Field Change
2021-06-01 18:20 FoxyHutch New Issue
2021-06-01 18:20 FoxyHutch File Added: 1.png
2021-06-01 18:20 FoxyHutch File Added: 2.png
2021-06-01 18:20 FoxyHutch File Added: 3.png
2021-06-01 19:33 ollehar Product Version => 3.25.20
2021-06-01 19:37 ollehar Note Added: 64693
2021-06-01 19:37 ollehar Assigned To => ollehar
2021-06-01 19:37 ollehar Status new => feedback
2021-06-01 22:17 FoxyHutch Note Added: 64700
2021-06-01 22:17 FoxyHutch Status feedback => assigned
2021-06-01 22:18 ollehar Note Added: 64701
2021-06-02 14:14 ollehar Note Added: 64712
2021-06-02 18:41 ollehar Note Added: 64722
2021-06-02 18:41 ollehar Status assigned => feedback
2021-06-07 21:06 gabrieljenik Note Added: 64775
2021-06-07 21:06 gabrieljenik Status feedback => ready for testing
2021-06-07 21:07 gabrieljenik Sync to Zoho Project => |Yes|
2021-06-08 12:46 ollehar Note Added: 64781
2021-06-08 20:55 gabrieljenik Note Added: 64789
2021-06-09 13:31 ollehar Status ready for testing => resolved
2021-06-09 13:31 ollehar Resolution open => fixed
2021-06-09 17:28 gabrieljenik Changeset attached => LimeSurvey master b463c91e
2021-06-09 17:28 ollehar Changeset attached => LimeSurvey master 5aff35f2
2021-06-09 17:28 gabrieljenik Changeset attached => LimeSurvey master 4246f446
2021-06-09 17:28 gabrieljenik Changeset attached => LimeSurvey 3.x-LTS 02bf28d3
2021-06-09 17:28 gabrieljenik Note Added: 64818
2021-06-09 17:28 gabrieljenik Assigned To ollehar => gabrieljenik
2021-07-12 11:53 c_schmitz Note Added: 65311
2021-07-12 11:53 c_schmitz Status resolved => closed