[TYPO3] userFunc in HMENU not working if the results array is too big (with templavoila)

Olivier Schopfer ops at wcc-coe.org
Fri Jun 27 14:49:07 CEST 2008


Dmitry Dulepov [typo3] wrote:
> Hi!
> 
> Olivier Schopfer wrote:
>> It seems that HMENU has a bug when using a userFunc that returns a too 
>> big array. If the number of results is limited, then it works 
>> perfectly. If I have  around 350 items, it fails and I get a blank 
>> page. Strange enough, it doesn't raise an error condition. Moreover, 
>> the admin pannel is still displayed, and seems to show the proper 
>> content of the menu.
>>
>> Any idea?
> 
> Do you have PHP error reporting enabled in Install tool?
Sure I do. PHP warnings and errors are logged in error.log. In this 
case, no error is logged.
> 
>> I have the following typoscript code in a TemplaVoilà data structure 
>> for a page:
> 
> <skip>
> 
>>         allWrap = <div class="hb_link">|</div>
> 
> I assume you wrapped script with CDATA? Other it will produce invalid DS 
> XML.
Yes it is embedded within a CDATA.
> 
>> And the code of the userFunc is:
> 
> <skip>
> 
>>       $local_cObj = t3lib_div::makeInstance('tslib_cObj'); // Local cObj.
>>       $menuArr = array();
>>       $subArr = array();
>>       $lConf = $conf["userFunc."];
>>       $value = $local_cObj->stdWrap($lConf["value"],$lConf["value."]);
> 
> Please, be consistent, use only single quotes :) This save several 
> milliseconds for each request.
Thanks for the suggestion. I replaced the quotes.
> 
>>       $res = 
>> $GLOBALS['TYPO3_DB']->exec_SELECTquery($lConf["select."]["selectFields"],'pages',' 
>> tx_templavoila_ds IN ( '.$lConf["datastructure"].') ORDER BY title ASC 
>> ');
> 
> <skip>
> 
>>       return $menuArr;
> 
> Resource leak: recordset is not freed. You'll get lots of memory leaks 
> in Apache/MySQL if you use persistent MySQL connections.

You are right, that was missing. I added 
GLOBALS['TYPO3_DB']->sql_free_result($res);
But it still doesn't work. Up to 340 records is ok, but not more.

Could it be an error in TemplaVoila? The Admin Panel shows a correct 
array for the HMENU, but no page is rendered.



More information about the TYPO3-english mailing list