AuthenticationStorage breaks: Object of class PHPIncompleteClass could not be converted to string #349 aeneasr opened this issue Dec 1, 2013 4 comments Comments.

  • Catchable fatal error: Object of class mysqli could not be converted to string in. If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.
  • Object of class stdClass could not be converted to string. Object of class stdClass could not be converted to string. Shushmit Newbie. Posts: 1 Threads: 1 Joined: Nov 2015 Reputation: 0 #1., 04:29 AM. I am sending data from android. Into android when i input data from edittext, then my code works fine. But when i am selecting.

I want to create CRUD data json in table. I want to send variable to client.php and create table in another php file, but in client PHP I want to test echo the variable. this code run if me print the variable from function

Line 208 is functions list_targets($data)

This vuforiaapi.php:

This class client:

Thanks for help.

Herlambang
HerlambangHerlambang
Herlambang is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Html2fpdf

2 Answers

Object of class html2fpdf could not be converted to string chords

You should not echo the result. Use the return statement to return the result of a method / function instead.

odanodan
2,5861 gold badge11 silver badges24 bronze badges
String

There are some issues with your code and one will be throwing a 'Recoverable Fatal Error'. Let's start with the call of the method:

  1. You are passing in $data as a parameter but it hasn't been created (at least in the section of code posted). This would raise an E_NOTICE.
  2. You are assigning a variable to a void method as no data is being returned by list_targets($data). If you later-on access it, it might give you unexpected results.
  3. Possibility of mixing by-reference/by-variable: you pass in variable $data (as mentioned above not set before) and assign values to it using $data = $this->$json->results;. If no ampersand is preceding a parameter in a function definition (e.g. function returnByRef(&$varName)) the parameter cannot be changed within the function scope and will be the same as was passed in into the function.
  4. Finally this line contains the error which is causing the exception:
  • You are decoding the result of the result->getBody() and assign it to $json. This will now be an object, array or variable, depending on the returned data.
  • in the next line you try to access the class instance scope's $this and try to access its property $json. Not only this, you are chaining a method call to it. This property hasn't been set (and I would strongly advise against 'variable variables' like $this->$property) so you are now calling a method on a non-object. The proper variable would have been the local variable $json.

Changed code

In fact you would only have to return the decoded JSON like so:

To be honest - and comments would be highly appreciated - I still wonder why this causes a 'could not be converted to string' error. Only idea would be that the raised exception is somehow trying to call __toString() on a non-object.

SaschaM78SaschaM78

Object Of Class Html2fpdf Could Not Be Converted To String Lyrics

3,0033 gold badges26 silver badges34 bronze badges

Object Of Class Html2fpdf Could Not Be Converted To Strings

Not the answer you're looking for? Browse other questions tagged phpvuforia or ask your own question.

Coments are closed
Scroll to top