mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing php4 compatibility issues in CakeLog.
This commit is contained in:
parent
af4e9ba76e
commit
2093f05ce7
2 changed files with 8 additions and 8 deletions
|
@ -63,7 +63,7 @@ class CakeLog {
|
||||||
function &getInstance() {
|
function &getInstance() {
|
||||||
static $instance = array();
|
static $instance = array();
|
||||||
if (!isset($instance[0])) {
|
if (!isset($instance[0])) {
|
||||||
$instance[0] = new CakeLog();
|
$instance[0] =& new CakeLog();
|
||||||
}
|
}
|
||||||
return $instance[0];
|
return $instance[0];
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ class CakeLog {
|
||||||
trigger_error(__('Missing logger classname', true), E_USER_WARNING);
|
trigger_error(__('Missing logger classname', true), E_USER_WARNING);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$self = CakeLog::getInstance();
|
$self =& CakeLog::getInstance();
|
||||||
$className = $self->_getLogger($config['engine']);
|
$className = $self->_getLogger($config['engine']);
|
||||||
if (!$className) {
|
if (!$className) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -113,7 +113,7 @@ class CakeLog {
|
||||||
trigger_error(sprintf(__('Could not load logger class %s', true), $loggerName), E_USER_WARNING);
|
trigger_error(sprintf(__('Could not load logger class %s', true), $loggerName), E_USER_WARNING);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!method_exists($loggerName, 'write')) {
|
if (!is_callable(array($loggerName, 'write'))) {
|
||||||
trigger_error(
|
trigger_error(
|
||||||
sprintf(__('logger class %s does not implement a write method.', true), $loggerName),
|
sprintf(__('logger class %s does not implement a write method.', true), $loggerName),
|
||||||
E_USER_WARNING
|
E_USER_WARNING
|
||||||
|
@ -130,7 +130,7 @@ class CakeLog {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function configured() {
|
function configured() {
|
||||||
$self = CakeLog::getInstance();
|
$self =& CakeLog::getInstance();
|
||||||
return array_keys($self->_streams);
|
return array_keys($self->_streams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class CakeLog {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function drop($streamName) {
|
function drop($streamName) {
|
||||||
$self = CakeLog::getInstance();
|
$self =& CakeLog::getInstance();
|
||||||
unset($self->_streams[$streamName]);
|
unset($self->_streams[$streamName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class CakeLog {
|
||||||
if (!class_exists('FileLog')) {
|
if (!class_exists('FileLog')) {
|
||||||
App::import('Core', 'log/FileLog');
|
App::import('Core', 'log/FileLog');
|
||||||
}
|
}
|
||||||
$this->_streams['default'] = new FileLog(array('path' => LOGS));
|
$this->_streams['default'] =& new FileLog(array('path' => LOGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -188,7 +188,7 @@ class CakeLog {
|
||||||
if (is_int($type) && isset($levels[$type])) {
|
if (is_int($type) && isset($levels[$type])) {
|
||||||
$type = $levels[$type];
|
$type = $levels[$type];
|
||||||
}
|
}
|
||||||
$self = CakeLog::getInstance();
|
$self =& CakeLog::getInstance();
|
||||||
if (empty($self->_streams)) {
|
if (empty($self->_streams)) {
|
||||||
$self->_autoConfig();
|
$self->_autoConfig();
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ class CakeLogTest extends CakeTestCase {
|
||||||
$result = file(LOGS . 'debug.log');
|
$result = file(LOGS . 'debug.log');
|
||||||
$this->assertEqual(count($result), 1);
|
$this->assertEqual(count($result), 1);
|
||||||
$this->assertPattern(
|
$this->assertPattern(
|
||||||
'/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} Notice: Notice \(8\): Undefined variable: out in \[.+ line \d+\]$/',
|
'/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} Notice: Notice \(8\): Undefined variable:\s+out in \[.+ line \d+\]$/',
|
||||||
$result[0]
|
$result[0]
|
||||||
);
|
);
|
||||||
@unlink(LOGS . 'debug.log');
|
@unlink(LOGS . 'debug.log');
|
||||||
|
|
Loading…
Reference in a new issue