Bug #14892
closedPassed variable is not an array or object in t3lib/class.t3lib_div.php on line 1458
0%
Description
I made a new Flexible-Content-Element with TemplaVoila and tried to use it on a page. But randomly i earn following errors. (PS: Am i right that this error is not issued by TemplaVoila and this is the right categorie?)
Warning: reset() [function.reset]: Passed variable is not an array or object in /opt/typo3_src-3.8.0/t3lib/class.t3lib_div.php on line 1458
Warning: Variable passed to each() is not an array or object in /opt/typo3_src-3.8.0/t3lib/class.t3lib_div.php on line 1459
Warning: Cannot modify header information - headers already sent by (output started at /opt/typo3_src-3.8.0/t3lib/class.t3lib_div.php:1458) in /opt/typo3_src-3.8.0/typo3/template.php on line 601
Now i took a look at class.t3lib_div.php on line 1458 and found a confusing line. Maybe i see ghosts but isn´t this nonsense?
class.t3lib_div.php - line: 1547
-----------------------------------------
function array_merge_recursive_overrule($arr0,$arr1,$notAddKeys=0,$includeEmtpyValues=true) {
reset($arr1);
while(list($key,$val) = each($arr1)) {
-----------------------------------------
Resetting $arr1 and then try to use it? Or is it correct? I´m really not shure!
(issue imported from #M1326)
Files
Updated by Andreas Bruckmeier over 19 years ago
Sorry, i wrote too fast.
It seems that the problem is not the line with reset(), but the argunemt $arr1, which sometimes is not an array, but no clue why.
I tried a patch from another Bug (http://bugs.typo3.org/view.php?id=1087) with a similar problem on other locations and this works at the moment. But still i dont know if this makes problems on other sides.
I changed this:
------------------------
function array_merge_recursive_overrule($arr0,$arr1,$notAddKeys=0,$includeEmtpyValues=true) {
+ if(!is_array($arr1)) {
+ $arr = array();
+ }
reset($arr1);
Updated by Jens Scheidtmann over 19 years ago
"reset" resets the internal counter of the array, if it is one. So it's not unset.
There should be a guard:
if (!is_array($arr1)) { return $arr0; }
in there. This would hide the bug you are experiencing, though.
Updated by Wolfgang Klinger over 18 years ago
Hi Robert,
please check if this error is still a problem with TV,
otherwise close this report as we won't "fix" it in array_merge_recursive_overrule
Updated by Robert Lemke over 18 years ago
I tried to reproduce it with TemplaVoila 0.7.0 - but couldn't. So I guess that by the time this bug has been solved.