Admidio / admidio

Admidio is a free open source user management system for websites of organizations and groups. The system has a flexible role model so that it’s possible to reflect the structure and permissions of your organization.
https://www.admidio.org
GNU General Public License v2.0
336 stars 131 forks source link

Wrong default value for $optionsAll['icon'] ? #69

Closed sistlind closed 9 years ago

sistlind commented 9 years ago

At my fresh installation with aache 2.4.7 / php5.5.9, the installation ended with:

[Fri Jun 12 08:23:40.755883 2015] [:error] [pid 3437] [client 127.0.0.1:41677] PHP Fatal error:  Uncaught exception 'AdmException' with message 'SYS_FILENAME_EMPTY' in /var/www/html/admidio/adm_program/system/string.php:274\nStack trace:\n#0 /var/www/html/admidio/adm_program/system/classes/htmlform.php(343): admStrIsValidFileName(NULL, true)\n#1 /var/www/html/admidio/adm_plugins/login_form/login_form.php(187): HtmlForm->addCheckbox('plg_auto_login', 'Angemeldet blei...', '0')\n#2 /var/www/html/admidio/adm_themes/modern/my_body_bottom.php(12): include('/var/www/html/a...')\n#3 /var/www/html/admidio/adm_program/system/classes/htmlpage.php(405): include('/var/www/html/a...')\n#4 /var/www/html/admidio/adm_program/index.php(176): HtmlPage->show()\n#5 {main}\n  thrown in /var/www/html/admidio/adm_program/system/string.php on line 274

I assume the problem is the default value for $optionsAll['icon'] =null in adm_programm/system/classes/htmlpage.php(line 310). With this nullpointer the if-condition in line 334 will not work and throw the exception.

this patch should work:

diff --git a/adm_program/system/classes/htmlform.php b/adm_program/system/classe
index 8ff5bb4..c5550de 100644
--- a/adm_program/system/classes/htmlform.php
+++ b/adm_program/system/classes/htmlform.php
@@ -307,7 +307,7 @@ class HtmlForm extends HtmlFormBasic
         $this->countElements++;

         // create array with all options
-        $optionsDefault = array('property' => FIELD_DEFAULT, 'helpTextIdLabel' 
+        $optionsDefault = array('property' => FIELD_DEFAULT, 'helpTextIdLabel' 
         $optionsAll     = array_replace($optionsDefault, $options);

         // disable field
############################################
### alternatively the check be done to check if there is a nullpointer
############################################
diff --git a/adm_program/system/classes/htmlform.php b/adm_program/system/classes/htmlform.php
index 8ff5bb4..65e3212 100644
--- a/adm_program/system/classes/htmlform.php
+++ b/adm_program/system/classes/htmlform.php
@@ -332,7 +332,7 @@ class HtmlForm extends HtmlFormBasic
             $attributes['class'] .= ' '.$optionsAll['class'];
         }

-        if($optionsAll['icon'] !== '')
+        if($optionsAll['icon'] !== null)
         {
             // create html for icon
             if(strpos(admStrToLower($optionsAll['icon']), 'http') === 0 && strValidCharacters($optionsAll['icon'], 'url')

Best regards Stefan

Edit: if done some syntax highlighting in this post. Best regards XimeX

Fasse commented 9 years ago

That looks to me thats its also a problem of the code cleanup.

ximex commented 9 years ago

hope this commit fixed that 3154dcd320e62983aaa9c97844d1c0a9cb6f8db9

ximex commented 9 years ago

@sistlind could you confirm that it is fixed?

sistlind commented 9 years ago

Hi, thx, now its working! But there is another (similar/depending) issue at the current master-branch: I could not open .../adm_program/modules/roles/roles.php to edit roles and i could not add a new category for userfields. At both sites i get the "Ungültiger Seitenaufruf"-error.

I think the problem is somewhere at the admFuncVariableIsValid function, i does not accept optional arguments correcty.

Best regards, Stefan

ximex commented 9 years ago

the last commit should fixed your "Ungültiger Seitenaufruf" bug. "announcements" and "profile" have an other bug... have to look tomorrow.

sistlind commented 9 years ago

perfect, now everything is working fine!

->closed