Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
Fix for segfault/memleak issues under PHP 7. Closes #143.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Mar 18, 2016
1 parent 11472e7 commit e6e2cb3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

- **[NEW]** Implemented generator stubs ([#11]).
- **[IMPROVED]** More default values for built-in return types ([#138], [#139]).
- **[FIXED]** Fixed memory leak under PHP 7 ([#143]).

[#11]: https://github.com/eloquent/phony/issues/11
[#138]: https://github.com/eloquent/phony/issues/138
[#139]: https://github.com/eloquent/phony/pull/139
[#143]: https://github.com/eloquent/phony/issues/143

## 0.8.0 (2016-02-12)

Expand Down
15 changes: 11 additions & 4 deletions src/Stub/Stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Eloquent\Phony\Stub;

use Eloquent\Phony\Assertion\Renderer\AssertionRenderer;
use Eloquent\Phony\Call\Argument\Arguments;
use Eloquent\Phony\Call\Argument\ArgumentsInterface;
use Eloquent\Phony\Invocation\AbstractWrappedInvocable;
Expand Down Expand Up @@ -132,10 +133,16 @@ public function __construct(
*/
public function __destruct()
{
try {
$this->closeRule();
} catch (Exception $e) {
printf("WARNING: %s\n", $e->getMessage());
if (!$this->answers && null !== $this->criteria) {
printf(
'WARNING: Stub criteria %s were never used. ' .
"Check for incomplete stub rules.\n",
var_export(
AssertionRenderer::instance()
->renderMatchers($this->criteria),
true
)
);
}
}

Expand Down

0 comments on commit e6e2cb3

Please sign in to comment.