mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
FPM: Emit error for invalid port setting
This commit is contained in:
parent
8620788c2a
commit
2874e5fa05
3
NEWS
3
NEWS
@ -10,6 +10,9 @@ PHP NEWS
|
||||
. Fixed bug GH-7771 (Fix filename/lineno of constant expressions). (ilutov)
|
||||
. Fixed bug GH-7792 (Improve class type in error messages). (ilutov)
|
||||
|
||||
- FPM:
|
||||
. Emit error for invalid port setting. (David Carlier)
|
||||
|
||||
- Intl:
|
||||
. Update all grandfathered language tags with preferred values
|
||||
. Fixed GH-7939 (Cannot unserialize IntlTimeZone objects). (cmb)
|
||||
|
@ -334,7 +334,7 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
|
||||
port_str = dup_address;
|
||||
}
|
||||
|
||||
if (port == 0) {
|
||||
if (port < 1 || port > 65535) {
|
||||
zlog(ZLOG_ERROR, "invalid port value '%s'", port_str);
|
||||
free(dup_address);
|
||||
return -1;
|
||||
|
36
sapi/fpm/tests/log-invalid-port.phpt
Normal file
36
sapi/fpm/tests/log-invalid-port.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
FPM: test invalid port value
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = 127.0.0.1:69002
|
||||
pm = dynamic
|
||||
pm.max_children = 1
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 1
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg);
|
||||
$tester->start();
|
||||
$tester->expectLogError("invalid port value '69002'");
|
||||
$tester->terminate();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
Loading…
Reference in New Issue
Block a user