Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Errors with 10.4.17-MariaDB

Questions related to using nuBuilder Forte.
Post Reply
potap
Posts: 28
Joined: Wed Nov 23, 2022 1:07 pm
Has thanked: 6 times
Been thanked: 1 time

Errors with 10.4.17-MariaDB

Unread post 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.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Errors with 10.4.17-MariaDB

Unread post by kev1n »

Hi,

What's your PHP version?
potap
Posts: 28
Joined: Wed Nov 23, 2022 1:07 pm
Has thanked: 6 times
Been thanked: 1 time

Re: Errors with 10.4.17-MariaDB

Unread post by potap »

Hosting has now PHP version 8.2.12
Whether they updated it recently or not I don't know
potap
Posts: 28
Joined: Wed Nov 23, 2022 1:07 pm
Has thanked: 6 times
Been thanked: 1 time

Re: Errors with 10.4.17-MariaDB

Unread post 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.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Errors with 10.4.17-MariaDB

Unread post 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>');

	}

}
potap
Posts: 28
Joined: Wed Nov 23, 2022 1:07 pm
Has thanked: 6 times
Been thanked: 1 time

Re: Errors with 10.4.17-MariaDB

Unread post 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);
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Errors with 10.4.17-MariaDB

Unread post by kev1n »

add this line before the eval code:

Code: Select all

nuDebug($php);

and then check nuDebug Results.
potap
Posts: 28
Joined: Wed Nov 23, 2022 1:07 pm
Has thanked: 6 times
Been thanked: 1 time

Re: Errors with 10.4.17-MariaDB

Unread post 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);
potap
Posts: 28
Joined: Wed Nov 23, 2022 1:07 pm
Has thanked: 6 times
Been thanked: 1 time

Re: Errors with 10.4.17-MariaDB

Unread post 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.
Post Reply