5050use function str_contains ;
5151use function str_replace ;
5252use function stripos ;
53- use function strlen ;
5453use function strtolower ;
5554use function strtoupper ;
5655use function substr ;
@@ -435,7 +434,7 @@ public function getCreateOptions(): array
435434 }
436435
437436 // we need explicit DEFAULT value here (different from '0')
438- $ hasPackKeys = isset ($ createOptions ['pack_keys ' ]) && strlen ( $ createOptions ['pack_keys ' ]) > 0 ;
437+ $ hasPackKeys = isset ($ createOptions ['pack_keys ' ]) && $ createOptions ['pack_keys ' ] !== '' ;
439438 $ createOptions ['pack_keys ' ] = $ hasPackKeys ? $ createOptions ['pack_keys ' ] : 'DEFAULT ' ;
440439
441440 return $ createOptions ;
@@ -485,7 +484,6 @@ public static function generateFieldSpec(
485484 $ columnsWithIndex = null ,
486485 $ oldColumnName = null
487486 ): string {
488- $ strLength = strlen ($ length );
489487 $ isTimestamp = mb_stripos ($ type , 'TIMESTAMP ' ) !== false ;
490488
491489 $ query = Util::backquote ($ name ) . ' ' . $ type ;
@@ -498,7 +496,7 @@ public static function generateFieldSpec(
498496 $ pattern = '@^(DATE|TINYBLOB|TINYTEXT|BLOB|TEXT| '
499497 . 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN|UUID|JSON)$@i ' ;
500498 if (
501- $ strLength !== 0
499+ $ length !== ''
502500 && ! preg_match ($ pattern , $ type )
503501 && Compatibility::isIntegersSupportLength ($ type , $ length , $ GLOBALS ['dbi ' ])
504502 ) {
@@ -511,7 +509,7 @@ public static function generateFieldSpec(
511509 if ($ attribute != '' ) {
512510 $ query .= ' ' . $ attribute ;
513511
514- if ($ isTimestamp && stripos ($ attribute , 'TIMESTAMP ' ) !== false && $ strLength !== 0 ) {
512+ if ($ isTimestamp && stripos ($ attribute , 'TIMESTAMP ' ) !== false && $ length !== '' ) {
515513 $ query .= '( ' . $ length . ') ' ;
516514 }
517515 }
@@ -592,7 +590,7 @@ public static function generateFieldSpec(
592590 $ query .= ' DEFAULT ' . $ defaultType ;
593591
594592 if (
595- $ strLength !== 0
593+ $ length !== ''
596594 && $ isTimestamp
597595 && $ defaultType !== 'NULL ' // Not to be added in case of NULL
598596 ) {
@@ -971,7 +969,7 @@ public static function moveCopy(
971969
972970 // If the target database is not specified, the operation is taking
973971 // place in the same database.
974- if (! isset ($ targetDb ) || strlen ( $ targetDb) === 0 ) {
972+ if (! isset ($ targetDb ) || $ targetDb === '' ) {
975973 $ targetDb = $ sourceDb ;
976974 }
977975
@@ -1381,7 +1379,7 @@ public static function isValidName($tableName, $isBackquoted = false): bool
13811379 return false ;
13821380 }
13831381
1384- if (strlen ( $ tableName) === 0 ) {
1382+ if ($ tableName === '' ) {
13851383 // zero length
13861384 return false ;
13871385 }
0 commit comments