diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 97bdc60b84..37c6bbb98a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -133,13 +133,7 @@ EOT $validAssetDirs = []; /** @var BundleInterface $bundle */ foreach ($kernel->getBundles() as $bundle) { - if (!method_exists($bundle, 'getPublicDir')) { - @trigger_error(sprintf('Not defining "getPublicDir()" method in the "%s" class is deprecated since Symfony 4.4 and will not be supported in 5.0.', \get_class($bundle)), E_USER_DEPRECATED); - $publicDir = 'Resources/public'; - } else { - $publicDir = ltrim($bundle->getPublicDir(), '\\/'); - } - if (!is_dir($originDir = $bundle->getPath().\DIRECTORY_SEPARATOR.$publicDir)) { + if (!is_dir($originDir = $bundle->getPath().\DIRECTORY_SEPARATOR.ltrim($bundle->getPublicDir(), '\\/'))) { continue; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php index 1bcf762c47..53ae228f01 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php @@ -40,7 +40,7 @@ abstract class WebTestCase extends KernelTestCase protected static function createClient(array $options = [], array $server = []) { if (true === static::$booted) { - @trigger_error(sprintf('Booting the kernel before calling %s::%s is deprecated and will throw in Symfony 5.0, the kernel should only be booted once.', __CLASS__, __METHOD__), E_USER_DEPRECATED); + throw new \LogicException(sprintf('Booting the kernel before calling %s() is not supported, the kernel should only be booted once.', __METHOD__)); } $kernel = static::bootKernel($options); diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php index 0a3f92f402..d8dd7ae94c 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php @@ -15,6 +15,7 @@ use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Core\Exception\LogicException; /** * FormLoginLdapFactory creates services for form login ldap authentication. @@ -40,7 +41,7 @@ class FormLoginLdapFactory extends FormLoginFactory if (!empty($config['query_string'])) { if ('' === $config['search_dn'] || '' === $config['search_password']) { - @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw in Symfony 5.0.', E_USER_DEPRECATED); + throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); } $definition->addMethodCall('setQueryString', [$config['query_string']]); } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php index 309d114fab..19b73b8028 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php @@ -15,6 +15,7 @@ use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Core\Exception\LogicException; /** * HttpBasicFactory creates services for HTTP basic authentication. @@ -44,7 +45,7 @@ class HttpBasicLdapFactory extends HttpBasicFactory if (!empty($config['query_string'])) { if ('' === $config['search_dn'] || '' === $config['search_password']) { - @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw in Symfony 5.0.', E_USER_DEPRECATED); + throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); } $definition->addMethodCall('setQueryString', [$config['query_string']]); } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php index 09b99dd3a2..ef776c52ff 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php @@ -15,6 +15,7 @@ use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Core\Exception\LogicException; /** * JsonLoginLdapFactory creates services for json login ldap authentication. @@ -42,7 +43,7 @@ class JsonLoginLdapFactory extends JsonLoginFactory if (!empty($config['query_string'])) { if ('' === $config['search_dn'] || '' === $config['search_password']) { - @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw in Symfony 5.0.', E_USER_DEPRECATED); + throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); } $definition->addMethodCall('setQueryString', [$config['query_string']]); } diff --git a/src/Symfony/Bundle/WebServerBundle/CHANGELOG.md b/src/Symfony/Bundle/WebServerBundle/CHANGELOG.md deleted file mode 100644 index edc7417cea..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/CHANGELOG.md +++ /dev/null @@ -1,17 +0,0 @@ -CHANGELOG -========= - -4.2.0 ------ - - * Added ability to display the current hostname address if available when binding to 0.0.0.0 - -3.4.0 ------ - - * WebServer can now use '*' as a wildcard to bind to 0.0.0.0 (INADDR_ANY) - -3.3.0 ------ - - * Added bundle diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php deleted file mode 100644 index b841bd1805..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php +++ /dev/null @@ -1,161 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle\Command; - -use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; -use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; -use Symfony\Bridge\Monolog\Handler\ConsoleHandler; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Exception\LogicException; -use Symfony\Component\Console\Exception\RuntimeException; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; - -/** - * @author Grégoire Pineau - * - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class ServerLogCommand extends Command -{ - private static $bgColor = ['black', 'blue', 'cyan', 'green', 'magenta', 'red', 'white', 'yellow']; - - private $el; - private $handler; - - protected static $defaultName = 'server:log'; - - public function isEnabled() - { - if (!class_exists(ConsoleFormatter::class)) { - return false; - } - - // based on a symfony/symfony package, it crashes due a missing FormatterInterface from monolog/monolog - if (!interface_exists(FormatterInterface::class)) { - return false; - } - - return parent::isEnabled(); - } - - protected function configure() - { - if (!class_exists(ConsoleFormatter::class)) { - return; - } - - $this - ->addOption('host', null, InputOption::VALUE_REQUIRED, 'The server host', '0.0.0.0:9911') - ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The line format', ConsoleFormatter::SIMPLE_FORMAT) - ->addOption('date-format', null, InputOption::VALUE_REQUIRED, 'The date format', ConsoleFormatter::SIMPLE_DATE) - ->addOption('filter', null, InputOption::VALUE_REQUIRED, 'An expression to filter log. Example: "level > 200 or channel in [\'app\', \'doctrine\']"') - ->setDescription('Starts a log server that displays logs in real time') - ->setHelp(<<<'EOF' -%command.name% starts a log server to display in real time the log -messages generated by your application: - - php %command.full_name% - -To get the information as a machine readable format, use the ---filter option: - -php %command.full_name% --filter=port -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - @trigger_error('Using the WebserverBundle is deprecated since 4.4. The new Symfony local server has more features, you can use it instead.', E_USER_DEPRECATED); - - $filter = $input->getOption('filter'); - if ($filter) { - if (!class_exists(ExpressionLanguage::class)) { - throw new LogicException('Package "symfony/expression-language" is required to use the "filter" option.'); - } - $this->el = new ExpressionLanguage(); - } - - $this->handler = new ConsoleHandler($output, true, [ - OutputInterface::VERBOSITY_NORMAL => Logger::DEBUG, - ]); - - $this->handler->setFormatter(new ConsoleFormatter([ - 'format' => str_replace('\n', "\n", $input->getOption('format')), - 'date_format' => $input->getOption('date-format'), - 'colors' => $output->isDecorated(), - 'multiline' => OutputInterface::VERBOSITY_DEBUG <= $output->getVerbosity(), - ])); - - if (false === strpos($host = $input->getOption('host'), '://')) { - $host = 'tcp://'.$host; - } - - if (!$socket = stream_socket_server($host, $errno, $errstr)) { - throw new RuntimeException(sprintf('Server start failed on "%s": %s %s.', $host, $errstr, $errno)); - } - - foreach ($this->getLogs($socket) as $clientId => $message) { - $record = unserialize(base64_decode($message)); - - // Impossible to decode the message, give up. - if (false === $record) { - continue; - } - - if ($filter && !$this->el->evaluate($filter, $record)) { - continue; - } - - $this->displayLog($input, $output, $clientId, $record); - } - } - - private function getLogs($socket) - { - $sockets = [(int) $socket => $socket]; - $write = []; - - while (true) { - $read = $sockets; - stream_select($read, $write, $write, null); - - foreach ($read as $stream) { - if ($socket === $stream) { - $stream = stream_socket_accept($socket); - $sockets[(int) $stream] = $stream; - } elseif (feof($stream)) { - unset($sockets[(int) $stream]); - fclose($stream); - } else { - yield (int) $stream => fgets($stream); - } - } - } - } - - private function displayLog(InputInterface $input, OutputInterface $output, $clientId, array $record) - { - if (isset($record['log_id'])) { - $clientId = unpack('H*', $record['log_id'])[1]; - } - $logBlock = sprintf(' ', self::$bgColor[$clientId % 8]); - $output->write($logBlock); - - $this->handler->handle($record); - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php deleted file mode 100644 index 53c9c807ad..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle\Command; - -use Symfony\Bundle\WebServerBundle\WebServer; -use Symfony\Bundle\WebServerBundle\WebServerConfig; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\ConsoleOutputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\Process\Process; - -/** - * Runs Symfony application using a local web server. - * - * @author Michał Pipa - * - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class ServerRunCommand extends Command -{ - private $documentRoot; - private $environment; - private $pidFileDirectory; - - protected static $defaultName = 'server:run'; - - public function __construct(string $documentRoot = null, string $environment = null, string $pidFileDirectory = null) - { - $this->documentRoot = $documentRoot; - $this->environment = $environment; - $this->pidFileDirectory = $pidFileDirectory; - - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setDefinition([ - new InputArgument('addressport', InputArgument::OPTIONAL, 'The address to listen to (can be address:port, address, or port)'), - new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root, usually where your front controllers are stored'), - new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'), - ]) - ->setDescription('Runs a local web server') - ->setHelp(<<<'EOF' -%command.name% runs a local web server: By default, the server -listens on 127.0.0.1 address and the port number is automatically selected -as the first free port starting from 8000: - - %command.full_name% - -This command blocks the console. If you want to run other commands, stop it by -pressing Control+C or use the non-blocking server:start -command instead. - -Change the default address and port by passing them as an argument: - - %command.full_name% 127.0.0.1:8080 - -Use the --docroot option to change the default docroot directory: - - %command.full_name% --docroot=htdocs/ - -Specify your own router script via the --router option: - - %command.full_name% --router=app/config/router.php - -See also: http://www.php.net/manual/en/features.commandline.webserver.php -EOF - ) - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - @trigger_error('Using the WebserverBundle is deprecated since 4.4. The new Symfony local server has more features, you can use it instead.', E_USER_DEPRECATED); - - $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); - - if (null === $documentRoot = $input->getOption('docroot')) { - if (!$this->documentRoot) { - $io->error('The document root directory must be either passed as first argument of the constructor or through the "--docroot" input option.'); - - return 1; - } - $documentRoot = $this->documentRoot; - } - - if (!$env = $this->environment) { - if ($input->hasOption('env') && !$env = $input->getOption('env')) { - $io->error('The environment must be either passed as second argument of the constructor or through the "--env" input option.'); - - return 1; - } else { - $io->error('The environment must be passed as second argument of the constructor.'); - - return 1; - } - } - - if ('prod' === $env) { - $io->error('Running this server in production environment is NOT recommended!'); - } - - $callback = null; - $disableOutput = false; - if ($output->isQuiet()) { - $disableOutput = true; - } else { - $callback = function ($type, $buffer) use ($output) { - if (Process::ERR === $type && $output instanceof ConsoleOutputInterface) { - $output = $output->getErrorOutput(); - } - $output->write($buffer, false, OutputInterface::OUTPUT_RAW); - }; - } - - try { - $server = new WebServer($this->pidFileDirectory); - $config = new WebServerConfig($documentRoot, $env, $input->getArgument('addressport'), $input->getOption('router')); - - $message = sprintf('Server listening on http://%s', $config->getAddress()); - if ('' !== $displayAddress = $config->getDisplayAddress()) { - $message = sprintf('Server listening on all interfaces, port %s -- see http://%s', $config->getPort(), $displayAddress); - } - $io->success($message); - if (ini_get('xdebug.profiler_enable_trigger')) { - $io->comment('Xdebug profiler trigger enabled.'); - } - $io->comment('Quit the server with CONTROL-C.'); - - $exitCode = $server->run($config, $disableOutput, $callback); - } catch (\Exception $e) { - $io->error($e->getMessage()); - - return 1; - } - - return $exitCode; - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php deleted file mode 100644 index 3e17c87bce..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php +++ /dev/null @@ -1,167 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle\Command; - -use Symfony\Bundle\WebServerBundle\WebServer; -use Symfony\Bundle\WebServerBundle\WebServerConfig; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\ConsoleOutputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\EventDispatcher\EventDispatcher; - -/** - * Runs a local web server in a background process. - * - * @author Christian Flothmann - * - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class ServerStartCommand extends Command -{ - private $documentRoot; - private $environment; - private $pidFileDirectory; - - protected static $defaultName = 'server:start'; - - public function __construct(string $documentRoot = null, string $environment = null, string $pidFileDirectory = null) - { - $this->documentRoot = $documentRoot; - $this->environment = $environment; - $this->pidFileDirectory = $pidFileDirectory; - - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setDefinition([ - new InputArgument('addressport', InputArgument::OPTIONAL, 'The address to listen to (can be address:port, address, or port)'), - new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root'), - new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'), - new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'), - ]) - ->setDescription('Starts a local web server in the background') - ->setHelp(<<<'EOF' -%command.name% runs a local web server: By default, the server -listens on 127.0.0.1 address and the port number is automatically selected -as the first free port starting from 8000: - - php %command.full_name% - -The server is run in the background and you can keep executing other commands. -Execute server:stop to stop it. - -Change the default address and port by passing them as an argument: - - php %command.full_name% 127.0.0.1:8080 - -Use the --docroot option to change the default docroot directory: - - php %command.full_name% --docroot=htdocs/ - -Specify your own router script via the --router option: - - php %command.full_name% --router=app/config/router.php - -See also: http://www.php.net/manual/en/features.commandline.webserver.php -EOF - ) - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - @trigger_error('Using the WebserverBundle is deprecated since 4.4. The new Symfony local server has more features, you can use it instead.', E_USER_DEPRECATED); - - $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); - - if (!\extension_loaded('pcntl')) { - $io->error([ - 'This command needs the pcntl extension to run.', - 'You can either install it or use the "server:run" command instead.', - ]); - - if ($io->confirm('Do you want to execute server:run immediately?', false)) { - return $this->getApplication()->find('server:run')->run($input, $output); - } - - return 1; - } - - if (null === $documentRoot = $input->getOption('docroot')) { - if (!$this->documentRoot) { - $io->error('The document root directory must be either passed as first argument of the constructor or through the "docroot" input option.'); - - return 1; - } - $documentRoot = $this->documentRoot; - } - - if (!$env = $this->environment) { - if ($input->hasOption('env') && !$env = $input->getOption('env')) { - $io->error('The environment must be either passed as second argument of the constructor or through the "--env" input option.'); - - return 1; - } else { - $io->error('The environment must be passed as second argument of the constructor.'); - - return 1; - } - } - - if ('prod' === $env) { - $io->error('Running this server in production environment is NOT recommended!'); - } - - // replace event dispatcher with an empty one to prevent console.terminate from firing - // as container could have changed between start and stop - $this->getApplication()->setDispatcher(new EventDispatcher()); - - try { - $server = new WebServer($this->pidFileDirectory); - if ($server->isRunning($input->getOption('pidfile'))) { - $io->error(sprintf('The web server has already been started. It is currently listening on http://%s. Please stop the web server before you try to start it again.', $server->getAddress($input->getOption('pidfile')))); - - return 1; - } - - $config = new WebServerConfig($documentRoot, $env, $input->getArgument('addressport'), $input->getOption('router')); - - if (WebServer::STARTED === $server->start($config, $input->getOption('pidfile'))) { - $message = sprintf('Server listening on http://%s', $config->getAddress()); - if ('' !== $displayAddress = $config->getDisplayAddress()) { - $message = sprintf('Server listening on all interfaces, port %s -- see http://%s', $config->getPort(), $displayAddress); - } - $io->success($message); - if (ini_get('xdebug.profiler_enable_trigger')) { - $io->comment('Xdebug profiler trigger enabled.'); - } - } - } catch (\Exception $e) { - $io->error($e->getMessage()); - - return 1; - } - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php deleted file mode 100644 index 5912b9d883..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle\Command; - -use Symfony\Bundle\WebServerBundle\WebServer; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\ConsoleOutputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; - -/** - * Shows the status of a process that is running PHP's built-in web server in - * the background. - * - * @author Christian Flothmann - * - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class ServerStatusCommand extends Command -{ - protected static $defaultName = 'server:status'; - - private $pidFileDirectory; - - public function __construct(string $pidFileDirectory = null) - { - $this->pidFileDirectory = $pidFileDirectory; - - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setDefinition([ - new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'), - new InputOption('filter', null, InputOption::VALUE_REQUIRED, 'The value to display (one of port, host, or address)'), - ]) - ->setDescription('Outputs the status of the local web server') - ->setHelp(<<<'EOF' -%command.name% shows the details of the given local web -server, such as the address and port where it is listening to: - - php %command.full_name% - -To get the information as a machine readable format, use the ---filter option: - -php %command.full_name% --filter=port - -Supported values are port, host, and address. -EOF - ) - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - @trigger_error('Using the WebserverBundle is deprecated since 4.4. The new Symfony local server has more features, you can use it instead.', E_USER_DEPRECATED); - - $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); - $server = new WebServer($this->pidFileDirectory); - if ($filter = $input->getOption('filter')) { - if ($server->isRunning($input->getOption('pidfile'))) { - list($host, $port) = explode(':', $address = $server->getAddress($input->getOption('pidfile'))); - if ('address' === $filter) { - $output->write($address); - } elseif ('host' === $filter) { - $output->write($host); - } elseif ('port' === $filter) { - $output->write($port); - } else { - throw new InvalidArgumentException(sprintf('"%s" is not a valid filter.', $filter)); - } - } else { - return 1; - } - } else { - if ($server->isRunning($input->getOption('pidfile'))) { - $io->success(sprintf('Web server still listening on http://%s', $server->getAddress($input->getOption('pidfile')))); - } else { - $io->warning('No web server is listening.'); - - return 1; - } - } - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php deleted file mode 100644 index 762bf6d869..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle\Command; - -use Symfony\Bundle\WebServerBundle\WebServer; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\ConsoleOutputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; - -/** - * Stops a background process running a local web server. - * - * @author Christian Flothmann - * - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class ServerStopCommand extends Command -{ - protected static $defaultName = 'server:stop'; - - private $pidFileDirectory; - - public function __construct(string $pidFileDirectory = null) - { - $this->pidFileDirectory = $pidFileDirectory; - - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setDefinition([ - new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'), - ]) - ->setDescription('Stops the local web server that was started with the server:start command') - ->setHelp(<<<'EOF' -%command.name% stops the local web server: - - php %command.full_name% -EOF - ) - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - @trigger_error('Using the WebserverBundle is deprecated since 4.4. The new Symfony local server has more features, you can use it instead.', E_USER_DEPRECATED); - - $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); - - try { - $server = new WebServer($this->pidFileDirectory); - $server->stop($input->getOption('pidfile')); - $io->success('Stopped the web server.'); - } catch (\Exception $e) { - $io->error($e->getMessage()); - - return 1; - } - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/DependencyInjection/WebServerExtension.php b/src/Symfony/Bundle/WebServerBundle/DependencyInjection/WebServerExtension.php deleted file mode 100644 index b7d5878e8c..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/DependencyInjection/WebServerExtension.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle\DependencyInjection; - -use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\Extension; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; - -/** - * @author Robin Chalas - * - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class WebServerExtension extends Extension -{ - public function load(array $configs, ContainerBuilder $container) - { - $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('webserver.xml'); - - $publicDirectory = $this->getPublicDirectory($container); - $container->getDefinition('web_server.command.server_run')->replaceArgument(0, $publicDirectory); - $container->getDefinition('web_server.command.server_start')->replaceArgument(0, $publicDirectory); - - $pidFileDirectory = $this->getPidFileDirectory($container); - $container->getDefinition('web_server.command.server_run')->replaceArgument(2, $pidFileDirectory); - $container->getDefinition('web_server.command.server_start')->replaceArgument(2, $pidFileDirectory); - $container->getDefinition('web_server.command.server_stop')->replaceArgument(0, $pidFileDirectory); - $container->getDefinition('web_server.command.server_status')->replaceArgument(0, $pidFileDirectory); - - if (!class_exists(ConsoleFormatter::class)) { - $container->removeDefinition('web_server.command.server_log'); - } - - @trigger_error('Using the WebserverBundle is deprecated since 4.3, the new symfony local server has more feature, you should use it instead.'); - } - - private function getPublicDirectory(ContainerBuilder $container) - { - $kernelProjectDir = $container->getParameter('kernel.project_dir'); - $publicDir = 'public'; - $composerFilePath = $kernelProjectDir.'/composer.json'; - - if (!file_exists($composerFilePath)) { - return $kernelProjectDir.'/'.$publicDir; - } - - $composerConfig = json_decode(file_get_contents($composerFilePath), true); - - if (isset($composerConfig['extra']['public-dir'])) { - $publicDir = $composerConfig['extra']['public-dir']; - } - - return $kernelProjectDir.'/'.$publicDir; - } - - private function getPidFileDirectory(ContainerBuilder $container): string - { - $kernelCacheDir = $container->getParameter('kernel.cache_dir'); - $environment = $container->getParameter('kernel.environment'); - - if (basename($kernelCacheDir) !== $environment) { - return $container->getParameter('kernel.project_dir'); - } - - return \dirname($container->getParameter('kernel.cache_dir')); - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/LICENSE b/src/Symfony/Bundle/WebServerBundle/LICENSE deleted file mode 100644 index a677f43763..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2019 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Symfony/Bundle/WebServerBundle/README.md b/src/Symfony/Bundle/WebServerBundle/README.md deleted file mode 100644 index 09e514dcb8..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/README.md +++ /dev/null @@ -1,15 +0,0 @@ -WebServerBundle -=============== - -WebServerBundle provides commands for running applications using the PHP -built-in web server. It simplifies your local development setup because you -don't have to configure a proper web server such as Apache or Nginx to run your -application. - -Resources ---------- - - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml b/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml deleted file mode 100644 index bb76b22098..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - %kernel.project_dir%/public - %kernel.environment% - %kernel.project_dir%/var/cache - - - - - %kernel.project_dir%/public - %kernel.environment% - %kernel.project_dir%/var/cache - - - - - %kernel.project_dir%/var/cache - - - - - %kernel.project_dir%/var/cache - - - - - - - - diff --git a/src/Symfony/Bundle/WebServerBundle/Resources/router.php b/src/Symfony/Bundle/WebServerBundle/Resources/router.php deleted file mode 100644 index 30d6b258a2..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Resources/router.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* - * This file implements rewrite rules for PHP built-in web server. - * - * See: http://www.php.net/manual/en/features.commandline.webserver.php - * - * If you have custom directory layout, then you have to write your own router - * and pass it as a value to 'router' option of server:run command. - * - * @author Michał Pipa - * @author Albert Jessurum - */ - -// Workaround https://bugs.php.net/64566 -if (ini_get('auto_prepend_file') && !in_array(realpath(ini_get('auto_prepend_file')), get_included_files(), true)) { - require ini_get('auto_prepend_file'); -} - -if (is_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) { - return false; -} - -$script = isset($_ENV['APP_FRONT_CONTROLLER']) ? $_ENV['APP_FRONT_CONTROLLER'] : 'index.php'; - -$_SERVER = array_merge($_SERVER, $_ENV); -$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$script; - -// Since we are rewriting to app_dev.php, adjust SCRIPT_NAME and PHP_SELF accordingly -$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR.$script; -$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR.$script; - -require $script; - -error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4); diff --git a/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/WebServerExtensionTest.php b/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/WebServerExtensionTest.php deleted file mode 100644 index 42eb6ade9b..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/WebServerExtensionTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; -use Symfony\Bundle\WebServerBundle\DependencyInjection\WebServerExtension; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -class WebServerExtensionTest extends TestCase -{ - /** - * @group legacy - */ - public function testLoad() - { - $container = new ContainerBuilder(); - $container->setParameter('kernel.project_dir', __DIR__); - $container->setParameter('kernel.cache_dir', __DIR__.'/var/cache/test'); - $container->setParameter('kernel.environment', 'test'); - (new WebServerExtension())->load([], $container); - - $this->assertSame( - __DIR__.'/test', - $container->getDefinition('web_server.command.server_run')->getArgument(0) - ); - $this->assertSame( - __DIR__.'/test', - $container->getDefinition('web_server.command.server_start')->getArgument(0) - ); - - $this->assertSame( - __DIR__.'/var/cache', - $container->getDefinition('web_server.command.server_run')->getArgument(2) - ); - $this->assertSame( - __DIR__.'/var/cache', - $container->getDefinition('web_server.command.server_start')->getArgument(2) - ); - $this->assertSame( - __DIR__.'/var/cache', - $container->getDefinition('web_server.command.server_stop')->getArgument(0) - ); - $this->assertSame( - __DIR__.'/var/cache', - $container->getDefinition('web_server.command.server_status')->getArgument(0) - ); - - $this->assertTrue($container->hasDefinition('web_server.command.server_run')); - $this->assertTrue($container->hasDefinition('web_server.command.server_start')); - $this->assertTrue($container->hasDefinition('web_server.command.server_stop')); - $this->assertTrue($container->hasDefinition('web_server.command.server_status')); - $this->assertSame(class_exists(ConsoleFormatter::class), $container->hasDefinition('web_server.command.server_log')); - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/composer.json b/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/composer.json deleted file mode 100644 index a4652ebdf8..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/composer.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "test-composer.json", - "extra": { - "public-dir": "test" - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/WebServer.php b/src/Symfony/Bundle/WebServerBundle/WebServer.php deleted file mode 100644 index 978c5bb17a..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/WebServer.php +++ /dev/null @@ -1,180 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle; - -use Symfony\Component\Process\Exception\RuntimeException; -use Symfony\Component\Process\PhpExecutableFinder; -use Symfony\Component\Process\Process; - -/** - * Manages a local HTTP web server. - * - * @author Fabien Potencier - * - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class WebServer -{ - const STARTED = 0; - const STOPPED = 1; - - private $pidFileDirectory; - - public function __construct(string $pidFileDirectory = null) - { - $this->pidFileDirectory = $pidFileDirectory; - } - - public function run(WebServerConfig $config, $disableOutput = true, callable $callback = null) - { - if ($this->isRunning()) { - throw new \RuntimeException(sprintf('A process is already listening on http://%s.', $config->getAddress())); - } - - $process = $this->createServerProcess($config); - if ($disableOutput) { - $process->disableOutput(); - $callback = null; - } else { - try { - $process->setTty(true); - $callback = null; - } catch (RuntimeException $e) { - } - } - - $process->run($callback); - - if (!$process->isSuccessful()) { - $error = 'Server terminated unexpectedly.'; - if ($process->isOutputDisabled()) { - $error .= ' Run the command again with -v option for more details.'; - } - - throw new \RuntimeException($error); - } - } - - public function start(WebServerConfig $config, $pidFile = null) - { - $pidFile = $pidFile ?: $this->getDefaultPidFile(); - if ($this->isRunning($pidFile)) { - throw new \RuntimeException(sprintf('A process is already listening on http://%s.', $config->getAddress())); - } - - $pid = pcntl_fork(); - - if ($pid < 0) { - throw new \RuntimeException('Unable to start the server process.'); - } - - if ($pid > 0) { - return self::STARTED; - } - - if (posix_setsid() < 0) { - throw new \RuntimeException('Unable to set the child process as session leader.'); - } - - $process = $this->createServerProcess($config); - $process->disableOutput(); - $process->start(); - - if (!$process->isRunning()) { - throw new \RuntimeException('Unable to start the server process.'); - } - - file_put_contents($pidFile, $config->getAddress()); - - // stop the web server when the lock file is removed - while ($process->isRunning()) { - if (!file_exists($pidFile)) { - $process->stop(); - } - - sleep(1); - } - - return self::STOPPED; - } - - public function stop($pidFile = null) - { - $pidFile = $pidFile ?: $this->getDefaultPidFile(); - if (!file_exists($pidFile)) { - throw new \RuntimeException('No web server is listening.'); - } - - unlink($pidFile); - } - - public function getAddress($pidFile = null) - { - $pidFile = $pidFile ?: $this->getDefaultPidFile(); - if (!file_exists($pidFile)) { - return false; - } - - return file_get_contents($pidFile); - } - - public function isRunning($pidFile = null) - { - $pidFile = $pidFile ?: $this->getDefaultPidFile(); - if (!file_exists($pidFile)) { - return false; - } - - $address = file_get_contents($pidFile); - $pos = strrpos($address, ':'); - $hostname = substr($address, 0, $pos); - $port = substr($address, $pos + 1); - if (false !== $fp = @fsockopen($hostname, $port, $errno, $errstr, 1)) { - fclose($fp); - - return true; - } - - unlink($pidFile); - - return false; - } - - /** - * @return Process The process - */ - private function createServerProcess(WebServerConfig $config) - { - $finder = new PhpExecutableFinder(); - if (false === $binary = $finder->find(false)) { - throw new \RuntimeException('Unable to find the PHP binary.'); - } - - $xdebugArgs = ini_get('xdebug.profiler_enable_trigger') ? ['-dxdebug.profiler_enable_trigger=1'] : []; - - $process = new Process(array_merge([$binary], $finder->findArguments(), $xdebugArgs, ['-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter()])); - $process->setWorkingDirectory($config->getDocumentRoot()); - $process->setTimeout(null); - - if (\in_array('APP_ENV', explode(',', getenv('SYMFONY_DOTENV_VARS')))) { - $process->setEnv(['APP_ENV' => false]); - $process->inheritEnvironmentVariables(); - } - - return $process; - } - - private function getDefaultPidFile() - { - return ($this->pidFileDirectory ?? getcwd()).'/.web-server-pid'; - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/WebServerBundle.php b/src/Symfony/Bundle/WebServerBundle/WebServerBundle.php deleted file mode 100644 index 22b541fca3..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/WebServerBundle.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -/** - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class WebServerBundle extends Bundle -{ - public function boot() - { - @trigger_error('Using the WebserverBundle is deprecated since 4.4. The new Symfony local server has more features, you can use it instead.', E_USER_DEPRECATED); - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/WebServerConfig.php b/src/Symfony/Bundle/WebServerBundle/WebServerConfig.php deleted file mode 100644 index e5ae3eed71..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/WebServerConfig.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebServerBundle; - -/** - * @author Fabien Potencier - * - * @deprecated since version 4.4, to be removed in 5.0; the new Symfony local server has more features, you can use it instead. - */ -class WebServerConfig -{ - private $hostname; - private $port; - private $documentRoot; - private $env; - private $router; - - public function __construct(string $documentRoot, string $env, string $address = null, string $router = null) - { - if (!is_dir($documentRoot)) { - throw new \InvalidArgumentException(sprintf('The document root directory "%s" does not exist.', $documentRoot)); - } - - if (null === $file = $this->findFrontController($documentRoot, $env)) { - throw new \InvalidArgumentException(sprintf('Unable to find the front controller under "%s" (none of these files exist: %s).', $documentRoot, implode(', ', $this->getFrontControllerFileNames($env)))); - } - - $_ENV['APP_FRONT_CONTROLLER'] = $file; - - $this->documentRoot = $documentRoot; - $this->env = $env; - - if (null !== $router) { - $absoluteRouterPath = realpath($router); - - if (false === $absoluteRouterPath) { - throw new \InvalidArgumentException(sprintf('Router script "%s" does not exist.', $router)); - } - - $this->router = $absoluteRouterPath; - } else { - $this->router = __DIR__.'/Resources/router.php'; - } - - if (null === $address) { - $this->hostname = '127.0.0.1'; - $this->port = $this->findBestPort(); - } elseif (false !== $pos = strrpos($address, ':')) { - $this->hostname = substr($address, 0, $pos); - if ('*' === $this->hostname) { - $this->hostname = '0.0.0.0'; - } - $this->port = substr($address, $pos + 1); - } elseif (ctype_digit($address)) { - $this->hostname = '127.0.0.1'; - $this->port = $address; - } else { - $this->hostname = $address; - $this->port = $this->findBestPort(); - } - - if (!ctype_digit($this->port)) { - throw new \InvalidArgumentException(sprintf('Port "%s" is not valid.', $this->port)); - } - } - - public function getDocumentRoot() - { - return $this->documentRoot; - } - - public function getEnv() - { - return $this->env; - } - - public function getRouter() - { - return $this->router; - } - - public function getHostname() - { - return $this->hostname; - } - - public function getPort() - { - return $this->port; - } - - public function getAddress() - { - return $this->hostname.':'.$this->port; - } - - /** - * @return string contains resolved hostname if available, empty string otherwise - */ - public function getDisplayAddress() - { - if ('0.0.0.0' !== $this->hostname) { - return ''; - } - - if (false === $localHostname = gethostname()) { - return ''; - } - - return gethostbyname($localHostname).':'.$this->port; - } - - private function findFrontController($documentRoot, $env) - { - $fileNames = $this->getFrontControllerFileNames($env); - - foreach ($fileNames as $fileName) { - if (file_exists($documentRoot.'/'.$fileName)) { - return $fileName; - } - } - } - - private function getFrontControllerFileNames($env) - { - return ['app_'.$env.'.php', 'app.php', 'index_'.$env.'.php', 'index.php']; - } - - private function findBestPort() - { - $port = 8000; - while (false !== $fp = @fsockopen($this->hostname, $port, $errno, $errstr, 1)) { - fclose($fp); - if ($port++ >= 8100) { - throw new \RuntimeException('Unable to find a port available to run the web server.'); - } - } - - return $port; - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/composer.json b/src/Symfony/Bundle/WebServerBundle/composer.json deleted file mode 100644 index d1d9db29c8..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/composer.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "symfony/web-server-bundle", - "type": "symfony-bundle", - "description": "Symfony WebServerBundle", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": "^7.2.9", - "symfony/config": "^4.4|^5.0", - "symfony/console": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/process": "^4.4|^5.0" - }, - "autoload": { - "psr-4": { "Symfony\\Bundle\\WebServerBundle\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "suggest": { - "symfony/monolog-bridge": "For using the log server.", - "symfony/expression-language": "For using the filter option of the log server." - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - } -} diff --git a/src/Symfony/Bundle/WebServerBundle/phpunit.xml.dist b/src/Symfony/Bundle/WebServerBundle/phpunit.xml.dist deleted file mode 100644 index 50586ac78e..0000000000 --- a/src/Symfony/Bundle/WebServerBundle/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index c45754b3ee..ba13d3df58 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -19,8 +19,6 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; * BundleInterface. * * @author Fabien Potencier - * - * @method string getPublicDir() Returns relative path for the public assets directory */ interface BundleInterface extends ContainerAwareInterface { @@ -70,4 +68,9 @@ interface BundleInterface extends ContainerAwareInterface * @return string The Bundle absolute path */ public function getPath(); + + /** + * Returns relative path to the public assets directory. + */ + public function getPublicDir(): string; } diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index 83eb100017..fc4bc0fc9c 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 5.0.0 ----- + * added the `getPublicDir()` method to `BundleInterface`. * removed the first and second constructor argument of `ConfigDataCollector` * removed `ConfigDataCollector::getApplicationName()` * removed `ConfigDataCollector::getApplicationVersion()` diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php index ed8c28fd7c..ce2c099987 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php @@ -15,6 +15,7 @@ use Symfony\Component\Ldap\Exception\ConnectionException; use Symfony\Component\Ldap\LdapInterface; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\LogicException; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\User\UserCheckerInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -87,7 +88,7 @@ class LdapBindAuthenticationProvider extends UserAuthenticationProvider if ('' !== $this->searchDn && '' !== $this->searchPassword) { $this->ldap->bind($this->searchDn, $this->searchPassword); } else { - @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw in Symfony 5.0.', E_USER_DEPRECATED); + throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); } $query = str_replace('{username}', $username, $this->queryString); $result = $this->ldap->query($this->dnString, $query)->execute(); diff --git a/src/Symfony/Component/Stopwatch/Section.php b/src/Symfony/Component/Stopwatch/Section.php index 907e4bad71..02e6ad5916 100644 --- a/src/Symfony/Component/Stopwatch/Section.php +++ b/src/Symfony/Component/Stopwatch/Section.php @@ -62,10 +62,6 @@ class Section */ public function get($id) { - if (null === $id) { - @trigger_error(sprintf('Passing "null" as the first argument of the "%s()" method is deprecated since Symfony 4.4, pass a valid child section identifier instead.', __METHOD__), E_USER_DEPRECATED); - } - foreach ($this->children as $child) { if ($id === $child->getId()) { return $child; diff --git a/src/Symfony/Component/Translation/MessageCatalogue.php b/src/Symfony/Component/Translation/MessageCatalogue.php index a9451901ee..b39f9b7fdf 100644 --- a/src/Symfony/Component/Translation/MessageCatalogue.php +++ b/src/Symfony/Component/Translation/MessageCatalogue.php @@ -30,12 +30,8 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf * @param string $locale The locale * @param array $messages An array of messages classified by domain */ - public function __construct(?string $locale, array $messages = []) + public function __construct(string $locale, array $messages = []) { - if (null === $locale) { - @trigger_error(sprintf('Passing "null" to the first argument of the "%s" method has been deprecated since Symfony 4.4 and will throw an error in 5.0.', __METHOD__), E_USER_DEPRECATED); - } - $this->locale = $locale; $this->messages = $messages; } diff --git a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php index 3113271462..cf0dd1a24c 100644 --- a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php +++ b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php @@ -23,17 +23,6 @@ class MessageCatalogueTest extends TestCase $this->assertEquals('en', $catalogue->getLocale()); } - /** - * @group legacy - * @expectedDeprecation Passing "null" to the first argument of the "Symfony\Component\Translation\MessageCatalogue::__construct" method has been deprecated since Symfony 4.4 and will throw an error in 5.0. - */ - public function testGetNullLocale() - { - $catalogue = new MessageCatalogue(null); - - $this->assertNull($catalogue->getLocale()); - } - public function testGetDomains() { $catalogue = new MessageCatalogue('en', ['domain1' => [], 'domain2' => [], 'domain2+intl-icu' => [], 'domain3+intl-icu' => []]); diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index d7244dbcee..006c8991ac 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -130,10 +130,6 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA $domain = 'messages'; } - if (null === $locale) { - @trigger_error(sprintf('Passing "null" to the third argument of the "%s" method has been deprecated since Symfony 4.4 and will throw an error in 5.0.', __METHOD__), E_USER_DEPRECATED); - } - $this->assertValidLocale($locale); $this->resources[$locale][] = [$format, $resource, $domain];