convert enchant resources to objects#5528
Conversation
ext/enchant/enchant.stub.php
Outdated
| * @deprecated | ||
| */ | ||
| function enchant_broker_get_dict_path($broker, int $name): string|false {} | ||
| function enchant_broker_get_dict_path(EnchantBroker$broker, int $name): string|false {} |
There was a problem hiding this comment.
nit: missing space (same for the two stubs below)
| function enchant_broker_get_dict_path(EnchantBroker$broker, int $name): string|false {} | |
| function enchant_broker_get_dict_path(EnchantBroker $broker, int $name): string|false {} |
|
I also choose to deprecate |
|
OO API added in latest commit. |
|
Help welcome on the leak reported by travis (cannot reproduce locally) Else, ready for review. |
The zend_objects have to be released in the free_obj handlers: ext/enchant/enchant.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index 795b149b87..9a092573d3 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -170,6 +170,7 @@ static void php_enchant_broker_free(zend_object *object) /* {{{ */
if (broker->pbroker) { /* may have been freed by enchant_broker_free */
enchant_broker_free(broker->pbroker);
}
+ zend_object_std_dtor(object);
}
}
/* }}} */
@@ -189,6 +190,7 @@ static void php_enchant_dict_free(zend_object *object) /* {{{ */
zval_ptr_dtor(&dict->zbroker);
}
}
+ zend_object_std_dtor(object);
}
}
/* }}} */I also think that ext/enchant/enchant.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index 795b149b87..6a490fb833 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -223,8 +223,8 @@ PHP_MINIT_FUNCTION(enchant)
enchant_dict_handlers.free_obj = php_enchant_dict_free;
enchant_dict_handlers.clone_obj = NULL;
- REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED);
+ REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED);
#ifdef HAVE_ENCHANT_GET_VERSION
REGISTER_STRING_CONSTANT("LIBENCHANT_VERSION", enchant_get_version(), CONST_CS | CONST_PERSISTENT);
#endif |
… `null` if no broker is available - raise exception on Invalid object
2990352 to
029964a
Compare
|
@cmb69 thanks again. PR rebased |
|
Replaced by #5533 |
This creates 2 new classes