Seeing this error on a site constructed by someone else:

warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in ...xmlsitemap.module on line 585.

Do not see a similar error reported elsewhere.

Files: 
CommentFileSizeAuthor
#3 554364-D5.patch915 bytesDave Reid
#2 issue-554364.patch965 bytesearnie

Comments

Status:Active» Postponed (maintainer needs more info)

I double checked to make sure this was the 5.x-1.6 version and not the 6.x-2.x version where I also call array_key_exists, and sure enough, line 585 of 5.x-1.6 is the problem:

575 :     function _xmlsitemap_frequency($interval) {
576 :     $frequencies = array(
577 :     'always' => 3600,
578 :     'hourly' => 86400,
579 :     'daily' => 604800,
580 :     'weekly' => 2419200,
581 :     'monthly' => 29030400,
582 :     'yearly' => 100000000,
583 :     'never' => 0,
584 :     );
585 :     if (array_key_exists($interval, $frequencies)) {

Sounds like it's being passed invalid data, but without more information it's hard to know what's going wrong.

Status:Postponed (maintainer needs more info)» Needs review
StatusFileSize
new965 bytes

The use of _xmlsitemap_frequency in _xmlsitemap_format could cause the $interval value to be NULL if the array element $entry['#changefreq'] is NULL. Or perhaps this is a buggy PHP version. What is the PHP version being used? What should the default frequency be? Oh, never mind I see that _xmlsitemap_frequency already takes care of the default.

What about this patch?

Status:Needs review» Fixed
StatusFileSize
new915 bytes

Did some testing and it's when the function is passed a float value is when this happens, because array_key_exists() in PHP 4.4.0 the $key value needs to be either a string or integer. Committed the following patch to CVS.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.