Development

Changeset 8052

You must first sign up to be able to contribute.

Changeset 8052

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

1.0: fixed sfNumberValidator doesn't like numbers less than 0

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/validator/sfNumberValidator.class.php

    r7791 r8052  
    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.0/test/unit/validator/sfNumberValidatorTest.php

    r7589 r8052  
    1313require_once($_test_dir.'/unit/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 = new sfContext(); 
     
    8686$h->launchTests($v, 4, true, 'type', 'type_error', array('type' => 'any')); 
    8787 
     88// number is negative 
     89$t->diag('->execute() - number is negative'); 
     90$h->launchTests($v, -4, true, 'type', 'type_error', array('type' => 'any')); 
     91 
    8892// conversion of value 
    8993$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.