Merge branch '2.1' into 2.2

Conflicts:
	lib/Cake/Cache/Engine/XcacheEngine.php
This commit is contained in:
mark_story 2012-06-10 20:05:25 -04:00
commit 7ae660c779
5 changed files with 39 additions and 13 deletions

View file

@ -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;
}
/**

View file

@ -343,6 +343,21 @@ array(
(int) 1 => 'Index one',
(int) 5 => 'Index five'
)
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>

View file

@ -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');
}
/**

View file

@ -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 . ')';
}

View file

@ -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));
}