From b27da85617ac2610a6d28a9377a6f22883e699f4 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 27 Dec 2006 07:47:10 +0000 Subject: [PATCH] Clean up Title::isSemiProtected() and make it return false if the page doesn't exist --- includes/Title.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index a6145e89d6..96df51d4e5 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -989,14 +989,15 @@ class Title { * @return bool */ function isSemiProtected( $action = 'edit' ) { - $restrictions = $this->getRestrictions( $action ); - # We do a full compare because this could be an array - foreach( $restrictions as $restriction ) { - if( strtolower( $restriction ) != 'autoconfirmed' ) { - return( false ); + if( $this->exists() ) { + foreach( $this->getRestrictions( $action ) as $restriction ) { + if( strtolower( $restriction ) != 'autoconfirmed' ) + return false; } + } else { + # If it doesn't exist, it can't be protected + return false; } - return( true ); } /** -- 2.20.1