From: <car...@us...> - 2025-02-14 23:22:39
|
Revision: 11108 http://sourceforge.net/p/phpwiki/code/11108 Author: carstenklapp Date: 2025-02-14 23:22:37 +0000 (Fri, 14 Feb 2025) Log Message: ----------- Important bugfix for PHP8.3 and newer: Fixed garbled pages due to depreciated errors. Modified Paths: -------------- trunk/lib/ErrorManager.php trunk/lib/prepend.php trunk/pgsrc/ReleaseNotes Modified: trunk/lib/ErrorManager.php =================================================================== --- trunk/lib/ErrorManager.php 2025-02-14 07:58:34 UTC (rev 11107) +++ trunk/lib/ErrorManager.php 2025-02-14 23:22:37 UTC (rev 11108) @@ -37,9 +37,23 @@ Only where absolute speed is necessary you might want to turn them off. */ + +/* PHP 8.3 deprecates all of the assert.* INI directives, ASSERT_* constants, + and assert_options() function. The zend.assertions INI directive works + as a replacement to enable or disable assert() functionality. + + This also means that the ability to execute custom callbacks is also + deprecated, with no replacement functionality provided. + https://php.watch/versions/8.3/assert-multiple-deprecations + Hide depreciated errors unless DEBUG=2 because they output compressed text + before all headers have been sent, resulting in a garbled page. + All code using assertions will have to be rewritten for php9. + */ if (defined('DEBUG') and DEBUG) { + Error_reporting(E_ALL); assert_options(ASSERT_ACTIVE, 1); } else { + Error_reporting(E_ALL ^ (/*E_NOTICE | E_WARNING |*/ E_DEPRECATED)); assert_options(ASSERT_ACTIVE, 0); } assert_options(ASSERT_CALLBACK, 'wiki_assert_handler'); @@ -62,6 +76,12 @@ /** * As this is a singleton class, you should never call this. */ + //fixed depreciated dynamic typing + public $_handlers; + public $_fatal_handler; + public $_postpone_mask; + public $_postponed_errors;//ok + public function __construct() { $this->_handlers = array(); @@ -482,10 +502,17 @@ return ($this->errno & EM_NOTICE_ERRORS) != 0; } + public function isDepreciated() + { + return ($this->errno & E_DEPRECATED) != 0; //E_DEPRECATED is 8192 + } + public function getHtmlClass() { if ($this->isNotice()) { return 'hint'; + } elseif ($this->isDepreciated()) { + return 'depreciated'; } elseif ($this->isWarning()) { return 'warning'; } else { @@ -497,6 +524,8 @@ { if ($this->isNotice()) { return 'Notice'; + } elseif ($this->isDepreciated()) { + return 'depreciated'; } elseif ($this->isWarning()) { return 'Warning'; } else { @@ -548,6 +577,10 @@ } $html->pushContent($list); } + //only print depreciated if debug is 2 or higher + if (DEBUG < 2 && $this->isDepreciated()) { + $html=false; + } return $html; } @@ -627,6 +660,8 @@ */ class PhpErrorOnce extends PhpError { + public $_count; + public function __construct($errno, $errstr, $errfile, $errline) { $this->_count = 1; Modified: trunk/lib/prepend.php =================================================================== --- trunk/lib/prepend.php 2025-02-14 07:58:34 UTC (rev 11107) +++ trunk/lib/prepend.php 2025-02-14 23:22:37 UTC (rev 11108) @@ -29,7 +29,7 @@ * Things which must be done and defined before anything else. */ -define('PHPWIKI_VERSION', '1.6.4'); +define('PHPWIKI_VERSION', '1.6.5'); // A new php-5.1.x feature: Turn off php-5.1.x auto_globals_jit = On, or use this mess below. if (empty($GLOBALS['HTTP_SERVER_VARS'])) { @@ -62,6 +62,7 @@ // Used for debugging purposes class DebugTimer { + public $_start; public function __construct() { $this->_start = $this->microtime(); Modified: trunk/pgsrc/ReleaseNotes =================================================================== --- trunk/pgsrc/ReleaseNotes 2025-02-14 07:58:34 UTC (rev 11107) +++ trunk/pgsrc/ReleaseNotes 2025-02-14 23:22:37 UTC (rev 11108) @@ -1,4 +1,4 @@ -Date: Fri, 14 Feb 2025 05:10:22 +0000 +Date: Fri, 14 Feb 2025 23:09:08 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.6.5) Content-Type: application/x-phpwiki; pagename=ReleaseNotes; @@ -23,10 +23,17 @@ * Fixed MacOSX theme buttons not loading, other visual improvements and RecentChanges uses a table now. * Improved formatting output for debugging, adjusted code for themes - which depend on default theme. Added signature template (can be disabled - by adding this line to themeinfo.php: ##$this->addImageAlias('signature', false);)## -* Added 404 error to HttpClient.php which is displyed now in PhotoAlbum plugin. - Removed url of defunct example website that broke PhpWikiManual. + which depend on default theme. Added signature template. This can be + disabled by adding this line to themeinfo.php: + ##$this->addImageAlias('signature', false);## +* Added 404 error to ~HttpClient.php which is displayed now in + ~PhotoAlbumPlugin. Removed url of defunct example website that broke + PhpWikiManual. +* **Important bugfix for PHP8.3 and newer:** Fixed garbled pages due to + depreciated errors. Also try harder to suppress depreciated errors on all + PHP versions. Set ##DEBUG=2## in ##config.ini## to view depreciated errors, + and ##DEBUG=1## for basic errors. Added hooks for css formatting of + depreciated errors. == 1.6.4 2024-03-13 Marc-Etienne Vargenau, Christof Meerwald == This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |