mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix GH-11997: ctype_alnum 5 times slower in PHP 8.1 or greater Fix GH-12297: PHP Startup: Invalid library (maybe not a PHP library) 'mysqlnd.so' in Unknown on line
This commit is contained in:
commit
741dc80d0b
3 changed files with 50 additions and 32 deletions
8
NEWS
8
NEWS
|
@ -9,6 +9,10 @@ PHP NEWS
|
||||||
ext/dom). (nielsdos)
|
ext/dom). (nielsdos)
|
||||||
. Fixed bug GH-12273 (__builtin_cpu_init check). (Freaky)
|
. Fixed bug GH-12273 (__builtin_cpu_init check). (Freaky)
|
||||||
|
|
||||||
|
- CType:
|
||||||
|
. Fixed bug GH-11997 (ctype_alnum 5 times slower in PHP 8.1 or greater).
|
||||||
|
(nielsdos)
|
||||||
|
|
||||||
- Filter:
|
- Filter:
|
||||||
. Fix explicit FILTER_REQUIRE_SCALAR with FILTER_CALLBACK (ilutov)
|
. Fix explicit FILTER_REQUIRE_SCALAR with FILTER_CALLBACK (ilutov)
|
||||||
|
|
||||||
|
@ -22,6 +26,10 @@ PHP NEWS
|
||||||
. Fixed bug GH-12282 (IntlDateFormatter::construct should throw an exception
|
. Fixed bug GH-12282 (IntlDateFormatter::construct should throw an exception
|
||||||
on an invalid locale). (David Carlier)
|
on an invalid locale). (David Carlier)
|
||||||
|
|
||||||
|
- MySQLnd:
|
||||||
|
. Fixed bug GH-12297 (PHP Startup: Invalid library (maybe not a PHP library)
|
||||||
|
'mysqlnd.so' in Unknown on line). (nielsdos)
|
||||||
|
|
||||||
- PCRE:
|
- PCRE:
|
||||||
. Fixed bug GH-11956 (Backport upstream fix, PCRE regular expressions with
|
. Fixed bug GH-11956 (Backport upstream fix, PCRE regular expressions with
|
||||||
JIT enabled gives different result). (nielsdos)
|
JIT enabled gives different result). (nielsdos)
|
||||||
|
|
|
@ -61,27 +61,9 @@ static PHP_MINFO_FUNCTION(ctype)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static void ctype_impl(
|
/* Slow fallback for deprecated cases defined in a no-inline function to not bloat code. */
|
||||||
INTERNAL_FUNCTION_PARAMETERS, int (*iswhat)(int), bool allow_digits, bool allow_minus) {
|
static zend_never_inline void ctype_fallback(zval *c, zval *return_value, int (*iswhat)(int), bool allow_digits, bool allow_minus)
|
||||||
zval *c;
|
{
|
||||||
|
|
||||||
ZEND_PARSE_PARAMETERS_START(1, 1);
|
|
||||||
Z_PARAM_ZVAL(c)
|
|
||||||
ZEND_PARSE_PARAMETERS_END();
|
|
||||||
|
|
||||||
if (Z_TYPE_P(c) == IS_STRING) {
|
|
||||||
char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c);
|
|
||||||
if (e == p) {
|
|
||||||
RETURN_FALSE;
|
|
||||||
}
|
|
||||||
while (p < e) {
|
|
||||||
if (!iswhat((int)*(unsigned char *)(p++))) {
|
|
||||||
RETURN_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RETURN_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
php_error_docref(NULL, E_DEPRECATED,
|
php_error_docref(NULL, E_DEPRECATED,
|
||||||
"Argument of type %s will be interpreted as string in the future", zend_zval_type_name(c));
|
"Argument of type %s will be interpreted as string in the future", zend_zval_type_name(c));
|
||||||
if (Z_TYPE_P(c) == IS_LONG) {
|
if (Z_TYPE_P(c) == IS_LONG) {
|
||||||
|
@ -99,80 +81,105 @@ static void ctype_impl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Define as a macro such that iswhat can use the macro version instead of the function version.
|
||||||
|
* This heavily reduces the overhead. (GH-11997) */
|
||||||
|
#define ctype_impl(iswhat, allow_digits, allow_minus) do { \
|
||||||
|
zval *c; \
|
||||||
|
\
|
||||||
|
ZEND_PARSE_PARAMETERS_START(1, 1); \
|
||||||
|
Z_PARAM_ZVAL(c) \
|
||||||
|
ZEND_PARSE_PARAMETERS_END(); \
|
||||||
|
\
|
||||||
|
if (Z_TYPE_P(c) == IS_STRING) { \
|
||||||
|
char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c); \
|
||||||
|
if (e == p) { \
|
||||||
|
RETURN_FALSE; \
|
||||||
|
} \
|
||||||
|
while (p < e) { \
|
||||||
|
if (!iswhat((int)*(unsigned char *)(p++))) { \
|
||||||
|
RETURN_FALSE; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
RETURN_TRUE; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
ctype_fallback(c, return_value, iswhat, allow_digits, allow_minus); \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
/* {{{ Checks for alphanumeric character(s) */
|
/* {{{ Checks for alphanumeric character(s) */
|
||||||
PHP_FUNCTION(ctype_alnum)
|
PHP_FUNCTION(ctype_alnum)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, isalnum, 1, 0);
|
ctype_impl(isalnum, 1, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for alphabetic character(s) */
|
/* {{{ Checks for alphabetic character(s) */
|
||||||
PHP_FUNCTION(ctype_alpha)
|
PHP_FUNCTION(ctype_alpha)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, isalpha, 0, 0);
|
ctype_impl(isalpha, 0, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for control character(s) */
|
/* {{{ Checks for control character(s) */
|
||||||
PHP_FUNCTION(ctype_cntrl)
|
PHP_FUNCTION(ctype_cntrl)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, iscntrl, 0, 0);
|
ctype_impl(iscntrl, 0, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for numeric character(s) */
|
/* {{{ Checks for numeric character(s) */
|
||||||
PHP_FUNCTION(ctype_digit)
|
PHP_FUNCTION(ctype_digit)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, isdigit, 1, 0);
|
ctype_impl(isdigit, 1, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for lowercase character(s) */
|
/* {{{ Checks for lowercase character(s) */
|
||||||
PHP_FUNCTION(ctype_lower)
|
PHP_FUNCTION(ctype_lower)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, islower, 0, 0);
|
ctype_impl(islower, 0, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for any printable character(s) except space */
|
/* {{{ Checks for any printable character(s) except space */
|
||||||
PHP_FUNCTION(ctype_graph)
|
PHP_FUNCTION(ctype_graph)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, isgraph, 1, 1);
|
ctype_impl(isgraph, 1, 1);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for printable character(s) */
|
/* {{{ Checks for printable character(s) */
|
||||||
PHP_FUNCTION(ctype_print)
|
PHP_FUNCTION(ctype_print)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, isprint, 1, 1);
|
ctype_impl(isprint, 1, 1);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for any printable character which is not whitespace or an alphanumeric character */
|
/* {{{ Checks for any printable character which is not whitespace or an alphanumeric character */
|
||||||
PHP_FUNCTION(ctype_punct)
|
PHP_FUNCTION(ctype_punct)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, ispunct, 0, 0);
|
ctype_impl(ispunct, 0, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for whitespace character(s)*/
|
/* {{{ Checks for whitespace character(s)*/
|
||||||
PHP_FUNCTION(ctype_space)
|
PHP_FUNCTION(ctype_space)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, isspace, 0, 0);
|
ctype_impl(isspace, 0, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for uppercase character(s) */
|
/* {{{ Checks for uppercase character(s) */
|
||||||
PHP_FUNCTION(ctype_upper)
|
PHP_FUNCTION(ctype_upper)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, isupper, 0, 0);
|
ctype_impl(isupper, 0, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Checks for character(s) representing a hexadecimal digit */
|
/* {{{ Checks for character(s) representing a hexadecimal digit */
|
||||||
PHP_FUNCTION(ctype_xdigit)
|
PHP_FUNCTION(ctype_xdigit)
|
||||||
{
|
{
|
||||||
ctype_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, isxdigit, 1, 0);
|
ctype_impl(isxdigit, 1, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
#include "php.h"
|
#include "php.h"
|
||||||
#include "mysqlnd.h"
|
#include "mysqlnd.h"
|
||||||
#include "mysqlnd_priv.h"
|
#include "mysqlnd_priv.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue