Skip to content

Commit 0c09993

Browse files
author
Andi Gutmans
committed
- Attempt at fixing the Java extension for ZE2
1 parent 30bad12 commit 0c09993

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

ext/java/java.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static jobject _java_makeObject(pval* arg TSRMLS_DC)
288288
break;
289289

290290
case IS_OBJECT:
291-
zend_hash_index_find(arg->value.obj.properties, 0, (void*)&handle);
291+
zend_hash_index_find(Z_OBJPROP_P(arg), 0, (void*)&handle);
292292
result = zend_list_find((*handle)->value.lval, &type);
293293
break;
294294

@@ -455,7 +455,7 @@ void java_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_refe
455455

456456
jmethodID invoke = (*jenv)->GetMethodID(jenv, JG(reflect_class), "Invoke",
457457
"(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
458-
zend_hash_index_find(object->value.obj.properties, 0, (void**) &handle);
458+
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**) &handle);
459459
obj = zend_list_find((*handle)->value.lval, &type);
460460
method = (*jenv)->NewStringUTF(jenv, function_name->element.value.str.val);
461461
result = (jlong)(long)return_value;
@@ -529,7 +529,7 @@ static pval _java_getset_property
529529
propName = (*jenv)->NewStringUTF(jenv, property->element.value.str.val);
530530

531531
/* get the object */
532-
zend_hash_index_find(property_reference->object->value.obj.properties,
532+
zend_hash_index_find(Z_OBJPROP_P(property_reference->object),
533533
0, (void **) &pobject);
534534
obj = zend_list_find((*pobject)->value.lval, &type);
535535
result = (jlong)(long) &presult;
@@ -691,22 +691,18 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
691691
pval *handle;
692692

693693
if (presult->type != IS_OBJECT) {
694-
presult->type=IS_OBJECT;
695-
presult->value.obj.ce=&java_class_entry;
696-
ALLOC_HASHTABLE(presult->value.obj.properties);
697-
presult->is_ref=1;
694+
object_init_ex(presult, &java_class_entry);
695+
presult->is_ref=1;
698696
presult->refcount=1;
699-
zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
700-
};
697+
}
701698

702699
ALLOC_ZVAL(handle);
703700
handle->type = IS_LONG;
704701
handle->value.lval =
705702
zend_list_insert((*jenv)->NewGlobalRef(jenv, value), le_jobject);
706703
pval_copy_constructor(handle);
707704
INIT_PZVAL(handle);
708-
zend_hash_index_update(presult->value.obj.properties, 0,
709-
&handle, sizeof(pval *), NULL);
705+
zend_hash_index_update(Z_OBJPROP_P(presult), 0, &handle, sizeof(pval *), NULL);
710706
}
711707

712708
JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromArray

ext/rpc/java/java.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static jobject _java_makeObject(pval* arg TSRMLS_DC)
288288
break;
289289

290290
case IS_OBJECT:
291-
zend_hash_index_find(arg->value.obj.properties, 0, (void*)&handle);
291+
zend_hash_index_find(Z_OBJPROP_P(arg), 0, (void*)&handle);
292292
result = zend_list_find((*handle)->value.lval, &type);
293293
break;
294294

@@ -455,7 +455,7 @@ void java_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_refe
455455

456456
jmethodID invoke = (*jenv)->GetMethodID(jenv, JG(reflect_class), "Invoke",
457457
"(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
458-
zend_hash_index_find(object->value.obj.properties, 0, (void**) &handle);
458+
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**) &handle);
459459
obj = zend_list_find((*handle)->value.lval, &type);
460460
method = (*jenv)->NewStringUTF(jenv, function_name->element.value.str.val);
461461
result = (jlong)(long)return_value;
@@ -529,7 +529,7 @@ static pval _java_getset_property
529529
propName = (*jenv)->NewStringUTF(jenv, property->element.value.str.val);
530530

531531
/* get the object */
532-
zend_hash_index_find(property_reference->object->value.obj.properties,
532+
zend_hash_index_find(Z_OBJPROP_P(property_reference->object),
533533
0, (void **) &pobject);
534534
obj = zend_list_find((*pobject)->value.lval, &type);
535535
result = (jlong)(long) &presult;
@@ -691,22 +691,18 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
691691
pval *handle;
692692

693693
if (presult->type != IS_OBJECT) {
694-
presult->type=IS_OBJECT;
695-
presult->value.obj.ce=&java_class_entry;
696-
ALLOC_HASHTABLE(presult->value.obj.properties);
697-
presult->is_ref=1;
694+
object_init_ex(presult, &java_class_entry);
695+
presult->is_ref=1;
698696
presult->refcount=1;
699-
zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
700-
};
697+
}
701698

702699
ALLOC_ZVAL(handle);
703700
handle->type = IS_LONG;
704701
handle->value.lval =
705702
zend_list_insert((*jenv)->NewGlobalRef(jenv, value), le_jobject);
706703
pval_copy_constructor(handle);
707704
INIT_PZVAL(handle);
708-
zend_hash_index_update(presult->value.obj.properties, 0,
709-
&handle, sizeof(pval *), NULL);
705+
zend_hash_index_update(Z_OBJPROP_P(presult), 0, &handle, sizeof(pval *), NULL);
710706
}
711707

712708
JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromArray

0 commit comments

Comments
 (0)