r103129 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103128‎ | r103129 | r103130 >
Date:04:33, 15 November 2011
Author:yaron
Status:deferred
Tags:
Comment:
Follow-up to r102484 and r102485 - as aesthetically unappealing as it is, it looks like calls to both is_null and "== ''" are necessary, since empty() unfortunately also returns true for the value 0
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_FormEdit.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php
@@ -188,7 +188,7 @@
189189 $wgOut->setPageTitle( $s );
190190
191191 if ( $form_submitted ) {
192 - if ( !empty( $page_name_formula ) ) {
 192+ if ( !is_null( $page_name_formula ) && $page_name_formula !== '' ) {
193193 $target_name = $generated_page_name;
194194 // prepend a super-page, if one was specified
195195 if ( $wgRequest->getCheck( 'super_page' ) ) {
Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -64,8 +64,7 @@
6565 $page_name = $wgRequest->getVal( 'page_name' );
6666 // This form can be used to create a sub-page for an
6767 // existing page
68 -
69 - if ( !empty( $super_page ) ) {
 68+ if ( !is_null( $super_page ) && $super_page !== '' ) {
7069 $page_name = "$super_page/$page_name";
7170 }
7271
@@ -184,7 +183,7 @@
185184 }
186185 }
187186
188 - if ( !empty( $params ) ) {
 187+ if ( !is_null( $params ) && $params !== '' ) {
189188 $redirect_url .= ( strpos( $redirect_url, '?' ) > - 1 ) ? '&' : '?';
190189 $redirect_url .= $params;
191190 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102484Fix for r102368 - apparently, the is_null() check was necessary; replaced the...yaron02:48, 9 November 2011
r102485Follow-up to r102365 - changed comparison to both blank and null to just use ...yaron02:54, 9 November 2011