Welcome to the nuBuilder Forums!

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

Subform: non Addable - apache warning

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

Subform: non Addable - apache warning

Unread post 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.
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Subform: non Addable - apache warning

Unread post 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
You do not have the required permissions to view the files attached to this post.
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

Re: Subform: non Addable - apache warning

Unread post 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.
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Subform: non Addable - apache warning

Unread post 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']);
admin
Site Admin
Posts: 2822
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Subform: non Addable - apache warning

Unread post by admin »

Guys,

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


Steven
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

Re: Subform: non Addable - apache warning

Unread post 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.
If you like nuBuilder, please leave a review on SourceForge
admin
Site Admin
Posts: 2822
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Subform: non Addable - apache warning

Unread post by admin »

Janusz,

It's available now.

Let me know how you go.


Steven
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

Re: Subform: non Addable - apache warning

Unread post by Janusz »

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

Janusz
If you like nuBuilder, please leave a review on SourceForge
admin
Site Admin
Posts: 2822
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Subform: non Addable - apache warning

Unread post by admin »

.
Post Reply