From 10a76b4fdc84b500c856e6539688e548f2fab60a Mon Sep 17 00:00:00 2001 From: ArrayIterator Date: Thu, 24 Oct 2024 02:26:41 +0700 Subject: [PATCH] patch --- src/Console/Command/BuiltInWebServer.php | 23 ++++++++++++------- .../Events/CreateSchemaToolsEvent.php | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Console/Command/BuiltInWebServer.php b/src/Console/Command/BuiltInWebServer.php index b286a3e..0b5432c 100644 --- a/src/Console/Command/BuiltInWebServer.php +++ b/src/Console/Command/BuiltInWebServer.php @@ -45,6 +45,7 @@ use function sprintf; use function strtolower; use function trim; +use function var_dump; use const DIRECTORY_SEPARATOR; use const PHP_BINARY; use const TD_INDEX_FILE; @@ -498,11 +499,14 @@ protected function doProcess( ) ); - $path = escapeshellcmd($publicFile); - + $docRoot = dirname($publicFile); $command = sprintf( - "%s -S $host:$port '$path'", - PHP_BINARY + '%s -t %s -S %s:%d %s', + PHP_BINARY, + escapeshellcmd($docRoot), + escapeshellcmd($host), + $port, + escapeshellcmd($publicFile), ); $output->writeln(''); @@ -534,19 +538,22 @@ protected function doProcess( $output->writeln(''); if (Consolidation::isUnix() && ( - !$output->isVeryVerbose() + ! $output->isVeryVerbose() && ! $output->isDebug() ) && file_exists('/dev/null') ) { - $command .= " 2>&1 & echo $!"; - $command = "cd " . dirname($publicFile) . " && $command"; + $command = sprintf( + 'cd %s && %s > /dev/null 2>&1', + $docRoot, + $command + ); } - // point to public directory chdir(dirname($publicFile)); exec($command, $array, $result_code); + if ($result_code !== 0) { return self::FAILURE; } elseif (!empty($array[1])) { diff --git a/src/Database/Events/CreateSchemaToolsEvent.php b/src/Database/Events/CreateSchemaToolsEvent.php index 83328d2..e4cef81 100644 --- a/src/Database/Events/CreateSchemaToolsEvent.php +++ b/src/Database/Events/CreateSchemaToolsEvent.php @@ -325,6 +325,7 @@ private function getColumnDeclarationAttributeOnUpdate( ) { $attribute = 'UNSIGNED ZEROFILL'; } + $attribute = preg_replace('~\s+~', ' ', $attribute); $allowedAttributes = [ 'ON UPDATE CURRENT_TIMESTAMP' => [ DateTimeType::class,