Topic: Missing files errors in /tmp/errors.log and fix

Reported in the Mantis BugTracker as issue #4082.

On a fresh install of FA 2.4.3 on WinXPSP3/XAMPP 1.73/PHP 5.3.1, we find that the "@" prefixing some function calls do not supress errors in the FA /tmp/errors.log. Here are a few errors that arose:

session.inc:440:[before upgrade] include_once(./tmp/faillog.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory
session.inc:440:[before upgrade] include_once() [<a href='function.include'>function.include</a>]: Failed opening './tmp/faillog.php' for inclusion (include_path='.;\XAMPP\php\PEAR')
session.inc:490:[before upgrade] include(./company/0/installed_extensions.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
session.inc:490:[before upgrade] include() [<a href='function.include'>function.include</a>]: Failed opening './company/0/installed_extensions.php' for inclusion (include_path='.;\XAMPP\php\PEAR)
hooks.inc:238:[before upgrade] Invalid argument supplied for foreach()
current_user.inc:735:[before upgrade] opendir(./company/0/js_cache/0) [<a href='function.opendir'>function.opendir</a>]: failed to open dir: No such file or directory
session.inc:440:[before upgrade] include_once(./tmp/faillog.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory
session.inc:440:[before upgrade] include_once() [<a href='function.include'>function.include</a>]: Failed opening './tmp/faillog.php' for inclusion (include_path='.;\XAMPP\php\PEAR')

Each time we logout of FA, the following gets logged (date/time prefix removed) in the FA /tmp/errors.log:

logout.php:50:[before upgrade] session_destroy() [<a href='function.session-destroy'>function.session-destroy</a>]: Session object destruction failed

These entries are the result of failure to respect the "@" prefixing the session_destroy() function used therein. Such entries, however, can be leveraged by any log parsing program to monitor logout events.

Post's attachments

FA24_errors_log_fix.diff 1.7 kb, 2 downloads since 2017-11-13 

You don't have the permssions to download the attachments of this post.

Re: Missing files errors in /tmp/errors.log and fix

@joe: Committed

Re: Missing files errors in /tmp/errors.log and fix

Hello ,,,

seems this fix caused an error message to appear.
after updating all the 3 files included in the fix
includes/current_user.inc
includes/hooks.inc
includes/session.inc

i started to get this error

set_exception_handler() expects the argument (exception_handler) to be a valid callback in file: ...includes/session.inc at line 375

Re: Missing files errors in /tmp/errors.log and fix

I am unable to simulate your error. Please state what steps were necessary to trigger it. Make sure your tmp folder is writeable by your webserver process.

Re: Missing files errors in /tmp/errors.log and fix

i just replaced the files with the ones from the last build.

includes/current_user.inc
includes/hooks.inc
includes/session.inc

Re: Missing files errors in /tmp/errors.log and fix

i can confirm now that the files mentioned above caused 2 problems.

1- the error message mentioned above.
2- when generating excel report the file is corrupted.

the problem is fixed by replacing the new files with the old files.

7 (edited by Alaa 11/17/2017 01:22:51 pm)

Re: Missing files errors in /tmp/errors.log and fix

this doesnt happen when i use the new files on my localhost but it happens on the online server.

Re: Missing files errors in /tmp/errors.log and fix

@alaa

What are the php versions?

/Joe

9 (edited by Alaa 11/17/2017 02:10:59 pm)

Re: Missing files errors in /tmp/errors.log and fix

5.6 on server "where the bug occurs"
7.1 localhost

Re: Missing files errors in /tmp/errors.log and fix

@joe / @itronics:

From the PHP Manual Comments:

Using the 'set_exception_handler' function within a class, the defined 'exception_handler' method must be declared as 'public' (preferrable 'public static' if you use the "array('example', 'exception_handler')" syntax). It should be in an array as below:

<?php
class example {
    public function __construct() {
        @set_exception_handler(array('example', 'exception_handler'));
        throw new Exception('DOH!!');
    }

    public static function exception_handler($exception) {
        print "Exception Caught: ". $exception->getMessage() ."\n";
    }
}

$example = new example;

echo "Not Executed\n";
?>

Declaring the 'exception_handler' function as 'private' causes a FATAL ERROR.

Looks like every instance of exception handling within a class should be so coded for PHP 5.6 / 7.1.

Place the 3 files one by one and see which one is faulty.