mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-22 08:26:38 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4f5aed221 | ||
|
|
45f25e16d2 | ||
|
|
4631611c44 | ||
|
|
0697a64f7e | ||
|
|
d6fcaf5da4 | ||
|
|
685708160e | ||
|
|
4a10037cb4 |
No files matched your search
@@ -1,7 +1,12 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 7.3.26
|
||||
07 Jan 2021, PHP 7.3.26
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
|
||||
(CVE-2020-7071) (cmb)
|
||||
. Fixed bug #80457 (stream_get_contents() fails with maxlength=-1 or default).
|
||||
(bruno dot premont at restena dot lu)
|
||||
|
||||
26 Nov 2020, PHP 7.3.25
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "3.3.26-dev"
|
||||
#define ZEND_VERSION "3.3.26"
|
||||
|
||||
#define ZEND_ENGINE_3
|
||||
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=3
|
||||
PHP_RELEASE_VERSION=26
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
MySQL 5.6 EXPIRE PASSWORD protocol change
|
||||
MySQL 5.6 / MariaDB 10.4.3 EXPIRE PASSWORD protocol change
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
@@ -14,6 +14,18 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
if ($link->server_version < 50610)
|
||||
die(sprintf("SKIP Needs MySQL 5.6.10 or newer, found MySQL %s\n", $link->server_info));
|
||||
|
||||
if ($link->server_version >= 100000) {
|
||||
if ($link->server_version < 100403)
|
||||
die(sprintf("SKIP Needs MariaDB 10.4.3 or newer, found MariaDB %s\n", $link->server_info));
|
||||
$result = $link->query("select @@disconnect_on_expired_password");
|
||||
if (!$result)
|
||||
die("SKIP Failed to query MariaDB @@disconnect_on_expired_password value");
|
||||
$row = mysqli_fetch_row($result);
|
||||
if ($row[0] == 0)
|
||||
die("SKIP Cannot run in MariaDB @@disconnect_on_expired_password=OFF state");
|
||||
|
||||
}
|
||||
|
||||
if (!$IS_MYSQLND && (mysqli_get_client_version() < 50610)) {
|
||||
die(sprintf("SKIP Needs libmysql 5.6.10 or newer, found %s\n", mysqli_get_client_version()));
|
||||
}
|
||||
@@ -21,15 +33,15 @@ if (!$IS_MYSQLND && (mysqli_get_client_version() < 50610)) {
|
||||
mysqli_query($link, 'DROP USER expiretest');
|
||||
mysqli_query($link, 'DROP USER expiretest@localhost');
|
||||
|
||||
if (!mysqli_query($link, 'CREATE USER expiretest@"%"') ||
|
||||
!mysqli_query($link, 'CREATE USER expiretest@"localhost"')) {
|
||||
if (!mysqli_query($link, 'CREATE USER expiretest IDENTIFIED BY \'expiredpassword\'') ||
|
||||
!mysqli_query($link, 'CREATE USER expiretest@localhost IDENTIFIED BY \'expiredpassword\'')) {
|
||||
printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
|
||||
mysqli_close($link);
|
||||
die("skip CREATE USER failed");
|
||||
}
|
||||
|
||||
if (!mysqli_query($link, 'ALTER USER expiretest@"%" PASSWORD EXPIRE') ||
|
||||
!mysqli_query($link, 'ALTER USER expiretest@"localhost" PASSWORD EXPIRE')) {
|
||||
if (!mysqli_query($link, 'ALTER USER expiretest PASSWORD EXPIRE') ||
|
||||
!mysqli_query($link, 'ALTER USER expiretest@localhost PASSWORD EXPIRE')) {
|
||||
printf("skip Cannot modify second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
|
||||
mysqli_close($link);
|
||||
die("skip ALTER USER failed");
|
||||
@@ -54,7 +66,7 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
|
||||
require_once('table.inc');
|
||||
|
||||
/* default */
|
||||
if (!$link = my_mysqli_connect($host, 'expiretest', "", $db, $port, $socket)) {
|
||||
if (!$link = my_mysqli_connect($host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
|
||||
printf("[001] Cannot connect [%d] %s\n",
|
||||
mysqli_connect_errno(), mysqli_connect_error());
|
||||
} else {
|
||||
@@ -65,7 +77,7 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
|
||||
/* explicitly requesting default */
|
||||
$link = mysqli_init();
|
||||
$link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0);
|
||||
if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
|
||||
if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
|
||||
printf("[003] Cannot connect [%d] %s\n",
|
||||
mysqli_connect_errno(), mysqli_connect_error());
|
||||
} else {
|
||||
@@ -76,7 +88,7 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
|
||||
/* allow connect */
|
||||
$link = mysqli_init();
|
||||
$link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
|
||||
if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
|
||||
if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
|
||||
printf("[005] Cannot connect [%d] %s\n",
|
||||
mysqli_connect_errno(), mysqli_connect_error());
|
||||
} else {
|
||||
@@ -88,7 +100,7 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
|
||||
/* allow connect, fix pw */
|
||||
$link = mysqli_init();
|
||||
$link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
|
||||
if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
|
||||
if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
|
||||
printf("[007] Cannot connect [%d] %s\n",
|
||||
mysqli_connect_errno(), mysqli_connect_error());
|
||||
} else {
|
||||
@@ -122,11 +134,11 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
|
||||
mysqli_query($link, 'DROP USER expiretest@localhost');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mysqli%sconnect(): (HY000/1862): %s in %s on line %d
|
||||
[001] Cannot connect [1862] %s
|
||||
Warning: mysqli%sconnect(): (HY000/%d): %s in %s on line %d
|
||||
[001] Cannot connect [%d] %s
|
||||
|
||||
Warning: mysqli%sconnect(): (HY000/1862): %s in %s on line %d
|
||||
[003] Cannot connect [1862] %s
|
||||
Warning: mysqli%sconnect(): (HY000/%d): %s in %s on line %d
|
||||
[003] Cannot connect [%d] %s
|
||||
[006] Connect allowed, query fail, [1820] %s
|
||||
[008] Connect allowed, pw set, [0%A
|
||||
array(1) {
|
||||
|
||||
@@ -666,7 +666,7 @@ mysqli.allow_local_infile=1
|
||||
$info = $new_info;
|
||||
|
||||
|
||||
// CREATE, ALTER, RENAME, DROP DATABASE
|
||||
// CREATE, ALTER, DROP DATABASE
|
||||
if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) {
|
||||
|
||||
if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
|
||||
@@ -685,25 +685,13 @@ mysqli.allow_local_infile=1
|
||||
mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
|
||||
$info = $new_info;
|
||||
|
||||
if (mysqli_get_server_version($link) > 51700) {
|
||||
if (!mysqli_query($link, "RENAME DATABASE mysqli_get_client_stats TO mysqli_get_client_stats_"))
|
||||
printf("[%03d] RENAME DATABASE failed, [%d] %s\n", ++$test_counter,
|
||||
mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
|
||||
printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
|
||||
++$test_counter, gettype($new_info), $new_info);
|
||||
mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
|
||||
$info = $new_info;
|
||||
} else {
|
||||
if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_"))
|
||||
printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter,
|
||||
mysqli_errno($link), mysqli_error($link));
|
||||
if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
|
||||
printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
|
||||
++$test_counter, gettype($new_info), $new_info);
|
||||
$info = $new_info;
|
||||
}
|
||||
if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_"))
|
||||
printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter,
|
||||
mysqli_errno($link), mysqli_error($link));
|
||||
if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
|
||||
printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
|
||||
++$test_counter, gettype($new_info), $new_info);
|
||||
$info = $new_info;
|
||||
|
||||
if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_"))
|
||||
printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter,
|
||||
|
||||
@@ -9,7 +9,8 @@ if (getenv('SKIP_ONLINE_TESTS')) die('skip online test');
|
||||
default_socket_timeout=-1
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump((bool) file_get_contents('https://php.net'));
|
||||
$clientCtx = stream_context_create(['ssl' => ['verify_peer' => false]]);
|
||||
var_dump((bool) file_get_contents('https://www.php.net', false, $clientCtx));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -442,7 +442,7 @@ PHP_FUNCTION(stream_get_contents)
|
||||
Z_PARAM_LONG(desiredpos)
|
||||
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
|
||||
|
||||
if (maxlen < 0 && maxlen != PHP_STREAM_COPY_ALL) {
|
||||
if (maxlen < 0 && maxlen != (ssize_t)PHP_STREAM_COPY_ALL) {
|
||||
php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to zero, or -1");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -575,15 +575,13 @@ $sample_urls = array (
|
||||
string(16) "some_page_ref123"
|
||||
}
|
||||
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["host"]=>
|
||||
string(11) "www.php.net"
|
||||
string(26) "secret@hideout@www.php.net"
|
||||
["port"]=>
|
||||
int(80)
|
||||
["user"]=>
|
||||
string(14) "secret@hideout"
|
||||
["path"]=>
|
||||
string(10) "/index.php"
|
||||
["query"]=>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #77423 (parse_url() will deliver a wrong host to user)
|
||||
--FILE--
|
||||
<?php
|
||||
$urls = array(
|
||||
"http://php.net\@aliyun.com/aaa.do",
|
||||
"https://example.com\uFF03@bing.com",
|
||||
);
|
||||
foreach ($urls as $url) {
|
||||
var_dump(filter_var($url, FILTER_VALIDATE_URL));
|
||||
var_dump(parse_url($url));
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
array(3) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["host"]=>
|
||||
string(19) "php.net\@aliyun.com"
|
||||
["path"]=>
|
||||
string(7) "/aaa.do"
|
||||
}
|
||||
bool(false)
|
||||
array(2) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["host"]=>
|
||||
string(26) "example.com\uFF03@bing.com"
|
||||
}
|
||||
@@ -506,15 +506,13 @@ echo "Done";
|
||||
string(16) "some_page_ref123"
|
||||
}
|
||||
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["host"]=>
|
||||
string(11) "www.php.net"
|
||||
string(26) "secret@hideout@www.php.net"
|
||||
["port"]=>
|
||||
int(80)
|
||||
["user"]=>
|
||||
string(14) "secret@hideout"
|
||||
["path"]=>
|
||||
string(10) "/index.php"
|
||||
["query"]=>
|
||||
|
||||
@@ -68,7 +68,7 @@ echo "Done";
|
||||
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
|
||||
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
|
||||
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(26) "secret@hideout@www.php.net"
|
||||
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
|
||||
--> nntp://news.php.net : string(12) "news.php.net"
|
||||
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(11) "ftp.gnu.org"
|
||||
|
||||
@@ -68,7 +68,7 @@ echo "Done";
|
||||
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
|
||||
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(0) ""
|
||||
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout"
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
|
||||
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
|
||||
--> nntp://news.php.net : NULL
|
||||
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
|
||||
|
||||
@@ -508,15 +508,13 @@ echo "Done";
|
||||
string(16) "some_page_ref123"
|
||||
}
|
||||
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["host"]=>
|
||||
string(11) "www.php.net"
|
||||
string(26) "secret@hideout@www.php.net"
|
||||
["port"]=>
|
||||
int(80)
|
||||
["user"]=>
|
||||
string(14) "secret@hideout"
|
||||
["path"]=>
|
||||
string(10) "/index.php"
|
||||
["query"]=>
|
||||
|
||||
+23
-1
@@ -102,6 +102,24 @@ static const char *binary_strcspn(const char *s, const char *e, const char *char
|
||||
return e;
|
||||
}
|
||||
|
||||
static int is_userinfo_valid(const char *str, size_t len)
|
||||
{
|
||||
char *valid = "-._~!$&'()*+,;=:";
|
||||
char *p = str;
|
||||
while (p - str < len) {
|
||||
if (isalpha(*p) || isdigit(*p) || strchr(valid, *p)) {
|
||||
p++;
|
||||
} else if (*p == '%' && p - str <= len - 3 && isdigit(*(p+1)) && isxdigit(*(p+2))) {
|
||||
p += 3;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* {{{ php_url_parse
|
||||
*/
|
||||
PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
|
||||
{
|
||||
zend_bool has_port;
|
||||
@@ -242,13 +260,17 @@ parse_host:
|
||||
ret->pass = zend_string_init(pp, (p-pp), 0);
|
||||
php_replace_controlchars_ex(ZSTR_VAL(ret->pass), ZSTR_LEN(ret->pass));
|
||||
} else {
|
||||
ret->user = zend_string_init(s, (p-s), 0);
|
||||
if (!is_userinfo_valid(s, p-s)) {
|
||||
goto check_port;
|
||||
}
|
||||
ret->user = zend_string_init(s, (p-s), 0);
|
||||
php_replace_controlchars_ex(ZSTR_VAL(ret->user), ZSTR_LEN(ret->user));
|
||||
}
|
||||
|
||||
s = p + 1;
|
||||
}
|
||||
|
||||
check_port:
|
||||
/* check for port */
|
||||
if (s < ue && *s == '[' && *(e-1) == ']') {
|
||||
/* Short circuit portscan,
|
||||
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
#define PHP_MAJOR_VERSION 7
|
||||
#define PHP_MINOR_VERSION 3
|
||||
#define PHP_RELEASE_VERSION 26
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "7.3.26-dev"
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "7.3.26"
|
||||
#define PHP_VERSION_ID 70326
|
||||
Reference in new issue
Block a user