Bug #77549 [NEW]: SOAP crashes PHP

From: Date: Thu, 31 Jan 2019 11:31:50 +0000
Subject: Bug #77549 [NEW]: SOAP crashes PHP
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219309@lists.php.net to get a copy of this message
From:             doug_luppi at hotmail dot com
Operating system: Windows Server 2012 R2
PHP version:      7.3.1
Package:          SOAP related
Bug Type:         Bug
Bug description:SOAP crashes PHP

Description:
------------
When calling a method by _soapCall, PHP 7.3.1 (XAMPP) crashes without
logging any error, even in the framework (CodeIgniter) or in isolated
script, returning ERR_CONNECTION_RESET error.

PHP log in XAMPP don't have anything too.

It doesn't happen with every wsdl and not with every method.

Doing the same request by SoapUI, everything goes fine.
Doing the same request in PHP 5.6.31 (WAMP), everything goes fine.

OBS: Sorry about all these catches, I was desperate for handling some
error.

Test script:
---------------
<?php
  // sleep(30);

  $objEnvio = array(
    'arg0' => array( 
      'status' => '',
       'canal' => 'TELEFONE',
       'dataCriacaoOrigem' => '2019-01-30',
       'dataRecebimento' => '2019-01-30',
       'dataFarmacovigilancia' => '2019-01-30',
       'tipoRelato' => 'ESNP',
       'sistemaOrigem' => '',
       'codOrigem' => '201900013/201',
       'codPais' => 'BR',
       'descricaoInicial' => 'Atendente SAC: Leonardo Coelho TESTE xD!
',
       'descricao' => '',
       'historiaMedica' => '',
       'autorizaContato' => '',
       'relator' => array(
          'email' => array(
            'email' => 'marcos_correa@hotmail.com',
            'tipo' => 'PROFISSIONAL',
          ),
        'endereco' => array ( 'tipo' => 'COMERCIAL',
'cep' =>
'76280-000', 'logradouro' => 'AV BRASILIA,100', 'numero'
=> '',
'complemento' => '', 'bairro' => 'CENTRO',
'cidade' => 'Britânia',
'estado' => 'GO', ), 'nome' => 'MARCOS CORREA',
'telefone' => array (
'tipo' => 'COMERCIAL', 'ddd' => '', 'numero'
=> '(19) 3863-2632',
'complemento' => '', ), 'instituicao' => array (
'email' => array (
'email' => '', 'tipo' => 'PROFISSIONAL', ),
'endereco' => array ( 'tipo'
=> 'COMERCIAL', 'cep' => '76280-000', 'logradouro'
=> 'AV BRASILIA,100',
'numero' => '', 'complemento' => '',
'bairro' => 'CENTRO', 'cidade' =>
'Britânia', 'estado' => 'GO', ), 'nome' =>
'MUNICIPIO DE BRITANIA',
'telefone' => array ( 'tipo' => 'COMERCIAL', 'ddd'
=> '', 'numero' =>
'0156233831233', 'complemento' => '', ), ), 'profissao'
=> '', 'sexo' =>
'M', ), 'paciente' => array ( 'email' => array (
'email' => '', 'tipo'
=> '', ), 'endereco' => array ( 'tipo' => '',
'cep' => '', 'logradouro'
=> '', 'numero' => '', 'complemento' =>
'', 'bairro' => '', 'cidade' =>
'', 'estado' => '', ), 'nome' => 'TESTE',
'telefone' => array ( 'tipo'
=> '', 'ddd' => '', 'numero' => '',
'complemento' => '', ),
'instituicao' => array ( ), 'profissao' => '', 'sexo'
=> 'M',
'aceitaContato' => '', 'altura' => '179',
'alturaNI' => false,
'contracepcao' => array ( 'intervaloAplicacoes' => '',
'descricaoPausa'
=> '', 'houveEsquecimento' => '', 'usaOutrosMetodos'
=> '',
'descricaoOutrosMetodos' => '', ), 'dataNascimento' =>
'1996-05-11',
'dataNascimentoNI' => false, 'etnia' => '', 'gestacao'
=> array (
'dataProvavelParto' => '', 'ultimaMenstruacao' => '',
), 'gestante' =>
'', 'idade' => 22, 'idadeNI' => false, 'iniciais'
=> 'T.', 'peso' =>
'77', 'pesoNI' => false, ), 'concomitante' => array ( ),
'eventoAdverso'
=> array ( 0 => array ( 'tipoEvento' => 'SUS_INE_TER',
'reacaoAdversa'
=> '', 'tipoReacaoAdversa' => '', 'inicio' =>
'', 'termino' => '',
'inicioStr' => '28/01/2019', 'inicioNI' => false,
'terminoStr' => '',
'terminoNI' => true, 'eventoPermanece' => 'S',
'previsibilidade' => '',
'gravidade' => 'GRAVE', 'intensidade' => '',
'criterioGravidade' =>
array ( ), 'cedeuAposSuspensao' => '', 'reapareceu' =>
'',
'emTratamento' => 'NI', 'descricaoTratamento' => '',
'intervaloAposUso'
=> '', 'causalidadeNaranjo' => '',
'causalidadeInformante' => '',
'medicamentoSuspeito' => array ( 'apresentacao' => array (
'nome' =>
'KOLLAGENASE 0,6U/g Pom Derm. - 1 bis. X 10g + esp.', 'codigo' =>
'46.3396', 'codigoProduto' => '46.3396', 'nomeProduto'
=> 'KOLLAGENASE
S/ CLORANF', 'principioAtivo' => 'COLAGENASE T-248 BIOTECNOLOGIA',
'fabricante' => '', ), 'lote' => '0',
'fabricacao' => '', 'validade' =>
'', 'inicio' => '', 'termino' => '',
'fabricacaoStr' => '',
'validadeStr' => '00/00/0000', 'inicioStr' =>
'28/01/2019', 'inicioNI'
=> false, 'terminoStr' => '00/00/0000', 'terminoNI' => true,
'duracao'
=> '', 'doseDiaria' => '', 'posologia' =>
'', 'posologiaNI' => true,
'indicacao' => '', 'indicacaoNI' => true,
'viaAdministracao' => '',
'viaAdministracaoNI' => true, 'comPrescricao' => 'S',
'prescritorNotificado' => 'NI', 'interrompeuUso' =>
'N', ), 'evolucao'
=> array ( ), 'visita' => array ( ), ), ), 'patologia' => array ( ), ),
);

  $soapClient = new SoapClient('http://zulu:9090/sis/Relato?wsdl',
['trace' => TRUE, 'exceptions' => TRUE]);

  
  try {
    $r = $soapClient->__soapCall('registraRelato', array($objEnvio));
    //$r = $soapClient->registraRelato($objEnvio);
  }
  catch(Throwable $e) {
    var_dump($e); die;
  }
  catch(SoapFault $e) {
    var_dump($e); die;
  }
  catch(Exception $e) {
    var_dump($e); die;
  }
  catch(\Throwable $e) {
    var_dump($e); die;
  }
  catch(\SoapFault $e) {
    var_dump($e); die;
  }
  catch(\Exception $e) {
    var_dump($e); die;
  }

  var_dump($r); die;
