From 96a4193fc9afbf9a02497f82ee0d9829d5cdae98 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 31 May 2010 20:07:09 -0700 Subject: [PATCH] Fix undefined index warnings in maintenance scripts. Signed-off-by: Edward Z. Yang --- NEWS | 1 + maintenance/flush.php | 3 +-- maintenance/generate-includes.php | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 1cad3a36..0ab8c449 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier ========================== 4.1.1, unknown release date +- Fix undefined index warnings in maintenance scripts. - Fix bug in DirectLex for parsing elements with a single attribute with entities. - Rewrite CSS output logic for font-family and url(). Thanks Mario diff --git a/maintenance/flush.php b/maintenance/flush.php index 38ce5785..6dada93f 100644 --- a/maintenance/flush.php +++ b/maintenance/flush.php @@ -18,8 +18,7 @@ function e($cmd) { if ($status) exit($status); } -$php = $_SERVER['argv'][1]; -if (!$php) $php = 'php'; +$php = empty($_SERVER['argv'][1]) ? 'php' : $_SERVER['argv'][1]; e($php . ' generate-includes.php'); e($php . ' generate-schema-cache.php'); diff --git a/maintenance/generate-includes.php b/maintenance/generate-includes.php index 8a30c4ad..498f49b9 100644 --- a/maintenance/generate-includes.php +++ b/maintenance/generate-includes.php @@ -80,8 +80,9 @@ function get_dependency_lookup($file) { if (strncmp('class', $line, 5) === 0) { // The implementation here is fragile and will break if we attempt // to use interfaces. Beware! - list(, $parent) = explode(' extends ', trim($line, ' {'."\n\r"), 2); - if (empty($parent)) break; + $arr = explode(' extends ', trim($line, ' {'."\n\r"), 2); + if (count($arr) < 2) break; + $parent = $arr[1]; $dep_file = HTMLPurifier_Bootstrap::getPath($parent); if (!$dep_file) break; $deps[$dep_file] = true; -- 2.11.4.GIT