File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424use function in_array ;
2525use function intval ;
2626use function is_array ;
27+ use function mb_strlen ;
2728use function mb_strtoupper ;
29+ use function mb_substr ;
2830use function preg_quote ;
2931use function preg_replace ;
3032use function rtrim ;
@@ -514,8 +516,6 @@ public static function decorateColumnMetaDefault(array $columnMeta): array
514516 // Could be null or empty string here
515517 if ($ columnMeta ['Default ' ] === null ) {
516518 $ metaDefault ['DefaultType ' ] = $ columnMeta ['Null ' ] === 'YES ' ? 'NULL ' : 'NONE ' ;
517- } else {
518- $ columnMeta ['DefaultValue ' ] = $ columnMeta ['Default ' ];
519519 }
520520
521521 break ;
@@ -531,8 +531,16 @@ public static function decorateColumnMetaDefault(array $columnMeta): array
531531 break ;
532532 default :
533533 if (substr ((string ) $ columnMeta ['Type ' ], -4 ) === 'text ' ) {
534- $ textDefault = substr ($ columnMeta ['Default ' ], 1 , -1 );
535- $ metaDefault ['DefaultValue ' ] = stripcslashes ($ textDefault );
534+ if (
535+ mb_strlen ($ columnMeta ['Default ' ]) >= 2 &&
536+ mb_substr ($ columnMeta ['Default ' ], 0 , 1 ) === "' " &&
537+ mb_substr ($ columnMeta ['Default ' ], -1 ) === "' "
538+ ) {
539+ $ textDefault = substr ($ columnMeta ['Default ' ], 1 , -1 );
540+ $ metaDefault ['DefaultValue ' ] = stripcslashes ($ textDefault );
541+ } else {
542+ $ metaDefault ['DefaultValue ' ] = $ columnMeta ['Default ' ];
543+ }
536544 } else {
537545 $ metaDefault ['DefaultValue ' ] = $ columnMeta ['Default ' ];
538546 }
You can’t perform that action at this time.
0 commit comments