Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/zend-log/library/Zend/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ public function registerErrorHandler()
E_USER_ERROR => Zend_Log::ERR,
E_CORE_ERROR => Zend_Log::ERR,
E_RECOVERABLE_ERROR => Zend_Log::ERR,
E_STRICT => Zend_Log::DEBUG,
);
// PHP 5.3.0+
if (defined('E_DEPRECATED')) {
Expand All @@ -603,6 +602,10 @@ public function registerErrorHandler()
if (defined('E_USER_DEPRECATED')) {
$this->_errorHandlerMap['E_USER_DEPRECATED'] = Zend_Log::DEBUG;
}
// PHP 8.5+
if (defined('E_STRICT')) {
$this->_errorHandlerMap['E_STRICT'] = Zend_Log::DEBUG;
}

$this->_registeredErrorHandler = true;
return $this;
Expand Down
8 changes: 6 additions & 2 deletions packages/zend-stdlib/library/Zend/Stdlib/CallbackHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ public function errorHandler($errno, $errstr)
*/
protected function registerCallback($callback)
{
set_error_handler(array($this, 'errorHandler'), E_STRICT);
if (PHP_VERSION_ID < 70400) {
set_error_handler(array($this, 'errorHandler'), E_STRICT);
}
$callable = is_callable($callback);
restore_error_handler();
if (PHP_VERSION_ID < 70400) {
restore_error_handler();
}
if (!$callable || $this->error) {
// require_once 'Zend/Stdlib/Exception/InvalidCallbackException.php';
throw new Zend_Stdlib_Exception_InvalidCallbackException('Invalid callback provided; not callable');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ public function load()
}

$classesLoadedBefore = get_declared_classes();
$oldLevel = error_reporting(E_ALL | ~E_STRICT); // remove strict so that other packages wont throw warnings
if (PHP_VERSION_ID < 70400) {
$oldLevel = error_reporting(E_ALL | ~E_STRICT); // remove strict so that other packages wont throw warnings
}
// should we lint the files here? i think so
include_once $file;
error_reporting($oldLevel); // restore old error level
if (PHP_VERSION_ID < 70400) {
error_reporting($oldLevel); // restore old error level
}
$classesLoadedAfter = get_declared_classes();
$loadedClasses = array_merge($loadedClasses, array_diff($classesLoadedAfter, $classesLoadedBefore));
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Zend/Json/JsonXMLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
* @version $Id$
*/

error_reporting( E_ALL | E_STRICT ); // now required for each test suite
error_reporting(E_ALL); // now required for each test suite
if (PHP_VERSION_ID < 70400) {
error_reporting(E_ALL | E_STRICT);
}

/**
* Zend_Json
Expand Down
6 changes: 5 additions & 1 deletion tests/Zend/Log/LogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ public function testUsingWithErrorHandler()
$oldErrorLevel = error_reporting();

$this->expectingLogging = true;
error_reporting(E_ALL | E_STRICT);

error_reporting(E_ALL);
if (PHP_VERSION_ID < 70400) {
error_reporting(E_ALL | E_STRICT);
}

$oldHandler = set_error_handler(array($this, 'verifyHandlerData'));
$logger->registerErrorHandler();
Expand Down
18 changes: 13 additions & 5 deletions tests/Zend/Session/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,19 @@ public function tearDown()

session_save_path($this->_savePath);

$this->assertSame(
E_ALL | E_STRICT,
error_reporting( E_ALL | E_STRICT ),
'A test altered error_reporting to something other than E_ALL | E_STRICT'
);
if (PHP_VERSION_ID < 70400) {
$this->assertSame(
E_ALL | E_STRICT,
error_reporting(E_ALL | E_STRICT),
'A test altered error_reporting to something other than E_ALL | E_STRICT'
);
} else {
$this->assertSame(
E_ALL,
error_reporting(E_ALL),
'A test altered error_reporting to something other than E_ALL'
);
}
}

/**
Expand Down
5 changes: 4 additions & 1 deletion tests/Zend/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,10 @@ public function escape($value, $additional = '')

public function testZf995UndefinedPropertiesReturnNull()
{
error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);
if (PHP_VERSION_ID < 70400) {
error_reporting(E_ALL | E_STRICT);
}
ini_set('display_errors', true);
$view = new Zend_View();
$view->setScriptPath(dirname(__FILE__) . '/View/_templates');
Expand Down
5 changes: 4 additions & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
/*
* Set error reporting to the level to which Zend Framework code must comply.
*/
error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);
if (PHP_VERSION_ID < 70400) {
error_reporting(E_ALL | E_STRICT);
}

$rootDir = dirname(__DIR__);

Expand Down
Loading