@@ -420,7 +420,13 @@ private function &readProperty(&$objectOrArray, $property, $isIndex)
420
420
$ isser = 'is ' .$ camelProp ;
421
421
$ hasser = 'has ' .$ camelProp ;
422
422
423
- if ($ reflClass ->hasMethod ($ getter )) {
423
+ if (is_callable (array ($ objectOrArray , $ getter ))) {
424
+ $ result [self ::VALUE ] = $ objectOrArray ->$ getter ();
425
+ } elseif (is_callable (array ($ objectOrArray , $ isser ))) {
426
+ $ result [self ::VALUE ] = $ objectOrArray ->$ isser ();
427
+ } elseif (is_callable (array ($ objectOrArray , $ hasser ))) {
428
+ $ result [self ::VALUE ] = $ objectOrArray ->$ hasser ();
429
+ } elseif ($ reflClass ->hasMethod ($ getter )) {
424
430
if (!$ reflClass ->getMethod ($ getter )->isPublic ()) {
425
431
throw new PropertyAccessDeniedException (sprintf ('Method "%s()" is not public in class "%s" ' , $ getter , $ reflClass ->name ));
426
432
}
@@ -438,15 +444,6 @@ private function &readProperty(&$objectOrArray, $property, $isIndex)
438
444
}
439
445
440
446
$ result [self ::VALUE ] = $ objectOrArray ->$ hasser ();
441
- } elseif ($ reflClass ->hasMethod ('__call ' ) &&
442
- is_callable (array ($ objectOrArray , $ getter ))) {
443
- $ result [self ::VALUE ] = $ objectOrArray ->$ getter ();
444
- } elseif ($ reflClass ->hasMethod ('__call ' ) &&
445
- is_callable (array ($ objectOrArray , $ isser ))) {
446
- $ result [self ::VALUE ] = $ objectOrArray ->$ isser ();
447
- } elseif ($ reflClass ->hasMethod ('__call ' ) &&
448
- is_callable (array ($ objectOrArray , $ hasser ))) {
449
- $ result [self ::VALUE ] = $ objectOrArray ->$ hasser ();
450
447
} elseif ($ reflClass ->hasMethod ('__get ' )) {
451
448
// needed to support magic method __get
452
449
$ result [self ::VALUE ] = $ objectOrArray ->$ property ;
0 commit comments