From: Thiemo Kreuz Date: Wed, 27 Mar 2019 10:10:39 +0000 (+0100) Subject: Replace misplaced strlen() checks with strict `false` comparisons X-Git-Tag: 1.34.0-rc.0~2319^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=666e3572827481d1df43758ed89a3617bacaef5e;p=lhc%2Fweb%2Fwiklou.git 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 --- 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." ); }