php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70271 Php SoapServer crashed after second SoapFault
Submitted: 2015-08-14 15:05 UTC Modified: 2015-08-23 14:03 UTC
From: miracle at rpz dot name Assigned:
Status: Duplicate Package: SOAP related
PHP Version: 5.6.12 OS: Irrelevant
Private report: No CVE-ID: None
 [2015-08-14 15:05 UTC] miracle at rpz dot name
Description:
------------
On first SoapFault server respond with status 500 (expected behavior).
On next fault server crashed.

Reproduced on windows and linux, with all 5.6.* versions, php-cli and mod_php, works fine on 5.5 and 5.4.

Test script:
---------------
<?php
    if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
        $srv = new SoapServer(null, ['uri' => 'http://test-uri/']);
        $srv->handle();
    } else {
        if (DIRECTORY_SEPARATOR == '\\') {
            // windows
            $phpRoot = 'c:\php56';
            $args = sprintf('"%s\php.exe" -d extension_dir=%s\ext -d extension=php_soap.dll -S %s:%d -t %s', $phpRoot, $phpRoot,  '127.0.0.1', 8081, __DIR__);
            $cmd =  'start "srv" ' . $args;
            pclose(popen($cmd, "r"));
        } else {
            // linux
            $cmd = 'php -S 127.0.0.1:8081 -t ' . __DIR__ . ' > /dev/null 2>&1 &';
            exec($cmd);
        }
	    // wait for starting web-server
        sleep(10);
        
        $client = new SoapClient(null, ['uri' => 'http://test-uri', 'location' => 'http://127.0.0.1:8081/' . basename(__FILE__)]);

        try {
            $client->unknownMethod(); // expected exception
        } catch (Exception $e) {
            var_dump($e->getMessage());
        }
 
        // any "normal" requests here
        
        try {
            $client->unknownMethod(); // server crashed here
        } catch (Exception $e) {
            var_dump($e->getMessage());
        }        
    }

Expected result:
----------------
string(38) "Function 'unknownMethod' doesn't exist"
string(38) "Function 'unknownMethod' doesn't exist"

Actual result:
--------------
string(38) "Function 'unknownMethod' doesn't exist"
string(27) "Error Fetching http headers"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-18 14:54 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2015-08-18 14:54 UTC] laruence@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2015-08-18 17:40 UTC] miracle at rpz dot name
client.php:

<?php
        $client = new SoapClient(null, ['uri' => 'http://test-uri', 'location' => 'http://127.0.0.1:8081/server.php']);

        try {
            $client->unknownMethod(); // expected exception
        } catch (Exception $e) {
            var_dump($e->getMessage());
        }
 
        // any "normal" requests here
        
        try {
            $client->unknownMethod(); // server crashed here
        } catch (Exception $e) {
            var_dump($e->getMessage());
        }
?>

$./php ./client.php
string(38) "Function 'unknownMethod' doesn't exist"
string(27) "Error Fetching http headers"

---------------------

server.php:

<?php
        $srv = new SoapServer(null, ['uri' => 'http://test-uri/']);
        $srv->handle();

?>

$ ./php -S 127.0.0.1:8081 -t /tmp/php-soapserver


PHP 5.6.12 Development Server started at Tue Aug 18 20:28:09 2015
Listening on http://127.0.0.1:8081
Document root is /tmp/php-soapserver
Press Ctrl-C to quit.
[Tue Aug 18 20:28:11 2015] 127.0.0.1:59246 [500]: /server.php - Function 'unknownMethod' doesn't exist in /tmp/php-soapserver/server.php on line 3
Segmentation fault (core dumped)

(gdb)bt
#0  0x00000000008ca757 in zend_std_object_get_class (object=0x7f3b34a0dc28) at /tmp/php-soapserver/php-5.6.12/Zend/zend_object_handlers.c:1528
#1  0x000000000089001d in zend_get_class_entry (zobject=0x7f3b34a0dc28) at /tmp/php-soapserver/php-5.6.12/Zend/zend_API.c:238
#2  0x00000000006b4c84 in soap_error_handler (error_num=8192, error_filename=0xd58393 "Unknown", error_lineno=0, 
    format=0xd43178 "Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input"..., args=0x7fff26f74920)
    at /tmp/php-soapserver/php-5.6.12/ext/soap/soap.c:2145
#3  0x000000000088dc11 in zend_error (type=8192, 
    format=0xd43178 "Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input"...) at /tmp/php-soapserver/php-5.6.12/Zend/zend.c:1133
#4  0x0000000000809669 in php_default_post_reader () at /tmp/php-soapserver/php-5.6.12/main/php_content_types.c:75
#5  0x000000000080363f in sapi_read_post_data () at /tmp/php-soapserver/php-5.6.12/main/SAPI.c:247
#6  0x0000000000803ff0 in sapi_activate () at /tmp/php-soapserver/php-5.6.12/main/SAPI.c:482
#7  0x00000000007f7f4e in php_request_startup () at /tmp/php-soapserver/php-5.6.12/main/main.c:1632
#8  0x000000000094c626 in php_cli_server_request_startup (server=0x10896c0 <server>, client=0x2dc21b0)
    at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli_server.c:2100
#9  0x000000000094c932 in php_cli_server_dispatch (server=0x10896c0 <server>, client=0x2dc21b0)
    at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli_server.c:2170
#10 0x000000000094d157 in php_cli_server_recv_event_read_request (server=0x10896c0 <server>, client=0x2dc21b0)
    at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli_server.c:2372
#11 0x000000000094d4ea in php_cli_server_do_event_for_each_fd_callback (_params=0x7fff26f74d30, fd=4, event=1)
    at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli_server.c:2463
#12 0x00000000009489bf in php_cli_server_poller_iter_on_active (poller=0x10896c8 <server+8>, opaque=0x7fff26f74d30, 
    callback=0x94d2af <php_cli_server_do_event_for_each_fd_callback>) at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli_server.c:960
#13 0x000000000094d560 in php_cli_server_do_event_for_each_fd (server=0x10896c0 <server>, 
    rhandler=0x94d060 <php_cli_server_recv_event_read_request>, whandler=0x94d17e <php_cli_server_send_event>)
---Type <return> to continue, or q <return> to quit---)
    at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli_server.c:2484
#14 0x000000000094d5c4 in php_cli_server_do_event_loop (server=0x10896c0 <server>)
    at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli_server.c:2494
#15 0x000000000094d904 in do_cli_server (argc=5, argv=0x2c0f710) at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli_server.c:2595
#16 0x000000000094236c in main (argc=5, argv=0x2c0f710) at /tmp/php-soapserver/php-5.6.12/sapi/cli/php_cli.c:1381


P.S

> report and change the status back to "Open".

Lost my "password", cannot find "reset/recover" function...
 [2015-08-23 14:03 UTC] cmb@php.net
-Status: Feedback +Status: Duplicate
 [2015-08-23 14:03 UTC] cmb@php.net
> Lost my "password", cannot find "reset/recover" function...

So I'm marking this ticket as duplicate of bug #70334.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC