Skip to content

Commit

Permalink
www/pecl-yaf: Fix build with PHP 8.2
Browse files Browse the repository at this point in the history
- Update WWW

Obtained from:	laruence/yaf#579 [1]
  • Loading branch information
sunpoet committed Jun 30, 2023
1 parent 010bb38 commit eed0de2
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
5 changes: 3 additions & 2 deletions www/pecl-yaf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ CATEGORIES= www

MAINTAINER= [email protected]
COMMENT= MVC framework written as a C PHP extension
WWW= https://pecl.php.net/package/yaf
WWW= https://pecl.php.net/package/yaf \
https://github.com/laruence/yaf

LICENSE= PHP301
LICENSE_FILE= ${WRKSRC}/LICENSE
Expand All @@ -13,6 +14,6 @@ LIB_DEPENDS= libpcre.so:devel/pcre

USES= localbase php:pecl

IGNORE_WITH_PHP=82 83
IGNORE_WITH_PHP=83

.include <bsd.port.mk>
64 changes: 64 additions & 0 deletions www/pecl-yaf/files/patch-php82
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Obtained from: https://github.com/laruence/yaf/pull/579

--- requests/yaf_request_simple.c.orig 2022-05-20 02:26:39 UTC
+++ requests/yaf_request_simple.c
@@ -140,6 +140,9 @@ YAF_STARTUP_FUNCTION(request_simple){
zend_class_entry ce;
YAF_INIT_CLASS_ENTRY(ce, "Yaf_Request_Simple", "Yaf\\Request\\Simple", yaf_request_simple_methods);
yaf_request_simple_ce = zend_register_internal_class_ex(&ce, yaf_request_ce);
+#if PHP_VERSION_ID >= 80200
+ yaf_request_simple_ce->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
+#endif

return SUCCESS;
}
--- tests/031.phpt.orig 2022-05-20 02:26:39 UTC
+++ tests/031.phpt
@@ -36,7 +36,7 @@ Array
)
array (
'_default' =>
- Yaf_Route_Map::__set_state(array(
+ %saf_Route_Map::__set_state(array(
'ctl_prefer:protected' => true,
'delimiter:protected' => '##',
)),
--- tests/issue231.phpt.orig 2022-05-20 02:26:40 UTC
+++ tests/issue231.phpt
@@ -34,7 +34,7 @@ Yaf_Request_Http Object
)

)
-Yaf_Request_Http::__set_state(array(
+%saf_Request_Http::__set_state(array(
'method' => 'POST',
'module' => NULL,
'controller' => NULL,
--- views/yaf_view_simple.c.orig 2022-05-20 02:26:39 UTC
+++ views/yaf_view_simple.c
@@ -388,8 +388,10 @@ static int yaf_view_simple_eval(yaf_view_t *view, zend
ZVAL_STR(&phtml, strpprintf(0, "?>%s", ZSTR_VAL(tpl)));
#if PHP_VERSION_ID < 80000
op_array = zend_compile_string(&phtml, eval_desc);
-#else
+#elif PHP_VERSION_ID < 80200
op_array = zend_compile_string(Z_STR(phtml), eval_desc);
+#else
+ op_array = zend_compile_string(Z_STR(phtml), eval_desc, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);
#endif
zval_dtor(&phtml);
efree(eval_desc);
--- yaf_application.c.orig 2022-05-20 02:26:40 UTC
+++ yaf_application.c
@@ -1053,8 +1053,10 @@ YAF_STARTUP_FUNCTION(application) {
yaf_application_ce->ce_flags |= ZEND_ACC_FINAL;
yaf_application_ce->serialize = zend_class_serialize_deny;
yaf_application_ce->unserialize = zend_class_unserialize_deny;
-#else
+#elif PHP_VERSION_ID < 80200
yaf_application_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE;
+#else
+ yaf_application_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE | ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
#endif

memcpy(&yaf_application_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));

0 comments on commit eed0de2

Please sign in to comment.