Page 1 of 1

Errors with 10.4.17-MariaDB

Posted: Sat Nov 18, 2023 7:00 pm
by potap
Hello,
I have a nubuilder system, that I developed about a year ago and installed it on free hosting (byethost). I don't know what DB version they had previously, but it worked fine. I didn't run it for quite a while, and now I found out that it started to throw errors like "Warning: Undefined array key 12 in /home/.../core/nucommon.php(1414) : eval()'d code on line 63" on change of almost every field.

I thought that maybe it is connected with DB update they made? Do you have any suggestions? On my local computer with mysql 8.0 it works fine.

Re: Errors with 10.4.17-MariaDB

Posted: Sat Nov 18, 2023 7:41 pm
by kev1n
Hi,

What's your PHP version?

Re: Errors with 10.4.17-MariaDB

Posted: Mon Nov 20, 2023 7:09 pm
by potap
Hosting has now PHP version 8.2.12
Whether they updated it recently or not I don't know

Re: Errors with 10.4.17-MariaDB

Posted: Mon Nov 27, 2023 6:48 pm
by potap
I've double checked it. Updated to the latest NuBuilder (september 23). The same error on my local computer with php 8.1
With php7 it works fine. Any suggestions? Maybe its possible to hide these warnings somehow? The saving takes effect, but the warning appears all the time.

Re: Errors with 10.4.17-MariaDB

Posted: Tue Nov 28, 2023 8:25 am
by kev1n
I suspect that there might be custom code causing compatibility issues with PHP 8+. You can pinpoint the problem by adding the following line to the nuExceptionHandler() function in nucommon.php. This will reveal the exact code being executed.

Code: Select all

function nuExceptionHandler($e, $code){

	$ce		= nuObjKey($_POST,'nuProcedureEval');
	$se		= nuObjKey($_POST,'nuSystemEval');
       
        //// add this line:
	nuDisplayError(">>>>>>>><br>".$code."<br>>>>>>>><br>");

	nuDisplayError("$ce $se<br>");
	nuDisplayError($e->getFile());
	nuDisplayError('<i>' . $e->getMessage() . '</i>');
	nuDisplayError('<br><b><i>Traced from...</i></b><br>');

	$a		= $e->getTrace();
	$t		= array_reverse($a);

	$count = count($t);
	for($i = 0 ; $i < $count ; $i++){

		$m	= '(line:<i>' . $t[$i]['line'] . '</i>) ' . $t[$i]['file'] . ' <b> - ' . $t[$i]['function'] . '<b>';

		nuDisplayError($m . '<br>');

	}

}

Re: Errors with 10.4.17-MariaDB

Posted: Tue Nov 28, 2023 1:38 pm
by potap
I added the line, as you said, but looks like there is no effect. The error looks as before... I don't see any >>>> symbols in the message. Thats what I see (the beggining):

Code: Select all

Uncaught Error.

Warning: Undefined array key 14 in C:\Server\data\htdocs\nbnew\core\nucommon.php(1408) : eval()'d code on line 5

Warning: Undefined array key 12 in C:\Server\data\htdocs\nbnew\core\nucommon.php(1408) : eval()'d code on line 28
{"record_id":"643","after_event":true,"user_id":"globeadmin","login_name":"globeadmin","user_team":"","user_department":"","user_position":"","user_cod
Looks like the error appears on the following line and doesn't go forward:

Code: Select all

$result = eval($php);

Re: Errors with 10.4.17-MariaDB

Posted: Tue Nov 28, 2023 2:59 pm
by kev1n
add this line before the eval code:

Code: Select all

nuDebug($php);

and then check nuDebug Results.

Re: Errors with 10.4.17-MariaDB

Posted: Tue Nov 28, 2023 4:26 pm
by potap
"Before safe" code that checks the logic.

Code: Select all

[0] : //nuDebug(nuHash()['nuFORMdata']);
//nuDebug(nuSubformObject('info_subform'));

$i=0;
while(nuHash()['nuFORMdata'][0]->fields[$i])
{
 if(nuHash()['nuFORMdata'][0]->fields[$i]=="reg_person_id") {
  if (nuHash()['nuFORMdata'][0]->rows[0][$i]==NULL) {
     nuDisplayError("Выберите или заведите нового участника, нажав на лупу рядом с полем Участник.");
  }
 }
 if(nuHash()['nuFORMdata'][0]->fields[$i]=="reg_role_id") {
  if (nuHash()['nuFORMdata'][0]->rows[0][$i]==NULL) {
     nuDisplayError("Выберите роль участника. Если это ребенок, то выберите роль его родителя");
  }
 }
 if(nuHash()['nuFORMdata'][0]->fields[$i]=="reg_festival_id") {
  if (nuHash()['nuFORMdata'][0]->rows[0][$i]==NULL) {
     nuDisplayError("Выберите фестиваль.");
  }
 }
 //nuDebug(nuHash()['nuFORMdata'][0]->fields[$i], nuHash()['nuFORMdata'][0]->rows[0][$i]);
 $i++;
}


$i=0;
while(nuHash()['nuFORMdata'][1]->fields[$i])
{
 
 if(nuHash()['nuFORMdata'][1]->fields[$i]=="person_document") {
  if (strlen(nuHash()['nuFORMdata'][1]->rows[0][$i])>50) {
     nuDisplayError("Документ должен быть не длиннее 50 символов.");
  }
 }
 
 if(nuHash()['nuFORMdata'][1]->fields[$i]=="person_city") {
  if (strlen(nuHash()['nuFORMdata'][1]->rows[0][$i])>50) {
     nuDisplayError("Город должен быть не длиннее 50 символов.");
  }
 }
 
 if(nuHash()['nuFORMdata'][1]->fields[$i]=="person_address") {
  if (strlen(nuHash()['nuFORMdata'][1]->rows[0][$i])>300) {
     nuDisplayError("Адрес должен быть не длиннее 300 символов.");
  }
 }
  
 if(nuHash()['nuFORMdata'][1]->fields[$i]=="person_comment") {
  if (strlen(nuHash()['nuFORMdata'][1]->rows[0][$i])>300) {
     nuDisplayError("Информация должна быть не длиннее 300 символов.");
  }
 }
 
 $i++;
}
On the other forms that throw the similar warnings the code is different from this one

Also several debug messages from NUSETHASHCOOKIE procedure

Code: Select all

[0] : $name = 'nuDevMode';
$value = '0';

nuSetProperty($name, $value, true);


$js = "
    if(window.nuOnPropertySet){
        nuOnPropertySet('$name', '$value');
    }
";

nuJavaScriptCallback($js);

Re: Errors with 10.4.17-MariaDB

Posted: Tue Nov 28, 2023 5:04 pm
by potap
Used "count" function for the array and put it in "while" expression and it stopped throwing warnings in this form. Thank you, Kevin. Will look through the other code.