Subform: non Addable - apache warning

Questions related to customising nuBuilder Forte with Javascript or PHP.

Subform: non Addable - apache warning

Postby Janusz » Sun Oct 06, 2019 9:27 am

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.
Janusz
 
Posts: 229
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: Subform: non Addable - apache warning

Postby kev1n » Mon Oct 07, 2019 5:31 pm

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
access_form.png (6.59 KiB) Viewed 48 times
kev1n
 
Posts: 260
Joined: Mon Oct 15, 2018 2:13 am

Re: Subform: non Addable - apache warning

Postby Janusz » Tue Oct 08, 2019 1:20 am

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=1kPYYOAT8Ha-I7qanHhoebWDvUVpmeZFn

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.
Janusz
 
Posts: 229
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: Subform: non Addable - apache warning

Postby kev1n » Wed Oct 09, 2019 3:22 am

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']);
kev1n
 
Posts: 260
Joined: Mon Oct 15, 2018 2:13 am

Re: Subform: non Addable - apache warning

Postby admin » Wed Oct 09, 2019 6:08 am

Guys,

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


Steven
admin
Site Admin
 
Posts: 3123
Joined: Mon Jun 15, 2009 9:53 am

Re: Subform: non Addable - apache warning

Postby Janusz » Wed Oct 09, 2019 6:45 am

Thank's for info and looking forwad to the new release :D

And just to confirm the fix from Kev1n is working fine.
Janusz
 
Posts: 229
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: Subform: non Addable - apache warning

Postby admin » Wed Oct 09, 2019 10:28 am

Janusz,

It's available now.

Let me know how you go.


Steven
admin
Site Admin
 
Posts: 3123
Joined: Mon Jun 15, 2009 9:53 am

Re: Subform: non Addable - apache warning

Postby Janusz » Wed Oct 09, 2019 2:34 pm

Steven,
New version is working fine - completelly NO warnings in the apache2 error logs.
Thank you very much :D

Janusz
Janusz
 
Posts: 229
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland


Return to Custom Code