1
I have found that building modules during the test of TDMCreate, I get errors on the type of programming adopted for foreach loops.
If I use the php function array_keys() and I have a null value, this function generates the following warning:
le="color: #000000"><?php Warning: array_keys() expects parameter 1 to be array, null given in file /class/xoopsform/grouppermform.php line 129 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 129 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 253 Warning: array_keys() expects parameter 1 to be array, null given in file /class/xoopsform/grouppermform.php line 266 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 266 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 253 Warning: array_keys() expects parameter 1 to be array, null given in file /class/xoopsform/grouppermform.php line 266 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 266 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 253 Warning: array_keys() expects parameter 1 to be array, null given in file /class/xoopsform/grouppermform.php line 266 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 266
while if use, in foreach, the type (array as $k => $v), not only solve the problem of container null, but the performance is better.
le="color: #000000"><?php Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 129 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 253 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 266 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 253 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 266 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 253 Warning: Invalid argument supplied for foreach() in file /class/xoopsform/grouppermform.php line 266
So at this point I was wondering if it would be inappropriate for aray_keys() function in the next versions of xoops we can be taken of this metod of writing code.
If you look on the php manual, you will notice the same thing that I have shown you some examples of users.
We want to create the appropriate function that can do this
This problem I found with the class grouppermform.php, although the results in hand, I would like to know if any of you has the same effect.