Browse Source

Merge branch '2.1' into 2.2

Conflicts:
	lib/Cake/Cache/Engine/XcacheEngine.php
mark_story 14 years ago
parent
commit
7ae660c779

+ 10 - 9
lib/Cake/Cache/Engine/XcacheEngine.php

@@ -45,16 +45,17 @@ class XcacheEngine extends CacheEngine {
  * @return boolean True if the engine has been successfully initialized, false if not
  */
 	public function init($settings = array()) {
-		if (!isset($settings['prefix'])) {
-			$settings['prefix'] = Inflector::slug(APP_DIR) . '_';
+		if (php_sapi_name() !== 'cli') {
+			parent::init(array_merge(array(
+				'engine' => 'Xcache',
+				'prefix' => Inflector::slug(APP_DIR) . '_',
+				'PHP_AUTH_USER' => 'user',
+				'PHP_AUTH_PW' => 'password'
+				), $settings)
+			);
+			return function_exists('xcache_info');
 		}
-		$settings += array(
-			'engine' => 'Xcache',
-			'PHP_AUTH_USER' => 'user',
-			'PHP_AUTH_PW' => 'password'
-		);
-		parent::init($settings);
-		return function_exists('xcache_info');
+		return false;
 	}
 
 /**

+ 21 - 0
lib/Cake/Test/Case/Utility/DebuggerTest.php

@@ -345,6 +345,21 @@ array(
 )
 TEXT;
 		$this->assertTextEquals($expected, $result);
+
+		$data = array(
+			'key' => array(
+				'value'
+			)
+		);
+		$result = Debugger::exportVar($data, 1);
+		$expected = <<<TEXT
+array(
+	'key' => array(
+		[maximum depth reached]
+	)
+)
+TEXT;
+		$this->assertTextEquals($expected, $result);
 	}
 
 /**
@@ -398,8 +413,14 @@ TEXT;
 <pre>array(
 	'People' => array(
 		(int) 0 => array(
+			'name' => 'joeseph',
+			'coat' => 'technicolor',
+			'hair_color' => 'brown'
 		),
 		(int) 1 => array(
+			'name' => 'Shaft',
+			'coat' => 'black',
+			'hair' => 'black'
 		)
 	)
 )</pre>

+ 2 - 0
lib/Cake/Test/Case/Utility/ValidationTest.php

@@ -1663,6 +1663,7 @@ class ValidationTest extends CakeTestCase {
 		$this->assertFalse(Validation::ip('127.0.0'));
 		$this->assertFalse(Validation::ip('127.0.0.a'));
 		$this->assertFalse(Validation::ip('127.0.0.256'));
+		$this->assertFalse(Validation::ip('2001:0db8:85a3:0000:0000:8a2e:0370:7334', 'ipv4'), 'IPv6 is not valid IPv4');
 	}
 
 /**
@@ -1702,6 +1703,7 @@ class ValidationTest extends CakeTestCase {
 		$this->assertFalse(Validation::ip('1:2:3::4:5:6:7:8:9', 'IPv6'));
 		$this->assertFalse(Validation::ip('::ffff:2.3.4', 'IPv6'));
 		$this->assertFalse(Validation::ip('::ffff:257.1.2.3', 'IPv6'));
+		$this->assertFalse(Validation::ip('255.255.255.255', 'ipv6'), 'IPv4 is not valid IPv6');
 	}
 
 /**

+ 3 - 1
lib/Cake/Utility/Debugger.php

@@ -544,8 +544,10 @@ class Debugger {
 			foreach ($var as $key => $val) {
 				$vars[] = $break . self::exportVar($key) .
 					' => ' .
-					self::_export($val, $depth - 1, $indent);
+					self::_export($val, $depth, $indent);
 			}
+		} else {
+			$vars[] = $break . '[maximum depth reached]';
 		}
 		return $out . implode(',', $vars) . $end . ')';
 	}

+ 3 - 3
lib/Cake/Utility/Validation.php

@@ -468,12 +468,12 @@ class Validation {
  */
 	public static function ip($check, $type = 'both') {
 		$type = strtolower($type);
-		$flags = array();
+		$flags = null;
 		if ($type === 'ipv4' || $type === 'both') {
-			$flags[] = FILTER_FLAG_IPV4;
+			$flags |= FILTER_FLAG_IPV4;
 		}
 		if ($type === 'ipv6' || $type === 'both') {
-			$flags[] = FILTER_FLAG_IPV6;
+			$flags |= FILTER_FLAG_IPV6;
 		}
 		return (boolean)filter_var($check, FILTER_VALIDATE_IP, array('flags' => $flags));
 	}