Skip to content

Tests #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/weakref_006.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
Weakref: Destroying the weakred within the std dtor of the object
Weakref: Destroying the weakref within the std dtor of the object
--FILE--
<?php

Expand Down
46 changes: 46 additions & 0 deletions tests/weakref_007.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
--TEST--
Weakref: Destroying the weakref and its object after a fatal error
--SKIPIF--
<?php if(!function_exists('pcntl_fork')) echo "skip can't test for returnvalue"; ?>
--FILE--
<?php
class A {
function __destruct() {
printf("Destroy A\n");
}
}
class B {
public $ref;

function __construct($a) {
$this->ref = array($a);
}

function __destruct() {
printf("Destroy B\n");
var_dump($this->ref->valid());
}
}
function doit() {
$a = new A();
$b = new B($a);
crash();
}
$pid = pcntl_fork();
if($pid == 0) {
doit();
exit(0);
}
pcntl_waitpid($pid, $status);
if(pcntl_wifsignaled($status)) {
echo "Killed: ". pcntl_wtermsig($status) ."\n";
} elseif(pcntl_wifexited($status)) {
echo "Exit: ". pcntl_wexitstatus($status) ."\n";
} else {
echo "Weird.\n";
}
?>
--EXPECTF--

Fatal error: Call to undefined function crash() in %s on line %d
Exit: 255