- Add LICENSE

- Fix build in PHP 5.5 [1]
- Use USES=tar:tgz
- Bump PORTREVISION for package change
- While I'm here, simplify Makefile

Obtained from:	c04ae7e2f5 [1]
PR:		ports/189863
Submitted by:	Gasol Wu <gasol.wu@gmail.com> (maintainer)
This commit is contained in:
Sunpoet Po-Chuan Hsieh 2014-05-24 14:12:03 +00:00
parent 757127c139
commit 0224b9e7cd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=355028
2 changed files with 111 additions and 31 deletions

View file

@ -3,23 +3,23 @@
PORTNAME= test_helpers
PORTVERSION= 1.1.0
PORTREVISION= 1
CATEGORIES= devel pear
MASTER_SITES= http://pear.phpunit.de/get/
PKGNAMEPREFIX= pecl-
EXTRACT_SUFX= .tgz
MAINTAINER= gasol.wu@gmail.com
COMMENT= Extension to ease testing of PHP code
LICENSE= BSD3CLAUSE
CONFIGURE_ARGS= --enable-test-helpers
USE_PHP= yes
USE_PHPEXT= yes
USE_PHPIZE= yes
USES= tar:tgz
SUB_FILES= pkg-message
PKGMESSAGE= ${WRKDIR}/pkg-message
post-install:
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

View file

@ -1,37 +1,100 @@
--- ./test_helpers.c.orig 2010-10-25 15:05:08.000000000 +0800
+++ ./test_helpers.c 2012-10-08 17:41:40.355030000 +0800
@@ -102,14 +102,30 @@
case IS_CONST:
return &(node->u.constant);
case IS_VAR:
+#if ZEND_EXTENSION_API_NO >= 220100525
+ return EX_T(node->u.op.var).var.ptr;
--- ./test_helpers.c.orig 2014-05-16 23:36:31.000000000 +0800
+++ ./test_helpers.c 2014-05-16 23:36:38.000000000 +0800
@@ -92,37 +92,69 @@
#undef EX
#define EX(element) execute_data->element
-#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset))
-static zval *pth_get_zval_ptr(znode *node, zval **freeval, zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
+#if PHP_VERSION_ID >= 50500
+# define EX_T(offset) (*EX_TMP_VAR(execute_data, offset))
+#else
return EX_T(node->u.var).var.ptr;
+# define EX_T(offset) (*(temp_variable *)((char*)execute_data->Ts + offset))
+#endif
case IS_TMP_VAR:
+#if ZEND_EXTENSION_API_NO >= 220100525
+ return (*freeval = &EX_T(node->u.op.var).tmp_var);
+
+#if PHP_VERSION_ID >= 50399
+# define PTH_ZNODE znode_op
+# define PTH_TYPE(t) t##_type
+#else
return (*freeval = &EX_T(node->u.var).tmp_var);
+# define PTH_ZNODE znode
+# define PTH_TYPE(t) t.op_type
+#endif
case IS_CV:
{
+#if ZEND_EXTENSION_API_NO >= 220100525
+ zval ***ret = &execute_data->CVs[node->u.op.var];
+
+zval *pth_get_zval_ptr(int node_type, PTH_ZNODE *node, zval **freeval, zend_execute_data *execute_data TSRMLS_DC)
{
*freeval = NULL;
- switch (node->op_type) {
- case IS_CONST:
- return &(node->u.constant);
- case IS_VAR:
- return EX_T(node->u.var).var.ptr;
- case IS_TMP_VAR:
- return (*freeval = &EX_T(node->u.var).tmp_var);
- case IS_CV:
- {
- zval ***ret = &execute_data->CVs[node->u.var];
- if (!*ret) {
- zend_compiled_variable *cv = &EG(active_op_array)->vars[node->u.var];
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void**)ret)==FAILURE) {
- zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
- return &EG(uninitialized_zval);
- }
- }
- return **ret;
+ switch (node_type) {
+ case IS_CONST:
+#if PHP_VERSION_ID >= 50399
+ return node->zv;
+#else
zval ***ret = &execute_data->CVs[node->u.var];
+ return &node->u.constant;
+#endif
if (!*ret) {
+#if ZEND_EXTENSION_API_NO >= 220100525
+ zend_compiled_variable *cv = &EG(active_op_array)->vars[node->u.op.var];
+ break;
+
+ case IS_VAR:
+#if PHP_VERSION_ID >= 50399
+ if (EX_T(node->var).var.ptr) {
+ return EX_T(node->var).var.ptr;
+#else
zend_compiled_variable *cv = &EG(active_op_array)->vars[node->u.var];
+ if (EX_T(node->u.var).var.ptr) {
+ return EX_T(node->u.var).var.ptr;
+#endif
if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void**)ret)==FAILURE) {
zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
return &EG(uninitialized_zval);
@@ -165,7 +181,11 @@
+ }
+ break;
+
+ case IS_TMP_VAR:
+#if PHP_VERSION_ID >= 50399
+ return (*freeval = &EX_T(node->var).tmp_var);
+#else
+ return (*freeval = &EX_T(node->u.var).tmp_var);
+#endif
+ break;
+
+ case IS_CV: {
+ zval **tmp;
+#if PHP_VERSION_ID >= 50399
+ tmp = zend_get_compiled_variable_value(execute_data, node->constant);
+#else
+ tmp = zend_get_compiled_variable_value(execute_data, node->u.constant.value.lval);
+#endif
+ if (tmp) {
+ return *tmp;
+ }
+ break;
}
- case IS_UNUSED:
- default:
- return NULL;
}
+
+ return NULL;
}
-/* }}} */
static void test_helpers_free_handler(zend_fcall_info *fci) /* {{{ */
{
@@ -165,7 +197,11 @@
}
}
@ -43,7 +106,7 @@
MAKE_STD_ZVAL(arg);
ZVAL_STRINGL(arg, old_ce->name, old_ce->name_length, 1);
@@ -189,7 +209,11 @@
@@ -189,7 +225,11 @@
zval_ptr_dtor(&retval);
@ -55,3 +118,20 @@
if (old_new_handler) {
return old_new_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -202,6 +242,7 @@
static int pth_exit_handler(ZEND_OPCODE_HANDLER_ARGS) /* {{{ */
{
zval *msg, *freeop;
+ zend_op *opline = EX(opline);
zval *retval;
if (THG(exit_fci).function_name == NULL) {
@@ -212,7 +253,7 @@
}
}
- msg = pth_get_zval_ptr(&EX(opline)->op1, &freeop, execute_data TSRMLS_CC);
+ msg = pth_get_zval_ptr(opline->PTH_TYPE(op1), &opline->op1, &freeop, execute_data TSRMLS_CC);
if (msg) {
zend_fcall_info_argn(&THG(exit_fci) TSRMLS_CC, 1, &msg);