Re: Cannot delete audit data [message #7753 is a reply to message #7752] |
Wed, 13 July 2022 18:35 |
divico
Messages: 16 Registered: August 2008
|
Junior Member |
|
|
Thanks for your response. I don't give up. I use the latest version 2.22.
1.) The correct location for script batch.ini is in the radicore <root> directory.
I inserted the following echo statements into the code:
function batchInit ($batchfile)
// initialisation for a batch process
{
global $stdout, $stdouth, $argv;
error_reporting(-1); // report everything
ini_set('display_errors', true); // display everything
$result = ini_set('max_execution_time', 0); // no time limit
set_error_handler('errorHandlerBatch');
echo $batchfile . PHP_EOL;
// get fully-qualified name of current file
$curr_file = str_replace("\\", "/", $batchfile);
echo $curr_file . PHP_EOL;
$curr_dir = dirname($curr_file); // extract directory
echo $curr_dir . PHP_EOL;
chdir($curr_dir); // set current working directory to this
// retrieve variables from file
if (file_exists('batch.ini')) {
echo "Use custom file" . PHP_EOL;
$ini_array = parse_ini_file('batch.ini'); // use custom file
} else {
echo "Use default file" . PHP_EOL;
$ini_array = parse_ini_file('batch.ini.default'); // use default file
} // if
This results in:
[$batchfile = ]/var/www/html/radicore/mysubsys/mybatch(batch).php
[$curr_file = ]/var/www/html/radicore/mysubsys/mybatch(batch).php
[$curr_dir = ]/var/www/html/radicore/mysubsys
Use default file
file_exists("batch.ini") looks in the subsys directory ("/var/www/html/radicore/mysubsys") and not in the root directory. It doesn't find it there, hence batch.ini.default is used. If the documentation is correct $curr_dir must be changed to point to the radicore root directory ("/var/www/html/radicore") in my case.
2.) The version of errorHandlerBatch() in the RADICORE download already contains the correct five arguments. The version which you are using must be incorrect.
I have the correct version with the correct signature. I found this in the documentation:
See https://www.php.net/manual/en/function.set-error-handler.php
errcontext:
"Warning
This parameter has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0. If your function defines this parameter without a default, an error of "too few arguments" will be raised when it is called."
I think this is the issue. As a matter of fact the errcontext may be removed or at least a default value has to be defined, as suggested by myself.
3.) The error reported at includes/language_detection.inc on line 279 is wrong as that line does not try to convert FALSE to array. On my system the command is:
$_SESSION['user_language_array'] = get_user_languages($_SERVER["HTTP_ACCEPT_LANGUAGE"]);
I have the same statement on this line. I think the issue is that $_SESSION is not defined, resp. is of type bool.
I changed the code as follows:
$a = get_user_languages($_SERVER["HTTP_ACCEPT_LANGUAGE"]);
echo "About to print the result of get_user_languages" . PHP_EOL;
echo gettype($a) . PHP_EOL;
var_dump($a);
echo "After print of the result of get_user_languages" . PHP_EOL;
//$_SESSION['user_language_array'] = get_user_languages($_SERVER["HTTP_ACCEPT_LANGUAGE"]);
echo "About to print the result of SESSION" . PHP_EOL;
echo gettype($_SESSION) . PHP_EOL;
var_dump($_SESSION);
echo "After print of the result of SESSION" . PHP_EOL;
$_SESSION = array();
$_SESSION['user_language_array'] = $a;
Results in:
About to print the result of get_user_languages
array
/var/www/html/radicore/includes/language_detection.inc:282:
array(1) {
[0] =>
array(4) {
[0] =>
string(5) "en-gb"
[1] =>
string(2) "en"
[2] =>
string(32) "English (United Kingdom) [en_GB]"
[3] =>
string(7) "English"
}
}
After print of the result of get_user_languages
About to print the result of SESSION
boolean
/var/www/html/radicore/includes/language_detection.inc:287:
bool(false)
After print of the result of SESSION
$_SESSION is of type bool. Therefore the error is raised. Potentially this change in PHP 8.1 applies here:
https://wiki.php.net/rfc/autovivification_false
Declaring $_SESSION as an array removes the error on my system.
4.) The error reported at /includes/include.session.inc line 993 is wrong as that command does not contain a call to 'strtoupper()'. On my system the command is:
trigger_error($GLOBALS['php_errormsg'], E_USER_ERROR);
I have the same code on this line and currently no idea why I receive the error. But I get what I get.
btw: I cannot download your zip file, receiving
Access to forum.radicore.org was denied
You don't have authorization to view this page.
HTTP ERROR 403
when I click on it.
I think I have a better understanding what happens re my issues 1-3. Would it be possible to consider my suggestions? I'm sure there must be a reasonable explanation for issue no 4 as well. Maybe something comes to your mind.
|
|
|