Ejemplo n.º 1
0
static zval *get_zval_ptr_safe(
	int op_type, const znode_op *node, const zend_execute_data *execute_data
) {
#ifdef ZEND_ENGINE_3
	switch (op_type) {
		case IS_CONST:
			return EX_CONSTANT(*node);
		case IS_CV:
		case IS_TMP_VAR:
		case IS_VAR:
		{
			zval *zv = EX_VAR(node->var);
			ZVAL_DEREF(zv);
			return !Z_ISUNDEF_P(zv) ? zv : NULL;
		}
		default:
			return NULL;
	}
#else
	switch (op_type) {
		case IS_CONST:
			return node->zv;
		case IS_TMP_VAR:
			return &SO_EX_T(node->var).tmp_var;
		case IS_VAR:
			return SO_EX_T(node->var).var.ptr;
		case IS_CV: {
			zval **tmp = SO_EX_CV(node->constant);
			return tmp ? *tmp : NULL;
		}
		default:
			return NULL;
	}
#endif
}
Ejemplo n.º 2
0
static zval *get_zval_safe(int op_type, const znode_op *node, const zend_execute_data *execute_data) {
	switch (op_type) {
		case IS_CONST:
			return node->zv;
		case IS_TMP_VAR:
			return &SO_EX_T(node->var).tmp_var;
		case IS_VAR:
			return SO_EX_T(node->var).var.ptr;
		case IS_CV: {
			zval **tmp = SO_EX_CV(node->constant);
			return tmp ? *tmp : NULL;
		}
		default:
			return NULL;
	}
}