Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object of class stdClass could not be converted to string #1391

Closed
sanishmfod opened this issue Oct 25, 2019 · 5 comments
Closed

Object of class stdClass could not be converted to string #1391

sanishmfod opened this issue Oct 25, 2019 · 5 comments
Labels
Milestone

Comments

@sanishmfod
Copy link

When logging a SoapFault with a details property that is not a string you get the error Object of class stdClass could not be converted to string .

The issue is on this line : https://github.com/Seldaek/monolog/blob/2.0.0/src/Monolog/Formatter/LineFormatter.php#L184

An example SoapFault which causes this problem is below :

<?xml version='1.0' encoding='utf-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
    <ns0:Fault xmlns:ns1="http://www.w3.org/2003/05/soap-envelope" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>ns0:Server</faultcode>
    <faultstring>Error in com.hotelzon.hsi.business.HotelzonServiceInterfaceObject. Details: ae.noavailability.notavailable; SX1022105710E11238 0176 BOOKING CODE IS NOT STORED ON ROOMMASTER., Identifier :#BZ1910221057102570340</faultstring>
    <faultactor>Server</faultactor>
    <detail>
        <SisuErrorCode>ae.noavailability.notavailable</SisuErrorCode>
    </detail>
    </ns0:Fault>
</S:Body>
</S:Envelope>
@Seldaek Seldaek added this to the 1.x milestone Nov 12, 2019
@Seldaek Seldaek added the Bug label Nov 12, 2019
@jake-rw
Copy link

jake-rw commented Nov 20, 2019

Hi Seldaek,
This issue still persists in the latest release.

If on line 184 I dd($e->detail) I get the below .


{#413
  +"stackTrace": """
    java.lang.NumberFormatException: Invalid date
    \tat org.apache.axis.encoding.ser.CalendarDeserializer.makeValue(CalendarDeserializer.java:80)
    \tat org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:172)
    \tat org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502)
    \tat org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
    \tat org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
    \tat org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
    \tat org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
    \tat org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
    \tat org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:81)
    \tat org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
    \tat org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    \tat org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    \tat org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    \tat org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
    \tat org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
    \tat org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
    \tat javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    \tat org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    \tat javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    \tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    \tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    \tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    \tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    \tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    \tat org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:439)
    \tat org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:178)
    \tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    \tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    \tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    \tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    \tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    \tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    \tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    \tat org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:680)
    \tat org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    \tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    \tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    \tat org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
    \tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    \tat org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    \tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
    \tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
    \tat java.lang.Thread.run(Thread.java:745)
    """
  +"hostname": "uat01c-stg"
  +"isRuntimeException": "true"
}

@Seldaek
Copy link
Owner

Seldaek commented Nov 21, 2019

can you dd(reset($e->detail)); dd(reset((array) $e->detail)); and dd(gettype($e->detail)); ? Just trying to understand what is going wrong here.. Also would be happy to know exactly which error you're seeing, and which monolog version you are using.

@sanishmfod
Copy link
Author

sanishmfod commented Nov 25, 2019

I am still also getting the issue using monolog 2.0.1, I believe this is because e1af546 only fixed normalizeException in NormalizerFormatter and not LineFormatter.

@Seldaek
Copy link
Owner

Seldaek commented Dec 7, 2019

@sanishmfod oh sorry missed that one as it was only present in 2.x, should be fixed now in master.

@yethee
Copy link

yethee commented Jan 20, 2020

I have same issue using monolog of version 2.0.2,

Object of class stdClass could not be converted to string in /app/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php on line 184

SoapFault:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <faultcode>SOAP-ENV:Client</faultcode>
      <faultstring>Недостаточно баллов</faultstring>
      <detail>
        <ns3:FaultResponse xmlns:ns3="http://api.direct.yandex.com/v5/general">
          <requestId>2577205305276726399</requestId>
          <errorCode>152</errorCode>
          <errorDetail>Недостаточно баллов для выполнения операции</errorDetail>
        </ns3:FaultResponse>
      </detail>
     </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

reset($e->detail) returns an instance of stdClass with these properties: requestId, errorCode and errorDetail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants