mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.1' into 2.2
Conflicts: lib/Cake/Cache/Engine/XcacheEngine.php
This commit is contained in:
commit
7ae660c779
5 changed files with 39 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 . ')';
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue