--TEST-- using different variables to access string offsets --FILE-- getMessage(), "\n"; } $obj = new stdClass; try { var_dump($str[$obj]); } catch (Error $e) { echo $e->getMessage(), "\n"; } $arr = Array(1,2,3); try { var_dump($str[$arr]); } catch (Error $e) { echo $e->getMessage(), "\n"; } echo "Done\n"; ?> --EXPECTF-- string(1) "i" Warning: String offset cast occurred in %s on line %d string(1) "S" Warning: String offset cast occurred in %s on line %d string(1) "S" Warning: Illegal string offset 'run away' in %s on line %d string(1) "S" string(1) "c" Warning: Illegal string offset '14.5' in %s on line %d string(1) "o" Notice: A non well formed numeric value encountered in %s on line %d string(1) "r" Warning: String offset cast occurred in %s on line %d string(1) "i" Warning: String offset cast occurred in %s on line %d string(1) "S" Illegal offset type Notice: Object of class stdClass could not be converted to int in %s on line %d Illegal offset type Illegal offset type Done