Permalink
Browse files

Merged pull request #448

  • Loading branch information...
derickr committed Feb 11, 2019
2 parents 606f0d9 + d96dc3a commit 53d96550448c4d74d8af2f33647819144ed1fc39
Showing with 46 additions and 8 deletions.
  1. +25 −0 tests/bug01629.phpt
  2. +21 −8 xdebug.c
@@ -0,0 +1,25 @@
--TEST--
Test for bug #1629: SOAP Client/Server detection code does not handle inherited classes
--SKIPIF--
<?php
if (!extension_loaded("soap")) { echo "skip SOAP extension required\n"; }
?>
--FILE--
<?php
class SoapAgent extends \SoapClient
{
public function __construct(string $wsdl)
{
try {
parent::__construct($wsdl);
echo 'Success!' . PHP_EOL;
} catch (\Throwable $t) {
echo $t->GetMessage(), "\n";
}
}
}
$client = new SoapAgent('test');
?>
--EXPECT--
SOAP-ERROR: Parsing WSDL: Couldn't load from 'test' : failed to load external entity "test"
@@ -1950,16 +1950,29 @@ void xdebug_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
XG(level)--;
}

static int check_soap_call(function_stack_entry *fse)
static int check_soap_call(function_stack_entry *fse, zend_execute_data *execute_data)
{
if (fse->function.class &&
(
(strstr(fse->function.class, "SoapClient") != NULL) ||
(strstr(fse->function.class, "SoapServer") != NULL)
) &&
if (
fse->function.class &&
Z_OBJ(EX(This)) &&
Z_TYPE(EX(This)) == IS_OBJECT &&
(zend_hash_str_find_ptr(&module_registry, "soap", sizeof("soap") - 1) != NULL)
) {
return 1;
zend_class_entry *soap_server_ce, *soap_client_ce;

soap_server_ce = zend_hash_str_find_ptr(CG(class_table), "soapserver", 10);
soap_client_ce = zend_hash_str_find_ptr(CG(class_table), "soapclient", 10);

if (!soap_server_ce || !soap_client_ce) {
return 0;
}

if (
(instanceof_function(Z_OBJCE(EX(This)), soap_server_ce)) ||
(instanceof_function(Z_OBJCE(EX(This)), soap_client_ce))
) {
return 1;
}
}
return 0;
}
@@ -1996,7 +2009,7 @@ void xdebug_execute_internal(zend_execute_data *current_execute_data, zval *retu
}

/* Check for SOAP */
if (check_soap_call(fse)) {
if (check_soap_call(fse, current_execute_data)) {
restore_error_handler_situation = 1;
tmp_error_cb = zend_error_cb;
zend_error_cb = xdebug_old_error_cb;

0 comments on commit 53d9655

Please sign in to comment.