From 666e3572827481d1df43758ed89a3617bacaef5e Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Wed, 27 Mar 2019 11:10:39 +0100 Subject: [PATCH] Replace misplaced strlen() checks with strict `false` comparisons As far as I can tell the intention of this code is *not* to detect empty strings, but `false`. Change-Id: I406d065a54a1437fdfd46827fec9493e5fad05f9 --- includes/externalstore/ExternalStore.php | 2 +- includes/libs/rdbms/database/Database.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/externalstore/ExternalStore.php b/includes/externalstore/ExternalStore.php index de7d1a4c48..9cf8e15d83 100644 --- a/includes/externalstore/ExternalStore.php +++ b/includes/externalstore/ExternalStore.php @@ -197,7 +197,7 @@ class ExternalStore { $msg = 'read only'; } else { $url = $store->store( $path, $data ); - if ( strlen( $url ) ) { + if ( $url !== false ) { return $url; // a store accepted the write; done! } $msg = 'operation failed'; diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index dea7aab27d..fcd15f1659 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -2547,7 +2547,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware throw new InvalidArgumentException( "Table must be a string or Subquery." ); } - if ( !strlen( $alias ) || $alias === $table ) { + if ( $alias === false || $alias === $table ) { if ( $table instanceof Subquery ) { throw new InvalidArgumentException( "Subquery table missing alias." ); } -- 2.20.1