note 129757 added to soapserver.handle

From: Date: Wed, 18 Sep 2024 14:45:02 +0000
Subject: note 129757 added to soapserver.handle
Groups: php.notes 
Request: Send a blank email to php-notes+get-221541@lists.php.net to get a copy of this message
The handle method catch Fatal errors (for example calling an undefined function), so they will never go to log file of function registered by register_shutdown_function, set_error_handler or set_exception_handler. This example log nothing : <?php function testFatal($name) { fhdkshfkhhf(); } $server = new SoapServer('https://example.com/soap.wsld'); $server->addFunction('testFatal'); $server->handle(); ?> To log error you need to catch Throwable : <?php function testFatal($name) { try { fhdkshfkhhf(); } catch (Throwable $e) { error_log("SOAP Error: " . $e->getMessage() . "\nStack trace:\n" . $e->getTraceAsString()); throw $e; } } $server = new SoapServer('https://example.com/soap.wsld'); $server->addFunction('testFatal'); $server->handle(); ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 78.116.242.67) ---- Manual Page -- https://php.net/manual/en/soapserver.handle.php Edit -- https://main.php.net/note/edit/129757 Del: integrated -- https://main.php.net/note/delete/129757/integrated Del: useless -- https://main.php.net/note/delete/129757/useless Del: bad code -- https://main.php.net/note/delete/129757/bad+code Del: spam -- https://main.php.net/note/delete/129757/spam Del: non-english -- https://main.php.net/note/delete/129757/non-english Del: in docs -- https://main.php.net/note/delete/129757/in+docs Del: other reasons-- https://main.php.net/note/delete/129757 Reject -- https://main.php.net/note/reject/129757 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221541) next »