Fetching rows as objects from a MySQL database via mysqli::fetch_object (all PHP5), they look like this on var_dump:
class stdClass#5 (5) {
public $id =>
string(2) "23"
public $started =>
NULL
public $finished =>
NULL
public $mode =>
string(3) "XML"
public $mail =>
string(0) ""
}
Now on doing this:
public function __construct($export) {
var_dump($export);
if (!($export instanceof stdClass)) {
//throw new exception ...
}
or this
public function __construct(stdClass $export) {
var_dump($export);
//...
or even with is_object($export)
- this fails
I actually get an Exception:
Fatal error: Uncaught exception 'Exception'
with message '$export is not an object'
or
Argument 1 passed to ConverterXML::__construct()
must be an instance of stdClass, none given
-
why
- or even better -
- How do I get to check weather $export is an anonymouse class from mysqli fetch_object?