@@ -1454,14 +1454,9 @@ PHP_METHOD(SoapServer, handle)
1454
1454
service -> soap_headers_ptr = & soap_headers ;
1455
1455
1456
1456
zval * soap_obj = NULL ;
1457
- zend_object * soap_zobj = NULL ;
1458
- zend_class_entry * soap_obj_ce = NULL ;
1459
- HashTable * function_table ;
1457
+ HashTable * function_table = NULL ;
1460
1458
if (service -> type == SOAP_OBJECT ) {
1461
1459
soap_obj = & service -> soap_object ;
1462
- soap_zobj = Z_OBJ_P (soap_obj );
1463
- soap_obj_ce = Z_OBJCE_P (soap_obj );
1464
- function_table = & soap_obj_ce -> function_table ;
1465
1460
} else if (service -> type == SOAP_CLASS ) {
1466
1461
/* If persistent then set soap_obj from the previous created session (if available) */
1467
1462
#ifdef SOAP_HAS_SESSION_SUPPORT
@@ -1519,9 +1514,6 @@ PHP_METHOD(SoapServer, handle)
1519
1514
soap_obj = & tmp_soap ;
1520
1515
}
1521
1516
}
1522
- soap_zobj = Z_OBJ_P (soap_obj );
1523
- soap_obj_ce = Z_OBJCE_P (soap_obj );
1524
- function_table = & soap_obj_ce -> function_table ;
1525
1517
} else {
1526
1518
if (service -> soap_functions .functions_all ) {
1527
1519
function_table = EG (function_table );
@@ -1546,20 +1538,29 @@ PHP_METHOD(SoapServer, handle)
1546
1538
}
1547
1539
}
1548
1540
#endif
1549
- zend_function * header_fn = zend_hash_find_ptr_lc (function_table , Z_STR (h -> function_name ));
1550
- /* If object has a __call() magic method use it */
1551
- if (header_fn == NULL && soap_obj_ce && soap_obj_ce -> __call ) {
1552
- header_fn = zend_get_call_trampoline_func (soap_obj_ce , Z_STR (function_name ), false);
1553
- }
1554
- if (UNEXPECTED (header_fn == NULL )) {
1555
- if (h -> mustUnderstand ) {
1556
- soap_server_fault_en ("MustUnderstand" ,"Header not understood" , NULL , NULL , NULL );
1557
- goto fail ;
1541
+
1542
+ if (soap_obj ) {
1543
+ /* This is because the object might define a __call() magic method */
1544
+ zend_result method_call_result = zend_call_method_if_exists (Z_OBJ_P (soap_obj ), Z_STR (h -> function_name ), & h -> retval , h -> num_params , h -> parameters );
1545
+ if (UNEXPECTED (method_call_result == FAILURE )) {
1546
+ if (h -> mustUnderstand ) {
1547
+ soap_server_fault_en ("MustUnderstand" ,"Header not understood" , NULL , NULL , NULL );
1548
+ goto fail ;
1549
+ }
1550
+ continue ;
1558
1551
}
1559
- continue ;
1552
+ } else {
1553
+ zend_function * header_fn = zend_hash_find_ptr_lc (function_table , Z_STR (h -> function_name ));
1554
+ if (UNEXPECTED (header_fn == NULL )) {
1555
+ if (h -> mustUnderstand ) {
1556
+ soap_server_fault_en ("MustUnderstand" ,"Header not understood" , NULL , NULL , NULL );
1557
+ goto fail ;
1558
+ }
1559
+ continue ;
1560
+ }
1561
+ zend_call_known_function (header_fn , NULL , NULL , & h -> retval , h -> num_params , h -> parameters , NULL );
1560
1562
}
1561
1563
1562
- zend_call_known_function (header_fn , soap_zobj , soap_obj_ce , & h -> retval , h -> num_params , h -> parameters , NULL );
1563
1564
if (Z_TYPE (h -> retval ) == IS_OBJECT &&
1564
1565
instanceof_function (Z_OBJCE (h -> retval ), soap_fault_class_entry )) {
1565
1566
php_output_discard ();
@@ -1575,23 +1576,28 @@ PHP_METHOD(SoapServer, handle)
1575
1576
}
1576
1577
}
1577
1578
1578
- zend_function * fn = zend_hash_find_ptr_lc ( function_table , Z_STR ( function_name ));
1579
- if ( UNEXPECTED ( fn == NULL )) {
1580
- if ( soap_obj_ce && soap_obj_ce -> __call ) {
1581
- fn = zend_get_call_trampoline_func ( soap_obj_ce , Z_STR ( function_name ), false);
1582
- } else {
1583
- if ( soap_obj_ce ) {
1584
- zend_throw_error ( NULL , "Call to undefined method %s::%s()" , ZSTR_VAL ( soap_obj_ce -> name ), Z_STRVAL ( function_name ) );
1585
- } else {
1586
- zend_throw_error ( NULL , "Call to undefined function %s()" , Z_STRVAL ( function_name ) );
1579
+ if ( soap_obj ) {
1580
+ /* This is because the object might define a __call() magic method */
1581
+ zend_result method_call_result = zend_call_method_if_exists ( Z_OBJ_P ( soap_obj ), Z_STR ( function_name ), & retval , num_params , params );
1582
+ if ( UNEXPECTED ( method_call_result == FAILURE )) {
1583
+ zend_throw_error ( NULL , "Call to undefined method %s::%s()" , ZSTR_VAL ( Z_OBJCE_P ( soap_obj ) -> name ), Z_STRVAL ( function_name ));
1584
+ php_output_discard ();
1585
+ _soap_server_exception ( service , function , ZEND_THIS );
1586
+ if ( service -> type == SOAP_CLASS ) {
1587
+ zval_ptr_dtor ( soap_obj );
1587
1588
}
1589
+ goto fail ;
1590
+ }
1591
+ } else {
1592
+ zend_function * fn = zend_hash_find_ptr_lc (function_table , Z_STR (function_name ));
1593
+ if (UNEXPECTED (fn == NULL )) {
1594
+ zend_throw_error (NULL , "Call to undefined function %s()" , Z_STRVAL (function_name ));
1588
1595
php_output_discard ();
1589
1596
_soap_server_exception (service , function , ZEND_THIS );
1590
- if (service -> type == SOAP_CLASS && soap_obj ) {zval_ptr_dtor (soap_obj );}
1591
1597
goto fail ;
1592
1598
}
1599
+ zend_call_known_function (fn , NULL , NULL , & retval , num_params , params , NULL );
1593
1600
}
1594
- zend_call_known_function (fn , soap_zobj , soap_obj_ce , & retval , num_params , params , NULL );
1595
1601
1596
1602
if (service -> type == SOAP_CLASS ) {
1597
1603
if (service -> soap_class .persistence != SOAP_PERSISTENCE_SESSION ) {
0 commit comments