View Issue Details

IDProjectCategoryView StatusLast Update
1273RackTablesdefaultpublic2014-10-09 13:07
Reportergeorg.hoellrigl Assigned Toinfrastation  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.20.8 
Target Version0.20.9Fixed in Version0.20.9 
Summary1273: No images are displayed
DescriptionI searched for an issue, where no images were displayed.
I've already a fix for that (besides disabling display errors)
Steps To ReproduceEnable display_errors in php.ini & don't have any php files to load in the $racktables_plugins_dir


Additional Information--- init.php 2014-07-09 09:40:13.967769274 +0200
+++ init.php 2014-07-09 09:35:10.495769599 +0200
@@ -142,7 +142,9 @@
 // load additional plugins
 ob_start();
 foreach (glob("$racktables_plugins_dir/*.php") as $filename)
- require_once $filename;
+ if (! empty($filename)) {
+ require_once $filename;
+ }
 // display plugins output if it contains something but newlines
 $tmp = ob_get_clean();
 if ($tmp != '' and ! preg_match ("/^\n+$/D", $tmp))
TagsNo tags attached.

Activities

georg.hoellrigl

georg.hoellrigl

2014-07-09 10:49

reporter   ~0002415

I'm sorry, I missed something up with the patch. Better have it in such a way - I'm sure someone working regulary in PHP code will do it in a better way!

--- init.php 2014-07-09 09:40:13.967769274 +0200
+++ init.php 2014-07-09 10:47:33.167764942 +0200
@@ -141,8 +141,11 @@

 // load additional plugins
 ob_start();
-foreach (glob("$racktables_plugins_dir/*.php") as $filename)
- require_once $filename;
+$x = glob("$racktables_plugins_dir/*.php");
+if (! empty($x)) {
+ foreach ($x as $filename)
+ require_once $filename;
+ }
 // display plugins output if it contains something but newlines
 $tmp = ob_get_clean();
 if ($tmp != '' and ! preg_match ("/^\n+$/D", $tmp))
infrastation

infrastation

2014-09-09 16:26

administrator   ~0002495

Without the fix the glob() error would normally affect not only the images but the HTML pages too. Could you check if that is the case? Also could you provide the error messages from httpd error.log if there are any without the fix? And could you tell if the following change fixes the issue?

--- a/wwwroot/inc/init.php
+++ b/wwwroot/inc/init.php
@@ -141,8 +141,9 @@ $op = '';
 
 // load additional plugins
 ob_start();
-foreach (glob("$racktables_plugins_dir/*.php") as $filename)
- require_once $filename;
+if (FALSE !== $plugin_files = glob ("$racktables_plugins_dir/*.php"))
+ foreach ($plugin_files as $plugin_file)
+ require_once $plugin_file;
 // display plugins output if it contains something but newlines
 $tmp = ob_get_clean();
 if ($tmp != '' and ! preg_match ("/^\n+$/D", $tmp))
georg.hoellrigl

georg.hoellrigl

2014-09-15 09:35

reporter   ~0002505

Here is a line from the error log, without the fix:
2014/09/10 09:19:01 [error] 18270#0: *363134 FastCGI sent in stderr: "PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/vhost/racktables/wwwroot/inc/init.php on line 144" while reading response header from upstream, client: 127.0.0.1, server: racktables, request: "GET /index.php?module=image&img=minirack&rack_id=29 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "racktables", referrer: "https://racktables/index.php?page=rackspace"

Your fix works and solves the problem!
infrastation

infrastation

2014-10-09 13:07

administrator   ~0002527

Although it is not clear now the bug affected the images but not the HTML, your findings provide sufficient ground to make the discussed change (commit ce69e97), which will be available in the next release. Thank you for the troubleshooting!

Issue History

Date Modified Username Field Change
2014-07-09 09:43 georg.hoellrigl New Issue
2014-07-09 10:49 georg.hoellrigl Note Added: 0002415
2014-09-09 16:26 infrastation Note Added: 0002495
2014-09-09 16:26 infrastation Assigned To => infrastation
2014-09-09 16:26 infrastation Status new => feedback
2014-09-15 09:35 georg.hoellrigl Note Added: 0002505
2014-09-15 09:35 georg.hoellrigl Status feedback => assigned
2014-10-09 13:07 infrastation Note Added: 0002527
2014-10-09 13:07 infrastation Status assigned => closed
2014-10-09 13:07 infrastation Resolution open => fixed
2014-10-09 13:07 infrastation Fixed in Version => 0.20.9
2014-10-09 13:07 infrastation Target Version => 0.20.9