I just moved a site from one server to another and I started getting the error below dozens of times on each cron run:
Notice: Object of class stdClass could not be converted to int in date_format_save() (line 1922 of /app/production/fvs/sites/all/modules/date/date_api.module).
The line in question is:
if (in_array($langcode, $languages)) {
I followed this from the top, where cron was calling date_api_flush_caches(). Which, then called date_formats_rebuild(). Which loops through all of the date_formats and calls date_format_save().
Following the other direction, we go to language_list(). Since I don't have any languages set up, language_default() is called, and this line executes:
$language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''));
It looks like the problem happens with PHP 5.1 and the casting "(object)". I'm not quite sure what happens, but in_array() doesn't like it. Luckily, the solution is very simple. All we have to do is make sure that in_array() is doing a strict check:
if (in_array($langcode, $languages, true)) {
Should I create a patch?
Comments
Comment #1
rolodmonkey commentedComment #2
rolodmonkey commentedSince Drupal 6 is no longer supported, I am closing this issue.