*/
protected function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
{
+ $item = (string) $item;
+
// array
if (Twig_TemplateInterface::METHOD_CALL !== $type) {
if ((is_array($object) && array_key_exists($item, $object))
'defined' => 'defined',
'zero' => 0,
'null' => null,
+ '1' => 1,
);
$objectArray = new Twig_TemplateArrayAccessObject;
array(true, 'defined', 'defined'),
array(false, null, 'undefined'),
array(true, 0, 'zero'),
+ array(true, 1, 1),
+ array(true, 1, 1.0),
array(true, null, 'null'),
);
$testObjects = array(
$tests = array();
foreach ($testObjects as $testObject) {
foreach ($basicTests as $test) {
+ // properties cannot be numbers
+ if ($testObject[0] instanceof stdClass && is_numeric($test[2])) {
+ continue;
+ }
+
$tests[] = array($test[0], $test[1], $testObject[0], $test[2], array(), $testObject[1]);
}
}
'defined' => 'defined',
'zero' => 0,
'null' => null,
+ '1' => 1,
);
public function offsetExists($name)
'defined' => 'defined',
'zero' => 0,
'null' => null,
+ '1' => 1,
);
public function __isset($name)
return 'defined';
}
+ public function get1()
+ {
+ return 1;
+ }
+
public function getZero()
{
return 0;