From: Michael Wallner Date: Wed, 10 Mar 2021 10:22:50 +0000 (+0100) Subject: compatibility with master X-Git-Tag: v2.2.0~9 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=320bae0144fab755d678317f7ec14f9cb3ae1869;p=m6w6%2Fext-pq compatibility with master --- diff --git a/src/php_pq_misc.h b/src/php_pq_misc.h index 07bd596..7ccda3e 100644 --- a/src/php_pq_misc.h +++ b/src/php_pq_misc.h @@ -40,13 +40,6 @@ extern char *php_pq_rtrim(char *e); /* R, W, RW */ extern const char *php_pq_strmode(long mode); -/* compare array index */ -#if PHP_VERSION_ID >= 80000 -extern int php_pq_compare_index(Bucket *lptr, Bucket *rptr); -#else -extern int php_pq_compare_index(const void *lptr, const void *rptr); -#endif - /* free zval ptr values (as hash dtor) */ extern void php_pq_hash_ptr_dtor(zval *p); @@ -63,6 +56,8 @@ extern HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size /* ZE compat */ #if PHP_VERSION_ID >= 80000 +extern int php_pq_compare_index(Bucket *lptr, Bucket *rptr); + # define php_pq_call_method(objval_ptr, method_name, num_args, ...) \ zend_call_method_with_ ## num_args ## _params( \ Z_OBJ_P(objval_ptr), Z_OBJCE_P(objval_ptr), NULL, \ @@ -77,6 +72,11 @@ extern HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size (Z_OBJ_HT_P(objval_ptr)->cast_object && \ SUCCESS == Z_OBJ_HT_P(objval_ptr)->cast_object(Z_OBJ_P(objval_ptr), (retval_ptr), (cast_type))) #else + +extern int php_pq_compare_index(const void *lptr, const void *rptr); + +# define zend_ze_countable spl_ce_Countable + # define php_pq_call_method(objval_ptr, method_name, num_args, ...) \ zend_call_method_with_ ## num_args ## _params( \ (objval_ptr), NULL, NULL, \ diff --git a/src/php_pqres.c b/src/php_pqres.c index 7e51271..be3d039 100644 --- a/src/php_pqres.c +++ b/src/php_pqres.c @@ -1249,9 +1249,9 @@ PHP_MINIT_FUNCTION(pqres) php_pqres_class_entry->create_object = php_pqres_create_object; php_pqres_class_entry->get_iterator = php_pqres_iterator_init; #if PHP_VERSION_ID >= 80000 - zend_class_implements(php_pqres_class_entry, 2, zend_ce_aggregate, spl_ce_Countable); + zend_class_implements(php_pqres_class_entry, 2, zend_ce_aggregate, zend_ce_countable); #else - zend_class_implements(php_pqres_class_entry, 2, zend_ce_traversable, spl_ce_Countable); + zend_class_implements(php_pqres_class_entry, 2, zend_ce_traversable, zend_ce_countable); #endif memcpy(&php_pqres_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/tests/res001.phpt b/tests/res001.phpt index b2a3667..a325247 100644 --- a/tests/res001.phpt +++ b/tests/res001.phpt @@ -19,7 +19,13 @@ class r extends pq\Result { public $dummy = 2; } -var_dump(new pq\Result, get_object_vars(new r)); +var_dump(new pq\Result); + +echo "Test\n"; +$v = get_object_vars(new r); +ksort($v); +var_dump($v); + ?> Done --EXPECTF-- @@ -42,6 +48,27 @@ Warning: pq\Result not initialized in %s on line %d Warning: pq\Result not initialized in %s on line %d Warning: pq\Result not initialized in %s on line %d +object(pq\Result)#%d (9) { + ["status"]=> + NULL + ["statusMessage"]=> + NULL + ["errorMessage"]=> + NULL + ["diag"]=> + NULL + ["numRows"]=> + int(0) + ["numCols"]=> + int(0) + ["affectedRows"]=> + int(0) + ["fetchType"]=> + int(0) + ["autoConvert"]=> + int(65535) +} +Test Warning: pq\Result not initialized in %s on line %d @@ -62,46 +89,26 @@ Warning: pq\Result not initialized in %s on line %d Warning: pq\Result not initialized in %s on line %d Warning: pq\Result not initialized in %s on line %d -object(pq\Result)#%d (9) { - ["status"]=> - NULL - ["statusMessage"]=> - NULL - ["errorMessage"]=> - NULL - ["diag"]=> - NULL - ["numRows"]=> - int(0) - ["numCols"]=> - int(0) +array(10) { ["affectedRows"]=> int(0) - ["fetchType"]=> - int(0) ["autoConvert"]=> int(65535) -} -array(10) { + ["diag"]=> + NULL ["dummy"]=> int(2) - ["status"]=> - NULL - ["statusMessage"]=> - NULL ["errorMessage"]=> NULL - ["diag"]=> - NULL - ["numRows"]=> + ["fetchType"]=> int(0) ["numCols"]=> int(0) - ["affectedRows"]=> - int(0) - ["fetchType"]=> + ["numRows"]=> int(0) - ["autoConvert"]=> - int(65535) + ["status"]=> + NULL + ["statusMessage"]=> + NULL } Done