Tuesday, August 7, 2018

__soapCall is returning nothing

Leave a Comment

I've got the following function:

public function query($sql) {     $query = array(     "queryString"=>$sql     );     $queryWrapper = array(     "query"=>$query     );      try {         $result = $this->_client->__soapCall("query", $queryWrapper, null, $this->_header);     } catch (SoapFault $e) {       $this->_client->__getLastResponse();     }     return $result; } 

The problem is that I can use var_dump('anything');exit; before the __soapCall(), and I see 'anything'. But if I var_dump('stuff');exit; AFTER the __soapCall(), I get just a blank page. I var_dump('something');exit; in the catch, but I don't see that. It's still just a blank page. My question is, what could be causing this? I would think that if the table in my query didn't exist, or something was wrong with my query at all, I'd get some sort of error. But I'm getting absolutely squat all.

1 Answers

Answers 1

I would try these scenarios:

1. Correct Exceptions

Is $this->_client instance of standard \SoapClient? If not, there could be different exceptions thrown that your catch ignores. If you are on PHP 7.0 and above try catching \Throwable if on older versions try catching \Exception.

2. Run in isolation

If the problem persists it would be better to isolate this function from your codebase and try running it separately. You can even try online tools like 3v4l.

3. Xdebug

If you still cannot find the cause, it is best to trace the issue with xdebug. You can find a simple setup tutorial for Docker and PhpStorm here: https://medium.com/@pablofmorales/xdebug-with-docker-and-phpstorm-786da0d0fad2

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment