web/lib/Zend/Ldap/Converter.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
--- a/web/lib/Zend/Ldap/Converter.php	Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Ldap/Converter.php	Thu Mar 21 19:50:53 2013 +0100
@@ -14,9 +14,9 @@
  *
  * @category   Zend
  * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Converter.php 22996 2010-09-22 17:01:46Z sgehrig $
+ * @version    $Id: Converter.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /**
@@ -24,7 +24,7 @@
  *
  * @category   Zend
  * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Ldap_Converter
@@ -73,7 +73,7 @@
         return $string;
     }
 
-	/**
+    /**
      * Convert any value to an LDAP-compatible value.
      *
      * By setting the <var>$type</var>-parameter the conversion of a certain
@@ -81,10 +81,10 @@
      *
      * @todo write more tests
      *
-     * @param	mixed 	$value 	The value to convert
-     * @param	int   	$ytpe  	The conversion type to use
-     * @return	string
-     * @throws	Zend_Ldap_Converter_Exception
+     * @param    mixed     $value     The value to convert
+     * @param    int       $ytpe      The conversion type to use
+     * @return    string
+     * @throws    Zend_Ldap_Converter_Exception
      */
     public static function toLdap($value, $type = self::STANDARD)
     {
@@ -132,11 +132,11 @@
      * DateTime Object, a string that is parseable by strtotime() or a Zend_Date
      * Object.
      *
-     * @param	integer|string|DateTimt|Zend_Date		$date	The date-entity
-     * @param	boolean									$asUtc	Whether to return the LDAP-compatible date-string
-     *                          								as UTC or as local value
-     * @return	string
-     * @throws	InvalidArgumentException
+     * @param    integer|string|DateTimt|Zend_Date        $date    The date-entity
+     * @param    boolean                                    $asUtc    Whether to return the LDAP-compatible date-string
+     *                                                          as UTC or as local value
+     * @return    string
+     * @throws    InvalidArgumentException
      */
     public static function toLdapDateTime($date, $asUtc = true)
     {
@@ -170,8 +170,8 @@
      * case-insensitive string 'true' to an LDAP-compatible 'TRUE'. All other
      * other values are converted to an LDAP-compatible 'FALSE'.
      *
-     * @param	boolean|integer|string		$value	The boolean value to encode
-     * @return	string
+     * @param    boolean|integer|string        $value    The boolean value to encode
+     * @return    string
      */
     public static function toLdapBoolean($value)
     {
@@ -188,8 +188,8 @@
     /**
      * Serialize any value for storage in LDAP
      *
-     * @param	mixed		$value	The value to serialize
-     * @return	string
+     * @param    mixed        $value    The value to serialize
+     * @return    string
      */
     public static function toLdapSerialize($value)
     {
@@ -202,11 +202,11 @@
      * By setting the <var>$type</var>-parameter the conversion of a certain
      * type can be forced
      * .
-     * @param	string	$value 			The value to convert
-     * @param	int		$ytpe  			The conversion type to use
-     * @param	boolean	$dateTimeAsUtc	Return DateTime values in UTC timezone
-     * @return	mixed
-     * @throws	Zend_Ldap_Converter_Exception
+     * @param    string    $value             The value to convert
+     * @param    int        $ytpe              The conversion type to use
+     * @param    boolean    $dateTimeAsUtc    Return DateTime values in UTC timezone
+     * @return    mixed
+     * @throws    Zend_Ldap_Converter_Exception
      */
     public static function fromLdap($value, $type = self::STANDARD, $dateTimeAsUtc = true)
     {
@@ -219,7 +219,8 @@
                 break;
             default:
                 if (is_numeric($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);
                 }
@@ -239,10 +240,10 @@
      *
      * CAVEAT: The DateTime-Object returned will alwasy be set to UTC-Timezone.
      *
-     * @param	string		$date	The generalized-Time
-     * @param	boolean		$asUtc	Return the DateTime with UTC timezone
-     * @return	DateTime
-     * @throws	InvalidArgumentException if a non-parseable-format is given
+     * @param    string        $date    The generalized-Time
+     * @param    boolean        $asUtc    Return the DateTime with UTC timezone
+     * @return    DateTime
+     * @throws    InvalidArgumentException if a non-parseable-format is given
      */
     public static function fromLdapDateTime($date, $asUtc = true)
     {
@@ -265,7 +266,7 @@
             'second' => 0,
             'offdir' => '+',
             'offsethours' => 0,
-			'offsetminutes' => 0
+            'offsetminutes' => 0
         );
 
         $length = strlen($date);
@@ -363,9 +364,9 @@
     /**
      * Convert an LDAP-compatible boolean value into a PHP-compatible one
      *
-     * @param	string		$value		The value to convert
-     * @return	boolean
-     * @throws	InvalidArgumentException
+     * @param    string        $value        The value to convert
+     * @return    boolean
+     * @throws    InvalidArgumentException
      */
     public static function fromLdapBoolean($value)
     {
@@ -381,9 +382,9 @@
     /**
      * Unserialize a serialized value to return the corresponding object
      *
-     * @param	string		$value	The value to convert
-     * @return	mixed
-     * @throws	UnexpectedValueException
+     * @param    string        $value    The value to convert
+     * @return    mixed
+     * @throws    UnexpectedValueException
      */
     public static function fromLdapUnserialize($value)
     {