Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 10:03 pm EST
Geeklog Forums
Odd Error
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
I get this error but only once a week or so....
An error has occurred:
2 - Invalid argument supplied for foreach() @ /Library/WebServer/commun/Documents/lib-common.php line 4723
when i load the main page of one of my sites however if i load again it goes away....????
Something must be wrong ?
An error has occurred:
2 - Invalid argument supplied for foreach() @ /Library/WebServer/commun/Documents/lib-common.php line 4723
when i load the main page of one of my sites however if i load again it goes away....????
Something must be wrong ?
8
8
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
1.4.1 this is the function...
{
global $_CONF;
$list = new Template( $_CONF['path_layout'] );
$list->set_file( array( 'list' => 'list.thtml',
'listitem' => 'listitem.thtml' ));
$list->set_var( 'site_url', $_CONF['site_url'] );
$list->set_var( 'layout_url', $_CONF['layout_url'] );
if( empty( $classname ))
{
$list->set_var( 'list_class', '' );
$list->set_var( 'list_class_name', '' );
}
else
{
$list->set_var( 'list_class', 'class="' . $classname . '"' );
$list->set_var( 'list_class_name', $classname );
}
foreach( $listofitems as $oneitem )
{
$list->set_var( 'list_item', $oneitem );
$list->parse( 'list_items', 'listitem', true );
}
$list->parse( 'newlist', 'list', true );
return $list->finish( $list->get_var( 'newlist' ));
}
Text Formatted Code
function COM_makeList( $listofitems, $classname = '' ){
global $_CONF;
$list = new Template( $_CONF['path_layout'] );
$list->set_file( array( 'list' => 'list.thtml',
'listitem' => 'listitem.thtml' ));
$list->set_var( 'site_url', $_CONF['site_url'] );
$list->set_var( 'layout_url', $_CONF['layout_url'] );
if( empty( $classname ))
{
$list->set_var( 'list_class', '' );
$list->set_var( 'list_class_name', '' );
}
else
{
$list->set_var( 'list_class', 'class="' . $classname . '"' );
$list->set_var( 'list_class_name', $classname );
}
foreach( $listofitems as $oneitem )
{
$list->set_var( 'list_item', $oneitem );
$list->parse( 'list_items', 'listitem', true );
}
$list->parse( 'newlist', 'list', true );
return $list->finish( $list->get_var( 'newlist' ));
}
5
10
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
You must have modified your lib-common.php then, since COM_makeList only starts in line 4797.
Anyway, the problem is with whatever is calling that function. Do you have some sort of dynamic block on your site that displays items in a list? Looks like occasionally, it's calling COM_makeList with an empty data set.
The function should certainly be more fault tolerant, but the real problem is the calling entity.
bye, Dirk
Anyway, the problem is with whatever is calling that function. Do you have some sort of dynamic block on your site that displays items in a list? Looks like occasionally, it's calling COM_makeList with an empty data set.
The function should certainly be more fault tolerant, but the real problem is the calling entity.
bye, Dirk
7
9
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
Quote by: Dirk
You must have modified your lib-common.php then, since COM_makeList only starts in line 4797.
Anyway, the problem is with whatever is calling that function. Do you have some sort of dynamic block on your site that displays items in a list? Looks like occasionally, it's calling COM_makeList with an empty data set.
The function should certainly be more fault tolerant, but the real problem is the calling entity.
bye, Dirk
I only have
GL Menu
Forum
MyCal in blocks on front page could it be one of those ???
9
8
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I've just added a in front of the foreach in CVS. I still think it's a problem in the calling entity, though. Hard to tell where it's coming from ...
bye, Dirk
Text Formatted Code
if (is_array($listofitems)) {bye, Dirk
8
10
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
Thanks...I have altered as follows, is this correct ?
if (is_array($listofitems))
foreach( $listofitems as $oneitem )
{
$list->set_var( 'list_item', $oneitem );
$list->parse( 'list_items', 'listitem', true );
}
$list->parse( 'newlist', 'list', true );
return $list->finish( $list->get_var( 'newlist' ));
}
Text Formatted Code
if (is_array($listofitems))
foreach( $listofitems as $oneitem )
{
$list->set_var( 'list_item', $oneitem );
$list->parse( 'list_items', 'listitem', true );
}
$list->parse( 'newlist', 'list', true );
return $list->finish( $list->get_var( 'newlist' ));
}
8
7
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
Great,
Site loads, in your example you wrote it as
Which failed to load, I guess because of the opening {
so I removed the { and it loads OK
Thanks, I guess it was some odd thing but at least the error will not effect anything now..
Site loads, in your example you wrote it as
Text Formatted Code
if (is_array($listofitems)) {Which failed to load, I guess because of the opening {
so I removed the { and it loads OK
Thanks, I guess it was some odd thing but at least the error will not effect anything now..
8
7
Quote
All times are EST. The time is now 10:03 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content