[Solar-talk] Is it just me or is Paul going to kill me? If secondvalue is 0 controller doesn't find it

Kilbride, James P. James.Kilbride at gd-ais.com
Mon May 5 06:21:28 CDT 2008


That worked paul. It is no recognizing the explicit 0 at the end and not
trimming it off. Looks good. You are right that I may want to provide
default values though i'm still deciding what those will be. I may
actually have it be looking to see if the values are set and if not it's
going to be kicking people back out as my 'principle' in which case I
don't want to set explicit values but rather check what I'm getting.
Depends on what behavior I need later I guess.

James Kilbride 

-----Original Message-----
From: solar-talk-bounces at lists.solarphp.com
[mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Paul M Jones
Sent: Friday, May 02, 2008 3:53 PM
To: solar-talk at lists.solarphp.com
Subject: Re: [Solar-talk] Is it just me or is Paul going to kill me? If
secondvalue is 0 controller doesn't find it


On May 2, 2008, at 12:42 , Kilbride, James P. wrote:
> if it's 0 though I get this:
>
> Warning: Missing argument 2 for
> ProcedureMatrix_App_Matrix::actionUpdate() in C:\Solar 
> \ProcedureMatrix\App\Matrix.php on line 73
>

First, you'll want to provide default values for all your action method
params, just on principle.  Defaulting that second one to "zero" or null
will help here.

Having said that, it should not be dropping explicit zeroes like that.
I know exactly what the bug is; Antti and I ran into something  
similar on parsing URIs, iirc.   In Solar_Controller_Page::_load(), at  
the very end, you will see this:

         // finally, remove blank info elements from the end.
         // this happens sometimes with elements being added
         // and removed from format checking, and helps make
         // sure that action default parameters are honored.
         $i = count($this->_info);
         while ($i --) {
             if (! empty($this->_info[$i])) {
                 // not empty, stop removing blanks
                 break;
             } else {
                 unset($this->_info[$i]);
             }
         }


My bet is that if you change the `! empty($this->_info[$i])` to
`trim($this->_info[$i]) != ''` then it'll work as expected.  (PHP's
dynamic variable casting is usually a boon, but in cases like this it's
a bane.  A string zero looks like an int zero, and that means
empty() is true.)

Let me know if that change works for you, and I'll apply it.

-- pmj


p.s. "Am I going to kill you?"  Of course not -- you know me better than
that.  ;-)


_______________________________________________
Solar-talk mailing list
Solar-talk at lists.solarphp.com
http://mailman-mail3.webfaction.com/listinfo/solar-talk



More information about the Solar-talk mailing list