Development

Changeset 8053

You must first sign up to be able to contribute.

Changeset 8053

Show
Ignore:
Timestamp:
03/23/08 03:34:55 (1 year ago)
Author:
Carl.Vondrick
Message:

1.1: fixed sfNumberValidator doesn't like numbers less than 0 (closes #3185)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfCompat10Plugin/lib/validator/sfNumberValidator.class.php

    r7902 r8053  
    4646  public function execute(&$value, &$error) 
    4747  { 
    48     if (!preg_match('/^\d+(\.\d+)?$/', $value)) 
     48    if (!preg_match('/^-?\d+(\.\d+)?$/', $value)) 
    4949    { 
    5050      // it's NaN, what nerve! 
  • branches/1.1/lib/plugins/sfCompat10Plugin/test/unit/validator/sfNumberValidatorTest.php

    r7590 r8053  
    1313require_once(dirname(__FILE__).'/sfValidatorTestHelper.class.php'); 
    1414 
    15 $t = new lime_test(51, new lime_output_color()); 
     15$t = new lime_test(53, new lime_output_color()); 
    1616 
    1717$context = sfContext::getInstance(); 
     
    8585$h->launchTests($v, 4, true, 'type', 'type_error', array('type' => 'any')); 
    8686 
     87// number is negative 
     88$t->diag('->execute() - number is negative'); 
     89$h->launchTests($v, -4, true, 'type', 'type_error', array('type' => 'any')); 
     90 
    8791// conversion of value 
    8892$t->diag('->execute() - conversion of value'); 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.