Warning in feedapi_mapper_date.inc

iva2k - June 29, 2009 - 01:13
Project:Feed Element Mapper
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

When using feedapi_mapper to map feed fields to one date field, and there could be missing some of "TO" dates, warnings are reported:

warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in /sites/all/modules/feedapi_mapper/mappers/feedapi_mapper_date.inc on line 405.
warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in /sites/all/modules/feedapi_mapper/mappers/feedapi_mapper_date.inc on line 407.
warning: date_format() expects parameter 1 to be DateTime, boolean given in /sites/all/modules/feedapi_mapper/mappers/feedapi_mapper_date.inc on line 409.

The resulting mapped nodes are OK.

#1

iva2k - June 29, 2009 - 01:14
Status:active» needs review

The following patch removes these warnings. In this patch I added verification if date part is present.

Please review for committing to 6.x-1.x-dev.

AttachmentSize
feedapi_mapper_date_warning.2009-06-28.patch 1.49 KB

#2

Aron Novak - June 29, 2009 - 07:40
Status:needs review» reviewed & tested by the community

The patch seems to be fine, however I rerolled as a standard drupal patch format and added isset().

AttachmentSize
504852_date_warning.patch 1.64 KB

#3

iva2k - July 26, 2009 - 20:31

nag nag

#4

alex_b - July 27, 2009 - 15:51
Status:reviewed & tested by the community» fixed

Committed to 1.x and 2.x branches. Thank you and thanks for the reminder ;)

#5

iva2k - August 9, 2009 - 05:04
Status:fixed» active

@alex_b,
Thanks for taking care of this. Sorry for reopening, but latest code with patch in #2 does not remove the warnings, which I received a bunch after updating. I should've tested it, but my code was still using patch in #1 until the recent update. It turns out that adding isset() in #2 passes on empty variables, but enclosed code still generates warnings on specific From-To dates in feeds.

Either remove isset(), or use patch in #1, which is equivalent. That fixed the warnings for good.

#6

Aron Novak - August 10, 2009 - 08:31
Status:active» needs review

However, I assume replacing isset() to empty() should be also fine.
The patch should apply to both branches (likely with some offset)

AttachmentSize
504852-6_date_warning.patch 1.18 KB

#7

iva2k - August 10, 2009 - 14:44
Status:needs review» reviewed & tested by the community

I edited by hand, and can confirm that !empty() in place of isset() removes the warnings.

#8

Aron Novak - August 18, 2009 - 10:37
Priority:normal» critical

should be in FeedAPI mapper 2.0 beta 1

#9

Aron Novak - September 18, 2009 - 13:31
Status:reviewed & tested by the community» fixed

committed, thank you iva2k

#10

System Message - October 2, 2009 - 13:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.