[Vtigercrm-developers] Warnings and Error messages when display_errors = On

Manilal K M libregeek at gmail.com
Wed Aug 27 00:39:52 PDT 2008


Hello everybody,
I have installed and configured vtiger-5.0.4 in our test server
running Fedora and PHP-5.2.6. However if the display_errors is On in
php.ini, then vtiger spits pages of warnings and notices which looks
like this:

Notice: Only variable references should be returned by reference in
/var/www/html/demo/vtigercrm/log4php/LoggerAppender.php on line 75
Notice: Only variable references should be returned by reference in
/var/www/html/demo/vtigercrm/log4php/LoggerPropertyConfigurator.php on
line 565
Notice: Undefined index: search in
/var/www/html/demo/vtigercrm/include/utils/utils.php on line 876
Notice: Undefined index: file in
/var/www/html/demo/vtigercrm/include/utils/utils.php on line 880
Notice: Undefined variable: announcement in
/var/www/html/demo/vtigercrm/include/utils/CommonUtils.php on line
2634
Notice: Undefined index: LNK_NEW_CONTACT in
/var/www/html/demo/vtigercrm/include/Menu.php on line 31
Notice: Undefined index: LNK_NEW_LEAD in
/var/www/html/demo/vtigercrm/include/Menu.php on line 32
Notice: Undefined index: Created in
/var/www/html/demo/vtigercrm/include/utils/CommonUtils.php on line
2757
Notice: Undefined index: Created in
/var/www/html/demo/vtigercrm/include/utils/CommonUtils.php on line
2757


I know that these messages are not a critical issue, but it's annoying
for the developers when they are testing vtiger and other web
applications on same test server. In most cases I have to use
display_errors=On for debugging purpose, then the programmers working
on vtiger will be annoyed.

I understand that the cause of these messages are due to simple
reasons. If we do some proper validation or variable declarations we
can get rid of these error messages. For example:

function &singleton($name, $class = '')
    {
        static $instances;
        if (!empty($name)) {
            if (!isset($instances[$name])) {
                if (!empty($class)) {
                    $appender = LoggerAppender::factory($name, $class);
                    if ($appender !== null) {
                        $instances[$name] = $appender;
                        return $instances[$name];
                    }
                }
                return null;
            }
            return $instances[$name];
        }
        return null;
    }


may be replaced with

function &singleton($name, $class = '')
    {
        static $instances;
        if (!empty($name)) {
            if (!isset($instances[$name])) {
                if (!empty($class)) {
                    $appender = LoggerAppender::factory($name, $class);
                    if ($appender !== null) {
                        $instances[$name] = $appender;
                        return $instances[$name];
                    }
                }
              $instances[$name] = null;
              return $instances[$name];
               }
            return $instances[$name];
        }
         $instances[$name] = null;
        return $instances[$name];
       }

I can work on these issues and submit a patch if the community accepts
it. Please let me know your thoughts.

-- 
Manilal K M : മണിലാല്‍ കെ എം.
http://libregeek.blogspot.com




More information about the vtigercrm-developers mailing list