Skip to content

Commit

Permalink
Fix GH-12628: The gh11374 test fails on Alpinelinux
Browse files Browse the repository at this point in the history
Closes GH-12636.
  • Loading branch information
nielsdos committed Nov 9, 2023
1 parent 10b2b4a commit 78fba9c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS
Expand Up @@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.1.27

- PCRE:
. Fixed bug GH-12628 (The gh11374 test fails on Alpinelinux). (nielsdos)

- Standard:
. Fix memory leak in syslog device handling. (danog)

Expand Down
6 changes: 6 additions & 0 deletions ext/pcre/tests/gh11374.phpt
@@ -1,5 +1,11 @@
--TEST--
GH-11374 (PCRE regular expression without JIT enabled gives different result)
--EXTENSIONS--
zend_test
--SKIPIF--
<?php
if (!zend_test_is_pcre_bundled() && (PCRE_VERSION_MAJOR == 10 && PCRE_VERSION_MINOR <= 42)) die("skip old pcre version");
?>
--FILE--
<?php

Expand Down
10 changes: 10 additions & 0 deletions ext/zend_test/test.c
Expand Up @@ -364,6 +364,16 @@ static ZEND_FUNCTION(zend_test_crash)
php_printf("%s", invalid);
}

static ZEND_FUNCTION(zend_test_is_pcre_bundled)
{
ZEND_PARSE_PARAMETERS_NONE();
#if HAVE_BUNDLED_PCRE
RETURN_TRUE;
#else
RETURN_FALSE;
#endif
}

static zend_object *zend_test_class_new(zend_class_entry *class_type)
{
zend_object *obj = zend_objects_new(class_type);
Expand Down
2 changes: 2 additions & 0 deletions ext/zend_test/test.stub.php
Expand Up @@ -125,6 +125,8 @@ function zend_test_crash(?string $message = null): void {}
#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
function zend_test_override_libxml_global_state(): void {}
#endif

function zend_test_is_pcre_bundled(): bool {}
}

namespace ZendTestNS {
Expand Down
10 changes: 7 additions & 3 deletions ext/zend_test/test_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 7effabe18579113dbfc4c61231d93c8c262d959a */
* Stub hash: ae75eda2b4b40224858d680c3fcf3d7cd2056bb6 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_test_array_return, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -91,9 +91,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_test_override_libxml_global
ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ZendTestNS2_ZendSubNS_namespaced_func, 0, 0, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_test_is_pcre_bundled, 0, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()

#define arginfo_ZendTestNS2_ZendSubNS_namespaced_func arginfo_zend_test_is_pcre_bundled

#define arginfo_class__ZendTestClass_is_object arginfo_zend_get_map_ptr_last

ZEND_BEGIN_ARG_INFO_EX(arginfo_class__ZendTestClass___toString, 0, 0, 0)
Expand All @@ -112,7 +114,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class__ZendTestChildClass_returnsThrowable, 0, 0, Exception, 0)
ZEND_END_ARG_INFO()

#define arginfo_class__ZendTestTrait_testMethod arginfo_ZendTestNS2_ZendSubNS_namespaced_func
#define arginfo_class__ZendTestTrait_testMethod arginfo_zend_test_is_pcre_bundled

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZendTestParameterAttribute___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, parameter, IS_STRING, 0)
Expand Down Expand Up @@ -156,6 +158,7 @@ static ZEND_FUNCTION(zend_test_crash);
#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
static ZEND_FUNCTION(zend_test_override_libxml_global_state);
#endif
static ZEND_FUNCTION(zend_test_is_pcre_bundled);
static ZEND_FUNCTION(namespaced_func);
static ZEND_METHOD(_ZendTestClass, is_object);
static ZEND_METHOD(_ZendTestClass, __toString);
Expand Down Expand Up @@ -199,6 +202,7 @@ static const zend_function_entry ext_functions[] = {
#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
ZEND_FE(zend_test_override_libxml_global_state, arginfo_zend_test_override_libxml_global_state)
#endif
ZEND_FE(zend_test_is_pcre_bundled, arginfo_zend_test_is_pcre_bundled)
ZEND_NS_FE("ZendTestNS2\\ZendSubNS", namespaced_func, arginfo_ZendTestNS2_ZendSubNS_namespaced_func)
ZEND_FE_END
};
Expand Down

0 comments on commit 78fba9c

Please sign in to comment.