diff options
-rw-r--r-- | 22.patch | 857 | ||||
-rw-r--r-- | PHPINFO | 6 | ||||
-rw-r--r-- | REFLECTION | 108 | ||||
-rw-r--r-- | php-pecl-parle.spec | 57 |
4 files changed, 951 insertions, 77 deletions
diff --git a/22.patch b/22.patch new file mode 100644 index 0000000..3bb0fa7 --- /dev/null +++ b/22.patch @@ -0,0 +1,857 @@ +From ddb2f1bcb9e3c268a278079b48291d328bac5a9f Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 15 Jan 2021 15:30:10 +0100 +Subject: [PATCH] fix PHP 8 compatibility + +--- + parle.cpp | 278 +++++++++++++++++++++++++++++++++++--- + tests/reflection_002.phpt | 10 +- + 2 files changed, 264 insertions(+), 24 deletions(-) + +diff --git a/parle.cpp b/parle.cpp +index 087de5e..b2b6819 100644 +--- a/parle.cpp ++++ b/parle.cpp +@@ -960,7 +960,7 @@ _parser_validate(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *par_ce, zend_cl + php_parle_rethrow_from_cpp(ParleParserException_ce, e.what(), 0); + } + +- RETURN_FALSE ++ RETURN_FALSE; + }/*}}}*/ + + /* {{{ public boolean Parser::validate(void) */ +@@ -1432,6 +1432,15 @@ ZEND_END_ARG_INFO(); + ZEND_BEGIN_ARG_INFO_EX(arginfo_parle_lexer_build, 0, 0, 0) + ZEND_END_ARG_INFO(); + ++ZEND_BEGIN_ARG_INFO_EX(arginfo_parle_lexer_push, 0, 0, 0) ++ ZEND_ARG_VARIADIC_INFO(0, args) ++ZEND_END_ARG_INFO(); ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_parle_lexer_insertmacro, 0, 0, 2) ++ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ++ ZEND_ARG_TYPE_INFO(0, reg, IS_STRING, 0) ++ZEND_END_ARG_INFO(); ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_parle_lexer_consume, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) + ZEND_END_ARG_INFO(); +@@ -1558,27 +1567,27 @@ const zend_function_entry ParleToken_methods[] = { + }; + + const zend_function_entry ParleLexer_methods[] = { +- PHP_ME(ParleLexer, push, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(ParleLexer, push, arginfo_parle_lexer_push, ZEND_ACC_PUBLIC) + PHP_ME(ParleLexer, getToken, arginfo_parle_lexer_gettoken, ZEND_ACC_PUBLIC) + PHP_ME(ParleLexer, build, arginfo_parle_lexer_build, ZEND_ACC_PUBLIC) + PHP_ME(ParleLexer, consume, arginfo_parle_lexer_consume, ZEND_ACC_PUBLIC) + PHP_ME(ParleLexer, advance, arginfo_parle_lexer_advance, ZEND_ACC_PUBLIC) + PHP_ME(ParleLexer, reset, arginfo_parle_lexer_reset, ZEND_ACC_PUBLIC) +- PHP_ME(ParleLexer, insertMacro, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(ParleLexer, insertMacro, arginfo_parle_lexer_insertmacro, ZEND_ACC_PUBLIC) + PHP_ME(ParleLexer, dump, arginfo_parle_lexer_dump, ZEND_ACC_PUBLIC) + PHP_ME(ParleLexer, callout, arginfo_parle_lexer_callout, ZEND_ACC_PUBLIC) + PHP_FE_END + }; + + const zend_function_entry ParleRLexer_methods[] = { +- PHP_ME(ParleRLexer, push, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(ParleRLexer, push, arginfo_parle_lexer_push, ZEND_ACC_PUBLIC) + PHP_ME(ParleRLexer, getToken, arginfo_parle_lexer_gettoken, ZEND_ACC_PUBLIC) + PHP_ME(ParleRLexer, build, arginfo_parle_lexer_build, ZEND_ACC_PUBLIC) + PHP_ME(ParleRLexer, consume, arginfo_parle_lexer_consume, ZEND_ACC_PUBLIC) + PHP_ME(ParleRLexer, advance, arginfo_parle_lexer_advance, ZEND_ACC_PUBLIC) + PHP_ME(ParleRLexer, reset, arginfo_parle_lexer_reset, ZEND_ACC_PUBLIC) + PHP_ME(ParleRLexer, pushState, arginfo_parle_lexer_pushstate, ZEND_ACC_PUBLIC) +- PHP_ME(ParleRLexer, insertMacro, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(ParleRLexer, insertMacro, arginfo_parle_lexer_insertmacro, ZEND_ACC_PUBLIC) + PHP_ME(ParleRLexer, dump, arginfo_parle_lexer_dump, ZEND_ACC_PUBLIC) + PHP_ME(ParleRLexer, callout, arginfo_parle_lexer_callout, ZEND_ACC_PUBLIC) + PHP_FE_END +@@ -1632,6 +1641,8 @@ const zend_function_entry ParleStack_methods[] = { + /* }}} */ + + /* {{{ Prop handler macros */ ++#if PHP_VERSION_ID < 80000 ++ + #define PARLE_IS_PROP(name) (zend_binary_strcmp(name, sizeof(name) - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) + #define PARLE_CHECK_THROW_RO_PROP_EX(ex_ce, prop, action) \ + if (PARLE_IS_PROP(prop)) { \ +@@ -1641,6 +1652,17 @@ const zend_function_entry ParleStack_methods[] = { + } \ + action; \ + } ++#else ++ ++#define PARLE_IS_PROP(name) (zend_binary_strcmp(name, sizeof(name) - 1, ZSTR_VAL(member), ZSTR_LEN(member)) == 0) ++#define PARLE_CHECK_THROW_RO_PROP_EX(ex_ce, prop, action) \ ++ if (PARLE_IS_PROP(prop)) { \ ++ zend_throw_exception_ex(ex_ce, 0, "Cannot set readonly property $%s of class %s", prop, ZSTR_VAL(object->ce->name)); \ ++ action; \ ++ } ++ ++#endif ++ + #define PARLE_LEX_CHECK_THROW_RET_RO_PROP(prop) PARLE_CHECK_THROW_RO_PROP_EX(ParleLexerException_ce, prop, return &EG(uninitialized_zval)) + #define PARLE_LEX_CHECK_THROW_RO_PROP(prop) PARLE_CHECK_THROW_RO_PROP_EX(ParleLexerException_ce, prop, return) + #define PARLE_PAR_CHECK_THROW_RET_RO_PROP(prop) PARLE_CHECK_THROW_RO_PROP_EX(ParleParserException_ce, prop, return &EG(uninitialized_zval)) +@@ -1709,6 +1731,7 @@ php_parle_lexer_object_init(zend_class_entry *ce) noexcept + }/*}}}*/ + + template <typename lexer_obj_type> zval * ++#if PHP_VERSION_ID < 80000 + php_parle_lex_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) noexcept + {/*{{{*/ + lexer_obj_type *zplo; +@@ -1722,6 +1745,16 @@ php_parle_lex_read_property(zval *object, zval *member, int type, void **cache_s + cache_slot = NULL; + } + ++ zplo = _php_parle_lexer_fetch_zobj<lexer_obj_type>(Z_OBJ_P(object)); ++#else ++php_parle_lex_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) noexcept ++{/*{{{*/ ++ lexer_obj_type *zplo; ++ zval *retval = NULL; ++ ++ zplo = _php_parle_lexer_fetch_zobj<lexer_obj_type>(object); ++#endif ++ + if (type != BP_VAR_R && type != BP_VAR_IS) { + PARLE_LEX_CHECK_THROW_RET_RO_PROP("state") + PARLE_LEX_CHECK_THROW_RET_RO_PROP("marker") +@@ -1730,8 +1763,6 @@ php_parle_lex_read_property(zval *object, zval *member, int type, void **cache_s + PARLE_LEX_CHECK_THROW_RET_RO_PROP("column") + } + +- zplo = _php_parle_lexer_fetch_zobj<lexer_obj_type>(Z_OBJ_P(object)); +- + auto &lex = *zplo->lex; + retval = rv; + if (PARLE_IS_PROP("bol")) { +@@ -1752,21 +1783,31 @@ php_parle_lex_read_property(zval *object, zval *member, int type, void **cache_s + retval = (zend_get_std_object_handlers())->read_property(object, member, type, cache_slot, rv); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + return retval; + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_lexer_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) noexcept ++#else ++php_parle_lexer_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) noexcept ++#endif + {/*{{{*/ + return php_parle_lex_read_property<ze_parle_lexer_obj>(object, member, type, cache_slot, rv); + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_rlexer_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) noexcept ++#else ++php_parle_rlexer_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) noexcept ++#endif + {/*{{{*/ + return php_parle_lex_read_property<ze_parle_rlexer_obj>(object, member, type, cache_slot, rv); + }/*}}}*/ +@@ -1777,6 +1818,7 @@ zval * + #else + void + #endif ++#if PHP_VERSION_ID < 80000 + php_parle_lex_write_property(zval *object, zval *member, zval *value, void **cache_slot) noexcept + {/*{{{*/ + lexer_obj_type *zplo; +@@ -1790,12 +1832,21 @@ php_parle_lex_write_property(zval *object, zval *member, zval *value, void **cac + } + + zplo = _php_parle_lexer_fetch_zobj<lexer_obj_type>(Z_OBJ_P(object)); ++#else ++php_parle_lex_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) noexcept ++{/*{{{*/ ++ lexer_obj_type *zplo = _php_parle_lexer_fetch_zobj<lexer_obj_type>(object); ++#endif + + auto &lex = *zplo->lex; + if (PARLE_IS_PROP("bol")) { + if (lex.par) { + /* Iterator has it const. */ ++#if PHP_VERSION_ID < 80000 + zend_throw_exception_ex(ParleLexerException_ce, 0, "Cannot set readonly property $bol of class %s", ZSTR_VAL(Z_OBJ_P(object)->ce->name)); ++#else ++ zend_throw_exception_ex(ParleLexerException_ce, 0, "Cannot set readonly property $bol of class %s", ZSTR_VAL(object->ce->name)); ++#endif + } else { + lex.iter.set_bol(static_cast<bool>(zval_is_true(value) == 1)); + } +@@ -1819,9 +1870,11 @@ php_parle_lex_write_property(zval *object, zval *member, zval *value, void **cac + (zend_get_std_object_handlers())->write_property(object, member, value, cache_slot); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + #if PHP_VERSION_ID >= 70400 + return value; +@@ -1833,7 +1886,11 @@ static zval * + #else + static void + #endif ++#if PHP_VERSION_ID < 80000 + php_parle_lexer_write_property(zval *object, zval *member, zval *value, void **cache_slot) noexcept ++#else ++php_parle_lexer_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) noexcept ++#endif + {/*{{{*/ + #if PHP_VERSION_ID >= 70400 + return +@@ -1846,7 +1903,11 @@ static zval * + #else + static void + #endif ++#if PHP_VERSION_ID < 80000 + php_parle_rlexer_write_property(zval *object, zval *member, zval *value, void **cache_slot) noexcept ++#else ++php_parle_rlexer_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) noexcept ++#endif + {/*{{{*/ + #if PHP_VERSION_ID >= 70400 + return +@@ -1855,14 +1916,19 @@ php_parle_rlexer_write_property(zval *object, zval *member, zval *value, void ** + }/*}}}*/ + + template <typename lexer_obj_type> HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_lex_get_properties(zval *object) noexcept + {/*{{{*/ +- lexer_obj_type *zplo; ++ lexer_obj_type *zplo = _php_parle_lexer_fetch_zobj<lexer_obj_type>(Z_OBJ_P(object)); ++#else ++php_parle_lex_get_properties(zend_object *object) noexcept ++{/*{{{*/ ++ lexer_obj_type *zplo = _php_parle_lexer_fetch_zobj<lexer_obj_type>(object); ++#endif + HashTable *props; + zval zv; + + props = zend_std_get_properties(object); +- zplo = _php_parle_lexer_fetch_zobj<lexer_obj_type>(Z_OBJ_P(object)); + + auto &lex = *zplo->lex; + ZVAL_LONG(&zv, lex.rules.flags()); +@@ -1884,18 +1950,27 @@ php_parle_lex_get_properties(zval *object) noexcept + }/*}}}*/ + + static HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_lexer_get_properties(zval *object) noexcept ++#else ++php_parle_lexer_get_properties(zend_object *object) noexcept ++#endif + {/*{{{*/ + return php_parle_lex_get_properties<ze_parle_lexer_obj>(object); + }/*}}}*/ + + static HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_rlexer_get_properties(zval *object) noexcept ++#else ++php_parle_rlexer_get_properties(zend_object *object) noexcept ++#endif + {/*{{{*/ + return php_parle_lex_get_properties<ze_parle_rlexer_obj>(object); + }/*}}}*/ + + template <typename lexer_obj_type> static int ++#if PHP_VERSION_ID < 80000 + php_parle_lex_has_property(zval *object, zval *member, int type, void **cache_slot) noexcept + {/*{{{*/ + zval tmp_member, rv, *prop; +@@ -1907,6 +1982,12 @@ php_parle_lex_has_property(zval *object, zval *member, int type, void **cache_sl + member = &tmp_member; + cache_slot = NULL; + } ++#else ++php_parle_lex_has_property(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++{/*{{{*/ ++ zval rv, *prop; ++ int retval = 0; ++#endif + + prop = php_parle_lex_read_property<lexer_obj_type>(object, member, BP_VAR_IS, cache_slot, &rv); + +@@ -1922,27 +2003,41 @@ php_parle_lex_has_property(zval *object, zval *member, int type, void **cache_sl + retval = (zend_get_std_object_handlers())->has_property(object, member, type, cache_slot); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + return retval; + }/*}}}*/ + + static int ++#if PHP_VERSION_ID < 80000 + php_parle_lexer_has_property(zval *object, zval *member, int type, void **cache_slot) noexcept ++#else ++php_parle_lexer_has_property(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++#endif + {/*{{{*/ + return php_parle_lex_has_property<ze_parle_lexer_obj>(object, member, type, cache_slot); + }/*}}}*/ + + static int ++#if PHP_VERSION_ID < 80000 + php_parle_rlexer_has_property(zval *object, zval *member, int type, void **cache_slot) noexcept ++#else ++php_parle_rlexer_has_property(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++#endif + {/*{{{*/ + return php_parle_lex_has_property<ze_parle_rlexer_obj>(object, member, type, cache_slot); + }/*}}}*/ + + static HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_lex_get_gc(zval *object, zval **gc_data, int *gc_data_count) noexcept ++#else ++php_parle_lex_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) noexcept ++#endif + {/*{{{*/ + *gc_data = NULL; + *gc_data_count = 0; +@@ -1950,6 +2045,7 @@ php_parle_lex_get_gc(zval *object, zval **gc_data, int *gc_data_count) noexcept + }/*}}}*/ + + template <typename lexer_obj_type> static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_lex_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) noexcept + {/*{{{*/ + zval tmp_member, *prop; +@@ -1960,6 +2056,11 @@ php_parle_lex_get_property_ptr_ptr(zval *object, zval *member, int type, void ** + member = &tmp_member; + cache_slot = NULL; + } ++#else ++php_parle_lex_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++{/*{{{*/ ++ zval *prop; ++#endif + + if (PARLE_IS_PROP("state") || PARLE_IS_PROP("marker") || PARLE_IS_PROP("cursor") || PARLE_IS_PROP("bol") || PARLE_IS_PROP("flags") || PARLE_IS_PROP("line") || PARLE_IS_PROP("column")) { + /* Fallback to read_property. */ +@@ -1968,21 +2069,30 @@ php_parle_lex_get_property_ptr_ptr(zval *object, zval *member, int type, void ** + + prop = (zend_get_std_object_handlers())->get_property_ptr_ptr(object, member, type, cache_slot); + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } +- ++#endif + return prop; + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_lexer_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) noexcept ++#else ++php_parle_lexer_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++#endif + {/*{{{*/ + return php_parle_lex_get_property_ptr_ptr<ze_parle_lexer_obj>(object, member, type, cache_slot); + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_rlexer_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) noexcept ++#else ++php_parle_rlexer_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++#endif + {/*{{{*/ + return php_parle_lex_get_property_ptr_ptr<ze_parle_rlexer_obj>(object, member, type, cache_slot); + }/*}}}*/ +@@ -2039,6 +2149,7 @@ php_parle_rparser_object_init(zend_class_entry *ce) noexcept + }/*}}}*/ + + template<typename parser_obj_type> static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_par_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) noexcept + {/*{{{*/ + parser_obj_type *zppo; +@@ -2052,13 +2163,21 @@ php_parle_par_read_property(zval *object, zval *member, int type, void **cache_s + cache_slot = NULL; + } + ++ zppo = _php_parle_parser_fetch_zobj<parser_obj_type>(Z_OBJ_P(object)); ++#else ++php_parle_par_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) noexcept ++{/*{{{*/ ++ parser_obj_type *zppo; ++ zval *retval = NULL; ++ ++ zppo = _php_parle_parser_fetch_zobj<parser_obj_type>(object); ++#endif ++ + if (type != BP_VAR_R && type != BP_VAR_IS) { + PARLE_PAR_CHECK_THROW_RET_RO_PROP("action") + PARLE_PAR_CHECK_THROW_RET_RO_PROP("reduceId") + } + +- zppo = _php_parle_parser_fetch_zobj<parser_obj_type>(Z_OBJ_P(object)); +- + auto &par = *zppo->par; + + retval = rv; +@@ -2074,21 +2193,31 @@ php_parle_par_read_property(zval *object, zval *member, int type, void **cache_s + retval = (zend_get_std_object_handlers())->read_property(object, member, type, cache_slot, rv); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + return retval; + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_parser_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) noexcept ++#else ++php_parle_parser_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) noexcept ++#endif + {/*{{{*/ + return php_parle_par_read_property<ze_parle_parser_obj>(object, member, type, cache_slot, rv); + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_rparser_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) noexcept ++#else ++php_parle_rparser_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) noexcept ++#endif + {/*{{{*/ + return php_parle_par_read_property<ze_parle_parser_obj>(object, member, type, cache_slot, rv); + }/*}}}*/ +@@ -2099,6 +2228,7 @@ zval * + #else + void + #endif ++#if PHP_VERSION_ID < 80000 + php_parle_par_write_property(zval *object, zval *member, zval *value, void **cache_slot) noexcept + {/*{{{*/ + zval tmp_member; +@@ -2109,6 +2239,10 @@ php_parle_par_write_property(zval *object, zval *member, zval *value, void **cac + member = &tmp_member; + cache_slot = NULL; + } ++#else ++php_parle_par_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) noexcept ++{/*{{{*/ ++#endif + + #if PHP_VERSION_ID >= 70400 + PARLE_PAR_CHECK_THROW_RET_RO_PROP("action") +@@ -2121,10 +2255,11 @@ php_parle_par_write_property(zval *object, zval *member, zval *value, void **cac + (zend_get_std_object_handlers())->write_property(object, member, value, cache_slot); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } +- ++#endif + #if PHP_VERSION_ID >= 70400 + return value; + #endif +@@ -2135,7 +2270,11 @@ static zval * + #else + static void + #endif ++#if PHP_VERSION_ID < 80000 + php_parle_parser_write_property(zval *object, zval *member, zval *value, void **cache_slot) noexcept ++#else ++php_parle_parser_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) noexcept ++#endif + {/*{{{*/ + #if PHP_VERSION_ID >= 70400 + return +@@ -2148,7 +2287,11 @@ static zval * + #else + static void + #endif ++#if PHP_VERSION_ID < 80000 + php_parle_rparser_write_property(zval *object, zval *member, zval *value, void **cache_slot) noexcept ++#else ++php_parle_rparser_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) noexcept ++#endif + {/*{{{*/ + #if PHP_VERSION_ID >= 70400 + return +@@ -2157,14 +2300,19 @@ php_parle_rparser_write_property(zval *object, zval *member, zval *value, void * + }/*}}}*/ + + template <typename parser_obj_type> HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_par_get_properties(zval *object) noexcept + {/*{{{*/ +- parser_obj_type *zppo; ++ parser_obj_type *zppo = _php_parle_parser_fetch_zobj<parser_obj_type>(Z_OBJ_P(object)); ++#else ++php_parle_par_get_properties(zend_object *object) noexcept ++{/*{{{*/ ++ parser_obj_type *zppo = _php_parle_parser_fetch_zobj<parser_obj_type>(object); ++#endif + HashTable *props; + zval zv; + + props = zend_std_get_properties(object); +- zppo = _php_parle_parser_fetch_zobj<parser_obj_type>(Z_OBJ_P(object)); + + auto &par = *zppo->par; + +@@ -2181,18 +2329,27 @@ php_parle_par_get_properties(zval *object) noexcept + }/*}}}*//*}}}*/ + + static HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_parser_get_properties(zval *object) noexcept ++#else ++php_parle_parser_get_properties(zend_object *object) noexcept ++#endif + {/*{{{*/ + return php_parle_par_get_properties<ze_parle_parser_obj>(object); + }/*}}}*/ + + static HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_rparser_get_properties(zval *object) noexcept ++#else ++php_parle_rparser_get_properties(zend_object *object) noexcept ++#endif + {/*{{{*/ + return php_parle_par_get_properties<ze_parle_rparser_obj>(object); + }/*}}}*/ + + template <typename parser_obj_type> static int ++#if PHP_VERSION_ID < 80000 + php_parle_par_has_property(zval *object, zval *member, int type, void **cache_slot) noexcept + {/*{{{*/ + zval tmp_member, rv, *prop; +@@ -2204,6 +2361,12 @@ php_parle_par_has_property(zval *object, zval *member, int type, void **cache_sl + member = &tmp_member; + cache_slot = NULL; + } ++#else ++php_parle_par_has_property(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++{/*{{{*/ ++ zval rv, *prop; ++ int retval = 0; ++#endif + + prop = php_parle_par_read_property<parser_obj_type>(object, member, BP_VAR_IS, cache_slot, &rv); + +@@ -2219,27 +2382,41 @@ php_parle_par_has_property(zval *object, zval *member, int type, void **cache_sl + retval = (zend_get_std_object_handlers())->has_property(object, member, type, cache_slot); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + return retval; + }/*}}}*/ + + static int ++#if PHP_VERSION_ID < 80000 + php_parle_parser_has_property(zval *object, zval *member, int type, void **cache_slot) noexcept ++#else ++php_parle_parser_has_property(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++#endif + {/*{{{*/ + return php_parle_par_has_property<ze_parle_parser_obj>(object, member, type, cache_slot); + }/*}}}*/ + + static int ++#if PHP_VERSION_ID < 80000 + php_parle_rparser_has_property(zval *object, zval *member, int type, void **cache_slot) noexcept ++#else ++php_parle_rparser_has_property(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++#endif + {/*{{{*/ + return php_parle_par_has_property<ze_parle_rparser_obj>(object, member, type, cache_slot); + }/*}}}*/ + + static HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_par_get_gc(zval *object, zval **gc_data, int *gc_data_count) noexcept ++#else ++php_parle_par_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) noexcept ++#endif + {/*{{{*/ + *gc_data = NULL; + *gc_data_count = 0; +@@ -2247,6 +2424,7 @@ php_parle_par_get_gc(zval *object, zval **gc_data, int *gc_data_count) noexcept + }/*}}}*/ + + template <typename parser_obj_type> static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_par_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) noexcept + {/*{{{*/ + zval tmp_member, *prop; +@@ -2257,6 +2435,11 @@ php_parle_par_get_property_ptr_ptr(zval *object, zval *member, int type, void ** + member = &tmp_member; + cache_slot = NULL; + } ++#else ++php_parle_par_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++{/*{{{*/ ++ zval *prop; ++#endif + + if (PARLE_IS_PROP("action") || PARLE_IS_PROP("reduceId")) { + /* Fallback to read_property. */ +@@ -2265,21 +2448,31 @@ php_parle_par_get_property_ptr_ptr(zval *object, zval *member, int type, void ** + + prop = (zend_get_std_object_handlers())->get_property_ptr_ptr(object, member, type, cache_slot); + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + return prop; + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_parser_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) noexcept ++#else ++php_parle_parser_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++#endif + {/*{{{*/ + return php_parle_par_get_property_ptr_ptr<ze_parle_parser_obj>(object, member, type, cache_slot); + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_rparser_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) noexcept ++#else ++php_parle_rparser_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++#endif + {/*{{{*/ + return php_parle_par_get_property_ptr_ptr<ze_parle_rparser_obj>(object, member, type, cache_slot); + }/*}}}*/ +@@ -2321,6 +2514,7 @@ php_parle_stack_object_init(zend_class_entry *ce) noexcept + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_stack_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) noexcept + {/*{{{*/ + ze_parle_stack_obj *zpso; +@@ -2334,13 +2528,21 @@ php_parle_stack_read_property(zval *object, zval *member, int type, void **cache + cache_slot = NULL; + } + ++ zpso = php_parle_stack_fetch_obj(Z_OBJ_P(object)); ++#else ++php_parle_stack_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) noexcept ++{/*{{{*/ ++ ze_parle_stack_obj *zpso; ++ zval *retval = NULL; ++ ++ zpso = php_parle_stack_fetch_obj(object); ++#endif ++ + if (type != BP_VAR_R && type != BP_VAR_IS) { + PARLE_STACK_CHECK_THROW_RET_RO_PROP("empty") + PARLE_STACK_CHECK_THROW_RET_RO_PROP("size") + } + +- zpso = php_parle_stack_fetch_obj(Z_OBJ_P(object)); +- + retval = rv; + if (PARLE_IS_PROP("top")) { + if (zpso->stack->empty()) { +@@ -2356,9 +2558,11 @@ php_parle_stack_read_property(zval *object, zval *member, int type, void **cache + retval = (zend_get_std_object_handlers())->read_property(object, member, type, cache_slot, rv); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + return retval; + }/*}}}*/ +@@ -2368,6 +2572,7 @@ static zval * + #else + static void + #endif ++#if PHP_VERSION_ID < 80000 + php_parle_stack_write_property(zval *object, zval *member, zval *value, void **cache_slot) noexcept + {/*{{{*/ + ze_parle_stack_obj *zpso; +@@ -2381,6 +2586,13 @@ php_parle_stack_write_property(zval *object, zval *member, zval *value, void **c + } + + zpso = php_parle_stack_fetch_obj(Z_OBJ_P(object)); ++#else ++php_parle_stack_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) noexcept ++{/*{{{*/ ++ ze_parle_stack_obj *zpso; ++ ++ zpso = php_parle_stack_fetch_obj(object); ++#endif + + if (PARLE_IS_PROP("top")) { + if (zpso->stack->empty()) { +@@ -2412,23 +2624,30 @@ php_parle_stack_write_property(zval *object, zval *member, zval *value, void **c + (zend_get_std_object_handlers())->write_property(object, member, value, cache_slot); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + #if PHP_VERSION_ID >= 70400 + return value; + #endif + }/*}}}*/ + + static HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_stack_get_properties(zval *object) noexcept + {/*{{{*/ +- ze_parle_stack_obj *zpso; ++ ze_parle_stack_obj *zpso = php_parle_stack_fetch_obj(Z_OBJ_P(object)); ++#else ++php_parle_stack_get_properties(zend_object *object) noexcept ++{/*{{{*/ ++ ze_parle_stack_obj *zpso = php_parle_stack_fetch_obj(object); ++#endif + HashTable *props; + zval zv; + + props = zend_std_get_properties(object); +- zpso = php_parle_stack_fetch_obj(Z_OBJ_P(object)); + + ZVAL_BOOL(&zv, zpso->stack->empty()); + zend_hash_str_update(props, "empty", sizeof("empty")-1, &zv); +@@ -2451,6 +2670,7 @@ php_parle_stack_get_properties(zval *object) noexcept + }/*}}}*/ + + static int ++#if PHP_VERSION_ID < 80000 + php_parle_stack_has_property(zval *object, zval *member, int type, void **cache_slot) noexcept + {/*{{{*/ + zval tmp_member, rv, *prop; +@@ -2462,6 +2682,12 @@ php_parle_stack_has_property(zval *object, zval *member, int type, void **cache_ + member = &tmp_member; + cache_slot = NULL; + } ++#else ++php_parle_stack_has_property(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++{/*{{{*/ ++ zval rv, *prop; ++ int retval = 0; ++#endif + + prop = php_parle_stack_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + +@@ -2477,15 +2703,21 @@ php_parle_stack_has_property(zval *object, zval *member, int type, void **cache_ + retval = (zend_get_std_object_handlers())->has_property(object, member, type, cache_slot); + } + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + return retval; + }/*}}}*/ + + static HashTable * ++#if PHP_VERSION_ID < 80000 + php_parle_stack_get_gc(zval *object, zval **gc_data, int *gc_data_count) noexcept ++#else ++php_parle_stack_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) noexcept ++#endif + {/*{{{*/ + *gc_data = NULL; + *gc_data_count = 0; +@@ -2493,6 +2725,7 @@ php_parle_stack_get_gc(zval *object, zval **gc_data, int *gc_data_count) noexcep + }/*}}}*/ + + static zval * ++#if PHP_VERSION_ID < 80000 + php_parle_stack_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) noexcept + {/*{{{*/ + zval tmp_member, *prop; +@@ -2503,6 +2736,11 @@ php_parle_stack_get_property_ptr_ptr(zval *object, zval *member, int type, void + member = &tmp_member; + cache_slot = NULL; + } ++#else ++php_parle_stack_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) noexcept ++{/*{{{*/ ++ zval *prop; ++#endif + + if (PARLE_IS_PROP("top") || PARLE_IS_PROP("empty") || PARLE_IS_PROP("size")) { + /* Fallback to read_property. */ +@@ -2511,9 +2749,11 @@ php_parle_stack_get_property_ptr_ptr(zval *object, zval *member, int type, void + + prop = (zend_get_std_object_handlers())->get_property_ptr_ptr(object, member, type, cache_slot); + ++#if PHP_VERSION_ID < 80000 + if (member == &tmp_member) { + zval_dtor(member); + } ++#endif + + return prop; + }/*}}}*/ +diff --git a/tests/reflection_002.phpt b/tests/reflection_002.phpt +index 432f4f1..1919243 100644 +--- a/tests/reflection_002.phpt ++++ b/tests/reflection_002.phpt +@@ -74,9 +74,9 @@ try { + + ?> + ==DONE== +---EXPECT-- +-Argument 2 passed to Parle\Parser::validate() must be an instance of Parle\Lexer, instance of Parle\RLexer given +-Argument 2 passed to Parle\Parser::consume() must be an instance of Parle\Lexer, instance of Parle\RLexer given +-Argument 2 passed to Parle\RParser::validate() must be an instance of Parle\RLexer, instance of Parle\Lexer given +-Argument 2 passed to Parle\RParser::consume() must be an instance of Parle\RLexer, instance of Parle\Lexer given ++--EXPECTF-- ++%s\Parser::validate()%s Parle\RLexer given ++%s\Parser::consume()%s Parle\RLexer given ++%s\RParser::validate()%s Parle\Lexer given ++%s\RParser::consume()%s Parle\Lexer given + ==DONE== @@ -0,0 +1,6 @@ + +parle + +Lexing and parsing support => enabled +Parle version => 0.8.1 +Parle internal UTF-32 => no @@ -1,7 +1,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { - Constants [1] { - Constant [ boolean Parle\INTERNAL_UTF32 ] { } + Constant [ bool Parle\INTERNAL_UTF32 ] { } } - Classes [10] { @@ -29,9 +29,9 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Class [ <internal:parle> class Parle\Token ] { - Constants [3] { - Constant [ public integer EOI ] { 0 } - Constant [ public integer UNKNOWN ] { 65535 } - Constant [ public integer SKIP ] { 65534 } + Constant [ public int EOI ] { 0 } + Constant [ public int UNKNOWN ] { 65535 } + Constant [ public int SKIP ] { 65534 } } - Static properties [0] { @@ -52,11 +52,11 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Class [ <internal:parle> class Parle\Lexer ] { - Constants [5] { - Constant [ public integer ICASE ] { 1 } - Constant [ public integer DOT_NOT_LF ] { 2 } - Constant [ public integer DOT_NOT_CRLF ] { 4 } - Constant [ public integer SKIP_WS ] { 8 } - Constant [ public integer MATCH_ZERO_LEN ] { 16 } + Constant [ public int ICASE ] { 1 } + Constant [ public int DOT_NOT_LF ] { 2 } + Constant [ public int DOT_NOT_CRLF ] { 4 } + Constant [ public int SKIP_WS ] { 8 } + Constant [ public int MATCH_ZERO_LEN ] { 16 } } - Static properties [0] { @@ -75,6 +75,10 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { - Methods [9] { Method [ <internal:parle> public method push ] { + + - Parameters [1] { + Parameter #0 [ <optional> ...$args ] + } } Method [ <internal:parle> public method getToken ] { @@ -106,11 +110,16 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Method [ <internal:parle> public method reset ] { - Parameters [1] { - Parameter #0 [ <required> integer $pos ] + Parameter #0 [ <required> int $pos ] } } Method [ <internal:parle> public method insertMacro ] { + + - Parameters [2] { + Parameter #0 [ <required> string $name ] + Parameter #1 [ <required> string $reg ] + } } Method [ <internal:parle> public method dump ] { @@ -122,7 +131,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Method [ <internal:parle> public method callout ] { - Parameters [2] { - Parameter #0 [ <required> integer $id ] + Parameter #0 [ <required> int $id ] Parameter #1 [ <required> $callback ] } } @@ -132,11 +141,11 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Class [ <internal:parle> class Parle\RLexer ] { - Constants [5] { - Constant [ public integer ICASE ] { 1 } - Constant [ public integer DOT_NOT_LF ] { 2 } - Constant [ public integer DOT_NOT_CRLF ] { 4 } - Constant [ public integer SKIP_WS ] { 8 } - Constant [ public integer MATCH_ZERO_LEN ] { 16 } + Constant [ public int ICASE ] { 1 } + Constant [ public int DOT_NOT_LF ] { 2 } + Constant [ public int DOT_NOT_CRLF ] { 4 } + Constant [ public int SKIP_WS ] { 8 } + Constant [ public int MATCH_ZERO_LEN ] { 16 } } - Static properties [0] { @@ -155,6 +164,10 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { - Methods [10] { Method [ <internal:parle> public method push ] { + + - Parameters [1] { + Parameter #0 [ <optional> ...$args ] + } } Method [ <internal:parle> public method getToken ] { @@ -186,7 +199,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Method [ <internal:parle> public method reset ] { - Parameters [1] { - Parameter #0 [ <required> integer $pos ] + Parameter #0 [ <required> int $pos ] } } @@ -195,10 +208,15 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { - Parameters [1] { Parameter #0 [ <required> string $state ] } - - Return [ integer ] + - Return [ int ] } Method [ <internal:parle> public method insertMacro ] { + + - Parameters [2] { + Parameter #0 [ <required> string $name ] + Parameter #1 [ <required> string $reg ] + } } Method [ <internal:parle> public method dump ] { @@ -210,7 +228,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Method [ <internal:parle> public method callout ] { - Parameters [2] { - Parameter #0 [ <required> integer $id ] + Parameter #0 [ <required> int $id ] Parameter #1 [ <required> $callback ] } } @@ -220,14 +238,14 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Class [ <internal:parle> class Parle\Parser ] { - Constants [8] { - Constant [ public integer ACTION_ERROR ] { 0 } - Constant [ public integer ACTION_SHIFT ] { 1 } - Constant [ public integer ACTION_REDUCE ] { 2 } - Constant [ public integer ACTION_GOTO ] { 3 } - Constant [ public integer ACTION_ACCEPT ] { 4 } - Constant [ public integer ERROR_SYNTAX ] { 0 } - Constant [ public integer ERROR_NON_ASSOCIATIVE ] { 1 } - Constant [ public integer ERROR_UNKNOWN_TOKEN ] { 2 } + Constant [ public int ACTION_ERROR ] { 0 } + Constant [ public int ACTION_SHIFT ] { 1 } + Constant [ public int ACTION_REDUCE ] { 2 } + Constant [ public int ACTION_GOTO ] { 3 } + Constant [ public int ACTION_ACCEPT ] { 4 } + Constant [ public int ERROR_SYNTAX ] { 0 } + Constant [ public int ERROR_NON_ASSOCIATIVE ] { 1 } + Constant [ public int ERROR_UNKNOWN_TOKEN ] { 2 } } - Static properties [0] { @@ -289,7 +307,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Parameter #0 [ <required> string $name ] Parameter #1 [ <required> string $rule ] } - - Return [ integer ] + - Return [ int ] } Method [ <internal:parle> public method validate ] { @@ -298,7 +316,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Parameter #0 [ <optional> string $data ] Parameter #1 [ <optional> Parle\Lexer $lexer ] } - - Return [ boolean ] + - Return [ bool ] } Method [ <internal:parle> public method tokenId ] { @@ -306,13 +324,13 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { - Parameters [1] { Parameter #0 [ <required> string $tok ] } - - Return [ integer ] + - Return [ int ] } Method [ <internal:parle> public method sigil ] { - Parameters [1] { - Parameter #0 [ <optional> integer $idx ] + Parameter #0 [ <optional> int $idx ] } - Return [ string ] } @@ -354,7 +372,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Method [ <internal:parle> public method reset ] { - Parameters [1] { - Parameter #0 [ <required> integer $tok ] + Parameter #0 [ <required> int $tok ] } } } @@ -363,14 +381,14 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Class [ <internal:parle> class Parle\RParser ] { - Constants [8] { - Constant [ public integer ACTION_ERROR ] { 0 } - Constant [ public integer ACTION_SHIFT ] { 1 } - Constant [ public integer ACTION_REDUCE ] { 2 } - Constant [ public integer ACTION_GOTO ] { 3 } - Constant [ public integer ACTION_ACCEPT ] { 4 } - Constant [ public integer ERROR_SYNTAX ] { 0 } - Constant [ public integer ERROR_NON_ASSOCIATIVE ] { 1 } - Constant [ public integer ERROR_UNKNOWN_TOKEN ] { 2 } + Constant [ public int ACTION_ERROR ] { 0 } + Constant [ public int ACTION_SHIFT ] { 1 } + Constant [ public int ACTION_REDUCE ] { 2 } + Constant [ public int ACTION_GOTO ] { 3 } + Constant [ public int ACTION_ACCEPT ] { 4 } + Constant [ public int ERROR_SYNTAX ] { 0 } + Constant [ public int ERROR_NON_ASSOCIATIVE ] { 1 } + Constant [ public int ERROR_UNKNOWN_TOKEN ] { 2 } } - Static properties [0] { @@ -432,7 +450,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Parameter #0 [ <required> string $name ] Parameter #1 [ <required> string $rule ] } - - Return [ integer ] + - Return [ int ] } Method [ <internal:parle> public method validate ] { @@ -441,7 +459,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Parameter #0 [ <optional> string $data ] Parameter #1 [ <optional> Parle\RLexer $lexer ] } - - Return [ boolean ] + - Return [ bool ] } Method [ <internal:parle> public method tokenId ] { @@ -449,13 +467,13 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { - Parameters [1] { Parameter #0 [ <required> string $tok ] } - - Return [ integer ] + - Return [ int ] } Method [ <internal:parle> public method sigil ] { - Parameters [1] { - Parameter #0 [ <optional> integer $idx ] + Parameter #0 [ <optional> int $idx ] } - Return [ string ] } @@ -497,7 +515,7 @@ Extension [ <persistent> extension #119 parle version 0.8.1 ] { Method [ <internal:parle> public method reset ] { - Parameters [1] { - Parameter #0 [ <required> integer $tok ] + Parameter #0 [ <required> int $tok ] } } } diff --git a/php-pecl-parle.spec b/php-pecl-parle.spec index ae9a573..4ee63da 100644 --- a/php-pecl-parle.spec +++ b/php-pecl-parle.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-parle # -# Copyright (c) 2017-2019 Remi Collet +# Copyright (c) 2017-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -21,30 +21,32 @@ # After json %global ini_name 40-%{pecl_name}.ini -%if 0%{?rhel} == 6 || 0%{?rhel} == 7 -# Always use DTS as c++14 is required -BuildRequires: devtoolset-6-toolchain -%global dtsenable source /opt/rh/devtoolset-6/enable -%global dtsprefix devtoolset-6- -%endif - Summary: Parsing and lexing Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 0.8.1 -Release: 8%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 9%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} # Extension is BSD, libraries are Boost License: BSD and Boost -URL: http://pecl.php.net/package/%{pecl_name} -Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +URL: https://pecl.php.net/package/%{pecl_name} +Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz Patch0: https://github.com/weltling/parle/commit/7c692b9880aa6a501b6627d923bbc8ed1da1465f.patch Patch1: https://patch-diff.githubusercontent.com/raw/weltling/parle/pull/17.patch +Patch2: https://patch-diff.githubusercontent.com/raw/weltling/parle/pull/22.patch -BuildRequires: %{?scl_prefix}php-devel >= 7 -BuildRequires: %{?scl_prefix}php-pear -BuildRequires: %{?scl_prefix}php-json +BuildRequires: make +%if 0%{?rhel} == 7 && 0%{?dtsversion} == 0 +# Always use DTS as c++14 is required +BuildRequires: devtoolset-8-toolchain +%global dtsenable source /opt/rh/devtoolset-8/enable +%global dtsprefix devtoolset-8- +%endif +BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?dtsprefix}gcc-c++ BuildRequires: %{?dtsprefix}libstdc++-devel +BuildRequires: %{?scl_prefix}php-devel >= 7.0 +BuildRequires: %{?scl_prefix}php-pear +BuildRequires: %{?scl_prefix}php-json # bundled libraries Provides: bundled(parsertl) @@ -66,31 +68,16 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele Obsoletes: %{name}-devel < %{version} -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -Obsoletes: php70u-pecl-%{pecl_name} <= %{version} -Obsoletes: php70w-pecl-%{pecl_name} <= %{version} -%if "%{php_version}" > "7.1" -Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.2" -Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} -%endif +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif - -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter shared private -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} %endif @@ -122,6 +109,7 @@ mv NTS/lib/parsertl14/parsertl/licence_1_0.txt NTS/LICENSE.parsertl14 cd NTS %patch0 -p1 -b .up %patch1 -p1 -b .pr17 +%patch2 -p1 -b .pr22 # Sanity check, really often broken extver=$(sed -n '/#define PHP_PARLE_VERSION/{s/.* "//;s/".*$//;p}' php_parle.h) @@ -250,8 +238,13 @@ fi %{php_ztsextdir}/%{pecl_name}.so %endif +######### TODO : use --enable-parle-utf32 ? %changelog +* Fri Jan 15 2021 Remi Collet <remi@remirepo.net> - 0.8.1-9 +- add patch for 8.0 from + https://github.com/weltling/parle/pull/22 + * Tue Sep 03 2019 Remi Collet <remi@remirepo.net> - 0.8.1-8 - rebuild for 7.4.0RC1 |