?>

Expected result:
----------------
CASE SUCCESS

object(stdClass)[2]
  public 'return' => 
    object(stdClass)[3]
      public 'code' => string 'SUCCESS' (length=7)
      public 'codOrigem' => string '201900013/201' (length=13)
      public 'relatoId' => int 94845
      public 'message' => string 'Relato criado com sucesso em 2000ms'
(length=35)

CASE FAIL (empty parameter for example)

object(SoapFault)[5]
  protected 'message' => string 'java.lang.NullPointerException'
(length=30)
  private 'string' (Exception) => string '' (length=0)
  protected 'code' => int 0
  protected 'file' => string 'E:\wamp\www\src\teste_sis.php'
(length=29)
  protected 'line' => int 30
  private 'trace' (Exception) => 
    array (size=1)
      0 => 
        array (size=6)
          'file' => string 'E:\wamp\www\src\teste_sis.php' (length=29)
          'line' => int 30
          'function' => string '__soapCall' (length=10)
          'class' => string 'SoapClient' (length=10)
          'type' => string '->' (length=2)
          'args' => 
            array (size=2)
              0 => string 'registraRelato' (length=14)
              1 => 
                array (size=0)
                  empty
  private 'previous' (Exception) => null
  public 'faultstring' => string 'java.lang.NullPointerException'
