Skip to content

Commit cdb029d

Browse files
committed
ext/soap: throw an Error for undefined functions/methods
1 parent a955ed1 commit cdb029d

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

ext/soap/soap.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ PHP_METHOD(SoapServer, handle)
14851485
}
14861486
#endif
14871487

1488-
/* If new session or something weird happned */
1488+
/* If new session or something weird happened */
14891489
if (soap_obj == NULL) {
14901490
object_init_ex(&tmp_soap, service->soap_class.ce);
14911491

@@ -1581,7 +1581,14 @@ PHP_METHOD(SoapServer, handle)
15811581
if (soap_obj_ce && soap_obj_ce->__call) {
15821582
fn = zend_get_call_trampoline_func(soap_obj_ce, Z_STR(function_name), false);
15831583
} else {
1584-
php_error(E_ERROR, "Function '%s' doesn't exist", Z_STRVAL(function_name));
1584+
if (soap_obj_ce) {
1585+
zend_throw_error(NULL, "Call to undefined method %s::%s()", ZSTR_VAL(soap_obj_ce->name), Z_STRVAL(function_name));
1586+
} else {
1587+
zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL(function_name));
1588+
}
1589+
php_output_discard();
1590+
_soap_server_exception(service, function, ZEND_THIS);
1591+
if (service->type == SOAP_CLASS && soap_obj) {zval_ptr_dtor(soap_obj);}
15851592
goto fail;
15861593
}
15871594
}

ext/soap/tests/bugs/bug73037.phpt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -136,43 +136,42 @@ cleanup:
136136
--EXPECT--
137137
Iteration 0
138138

139-
Function 'CATALOG' doesn't exist
139+
Call to undefined method stdClass::CATALOG()
140140

141-
Function 'CATALOG' doesn't exist
141+
Call to undefined method stdClass::CATALOG()
142142

143143
Iteration 1
144144

145-
Function 'CATALOG' doesn't exist
145+
Call to undefined method stdClass::CATALOG()
146146

147-
Function 'CATALOG' doesn't exist
147+
Call to undefined method stdClass::CATALOG()
148148

149149
Iteration 2
150150

151-
Function 'CATALOG' doesn't exist
151+
Call to undefined method stdClass::CATALOG()
152152

153-
Function 'CATALOG' doesn't exist
153+
Call to undefined method stdClass::CATALOG()
154154

155155
Iteration 3
156156

157-
Function 'CATALOG' doesn't exist
157+
Call to undefined method stdClass::CATALOG()
158158

159-
Function 'CATALOG' doesn't exist
159+
Call to undefined method stdClass::CATALOG()
160160

161161
Iteration 4
162162

163-
Function 'CATALOG' doesn't exist
163+
Call to undefined method stdClass::CATALOG()
164164

165-
Function 'CATALOG' doesn't exist
165+
Call to undefined method stdClass::CATALOG()
166166

167167
Iteration 5
168168

169-
Function 'CATALOG' doesn't exist
169+
Call to undefined method stdClass::CATALOG()
170170

171-
Function 'CATALOG' doesn't exist
171+
Call to undefined method stdClass::CATALOG()
172172

173173
Iteration 6
174174

175-
Function 'CATALOG' doesn't exist
176-
177-
Function 'CATALOG' doesn't exist
175+
Call to undefined method stdClass::CATALOG()
178176

177+
Call to undefined method stdClass::CATALOG()

0 commit comments

Comments
 (0)