Page 1 of 1

Subform: non Addable - apache warning

Posted: Sun Oct 06, 2019 1:57 am
by Janusz
Checking some apache2 logs I noticed some PHP warnings (not visible in nuBuilder).

After some more checking: warning are generated during save or delete operation of the main form when the subfom has the option Addable set to NO (no empty line at the bottom of the subform)
AND when the subform is still empty.

then I have the following warnings in apache2:

Code: Select all

PHP Warning:  in_array() expects parameter 2 to be array, null given in ..../nudata.php on line 161, referer: ... index.php?i=2&opener=.....
PHP Warning:  count(): Parameter must be an array or an object that implements Countable in ... nudata.php on line 163, referer: 
PHP Warning:  count(): Parameter must be an array or an object that implements Countable in .. on line 309, referer:....index.php?i=2&opener=....
If the Addable is set to YES then there is no warnings at all.

So currently I put the Addable ON to avoid warning.
If subform is set to grid then there are warnings as described above - if it is set as from - then it blocks the main form (majority of objects are not appearing)

It's just for info - maybe during the next release this issue cloud be corrected.

Re: Subform: non Addable - apache warning

Posted: Mon Oct 07, 2019 10:01 am
by kev1n
I can't recreate the problem myself. Test done with "Access Levels" and set Addable = No in the subform (accform)
There are no errors in the apache log file after saving the form.
access_form.png

Re: Subform: non Addable - apache warning

Posted: Mon Oct 07, 2019 5:50 pm
by Janusz
Kev1n,
Please find enclosed a DB example when I can see the warning.
In my case the warning can be reproduced when you add new record from the main form or delete record from the main form with empty subform.

Code: Select all

 [php7:warn] [...] PHP Warning:  in_array() expects parameter 2 to be array, null given in /var/www/.../nudata.php on line 161, referer: https://.../index.php
https://drive.google.com/open?id=1kPYYO ... DvUVpmeZFn

I noticed as well that on the recent nuBulder there is one warning related to line 161.
When I run the version from may/2019 then I have more warning - as in my original post.

Re: Subform: non Addable - apache warning

Posted: Tue Oct 08, 2019 7:52 pm
by kev1n
Try this fix in nudata.php, line 161:

replace this:

Code: Select all

$log		= in_array($table . '_nulog', $cts[$table]['names']);
... with:

Code: Select all

		if ($table != '') {
			$log		= in_array($table . '_nulog', $cts[$table]['names']);
		} else
		{
			$log = false;
		}
or this (untested, shorthand version)

Code: Select all

$log = $table == '' ? false : in_array($table . '_nulog', $cts[$table]['names']);

Re: Subform: non Addable - apache warning

Posted: Tue Oct 08, 2019 10:38 pm
by admin
Guys,

This is fixed in the new release available in the next few days.


Steven

Re: Subform: non Addable - apache warning

Posted: Tue Oct 08, 2019 11:15 pm
by Janusz
Thank's for info and looking forwad to the new release :D

And just to confirm the fix from Kev1n is working fine.

Re: Subform: non Addable - apache warning

Posted: Wed Oct 09, 2019 2:58 am
by admin
Janusz,

It's available now.

Let me know how you go.


Steven

Re: Subform: non Addable - apache warning

Posted: Wed Oct 09, 2019 7:04 am
by Janusz
Steven,
New version is working fine - completelly NO warnings in the apache2 error logs.
Thank you very much :D

Janusz

Re: Subform: non Addable - apache warning

Posted: Tue Oct 29, 2019 5:17 am
by admin
.