Error edit on API

Solved Posted In Wave
  • frode-meling 11 months ago
    	Testing API function, using insomnia I get this error when edit a post:
    	
    ErrorException (E_WARNING)
    json_decode() expects parameter 1 to be string, object given
    
    Ideas?
    Testing API function, using insomnia I get this error when edit a post:
    

    ErrorException (E_WARNING) json_decode() expects parameter 1 to be string, object given

    Ideas?

  • Best Answer

    (As selected by frode-meling)

    frode-meling 11 months ago
    Just remove json_decode from ApiController.php. it fixes the problem

    Just remove json_decode from ApiController.php. it fixes the problem

  • frode-meling 11 months ago
    I have found out that in my installation of Wave.
    
    tcg/voyager                           v1.1.10
    
    laravel/framework                 v5.6.38
    
    
    data_rows->details get empty json as value. {}. It seems NULL or blank is for all existing data. Is this new in Voyager?
    
    At least it makes Wave crash in ApiController:L238 - $options = json_decode($row->details);
    it seems $row->details then returns an object of stdClass and not a string, causing json_decode to crash.
    Also putting valid jsoncode will make this crash. Is it Eloquent that is changed? It seems to not return string, but objects instead.
    
    

    I have found out that in my installation of Wave.

    tcg/voyager v1.1.10

    laravel/framework v5.6.38

    data_rows->details get empty json as value. {}. It seems NULL or blank is for all existing data. Is this new in Voyager?

    At least it makes Wave crash in ApiController:L238 - $options = json_decode($row->details); it seems $row->details then returns an object of stdClass and not a string, causing json_decode to crash. Also putting valid jsoncode will make this crash. Is it Eloquent that is changed? It seems to not return string, but objects instead.

  • frode-meling 11 months ago
    It seems this pull: https://github.com/the-control-group/voyager/pull/3637 breaks Wave.
    You should get Wave up with automatic testing before releasing it. 
    
    Json_decode can probably be removed from ApiController.

    It seems this pull: https://github.com/the-control-group/voyager/pull/3637 breaks Wave. You should get Wave up with automatic testing before releasing it.

    Json_decode can probably be removed from ApiController.

  • emil-gaarde 11 months ago
    +1  Having the same issue :(

    +1 Having the same issue :(

  • frode-meling 11 months ago
    Just remove json_decode from ApiController.php. it fixes the problem

    Just remove json_decode from ApiController.php. it fixes the problem

Please login or signup to leave a response.

Login

or Sign Up

Sign Up

or Login
×
Want to create your own SAAS?

I can teach you to create your own Software as a Service. Click here to learn more!

Visit SAAS Adventure!