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 2817343 commit e1cdbdf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## 0.6.3

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

## 0.6.2

* Changed `.gitattributes` - do not remove whole `/bin` directory
Expand Down
9 changes: 8 additions & 1 deletion src/Properties/ReflectionProperty.php
Expand Up @@ -23,7 +23,14 @@ 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 e1cdbdf

Please sign in to comment.