(length=30)
  public 'faultcode' => string 'S:Server' (length=8)
  public 'detail' => 
    object(stdClass)[2]
      public 'exception' => 
        object(stdClass)[3]
          public 'stackTrace' => 
            object(stdClass)[4]
              public 'frame' => 
                array (size=39)
                  0 => string '' (length=0)
                  1 => string '' (length=0)
                  2 => string '' (length=0)
                  3 => string '' (length=0)
                  4 => string '' (length=0)
                  5 => string '' (length=0)
                  6 => string '' (length=0)
                  7 => string '' (length=0)
                  8 => string '' (length=0)
                  9 => string '' (length=0)
                  10 => string '' (length=0)
                  11 => string '' (length=0)
                  12 => string '' (length=0)
                  13 => string '' (length=0)
                  14 => string '' (length=0)
                  15 => string '' (length=0)
                  16 => string '' (length=0)
                  17 => string '' (length=0)
                  18 => string '' (length=0)
                  19 => string '' (length=0)
                  20 => string '' (length=0)
                  21 => string '' (length=0)
                  22 => string '' (length=0)
                  23 => string '' (length=0)
                  24 => string '' (length=0)
                  25 => string '' (length=0)
                  26 => string '' (length=0)
                  27 => string '' (length=0)
                  28 => string '' (length=0)
                  29 => string '' (length=0)
                  30 => string '' (length=0)
                  31 => string '' (length=0)
                  32 => string '' (length=0)
                  33 => string '' (length=0)
                  34 => string '' (length=0)
                  35 => string '' (length=0)
                  36 => string '' (length=0)
                  37 => string '' (length=0)
                  38 => string '' (length=0)
  public 'xdebug_message' => string '<tr><th align='left'
bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000;
color: #fce94f; font-size: x-large;'>( ! )</span> SoapFault:
java.lang.NullPointerException in E:\wamp\www\src\teste_sis.php on line
<i>30</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call
Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th
align='left'
bgcolor='#eeeeec'>Time</th><th align='left'
bgcolor='#eeeeec'>Memory</th><th align='left'
bgcolor='#eeeeec'>Function</th><th align='left'
bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td
bgcolor='#eeeeec'
align='center'>0.0021</td><td bgcolor='#eeeeec'
align='right'>268544</td><td bgcolor='#eeeeec'>{main}( 
)</td><td
title='E:\wamp\www\src\teste_sis.php'
bgcolor='#eeeeec'>...\teste_sis.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td
bgcolor='#eeeeec'
align='center'>0.0026</td><td bgcolor='#eeeeec'
align='right'>398760</td><td bgcolor='#eeeeec'><a
href='http://www.php.net/SoapClient.--soapCall'
target='_new'>__soapCall</a>
(  )</td><td title='E:\wamp\www\src\teste_sis.php'
bgcolor='#eeeeec'>...\teste_sis.php<b>:</b>30</td></tr>
' (length=1182)

Actual result:
--------------
Report for
php__PID__8708__Date__01_31_2019__Time_08_32_47AM__677__Second_Chance_Exception_C0000005.dmp

Type of Analysis Performed   Combined Crash/Hang Analysis 
Machine Name   ZULU 
Operating System   Windows Server 2012 
Number Of Processors   8 
Process ID   8708 
Process Image   E:\xampp\php\php.exe 
Command Line   php.exe E:\wamp\www\src\teste_sis.php 
System Up-Time   15 day(s) 11:32:27 
Process Up-Time   00:00:40 
Processor Type   X86 
Process Bitness   32-Bit 

Top 5 Threads by CPU time

Note - Times include both user mode and kernel mode for each thread 
Thread ID: 0     Total CPU Time: 00:00:00.124     Entry Point for
Thread: php!mainCRTStartup 
Thread ID: 1     Total CPU Time: 00:00:00.000     Entry Point for
Thread: mswsock!Tcpip4_WSHGetWildcardSockaddr+150 

