View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
18453Bug reportsOtherpublic2022-11-19 19:01
ReporterDenisChenu Assigned To 
PrioritynormalSeverityminor 
Status confirmedResolutionopen 
Product Version5.4.x 
Summary18453: PHP error with debug 2 on PHP8.1 (upgrade Twig?)
Description

When se debug = 2 on PHP8.A : all page are broken

Steps To Reproduce

Steps to reproduce

Set debug to 2
Go to home page (or admin page too)

Expected result

See home page

Actual result

Error page

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)5.4.9 / master
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & version10.3.36-MariaDB-0+deb10u2
Server OS (if known)debian
Webserver software & version (if known)apache
PHP Version8.1.12

Relationships

related to 18454 confirmed Bug reports PHP deprecated notice on lot of page for PHP 8.1 

Users monitoring this issue

User List There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2022-11-04 09:30

developer  

PHP error.html (16,026 bytes)   
<!DOCTYPE html PUBLIC
	"-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>PHP error</title>

<style type="text/css">
/*<![CDATA[*/
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;margin:0;padding:0;}
body{line-height:1;}
ol,ul{list-style:none;}
blockquote,q{quotes:none;}
blockquote:before,blockquote:after,q:before,q:after{content:none;}
:focus{outline:0;}
ins{text-decoration:none;}
del{text-decoration:line-through;}
table{border-collapse:collapse;border-spacing:0;}

body {
	font: normal 9pt "Verdana";
	color: #000;
	background: #fff;
}

h1 {
	font: normal 18pt "Verdana";
	color: #f00;
	margin-bottom: .5em;
}

h2 {
	font: normal 14pt "Verdana";
	color: #800000;
	margin-bottom: .5em;
}

h3 {
	font: bold 11pt "Verdana";
}

pre {
	font: normal 11pt Menlo, Consolas, "Lucida Console", Monospace;
}

pre span.error {
	display: block;
	background: #fce3e3;
}

pre span.ln {
	color: #999;
	padding-right: 0.5em;
	border-right: 1px solid #ccc;
}

pre span.error-ln {
	font-weight: bold;
}

.container {
	margin: 1em 4em;
}

.version {
	color: gray;
	font-size: 8pt;
	border-top: 1px solid #aaa;
	padding-top: 1em;
	margin-bottom: 1em;
}

.message {
	color: #000;
	padding: 1em;
	font-size: 11pt;
	background: #f3f3f3;
	-webkit-border-radius: 10px;
	-moz-border-radius: 10px;
	border-radius: 10px;
	margin-bottom: 1em;
	line-height: 160%;
}

.source {
	margin-bottom: 1em;
}

.code pre {
	background-color: #ffe;
	margin: 0.5em 0;
	padding: 0.5em;
	line-height: 125%;
	border: 1px solid #eee;
}

.source .file {
	margin-bottom: 1em;
	font-weight: bold;
}

.traces {
	margin: 2em 0;
}

.trace {
	margin: 0.5em 0;
	padding: 0.5em;
}

.trace.app {
	border: 1px dashed #c00;
}

.trace .number {
	text-align: right;
	width: 2em;
	padding: 0.5em;
}

.trace .content {
	padding: 0.5em;
}

.trace .plus,
.trace .minus {
	display:inline;
	vertical-align:middle;
	text-align:center;
	border:1px solid #000;
	color:#000;
	font-size:10px;
	line-height:10px;
	margin:0;
	padding:0 1px;
	width:10px;
	height:10px;
}

.trace.collapsed .minus,
.trace.expanded .plus,
.trace.collapsed pre {
	display: none;
}

.trace-file {
	cursor: pointer;
	padding: 0.2em;
}

.trace-file:hover {
	background: #f0ffff;
}
/*]]>*/
</style>
</head>

<body>
<div class="container">
	<h1>PHP error</h1>

	<p class="message">
		realpath(): Passing null to parameter #1 ($path) of type string is deprecated	</p>

	<div class="source">
		<p class="file">/home/www/demonstrations/master.sondages.pro/htdocs/third_party/twig/twig/src/Loader/FilesystemLoader.php(40)</p>
		<div class="code"><pre><span class="ln">28</span>     protected $cache = [];
