Weird question mark sign after casting object to array

Viewed 49

I am trying to cast an object to array, to use its protected properties. Unfortunately, the array keys contain some wierd looking question marks so I cannot use these values in my code. The error says "undefined index of array".

Where does it come from and what can I do about it?

Object var_dump:

object(testClassName)#35 (2) {
  ["name":protected]=>
  NULL
  ["path":protected]=>
  string(9) "files/"

Typecast:

$object = new testClassName();
$array = (array) $object;

Array var_dump:

array(2) {
  ["�*�name"]=>
  NULL
  ["�*�path"]=>
  string(9) "files/"
}
0 Answers
Related