Seems that by declaring &$date in the first loop in bookingsapi_interval_build, the second loop, which declares $date, causes the $intervals array to be altered. Very strange. To fix this, I renamed the &$date to &$interval_date to avoid name collision. Patch included.

CommentFileSizeAuthor
bookingsapi.module.patch877 bytesdeveloper-x

Comments

Anonymous’s picture

Thanks. I somehow missed this...

Anonymous’s picture

Status: Needs review » Fixed

Committed.

Actually the problem is that $date is valid outside of its scope. And as its a reference ... Thanks for noticing and fixing!

developer-x’s picture

Cool - I come from the Java world - a redeclaration like this causes a compiler error. PHP seems to quietly ignore the redeclaration - nasty.....

Anonymous’s picture

Its not a real redeclaration - you don't need to declare variables in PHP before you use them (and yes, I prefer Java too ;) )

developer-x’s picture

I definitely didn't say I preferred Java ;-)

Actually, for web apps, I much perfer PHP - there is too much subtlety and far too much fussiness with Java for what a web app requires. Passing simple arrays/hashtables around the PHP way is way more productive than the whole OO/ORM/Spring/WebFlow/Struts/Tiles/JSP (add your technology component here). And you can't beat Drupal infrastructure and the community for delivering easy to deploy and integrate User functionality.

If I'm in the business of producing a transaction heavy airline reservation or banking system with a well established and non-flexible datamodel - give me the whole Java/SOA thing - but ask me to build a webapp - I'll take Drupal, thank you.

Anyway - just got that off my chest ;-)

Glad this worked out. BTW, great job with the bookingsapi - very thorough - and well done with all the unit testing.

Status: Fixed » Closed (fixed)

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