CLR Information

Thread Report

Thread 0 - System ID 10816

Entry point   php!mainCRTStartup 
Create time   31/01/2019 08:32:15 
Time spent in user mode   0 Days 00:00:00.031 
Time spent in kernel mode   0 Days 00:00:00.093 

This thread is not fully resolved and may or may not be a problem.
Further analysis of these threads may be required.

php_soap!to_xml_object+104 
php_soap!sdl_guess_convert_xml+81 
php_soap!master_to_xml_int+78a 
php_soap!model_to_xml_object+430 
php_soap!model_to_xml_object+1b3 
php_soap!to_xml_object+2ec 
php_soap!sdl_guess_convert_xml+81 
php_soap!master_to_xml_int+78a 
php_soap!to_xml_object+119 
php_soap!sdl_guess_convert_xml+81 
php_soap!master_to_xml_int+78a 
php_soap!model_to_xml_object+430 
php_soap!model_to_xml_object+1b3 
php_soap!to_xml_object+2ec 
php_soap!sdl_guess_convert_xml+81 
php_soap!master_to_xml_int+78a 
php_soap!model_to_xml_object+430 
php_soap!model_to_xml_object+1b3 
php_soap!to_xml_object+2ec 
php_soap!sdl_guess_convert_xml+81 
php_soap!master_to_xml_int+78a 
php_soap!serialize_zval+cc 
php_soap!serialize_parameter+e2 
php_soap!serialize_function_call+296 
php_soap!do_soap_call+578 
0x06fce3f8 
php7ts!zend_parse_parameters+1c 
php_soap!zim_SoapClient___call+2b2 
php7ts!execute_internal+1c 
php_xdebug+5cf6 

Thread 1 - System ID 15252

Entry point   mswsock!Tcpip4_WSHGetWildcardSockaddr+150 
Create time   31/01/2019 08:32:45 
Time spent in user mode   0 Days 00:00:00.000 
Time spent in kernel mode   0 Days 00:00:00.000 

This thread is not fully resolved and may or may not be a problem.
Further analysis of these threads may be required.

ntdll!ZwRemoveIoCompletion+c 
kernel32!BaseThreadInitThunk+24 
ntdll!RtlInitializeExceptionChain+8f 
ntdll!RtlInitializeExceptionChain+5a 

Exception Information

PHP_SOAP!TO_XML_OBJECT+104In
php__PID__8708__Date__01_31_2019__Time_08_32_47AM__677__Second_Chance_Exception_C0000005.dmp
the assembly instruction at php_soap!to_xml_object+104 in
E:\xampp\php\ext\php_soap.dll from The PHP Group has caused an access
violation exception (0xC0000005) when trying to write to memory location
0x6c6d3d24 on thread 0

Module Information 

Image Name: E:\xampp\php\ext\php_soap.dll   Symbol Type:  PDB 
Base address: 0x00905a4d   Time Stamp:  Wed Jan 09 21:25:53 2019  
Checksum: 0x00000000   Comments:  Thanks to Brad Lafountain, Shane
Caraveo, Dmitry Stogov 
COM DLL: False   Company Name:  The PHP Group 
ISAPIExtension: False   File Description:  SOAP 
ISAPIFilter: False   File Version:  7.3.1 
Managed DLL: False   Internal Name:  SOAP extension 
VB DLL: False   Legal Copyright:  Copyright © 1997-2018 The PHP Group

Loaded Image Name:  php_soap.dll   Legal Trademarks:  PHP 
Mapped Image Name:     Original filename:  php_soap.dll 
Module name:  php_soap   Private Build:   
Single Threaded:  False   Product Name:  PHP 
Module Size:  228 KBytes   Product Version:  7.3.1 
Symbol File Name:  e:\xampp\php\php_debug\php_soap.pdb   Special Build: 
& 


-- 
Edit bug report at https://bugs.php.net/bug.php?id=77549&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=77549&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=77549&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=77549&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=77549&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=77549&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=77549&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=77549&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=77549&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=77549&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=77549&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=77549&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=77549&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=77549&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77549&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=77549&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=77549&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=77549&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77549&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=77549&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=77549&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#219309) next »