From fb0742394a2097a506a777f0bc7c285c07eb6a72 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 10 Nov 2010 13:14:44 +0300 Subject: [PATCH] remove error_reporting() hacks; set default error reporting level in functions.php --- backend.php | 14 +------------- db-updater.php | 7 ++----- digest.php | 2 -- functions.php | 45 +++++++++------------------------------------ localized_js.php | 1 - opml.php | 4 +--- prefs.php | 2 -- register.php | 7 ++----- tt-rss.php | 2 -- update.php | 5 +---- update_daemon2.php | 5 ----- 11 files changed, 16 insertions(+), 78 deletions(-) diff --git a/backend.php b/backend.php index 34f9c3b25..8b1454ad7 100644 --- a/backend.php +++ b/backend.php @@ -1,6 +1,4 @@ get($obj_id)) { @@ -628,7 +616,7 @@ } else { if (!$use_simplepie) { - $rss = fetch_rss($fetch_url); + $rss = @fetch_rss($fetch_url); } else { if (!is_dir(SIMPLEPIE_CACHE_DIR)) { mkdir(SIMPLEPIE_CACHE_DIR); @@ -668,8 +656,6 @@ if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) { _debug("update_rss_feed: fetch done, parsing..."); - } else { - error_reporting (DEFAULT_ERROR_LEVEL); } $feed = db_escape_string($feed); @@ -1134,8 +1120,6 @@ $dupcheck_qpart = ""; } -// error_reporting(0); - /* Collect article tags here so we could filter by them: */ $article_filters = get_article_filters($filters, $entry_title, @@ -1153,8 +1137,6 @@ continue; } -// error_reporting (DEFAULT_ERROR_LEVEL); - $score = calculate_article_score($article_filters); if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) { @@ -2261,8 +2243,6 @@ function sanity_check($link) { - error_reporting(0); - $error_code = 0; $schema_version = get_schema_version($link); @@ -2281,8 +2261,6 @@ $error_code = 12; } - error_reporting (DEFAULT_ERROR_LEVEL); - if ($error_code != 0) { print_error_xml($error_code); return false; @@ -2293,9 +2271,7 @@ function file_is_locked($filename) { if (function_exists('flock')) { - error_reporting(0); - $fp = fopen(LOCK_DIRECTORY . "/$filename", "r"); - error_reporting(DEFAULT_ERROR_LEVEL); + $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r"); if ($fp) { if (flock($fp, LOCK_EX | LOCK_NB)) { flock($fp, LOCK_UN); @@ -3232,7 +3208,7 @@ if (time() - $_SESSION["daemon_stamp_check"] > 30) { - $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); + $stamp = (int) @file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); if ($stamp) { $stamp_delta = time() - $stamp; @@ -3256,7 +3232,7 @@ if (CHECK_FOR_NEW_VERSION && $_SESSION["access_level"] >= 10) { if ($_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) { - $new_version_details = check_for_update($link); + $new_version_details = @check_for_update($link); print ""; @@ -3950,18 +3926,15 @@ return; } - error_reporting(0); if (DEFAULT_UPDATE_METHOD == "1") { $rss = new SimplePie(); $rss->set_useragent(SIMPLEPIE_USERAGENT . MAGPIE_USER_AGENT_EXT); -// $rss->set_timeout(MAGPIE_FETCH_TIME_OUT); $rss->set_feed_url($fetch_url); $rss->set_output_encoding('UTF-8'); $rss->init(); } else { $rss = fetch_rss($releases_feed); } - error_reporting (DEFAULT_ERROR_LEVEL); if ($rss) { @@ -5100,8 +5073,6 @@ $lnum = $limit*$offset; - error_reporting (DEFAULT_ERROR_LEVEL); - $num_unread = 0; $cur_feed_title = ''; @@ -6859,6 +6830,8 @@ $url = fix_url($url); $baseUrl = substr($url, 0, strrpos($url, '/') + 1); + libxml_use_internal_errors(true); + $doc = new DOMDocument(); $doc->loadHTMLFile($url); $xpath = new DOMXPath($doc); diff --git a/localized_js.php b/localized_js.php index 0d66da575..08eec1aff 100644 --- a/localized_js.php +++ b/localized_js.php @@ -1,5 +1,4 @@