Page 1 of 1
Invalid argument supplied for foreach()
Posted: Fri Apr 01, 2005 1:32 am
by RadBryan
When attempting to install the b4 release, I get the following errors (when choosing "Expert Installation":
Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/reasonableness.com/httpdocs/blog/include/functions_installer.inc.php on line 370 (Repeated 5 times)
I click "Complete Installation" and these errors occur:
Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/reasonableness.com/httpdocs/blog/include/admin/installer.inc.php on line 35 (Repeated 5 times)
Fatal error: Call to undefined function: serendipity_db_probe() in /home/httpd/vhosts/reasonableness.com/httpdocs/blog/include/functions_installer.inc.php on line 527
This is with PHP 4.3.10, MySQL, no Imagemagick library.
Any ideas? (I've installed previous 7.x releases of Serendipity on different servers, never encountered problems like this before.)
Thanks!
Re: Invalid argument supplied for foreach()
Posted: Fri Apr 01, 2005 11:52 am
by garvinhicking
This error seems to happen because serendipity cannot parse the file include/tpl/config_local.inc.php - check if that file exists?
Maybe you got a corrupted tarball.
Regards,
Garvin
Posted: Fri Apr 01, 2005 8:00 pm
by RadBryan
Thanks for the response Garvin.
Double checked, and include/tpl/config_local.inc.php exists, has permissions set wide open (rwx all) and doesn't look to be corrupted at all.
Any other ideas?

Posted: Fri Apr 01, 2005 8:32 pm
by RadBryan
Just tried again with the b5 released today with the same errors.
(Since I started trying to get Serendipity setup I've been able to install phpBB without problem, so PHP isn't having trouble talking to my MySQL db.)
Posted: Sun Apr 03, 2005 2:06 am
by garvinhicking
This may be caused by a special CGI setup of php. Can you give me a link to a phpinfo() output? I cannot reproduce this anywhere on my machine
Regards,
Garvin
Posted: Mon Apr 04, 2005 6:34 pm
by RadBryan
Posted: Mon Apr 04, 2005 11:23 pm
by garvinhicking
Wow. I've never seen such a overfilled PHP/Apache combination! You load about any module that is available; I'm quite sury any of these modules create trouble; maybe some of the encoders or additional modules.
I'm really sorry, but this is too hard to debug, there are just so many components which could act weird. I can only offer you to look at it if you give me FTP access to the blog directory, then I'll do some debugging.
Regards,
Garvin
Posted: Tue Apr 05, 2005 10:21 am
by RadBryan
Private message sent.

Posted: Tue Apr 05, 2005 11:17 am
by garvinhicking
Thanks to the help of RadBryan by supplying me with FTP data, I got his problem down to a thing.
Bryan, your PHP installation is garbaged. It produces wrong results when iterating through an array. I created a test.php:
Code: Select all
<?php
$test = array(
'database' => array(
'items' => array(
array(
'var' => '1',
'nothing' => '2'),
array(
'var' => '3',
'nothing' => '4')
)
),
'paths' => array(
'items' => array(
array(
'var' => '1',
'nothing' => '2'),
array(
'var' => '3',
'nothing' => '4')
)
)
);
print_r($test);
foreach($test AS $category) {
print_r($category);
}
This produces this output on your machine
Code: Select all
Array
(
[database] => Array
(
[items] => Array
(
[0] => Array
(
[var] => 1
[nothing] => 2
)
[1] => Array
(
[var] => 3
[nothing] => 4
)
)
)
[paths] => Array
(
[items] => Array
(
[0] => Array
(
[var] => 1
[nothing] => 2
)
[1] => Array
(
[var] => 3
[nothing] => 4
)
)
)
)
Array
(
[0] => Array
(
[items] => Array
(
[0] => Array
(
[var] => 1
[nothing] => 2
)
[1] => Array
(
[var] => 3
[nothing] => 4
)
)
)
[1] => database
)
Array
(
[0] => Array
(
[items] => Array
(
[0] => Array
(
[var] => 1
[nothing] => 2
)
[1] => Array
(
[var] => 3
[nothing] => 4
)
)
)
[1] => paths
)
while this is the output that is produced on a right server:
Code: Select all
Array
(
[database] => Array
(
[items] => Array
(
[0] => Array
(
[var] => 1
[nothing] => 2
)
[1] => Array
(
[var] => 3
[nothing] => 4
)
)
)
[paths] => Array
(
[items] => Array
(
[0] => Array
(
[var] => 1
[nothing] => 2
)
[1] => Array
(
[var] => 3
[nothing] => 4
)
)
)
)
Array
(
[items] => Array
(
[0] => Array
(
[var] => 1
[nothing] => 2
)
[1] => Array
(
[var] => 3
[nothing] => 4
)
)
)
Array
(
[items] => Array
(
[0] => Array
(
[var] => 1
[nothing] => 2
)
[1] => Array
(
[var] => 3
[nothing] => 4
)
)
)
As you can see, your PHP module returns completely wrong array indizes.
For PHP 4.3.10 this can happen because they changed the bytecode of the foreach() operation. This caused quite some seroius bugs using the zendEncoder or other zend bytecode compilers, causing the exact same problem.
As your phpinfo() tells that you are using the ionCube encode, it looks that this is creating the trouble for you. Deactivate that module and you should be fine!
Regards,
Garvin