Просмотр исходного кода

[ZF-11639] removed float-cast because it is actually unimportant to have type-save numeric data here; should not break BC unless users do a strict type check on the return values

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24353 44c647ce-9c0f-0410-b52a-842ac1e357ba
sgehrig 14 лет назад
Родитель
Сommit
39887b76ce
2 измененных файлов с 6 добавлено и 9 удалено
  1. 2 6
      library/Zend/Ldap/Converter.php
  2. 4 3
      tests/Zend/Ldap/ConverterTest.php

+ 2 - 6
library/Zend/Ldap/Converter.php

@@ -219,12 +219,8 @@ class Zend_Ldap_Converter
                 break;
             default:
                 if (is_numeric($value)) {
-                    // specialized handling of phone numbers that start with +
-                    // ZF-11639
-                    if ($value[0] === '+') {
-                        return $value;
-                    }
-                    return (float)$value;
+                    // prevent numeric values to be treated as date/time
+                    return $value;
                 } else if ('TRUE' === $value || 'FALSE' === $value) {
                     return self::fromLdapBoolean($value);
                 }

+ 4 - 3
tests/Zend/Ldap/ConverterTest.php

@@ -227,11 +227,12 @@ class Zend_Ldap_ConverterTest extends PHPUnit_Framework_TestCase
 
     public function fromLdapProvider(){
         return array(
-           array(1.0, '1', 0, true),
-           array(0.0, '0', 0, true),
+           array('1', '1', 0, true),
+           array('0', '0', 0, true),
            array(true, 'TRUE', 0, true),
            array(false, 'FALSE', 0, true),
-           array(123456789.0, '123456789', 0, true),
+           array('123456789', '123456789', 0, true),
+           // ZF-11639
            array('+123456789', '+123456789', 0, true),
         );
     }