Skip to content

Commit

Permalink
Fixed bug - ReflectionProperty::getValue can trigger error or throw a…
Browse files Browse the repository at this point in the history
…n exception
  • Loading branch information
bkrukowski committed Jul 20, 2017
1 parent 88e6ecf commit 19b6ce5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## 0.1.2

* Fixed bug - `ReflectionProperty::getValue` can trigger error or throw an exception

## 0.1.1

* Missing **@internal** tags
Expand Down
11 changes: 9 additions & 2 deletions src/Properties/ReflectionProperty.php
Expand Up @@ -23,8 +23,15 @@ public function __construct(\ReflectionProperty $property, $object)
public function getValue()
{
$this->reflection->setAccessible(true);
$result = $this->reflection->getValue($this->object);

set_error_handler(function () {});
$result = null;
try {
$result = $this->reflection->getValue($this->object);
} catch (\Exception $e) {
} catch (\Throwable $e) {
}
restore_error_handler();

return $result;
}

Expand Down

0 comments on commit 19b6ce5

Please sign in to comment.