Commit f35b209f authored by nyloth's avatar nyloth

[MOD] error notices: do not display notices / warnings for third party libs....

[MOD] error notices: do not display notices / warnings for third party libs. To achieve this, 'lib/setup/third_party.php' was added to define a pattern that should match third party directories. This was already done for the release.php script, this is why it's in a separated script to avoid code duplication. SMARTY_DIR constant was also moved into this new setup file + fix some typos
parent faeb8692
......@@ -2483,6 +2483,7 @@ lib/setup/site_closed.php -text
lib/setup/smarty.php -text
lib/setup/stats.php -text
lib/setup/theme.php -text
lib/setup/third_party.php -text
lib/setup/tikisetup.class.php -text
lib/setup/timer.class.php -text
lib/setup/twversion.class.php -text
......
......@@ -26,9 +26,7 @@ define( 'LICENSE_FILENAME', 'license.txt' );
define( 'ERROR_REPORTING_LEVEL', E_ALL | E_STRICT );
error_reporting( ERROR_REPORTING_LEVEL );
// Exclude some third party libs when displaying warnings from the PHP syntax check, because we can't fix it directly by the way.
define( 'PHP_WARNINGS_EXLUDE_PATTERN', '#lib/(pear|ajax|adodb)#' );
require_once ROOT . '/lib/setup/third_party.php';
require_once TOOLS . '/svntools.php';
if ( version_compare(PHP_VERSION, '5.0.0', '<') )
......@@ -363,8 +361,9 @@ function check_php_syntax(&$dir, &$error_msg, $hide_php_warnings, $retry = 10) {
$fullOutput = trim($fullOutput);
$error_msg = ( $fullOutput == '' ) ? "\nPHP Parsing error in '{$entries[$i]}' ($return_var)\n" : "\n$fullOutput";
return false;
} elseif ( ! $hide_php_warnings && ( $nb_lines = count($output) ) > 1 && ! preg_match(PHP_WARNINGS_EXLUDE_PATTERN, $entries[$i]) ) {
} elseif ( ! $hide_php_warnings && ( $nb_lines = count($output) ) > 1 && ! preg_match(THIRD_PARTY_LIBS_PATTERN, $entries[$i]) ) {
// Handle PHP warnings / notices (this just displays a yellow warning, it doesn't return false or an error_msg)
// and exclude some third party libs when displaying warnings from the PHP syntax check, because we can't fix it directly by the way.
echo "\r";
foreach ( $output as $k => $line ) {
// Remove empty lines and last line (because in case of a simple warning, the last line simply says 'No syntax errors...')
......
......@@ -132,8 +132,9 @@ function tiki_error_handling($errno, $errstr, $errfile, $errline) {
if ( !defined('E_USER_DEPRECATED') ) define('E_USER_DEPRECATED', 16384);
$err[E_USER_DEPRECATED] = 'E_USER_DEPRECATED';
if (!empty($prefs['error_reporting_level']) and $prefs['error_reporting_level']) {
$errfile = basename($errfile);
if ( ! empty($prefs['error_reporting_level']) and $prefs['error_reporting_level'] ) {
global $tikipath;
$errfile = str_replace($tikipath, '', $errfile);
switch ($errno) {
case E_ERROR:
case E_CORE_ERROR:
......@@ -160,7 +161,7 @@ function tiki_error_handling($errno, $errstr, $errfile, $errline) {
case E_STRICT:
case E_DEPRECATED:
case E_USER_DEPRECATED:
if ($prefs['error_reporting_level'] == '2047' and $tiki_p_admin == 'y') {
if ( $prefs['error_reporting_level'] == '2047' and $tiki_p_admin == 'y' and ! preg_match(THIRD_PARTY_LIBS_PATTERN, $errfile) ) {
if ($prefs['smarty_notice_reporting'] != 'y' && strstr($errfile, '.tpl.php'))
break;
$back = "<div style='padding:4px;border:1px solid #000;background-color:#FF6;font-size:10px;'>";
......
......@@ -2,7 +2,7 @@
/*
Begining with TikiWiki 3.0, PHP >=5.1 is required. This file includes soft
implementations of functions introduced in versions later versions of PHP.
implementations of functions introduced in newer versions of PHP.
*/
if( ! function_exists( 'json_encode' ) )
......
<?php
// Copyright (c) 2002-2009, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for
// details.
//this script may only be included - so its better to die if called directly.
if ( basename($_SERVER['SCRIPT_NAME']) == basename(__FILE__) ) {
header("location: index.php");
exit;
}
// The following constant is at least used in the release.php script and in the error handling functions
define( 'THIRD_PARTY_LIBS_PATTERN', '#lib/(pear|ajax|adodb)#' );
// add a line like the following in db/local.php to use an external smarty installation: $smarty_path='/usr/share/php/smarty/'
define('TIKI_SMARTY_DIR', 'lib/smarty_tiki/');
if ( isset($smarty_path) && $smarty_path != '' && file_exists($smarty_path.'Smarty.class.php') ) define('SMARTY_DIR', $smarty_path);
else define('SMARTY_DIR', 'lib/smarty/libs/');
......@@ -10,14 +10,8 @@
if (strpos($_SERVER['SCRIPT_NAME'],basename(__FILE__)) !== FALSE) {
header('location: index.php');
exit;
die();
}
// add a line like the following in db/local.php to use an external smarty installation: $smarty_path='/usr/share/php/smarty/'
define('TIKI_SMARTY_DIR', 'lib/smarty_tiki/');
if ( isset($smarty_path) && $smarty_path != '' && file_exists($smarty_path.'Smarty.class.php') ) define('SMARTY_DIR', $smarty_path);
else define('SMARTY_DIR', 'lib/smarty/libs/');
require_once(SMARTY_DIR.'Smarty.class.php');
class Smarty_Tikiwiki extends Smarty {
......@@ -240,7 +234,6 @@ class Smarty_Tikiwiki extends Smarty {
$smarty = new Smarty_Tikiwiki($tikidomain);
$smarty->load_filter('pre', 'tr');
$smarty->load_filter('pre', 'jq');
// $smarty->load_filter('output','trimwhitespace');
include_once('lib/smarty_tiki/resource.wiki.php');
$smarty->register_resource('wiki', array('smarty_resource_wiki_source', 'smarty_resource_wiki_timestamp', 'smarty_resource_wiki_secure', 'smarty_resource_wiki_trusted'));
?>
......@@ -17,6 +17,7 @@ if (version_compare(PHP_VERSION, '5.0.0', '<')) {
exit;
}
require_once 'lib/setup/third_party.php';
require_once 'tiki-filter-base.php';
// Enable Versioning
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment