Skip to content

Commit d2ed599

Browse files
committed
Merge branch 'master' into accessors
Conflicts: Zend/zend_compile.c Zend/zend_compile.h
2 parents 041610d + 90cbe2a commit d2ed599

File tree

154 files changed

+2547
-1460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+2547
-1460
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ stamp-h.in
9696
scan_makefile_in.awk
9797
TSRM/tsrm_config.h
9898
Zend/zend_config.h
99+
Zend/zend_dtrace_gen.h
100+
Zend/zend_dtrace_gen.hbak
99101
Zend/zend_ini_parser.c
100102
Zend/zend_ini_parser.h
101103
Zend/zend_ini_parser.output

Zend/tests/bug63741.phpt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
--TEST--
2+
Bug #63741 (Crash when autoloading from spl)
3+
--FILE--
4+
<?php
5+
file_put_contents(dirname(__FILE__)."/bug63741.tmp.php",
6+
<<<'EOT'
7+
<?php
8+
if (isset($autoloading))
9+
{
10+
class ClassToLoad
11+
{
12+
static function func ()
13+
{
14+
print "OK!\n";
15+
}
16+
}
17+
return;
18+
}
19+
else
20+
{
21+
class autoloader
22+
{
23+
static function autoload($classname)
24+
{
25+
print "autoloading...\n";
26+
$autoloading = true;
27+
include __FILE__;
28+
}
29+
}
30+
31+
spl_autoload_register(["autoloader", "autoload"]);
32+
33+
function start()
34+
{
35+
ClassToLoad::func();
36+
}
37+
38+
start();
39+
}
40+
?>
41+
EOT
42+
);
43+
44+
include dirname(__FILE__)."/bug63741.tmp.php";
45+
?>
46+
--CLEAN--
47+
<?php unlink(dirname(__FILE__)."/bug63741.tmp.php"); ?>
48+
--EXPECT--
49+
autoloading...
50+
OK!

Zend/tests/bug63762.phpt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--TEST--
2+
Bug #63762 - Sigsegv when Exception::$trace is changed by user
3+
--FILE--
4+
<?php
5+
$e = new Exception();
6+
7+
$ref = new ReflectionProperty($e, 'trace');
8+
$ref->setAccessible(TRUE);
9+
10+
echo "Array of NULL:\n";
11+
$ref->setValue($e, array(NULL));
12+
13+
var_dump($e->getTraceAsString());
14+
15+
echo "\nArray of empty array:\n";
16+
$ref->setValue($e, array(array()));
17+
var_dump($e->getTraceAsString());
18+
19+
echo "\nArray of array of NULL values:\n";
20+
$ref->setValue($e, array(array(
21+
'file' => NULL,
22+
'line' => NULL,
23+
'class' => NULL,
24+
'type' => NULL,
25+
'function' => NULL,
26+
'args' => NULL
27+
)));
28+
var_dump($e->getTraceAsString());
29+
?>
30+
--EXPECTF--
31+
Array of NULL:
32+
33+
Warning: Expected array for frame 0 in %s on line %d
34+
string(9) "#0 {main}"
35+
36+
Array of empty array:
37+
string(36) "#0 [internal function]: ()
38+
#1 {main}"
39+
40+
Array of array of NULL values:
41+
42+
Warning: Function name is no string in %s on line %d
43+
44+
Warning: Value for class is no string in %s on line %d
45+
46+
Warning: Value for type is no string in %s on line %d
47+
48+
Warning: Value for function is no string in %s on line %d
49+
50+
Warning: args element is no array in %s on line %d
51+
string(60) "#0 [unknown function][unknown][unknown][unknown]()
52+
#1 {main}"
53+

Zend/tests/catch_finally_006.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ try {
2525
--EXPECT--
2626
string(4) "para"
2727
string(7) "finally"
28-
string(2) "ex"
28+
string(6) "return"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Cloning a generator after an object method was called
3+
--FILE--
4+
<?php
5+
6+
class A { public function b() { } }
7+
8+
function gen() {
9+
$a = new A;
10+
$a->b();
11+
yield;
12+
}
13+
14+
$g1 = gen();
15+
$g1->rewind();
16+
$g2 = clone $g1;
17+
18+
echo "Done";
19+
--EXPECT--
20+
Done

Zend/tests/generators/finally_with_return.phpt renamed to Zend/tests/generators/finally/return_return.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Use of finally in generator with return
2+
try { return } finally { return } in generator
33
--FILE--
44
<?php
55

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
try { return } finally { yield }
3+
--FILE--
4+
<?php
5+
function foo($f, $t) {
6+
for ($i = $f; $i <= $t; $i++) {
7+
try {
8+
return;
9+
} finally {
10+
yield $i;
11+
}
12+
}
13+
}
14+
foreach (foo(1, 5) as $x) {
15+
echo $x, "\n";
16+
}
17+
--EXPECT--
18+
1
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
try { throw } finally { yield }
3+
--FILE--
4+
<?php
5+
function foo($f, $t) {
6+
for ($i = $f; $i <= $t; $i++) {
7+
try {
8+
throw new Exception;
9+
} finally {
10+
yield $i;
11+
}
12+
}
13+
}
14+
foreach (foo(1, 5) as $x) {
15+
echo $x, "\n";
16+
}
17+
--EXPECTF--
18+
1
19+
20+
Fatal error: Uncaught exception 'Exception' in %s:%d
21+
Stack trace:
22+
#0 %s(%d): foo(1, 5)
23+
#1 {main}
24+
thrown in %s on line %d
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
try { yield } finally { return }
3+
--FILE--
4+
<?php
5+
function foo($f, $t) {
6+
for ($i = $f; $i <= $t; $i++) {
7+
try {
8+
yield $i;
9+
} finally {
10+
return;
11+
}
12+
}
13+
}
14+
foreach (foo(1, 5) as $x) {
15+
echo $x, "\n";
16+
}
17+
--EXPECT--
18+
1
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
try { yield } finally { throw }
3+
--FILE--
4+
<?php
5+
function foo($f, $t) {
6+
for ($i = $f; $i <= $t; $i++) {
7+
try {
8+
yield $i;
9+
} finally {
10+
throw new Exception;
11+
}
12+
}
13+
}
14+
foreach (foo(1, 5) as $x) {
15+
echo $x, "\n";
16+
}
17+
--EXPECTF--
18+
1
19+
20+
Fatal error: Uncaught exception 'Exception' in %s:%d
21+
Stack trace:
22+
#0 %s(%d): foo(1, 5)
23+
#1 {main}
24+
thrown in %s on line %d
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Try { yield } finally { yield }
3+
--FILE--
4+
<?php
5+
6+
function foo() {
7+
try {
8+
echo "1";
9+
yield "2";
10+
echo "3";
11+
} finally {
12+
echo "4";
13+
yield "5";
14+
echo "6";
15+
}
16+
echo "7";
17+
}
18+
foreach (foo() as $x) {
19+
echo $x;
20+
}
21+
--EXPECT--
22+
1234567

Zend/tests/generators/finally_uninterrupted.phpt

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Ignoring a sent value shouldn't leak memory
3+
--FILE--
4+
<?php
5+
6+
function gen() {
7+
yield;
8+
}
9+
10+
$gen = gen();
11+
$gen->send(NULL);
12+
13+
echo "DONE";
14+
15+
?>
16+
--EXPECT--
17+
DONE
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Generator::throw() on an already closed generator
3+
--FILE--
4+
<?php
5+
6+
function gen() {
7+
yield;
8+
}
9+
10+
$gen = gen();
11+
$gen->next();
12+
$gen->next();
13+
var_dump($gen->valid());
14+
$gen->throw(new Exception('test'));
15+
16+
?>
17+
--EXPECTF--
18+
bool(false)
19+
20+
Fatal error: Uncaught exception 'Exception' with message 'test' in %s:%d
21+
Stack trace:
22+
#0 {main}
23+
thrown in %s on line %d
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Generator::throw() where the exception is caught in the generator
3+
--FILE--
4+
<?php
5+
6+
function gen() {
7+
try {
8+
yield;
9+
} catch (RuntimeException $e) {
10+
echo $e, "\n\n";
11+
}
12+
13+
yield 'result';
14+
}
15+
16+
$gen = gen();
17+
var_dump($gen->throw(new RuntimeException('Test')));
18+
19+
?>
20+
--EXPECTF--
21+
exception 'RuntimeException' with message 'Test' in %s:%d
22+
Stack trace:
23+
#0 {main}
24+
25+
string(6) "result"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Generator::throw() with something that's not an exception
3+
--FILE--
4+
<?php
5+
6+
function gen() {
7+
yield;
8+
}
9+
10+
$gen = gen();
11+
$gen->throw(new stdClass);
12+
13+
?>
14+
--EXPECTF--
15+
Fatal error: Exceptions must be valid objects derived from the Exception base class in %s on line %d

0 commit comments

Comments
 (0)