shepherdweb.com

Undefined index: action in /cake/dispatcher.php line 144

April 2nd, 2007

It took me almost an hour to figure out what was causing this error.

Undefined index: action in /cake/dispatcher.php line 144

$aInfo = $this->requestAction(’/tours/GetAgentInfo/’ . $property["Listing"]["agent"] . ‘/’ . $property["Listing"]["listingoffice"]);
?>

The problem turned out to be that one of the values in $property["Listing"] was returning a value which included a space. Something like this: “396 “. Since the requestAction method uses a URL to get it’s parameters, it was bombing when the URL looked like this: ‘/tours/GetAgentInfo/396 /94′. I used the php trim() function to remove spaces, and presto… problem solved!

$aInfo = $this->requestAction(’/tours/GetAgentInfo/’ . trim($property["Listing"]["agent"]) . ‘/’ . trim($property["Listing"]["listingoffice"]));
?>

Technorati Tags: ,

4 Comments »

  1. Nate Abele wrote,

    Upgrade to Cake 1.2. You get automatic stack traces and context help on all non-fatal PHP errors.

    Comment on April 2, 2007 @ 10:45 pm

  2. Shane wrote,

    Nate, Thanks for the tip! It looks like Cake 1.2 is still in alpha which means I won’t be deploying it for any paying clients yet. It looks promising though!

    Comment on April 3, 2007 @ 7:55 am

  3. farmerbob wrote,

    How do you feel about CakePHP? Have you tried Symfony, etc?

    I’ve avoided server-side frameworks for my LAMP projects thus far, but I’m curious about your take on CakePHP.

    Comment on June 8, 2007 @ 2:41 pm

  4. Shane wrote,

    @farmerbob - I’m a big fan of CakePHP now! I haven’t used Symfony, but I did do some research before settling down with CakePHP. There is a slight learning curve, but if you are familiar with OOP, it’s not too bad. Also, the documentation could be better…but it’s better than some. I found the Google CakePHP Group to be the most useful resource.

    Comment on June 8, 2007 @ 8:47 pm

Leave a comment

RSS feed for comments on this post.

TrackBack URI

Bad Behavior has blocked 649 access attempts in the last 7 days.