[ciapug] Symfony bug

carl-olsen at mchsi.com carl-olsen at mchsi.com
Tue Nov 6 10:43:11 CST 2007


Here is a page I'm playing around with.

http://www.drake.edu/myproject/mymodule

When I hit the "Ok" button without typing anything in the text field, it was throwing an error because it was only checking for a null value.  If you go ahead a click through to the next page, you'll see an example of the "date picker" control and the "rich text editor" control.  They are very easy to instantiate in the page with a single line of code, so that is a nice feature.  The drop down lists are very easy to create with a single line of code because of all the object oriented relational mapping that propel does during the model layer setup.

I created the project on Windows, because that is where PEAR installed all the command line tools.  I had to tweak it for the Sun Solaris server.  I also had to re-arrange the directory structures because our web server isn't set up the same way as the default Symfony installation.  I'm running it in a subdirectory and it installs itself as if it were going to be in control of the entire web site and not just a subdirectory.  I thought is was all fairly straight forward, although it takes quite a few changes to the configuration files.

Carl

-------------- Original message ----------------------
From: carl-olsen at mchsi.com
>
> If a parameter (form field) is blank, you can supply a default value in the 
> Symfony form helpers.  Unfortunately, the code checks for a null value instead 
> of an empty string, and it doesn't work.  I corrected the code by adding a check 
> for an empty string (although I don't see how it is possible for a null value to 
> ever be returned by the calling code - a form post).
> 
> Here is the bug I mentioned at the meeting last night:
> 
> #2436: BUG in sfParameterHolder.class.php
> ----------------------------+-------------------------------------------
> ----------------------------+----
>      Reporter:  carlolsen   |       Owner:  fabien
>          Type:  defect      |      Status:  new   
>      Priority:  minor       |   Component:  other 
>       Version:  1.0.8       |    Keywords:        
> Qualification:  Unreviewed  |  
> ----------------------------+-------------------------------------------
> ----------------------------+----
>  On line 87 of sfParameterHolder.class.php the check for a null value is  not 
> going to catch an empty string.  I rewrote the method, as follows  (starting at 
> line 80):
> 
>    public function & get($name, $default = null, $ns = null)
>    {
>      if (!$ns)
>      {
>        $ns = $this->default_namespace;
>      }
> 
>      if (isset($this->parameters[$ns][$name]) &&  ($this->parameters[$ns][$name] 
> != ''))
>      {
>        $value = & $this->parameters[$ns][$name];
>      }
>      else if (isset($this->parameters[$ns]))
>      {
>        $value = sfToolkit::getArrayValueForPath($this->parameters[$ns],
>  $name, $default);
>      }
>      else
>      {
>        $value = $default;
>      }
> 
>      return $value;
>    }
> 
> --
> Ticket URL: <http://trac.symfony-project.com/ticket/2436>
> symfony <http://www.symfony-project.com/> symfony project
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug




More information about the ciapug mailing list