Hi,
I've just moved my current drupal 5.1 database (phpmyadmin export/import) and all the files, including the files directory above the root using ftp. Everything seems to function and there are no substantial differences between the two hosts but my domain switched from domain.com to domain.net.
I am using a modified pushbutton theme and have added template.php, field.tpl.php, user_profile.tpl.php files. These are working just fine in my current domain.com but at the domain.net I'm getting the following error:
Warning: array_reverse() [function.array-reverse]: The argument should be an array in /home/user/public_html/themes/engines/phptemplate/phptemplate.engine on line 365
Warning: Invalid argument supplied for foreach() in /home/user/public_html/themes/engines/phptemplate/phptemplate.engine on line 366
referring to this part in the phptemplate.engine
// Loop through any suggestions in FIFO order.
$suggestions = array_reverse($suggestions);
foreach ($suggestions as $suggestion) {
if (!empty($suggestion) && file_exists(path_to_theme() .'/'. $suggestion . $extension)) {
$file = path_to_theme() .'/'. $suggestion . $extension;
break;
}
I did read another topic and switched to the garland theme and the errors disappeared. But I'm wondering why it would work on one site and not the other. Someone else mentioned something about changing any instances of the .com in the new domain database. Is this something I should do? But if so, why wouldn't that affect the garland theme?
The other thing that's strange is that these errors show up but when they end the site page displays correctly.
What does this error mean?
Thanks.
Lsabug
Comments
have you cleared your cache
have you cleared your cache tables in the database ?
Yes, I've cleared the cache in the database
What does the error mean about Warning: array_reverse() [function.array-reverse]
I've deleted the template.php file and that removed the error. I'm going to reupload it again but without certain parts that I've added to see what causes the error. I'd like to know what array_reverse does or means though, I think it'd help troubleshooting.
Thanks for the suggestion.
information about
information about array-reverse can be found on php.net see: http://us2.php.net/manual/en/function.array-reverse.php
something to try...
not a pro, but I added the following to phptemplate.engine, and it seems to work...
// Loop through any suggestions in FIFO order.
if (is_array($suggestions)){}Don't change phptemplate.engine, change template.php instead
That fixes the problem, but you really don't want to do that yourself since then you'd be forking your drupal install, and could lose that fix if you upgrade. It's probably not so much a problem in phptemplate.engine as it is in the sample code that comes with CCK.
You can fix this with a change to the callback at the bottom of your phptemplate_field() function in your theme's template.php file.
Change
to
and your problem should go away. This happens because the phptemplate engine expects the third parameter of the callback to be an array, and the sample code in CCK suggests you pass in a scalar.
I spent a good day trying to figure this one out. Just submitted the bug report, should be an easy fix in HEAD.
JFR
Thanks for this fix
It worked for my change to a new host using drupal 5.x