mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Merge branch 'master' into 2.7
Conflicts: lib/Cake/VERSION.txt
This commit is contained in:
commit
3078a1eb52
11 changed files with 85 additions and 26 deletions
|
@ -136,7 +136,6 @@
|
|||
<dependencies>
|
||||
<php minimum_version="5.2.8" />
|
||||
<pear minimum_version="1.9.0" recommended_version="1.9.4" />
|
||||
<package name="PHPUnit" channel="pear.phpunit.de" minimum_version="3.5.0" type="optional" />
|
||||
</dependencies>
|
||||
<dirroles key="bin">script</dirroles>
|
||||
<dirroles key="Cake/Console/Templates/skel">php</dirroles>
|
||||
|
|
|
@ -974,7 +974,7 @@ class Controller extends Object implements CakeEventListener {
|
|||
}
|
||||
|
||||
$referer = $this->request->referer($local);
|
||||
if ($referer === '/' && $default) {
|
||||
if ($referer === '/' && $default && $default !== $referer) {
|
||||
return Router::url($default, !$local);
|
||||
}
|
||||
return $referer;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
The MIT License
|
||||
|
||||
CakePHP(tm) : The Rapid Development PHP Framework (http://cakephp.org)
|
||||
Copyright (c) 2005-2013, Cake Software Foundation, Inc.
|
||||
Copyright (c) 2005-2015, Cake Software Foundation, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
|
|
|
@ -460,7 +460,9 @@ class CakeSession {
|
|||
self::_startSession();
|
||||
}
|
||||
|
||||
session_destroy();
|
||||
if (self::started()) {
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
$_SESSION = null;
|
||||
self::$id = null;
|
||||
|
|
|
@ -795,6 +795,17 @@ class Mysql extends DboSource {
|
|||
return 'text';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function value($data, $column = null) {
|
||||
$value = parent::value($data, $column);
|
||||
if (is_numeric($value) && substr($column, 0, 3) === 'set') {
|
||||
return $this->_connection->quote($value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the schema name
|
||||
*
|
||||
|
|
|
@ -355,8 +355,10 @@ class DboSource extends DataSource {
|
|||
return str_replace(',', '.', strval($data));
|
||||
}
|
||||
if ((is_int($data) || $data === '0') || (
|
||||
is_numeric($data) && strpos($data, ',') === false &&
|
||||
$data[0] != '0' && strpos($data, 'e') === false)
|
||||
is_numeric($data) &&
|
||||
strpos($data, ',') === false &&
|
||||
$data[0] != '0' &&
|
||||
strpos($data, 'e') === false)
|
||||
) {
|
||||
return $data;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Connect the socket to the given host and port.
|
||||
* Connects the socket to the given host and port.
|
||||
*
|
||||
* @return bool Success
|
||||
* @throws SocketException
|
||||
|
@ -188,7 +188,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the connection context.
|
||||
* Gets the connection context.
|
||||
*
|
||||
* @return null|array Null when there is no connection, an array when there is.
|
||||
*/
|
||||
|
@ -200,7 +200,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the host name of the current connection.
|
||||
* Gets the host name of the current connection.
|
||||
*
|
||||
* @return string Host name
|
||||
*/
|
||||
|
@ -212,7 +212,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the IP address of the current connection.
|
||||
* Gets the IP address of the current connection.
|
||||
*
|
||||
* @return string IP address
|
||||
*/
|
||||
|
@ -224,7 +224,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all IP addresses associated with the current connection.
|
||||
* Gets all IP addresses associated with the current connection.
|
||||
*
|
||||
* @return array IP addresses
|
||||
*/
|
||||
|
@ -236,7 +236,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the last error as a string.
|
||||
* Gets the last error as a string.
|
||||
*
|
||||
* @return string|null Last error
|
||||
*/
|
||||
|
@ -248,7 +248,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the last error.
|
||||
* Sets the last error.
|
||||
*
|
||||
* @param int $errNum Error code
|
||||
* @param string $errStr Error string
|
||||
|
@ -259,7 +259,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Write data to the socket.
|
||||
* Writes data to the socket.
|
||||
*
|
||||
* @param string $data The data to write to the socket
|
||||
* @return bool Success
|
||||
|
@ -281,7 +281,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Read data from the socket. Returns false if no data is available or no connection could be
|
||||
* Reads data from the socket. Returns false if no data is available or no connection could be
|
||||
* established.
|
||||
*
|
||||
* @param int $length Optional buffer length to read; defaults to 1024
|
||||
|
@ -307,7 +307,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Disconnect the socket from the current connection.
|
||||
* Disconnects the socket from the current connection.
|
||||
*
|
||||
* @return bool Success
|
||||
*/
|
||||
|
@ -353,14 +353,14 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Encrypts current stream socket, using one of the defined encryption methods
|
||||
* Encrypts current stream socket, using one of the defined encryption methods.
|
||||
*
|
||||
* @param string $type can be one of 'ssl2', 'ssl3', 'ssl23' or 'tls'
|
||||
* @param string $clientOrServer can be one of 'client', 'server'. Default is 'client'
|
||||
* @param bool $enable enable or disable encryption. Default is true (enable)
|
||||
* @param string $type Type which can be one of 'sslv2', 'sslv3', 'sslv23' or 'tls'.
|
||||
* @param string $clientOrServer Can be one of 'client', 'server'. Default is 'client'.
|
||||
* @param bool $enable Enable or disable encryption. Default is true (enable)
|
||||
* @return bool True on success
|
||||
* @throws InvalidArgumentException When an invalid encryption scheme is chosen.
|
||||
* @throws SocketException When attempting to enable SSL/TLS fails
|
||||
* @throws SocketException When attempting to enable SSL/TLS fails.
|
||||
* @see stream_socket_enable_crypto
|
||||
*/
|
||||
public function enableCrypto($type, $clientOrServer = 'client', $enable = true) {
|
||||
|
@ -369,7 +369,8 @@ class CakeSocket {
|
|||
}
|
||||
$enableCryptoResult = false;
|
||||
try {
|
||||
$enableCryptoResult = stream_socket_enable_crypto($this->connection, $enable, $this->_encryptMethods[$type . '_' . $clientOrServer]);
|
||||
$enableCryptoResult = stream_socket_enable_crypto($this->connection, $enable,
|
||||
$this->_encryptMethods[$type . '_' . $clientOrServer]);
|
||||
} catch (Exception $e) {
|
||||
$this->setLastError(null, $e->getMessage());
|
||||
throw new SocketException($e->getMessage());
|
||||
|
|
|
@ -1031,6 +1031,30 @@ class ControllerTest extends CakeTestCase {
|
|||
$this->assertEquals('/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the referer is not absolute if it is '/'.
|
||||
*
|
||||
* This avoids the base path being applied twice on string urls.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRefererSlash() {
|
||||
$request = $this->getMock('CakeRequest', array('referer'));
|
||||
$request->base = '/base';
|
||||
$request->expects($this->any())
|
||||
->method('referer')
|
||||
->will($this->returnValue('/'));
|
||||
Router::setRequestInfo($request);
|
||||
|
||||
$controller = new Controller($request);
|
||||
$result = $controller->referer('/', true);
|
||||
$this->assertEquals('/', $result);
|
||||
|
||||
$controller = new Controller($request);
|
||||
$result = $controller->referer('/some/path', true);
|
||||
$this->assertEquals('/base/some/path', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSetAction method
|
||||
*
|
||||
|
|
|
@ -553,6 +553,10 @@ class MysqlTest extends CakeTestCase {
|
|||
$result = $this->Dbo->column('decimal(14,7) unsigned');
|
||||
$expected = 'decimal';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Dbo->column("set('a','b','c')");
|
||||
$expected = "set('a','b','c')";
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4071,4 +4075,21 @@ SQL;
|
|||
$this->Dbo->useNestedTransactions = $nested;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that value() quotes set values even when numeric.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetValue() {
|
||||
$column = "set('a','b','c')";
|
||||
$result = $this->Dbo->value('1', $column);
|
||||
$this->assertEquals("'1'", $result);
|
||||
|
||||
$result = $this->Dbo->value(1, $column);
|
||||
$this->assertEquals("'1'", $result);
|
||||
|
||||
$result = $this->Dbo->value('a', $column);
|
||||
$this->assertEquals("'a'", $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -604,8 +604,7 @@ class FileTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNoPartialPathBeingSetForNonExistentPath()
|
||||
{
|
||||
public function testNoPartialPathBeingSetForNonExistentPath() {
|
||||
$tmpFile = new File('/non/existent/file');
|
||||
$this->assertNull($tmpFile->pwd());
|
||||
$this->assertNull($tmpFile->path);
|
||||
|
|
|
@ -706,7 +706,7 @@ class PaginatorHelper extends AppHelper {
|
|||
* - `currentClass` Class for wrapper tag on current active page, defaults to 'current'
|
||||
* - `currentTag` Tag to use for current page number, defaults to null
|
||||
*
|
||||
* @param array $options Options for the numbers, (before, after, model, modulus, separator)
|
||||
* @param array|bool $options Options for the numbers, (before, after, model, modulus, separator)
|
||||
* @return string Numbers string.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::numbers
|
||||
*/
|
||||
|
@ -727,7 +727,7 @@ class PaginatorHelper extends AppHelper {
|
|||
$params = (array)$this->params($options['model']) + array('page' => 1);
|
||||
unset($options['model']);
|
||||
|
||||
if ($params['pageCount'] <= 1) {
|
||||
if (empty($params['pageCount']) || $params['pageCount'] <= 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue