aboutsummaryrefslogtreecommitdiffstats
path: root/textproc
diff options
context:
space:
mode:
authorDanilo G. Baio <dbaio@FreeBSD.org>2018-10-14 01:50:36 +0800
committerDanilo G. Baio <dbaio@FreeBSD.org>2018-10-14 01:50:36 +0800
commit1ff6a5f2d4945f0233c1aabd7cfb435324900ddc (patch)
treec312e4c85f60b11a53971025e798f9bcc2c2957b /textproc
parent093fd7ff95e9cfc087d76be004a79040b88850c9 (diff)
downloadfreebsd-ports-gnome-1ff6a5f2d4945f0233c1aabd7cfb435324900ddc.tar.gz
freebsd-ports-gnome-1ff6a5f2d4945f0233c1aabd7cfb435324900ddc.tar.zst
freebsd-ports-gnome-1ff6a5f2d4945f0233c1aabd7cfb435324900ddc.zip
textproc/pecl-yaml: Fix build with PHP 7.3
Obtained from: upstream
Diffstat (limited to 'textproc')
-rw-r--r--textproc/pecl-yaml/Makefile2
-rw-r--r--textproc/pecl-yaml/files/patch-emit.c123
2 files changed, 124 insertions, 1 deletions
diff --git a/textproc/pecl-yaml/Makefile b/textproc/pecl-yaml/Makefile
index 2df896461c49..6754ce80f06d 100644
--- a/textproc/pecl-yaml/Makefile
+++ b/textproc/pecl-yaml/Makefile
@@ -14,6 +14,6 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
LIB_DEPENDS= libyaml.so:textproc/libyaml
USES= php:pecl
-IGNORE_WITH_PHP= 56 73
+IGNORE_WITH_PHP= 56
.include <bsd.port.mk>
diff --git a/textproc/pecl-yaml/files/patch-emit.c b/textproc/pecl-yaml/files/patch-emit.c
new file mode 100644
index 000000000000..b636931b5ca5
--- /dev/null
+++ b/textproc/pecl-yaml/files/patch-emit.c
@@ -0,0 +1,123 @@
+https://github.com/php/pecl-file_formats-yaml/commit/a217a24a674adafd03a03382e0950cbb743ba9a8
+From a217a24a674adafd03a03382e0950cbb743ba9a8 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 4 Jul 2018 12:14:48 +0200
+Subject: [PATCH] Fix for PHP 7.3
+
+--- emit.c.orig 2017-07-29 21:56:18 UTC
++++ emit.c
+@@ -173,7 +173,11 @@ static void y_scan_recursion(const y_emit_state_t *sta
+ return;
+ }
+
++#if PHP_VERSION_ID >= 70300
++ if (!(GC_FLAGS(ht) & GC_IMMUTABLE) && GC_IS_RECURSIVE(ht)) {
++#else
+ if (ZEND_HASH_APPLY_PROTECTION(ht) && ht->u.v.nApplyCount > 0) {
++#endif
+ zval tmp;
+ ZVAL_LONG(&tmp, (zend_ulong) ht);
+
+@@ -182,17 +186,29 @@ static void y_scan_recursion(const y_emit_state_t *sta
+ return;
+ }
+
++#if PHP_VERSION_ID >= 70300
++ if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
++ GC_PROTECT_RECURSION(ht);
++ }
++#else
+ if (ZEND_HASH_APPLY_PROTECTION(ht)) {
+ ht->u.v.nApplyCount++;
+ }
++#endif
+
+ ZEND_HASH_FOREACH_VAL(ht, elm) {
+ y_scan_recursion(state, elm TSRMLS_CC);
+ } ZEND_HASH_FOREACH_END();
+
++#if PHP_VERSION_ID >= 70300
++ if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
++ GC_UNPROTECT_RECURSION(ht);
++ }
++#else
+ if (ZEND_HASH_APPLY_PROTECTION(ht)) {
+ ht->u.v.nApplyCount--;
+ }
++#endif
+
+ return;
+ }
+@@ -462,7 +478,6 @@ static int y_write_array(
+ zval key_zval;
+ zend_ulong kidx;
+ zend_string *kstr;
+- HashTable *tmp_ht;
+ zend_long recursive_idx = -1;
+ char *anchor = { 0 };
+ size_t anchor_size;
+@@ -495,7 +510,11 @@ static int y_write_array(
+ anchor = (char*) emalloc(anchor_size + 1);
+ snprintf(anchor, anchor_size + 1, "refid%ld", recursive_idx + 1);
+
+- if (ZEND_HASH_APPLY_PROTECTION(ht) && ht->u.v.nApplyCount > 1) {
++#if PHP_VERSION_ID >= 70300
++ if (!(GC_FLAGS(ht) & GC_IMMUTABLE) && GC_IS_RECURSIVE(ht)) {
++#else
++ if (ZEND_HASH_APPLY_PROTECTION(ht) && ht->u.v.nApplyCount > 0) {
++#endif
+ /* node has been visited before */
+ status = yaml_alias_event_initialize(
+ &event, (yaml_char_t *) anchor);
+@@ -536,6 +555,18 @@ static int y_write_array(
+ return FAILURE;
+ }
+
++#if PHP_VERSION_ID >= 70300
++ if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
++ /* increment access count for hash */
++ GC_PROTECT_RECURSION(ht);
++ }
++#else
++ if (ZEND_HASH_APPLY_PROTECTION(ht)) {
++ /* increment access count for hash */
++ ht->u.v.nApplyCount++;
++ }
++#endif
++
+ /* emit array elements */
+ ZEND_HASH_FOREACH_KEY_VAL(ht, kidx, kstr, elm) {
+ ZVAL_DEREF(elm);
+@@ -555,23 +586,23 @@ static int y_write_array(
+ }
+ }
+
+- tmp_ht = HASH_OF(elm);
+- if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
+- /* increment access count for hash */
+- tmp_ht->u.v.nApplyCount++;
+- }
+-
+ status = y_write_zval(state, elm, NULL TSRMLS_CC);
+
+- if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
+- tmp_ht->u.v.nApplyCount--;
+- }
+
+ if (SUCCESS != status) {
+ return FAILURE;
+ }
+ } ZEND_HASH_FOREACH_END();
+
++#if PHP_VERSION_ID >= 70300
++ if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
++ GC_UNPROTECT_RECURSION(ht);
++ }
++#else
++ if (ZEND_HASH_APPLY_PROTECTION(ht)) {
++ ht->u.v.nApplyCount--;
++ }
++#endif
+
+ if (Y_ARRAY_SEQUENCE == array_type) {
+ status = yaml_sequence_end_event_initialize(&event);