<span class="ln">29</span>     protected $errorCache = [];
<span class="ln">30</span> 
<span class="ln">31</span>     private $rootPath;
<span class="ln">32</span> 
<span class="ln">33</span>     /**
<span class="ln">34</span>      * @param string|array $paths    A path or an array of paths where to look for templates
<span class="ln">35</span>      * @param string|null  $rootPath The root path common to all relative paths (null for getcwd())
<span class="ln">36</span>      */
<span class="ln">37</span>     public function __construct($paths = [], $rootPath = null)
<span class="ln">38</span>     {
<span class="ln">39</span>         $this-&gt;rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR;
<span class="error"><span class="ln error-ln">40</span>         if (false !== $realPath = realpath($rootPath)) {
</span><span class="ln">41</span>             $this-&gt;rootPath = $realPath.\DIRECTORY_SEPARATOR;
<span class="ln">42</span>         }
<span class="ln">43</span> 
<span class="ln">44</span>         if ($paths) {
<span class="ln">45</span>             $this-&gt;setPaths($paths);
<span class="ln">46</span>         }
<span class="ln">47</span>     }
<span class="ln">48</span> 
<span class="ln">49</span>     /**
<span class="ln">50</span>      * Returns the paths to the templates.
<span class="ln">51</span>      *
<span class="ln">52</span>      * @param string $namespace A path namespace
</pre></div>	</div>

	<div class="traces">
		<h2>Stack Trace</h2>
				<table style="width:100%;">
						<tr class="trace app expanded">
			<td class="number">
				#0			</td>
			<td class="content">
				<div class="trace-file">
											<div class="plus">+</div>
						<div class="minus">–</div>
										&nbsp;/home/www/demonstrations/master.sondages.pro/htdocs/third_party/twig/twig/src/Loader/FilesystemLoader.php(40): <strong>realpath</strong>(null)				</div>

				<div class="code"><pre><span class="ln">35</span>      * @param string|null  $rootPath The root path common to all relative paths (null for getcwd())
<span class="ln">36</span>      */
<span class="ln">37</span>     public function __construct($paths = [], $rootPath = null)
<span class="ln">38</span>     {
<span class="ln">39</span>         $this-&gt;rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR;
<span class="error"><span class="ln error-ln">40</span>         if (false !== $realPath = realpath($rootPath)) {
</span><span class="ln">41</span>             $this-&gt;rootPath = $realPath.\DIRECTORY_SEPARATOR;
<span class="ln">42</span>         }
<span class="ln">43</span> 
<span class="ln">44</span>         if ($paths) {
<span class="ln">45</span>             $this-&gt;setPaths($paths);
</pre></div>			</td>
		</tr>
						<tr class="trace app expanded">
			<td class="number">
				#1			</td>
			<td class="content">
				<div class="trace-file">
											<div class="plus">+</div>
						<div class="minus">–</div>
										&nbsp;/home/www/demonstrations/master.sondages.pro/htdocs/third_party/yiiext/twig-renderer/ETwigViewRenderer.php(86): <strong>Twig\Loader\FilesystemLoader</strong>-><strong>__construct</strong>(array(&quot;/home/www/demonstrations/master.sondages.pro/htdocs/application&quot;))				</div>

				<div class="code"><pre><span class="ln">81</span>             $this-&gt;_paths[] = $theme-&gt;getBasePath();
<span class="ln">82</span>         }
<span class="ln">83</span> 
<span class="ln">84</span>         $this-&gt;_paths[] = $app-&gt;getBasePath();
<span class="ln">85</span> 
<span class="error"><span class="ln error-ln">86</span>         $loader = new Twig_Loader_Filesystem($this-&gt;_paths);
</span><span class="ln">87</span> 
<span class="ln">88</span>         $defaultOptions = array(
<span class="ln">89</span>             &#039;autoescape&#039; =&gt; false, // false because other way Twig escapes all HTML in templates
<span class="ln">90</span>             &#039;auto_reload&#039; =&gt; true,
<span class="ln">91</span>             &#039;cache&#039; =&gt; $app-&gt;getRuntimePath() . &#039;/twig_cache/&#039;,
</pre></div>			</td>
		</tr>
						<tr class="trace core collapsed">
			<td class="number">
				#2			</td>
			<td class="content">
				<div class="trace-file">
											<div class="plus">+</div>
						<div class="minus">–</div>
										&nbsp;/home/www/demonstrations/master.sondages.pro/htdocs/third_party/yiisoft/yii/framework/base/CModule.php(394): <strong>ETwigViewRenderer</strong>-><strong>init</strong>()				</div>

				<div class="code"><pre><span class="ln">389</span>             if(!isset($config[&#039;enabled&#039;]) || $config[&#039;enabled&#039;])
<span class="ln">390</span>             {
<span class="ln">391</span>                 Yii::trace(&quot;Loading \&quot;$id\&quot; application component&quot;,&#039;system.CModule&#039;);
<span class="ln">392</span>                 unset($config[&#039;enabled&#039;]);
<span class="ln">393</span>                 $component=Yii::createComponent($config);
<span class="error"><span class="ln error-ln">394</span>                 $component-&gt;init();
</span><span class="ln">395</span>                 return $this-&gt;_components[$id]=$component;
<span class="ln">396</span>             }
<span class="ln">397</span>         }
<span class="ln">398</span>     }
<span class="ln">399</span> 
</pre></div>			</td>
		</tr>
						<tr class="trace core collapsed">
			<td class="number">
				#3			</td>
			<td class="content">
				<div class="trace-file">
											<div class="plus">+</div>
						<div class="minus">–</div>
										&nbsp;/home/www/demonstrations/master.sondages.pro/htdocs/third_party/yiisoft/yii/framework/base/CModule.php(530): <strong>CModule</strong>-><strong>getComponent</strong>(&quot;ETwigViewRenderer&quot;)				</div>

				<div class="code"><pre><span class="ln">525</span>      * Loads static application components.
<span class="ln">526</span>      */
<span class="ln">527</span>     protected function preloadComponents()
<span class="ln">528</span>     {
<span class="ln">529</span>         foreach($this-&gt;preload as $id)
<span class="error"><span class="ln error-ln">530</span>             $this-&gt;getComponent($id);
</span><span class="ln">531</span>     }
<span class="ln">532</span> 
<span class="ln">533</span>     /**
<span class="ln">534</span>      * Preinitializes the module.
<span class="ln">535</span>      * This method is called at the beginning of the module constructor.
</pre></div>			</td>
		</tr>
						<tr class="trace core collapsed">
			<td class="number">
				#4			</td>
			<td class="content">
				<div class="trace-file">
											<div class="plus">+</div>
						<div class="minus">–</div>
										&nbsp;/home/www/demonstrations/master.sondages.pro/htdocs/third_party/yiisoft/yii/framework/base/CApplication.php(168): <strong>CModule</strong>-><strong>preloadComponents</strong>()				</div>

				<div class="code"><pre><span class="ln">163</span>         $this-&gt;initSystemHandlers();
<span class="ln">164</span>         $this-&gt;registerCoreComponents();
<span class="ln">165</span> 
<span class="ln">166</span>         $this-&gt;configure($config);
<span class="ln">167</span>         $this-&gt;attachBehaviors($this-&gt;behaviors);
<span class="error"><span class="ln error-ln">168</span>         $this-&gt;preloadComponents();
</span><span class="ln">169</span> 
<span class="ln">170</span>         $this-&gt;init();
<span class="ln">171</span>     }
<span class="ln">172</span> 
<span class="ln">173</span> 
</pre></div>			</td>
		</tr>
						<tr class="trace app expanded">
			<td class="number">
				#5			</td>
			<td class="content">
				<div class="trace-file">
											<div class="plus">+</div>
						<div class="minus">–</div>
										&nbsp;/home/www/demonstrations/master.sondages.pro/htdocs/application/core/LSYii_Application.php(90): <strong>CApplication</strong>-><strong>__construct</strong>(array(&quot;name&quot; =&gt; &quot;LimeSurvey&quot;, &quot;localeClass&quot; =&gt; &quot;LSYii_Locale&quot;, &quot;defaultController&quot; =&gt; &quot;surveys&quot;, &quot;modules&quot; =&gt; array(&quot;HelloWorld&quot; =&gt; array(&quot;class&quot; =&gt; &quot;modules.root.HelloWorld.HelloWorldModule&quot;)), ...))				</div>

				<div class="code"><pre><span class="ln">85</span>         if (array_key_exists(&#039;use_custom_twig_extensions&#039;, $baseConfig) &amp;&amp; $baseConfig [&#039;use_custom_twig_extensions&#039;]) {
<span class="ln">86</span>             $aApplicationConfig = $this-&gt;getTwigCustomExtensionsConfig($baseConfig[&#039;usertwigextensionrootdir&#039;], $aApplicationConfig);
<span class="ln">87</span>         }
<span class="ln">88</span> 
<span class="ln">89</span>         /* Construct CWebApplication */
<span class="error"><span class="ln error-ln">90</span>         parent::__construct($aApplicationConfig);
</span><span class="ln">91</span> 
<span class="ln">92</span>         /* Because we have app now : we have to call again the config (usage of Yii::app() for publicurl) */
<span class="ln">93</span>         $this-&gt;setConfigs();
<span class="ln">94</span>         /* Since session can be set by DB : need to be set again … */
<span class="ln">95</span>         $this-&gt;setSessionByDB($aApplicationConfig);
</pre></div>			</td>
		</tr>
						<tr class="trace core collapsed">
			<td class="number">
				#6			</td>
			<td class="content">
				<div class="trace-file">
											<div class="plus">+</div>
						<div class="minus">–</div>
										&nbsp;/home/www/demonstrations/master.sondages.pro/htdocs/third_party/yiisoft/yii/framework/YiiBase.php(132): <strong>LSYii_Application</strong>-><strong>__construct</strong>(array(&quot;basePath&quot; =&gt; &quot;/home/www/demonstrations/master.sondages.pro/htdocs/application&quot;, &quot;name&quot; =&gt; &quot;LimeSurvey&quot;, &quot;localeClass&quot; =&gt; &quot;LSYii_Locale&quot;, &quot;defaultController&quot; =&gt; &quot;surveys&quot;, ...))				</div>

				<div class="code"><pre><span class="ln">127</span>      * to the constructor of the application class.
<span class="ln">128</span>      * @return mixed the application instance
<span class="ln">129</span>      */
<span class="ln">130</span>     public static function createApplication($class,$config=null)
<span class="ln">131</span>     {
<span class="error"><span class="ln error-ln">132</span>         return new $class($config);
</span><span class="ln">133</span>     }
<span class="ln">134</span> 
<span class="ln">135</span>     /**
<span class="ln">136</span>      * Returns the application singleton or null if the singleton has not been created yet.
<span class="ln">137</span>      * @return CApplication the application singleton, null if the singleton has not been created yet.
</pre></div>			</td>
		</tr>
						<tr class="trace app collapsed">
			<td class="number">
				#7			</td>
			<td class="content">
				<div class="trace-file">
											<div class="plus">+</div>
						<div class="minus">–</div>
										&nbsp;/home/www/demonstrations/master.sondages.pro/htdocs/index.php(192): <strong>YiiBase</strong>::<strong>createApplication</strong>(&quot;LSYii_Application&quot;, array(&quot;basePath&quot; =&gt; &quot;/home/www/demonstrations/master.sondages.pro/htdocs/application&quot;, &quot;name&quot; =&gt; &quot;LimeSurvey&quot;, &quot;localeClass&quot; =&gt; &quot;LSYii_Locale&quot;, &quot;defaultController&quot; =&gt; &quot;surveys&quot;, ...))				</div>

				<div class="code"><pre><span class="ln">187</span> require_once APPPATH . &#039;core/LSYii_Application&#039; . EXT;
<span class="ln">188</span> 
<span class="ln">189</span> $config = require_once(APPPATH . &#039;config/internal&#039; . EXT);
<span class="ln">190</span> 
<span class="ln">191</span> Yii::$enableIncludePath = false;
<span class="error"><span class="ln error-ln">192</span> Yii::createApplication(&#039;LSYii_Application&#039;, $config)-&gt;run();
</span><span class="ln">193</span> 
<span class="ln">194</span> /* End of file index.php */
<span class="ln">195</span> /* Location: ./index.php */
</pre></div>			</td>
		</tr>
				</table>
	</div>

	<div class="version">
		2022-11-04 09:25:13 Apache/2.4.38 (Debian) <a href="https://www.yiiframework.com/">Yii Framework</a>/1.1.26	</div>
</div>

<script type="text/javascript">
/*<![CDATA[*/
var traceReg = new RegExp("(^|\\s)trace-file(\\s|$)");
var collapsedReg = new RegExp("(^|\\s)collapsed(\\s|$)");

var e = document.getElementsByTagName("div");
for(var j=0,len=e.length;j<len;j++){
	if(traceReg.test(e[j].className)){
		e[j].onclick = function(){
			var trace = this.parentNode.parentNode;
			if(collapsedReg.test(trace.className))
				trace.className = trace.className.replace("collapsed", "expanded");
			else
				trace.className = trace.className.replace("expanded", "collapsed");
		}
	}
}
/*]]>*/
</script>

</body>
</html>
PHP error.html (16,026 bytes)   
ollehar

ollehar

2022-11-04 11:41

administrator   ~72552

Same bug as other for deprecated warnings? Merge?

DenisChenu

DenisChenu

2022-11-04 11:46

developer   ~72556

This one is in all page ,

Related to third_party twig … we currently use 1.X branch ? Right ?

https://github.com/twigphp/Twig/tree/1.x
Twig version 1 is not maintained anymore. Please, upgrade at your earliest convenience.

Argl ?

ollehar

ollehar

2022-11-04 11:48

administrator   ~72557

To upgrade Twig, we might have to drop support for PHP 7.2. Maybe we do this for LS 6.0? Which is the Bootstrap 5 update.

DenisChenu

DenisChenu

2022-11-04 11:48

developer   ~72558

https://twig.symfony.com/doc/2.x/deprecated.html

DenisChenu

DenisChenu

2022-11-04 11:50

developer   ~72559

To upgrade Twig, we might have to drop support for PHP 7.2. Maybe we do this for LS 6.0? Which is the Bootstrap 5 update.

Then check if we can fix via calling twig part ? Else LimeSurvey are not PHP8.1 compatible …

Let me check if i can fix it with the call $loader = new Twig_Loader_Filesystem($this->_paths);

ollehar

ollehar

2022-11-04 11:52

administrator   ~72561

"Twig 3.x needs at least PHP 7.2.5 to run."
Hm!

DenisChenu

DenisChenu

2022-11-04 12:02

developer   ~72566

Same for 2 : "Twig 2.x needs at least PHP 7.2.5 to run."

Else : another third_party …
https://github.com/yiiext/twig-renderer/issues

adding getcwd to call anotherbroke

Return type of Twig\Node\Node::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

… … :(

gabrieljenik

gabrieljenik

2022-11-07 14:18

manager   ~72612

As to also consider
https://bugs.limesurvey.org/view.php?id=18359#c72079

Issue History

Date Modified Username Field Change
2022-11-04 09:30 DenisChenu New Issue
2022-11-04 09:30 DenisChenu File Added: PHP error.html
2022-11-04 11:41 ollehar Note Added: 72552
2022-11-04 11:41 ollehar Bug heat 0 => 2
2022-11-04 11:46 DenisChenu Note Added: 72556
2022-11-04 11:46 DenisChenu Bug heat 2 => 4
2022-11-04 11:48 ollehar Note Added: 72557
2022-11-04 11:48 DenisChenu Note Added: 72558
2022-11-04 11:50 DenisChenu Note Added: 72559
2022-11-04 11:52 ollehar Note Added: 72561
2022-11-04 11:54 ollehar Priority none => normal
2022-11-04 12:02 DenisChenu Note Added: 72566
2022-11-04 12:05 ollehar Summary PHP error with debug 2 on PHP8.1 => PHP error with debug 2 on PHP8.1 (upgrade Twig?)
2022-11-07 14:18 gabrieljenik Note Added: 72612
2022-11-07 14:18 gabrieljenik Bug heat 4 => 6
2022-11-07 14:18 gabrieljenik Status new => confirmed
2022-11-19 19:01 DenisChenu Relationship added related to 18454