Skip to content

Commit c8e9b77

Browse files
committed
Remove superfluous sapi/ include step
1 parent 76225c1 commit c8e9b77

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
--TEST--
2+
Observer: Generator yield from
3+
--SKIPIF--
4+
skip: TODO Fix this test
5+
<?php if (!extension_loaded('zend_test')) die('skip: zend_test extension required'); ?>
6+
--INI--
7+
zend_test.observer.enabled=1
8+
zend_test.observer.observe_all=1
9+
zend_test.observer.show_return_value=1
10+
--FILE--
11+
<?php
12+
function fooResults() {
13+
yield from [0, 1, 2];
14+
}
15+
16+
function doSomething() {
17+
$generator = fooResults();
18+
foreach ($generator as $value) {
19+
echo $value . PHP_EOL;
20+
}
21+
return 'Done.';
22+
}
23+
24+
echo doSomething() . PHP_EOL;
25+
?>
26+
--EXPECTF--
27+
<!-- init '%s/observer_generator_%d.php' -->
28+
<file '%s/observer_generator_%d.php'>
29+
<!-- init doSomething() -->
30+
<doSomething>
31+
<!-- init fooResults() -->
32+
<fooResults>
33+
</fooResults:0>
34+
0
35+
<fooResults>
36+
</fooResults:1>
37+
1
38+
<fooResults>
39+
</fooResults:2>
40+
2
41+
</doSomething:'Done.'>
42+
Done.
43+
</file '%s/observer_generator_%d.php'>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Observer: Generator with uncaught TypeError
3+
--SKIPIF--
4+
<?php if (!extension_loaded('zend_test')) die('skip: zend_test extension required'); ?>
5+
--INI--
6+
zend_test.observer.enabled=1
7+
zend_test.observer.observe_all=1
8+
zend_test.observer.show_return_value=1
9+
--FILE--
10+
<?php
11+
function gen(array $a) { yield; }
12+
gen(42);
13+
?>
14+
--EXPECTF--
15+
<!-- init '%s/observer_generator_%d.php' -->
16+
<file '%s/observer_generator_%d.php'>
17+
<!-- Exception: TypeError -->
18+
</file '%s/observer_generator_%d.php'>
19+
20+
Fatal error: Uncaught TypeError: gen(): Argument #1 ($a) must be of type array, int given, called in %s:%d
21+
Stack trace:
22+
#0 %s/observer_generator_%d.php(%d): gen(42)
23+
#1 {main}
24+
thrown in %s/observer_generator_%d.php on line %d

sapi/embed/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ int main(int argc, char **argv)
3131
}
3232
```
3333
34-
To compile this, we must point the compiler to the PHP header files. The paths to the header files are listed from `php-config --includes`, but the path to the SAPI header files are not included in that list by default so we must explicitly include `$(php-config --include-dir)/sapi`.
34+
To compile this, we must point the compiler to the PHP header files. The paths to the header files are listed from `php-config --includes`.
3535
3636
We must also point the linker and the runtime loader to the `libphp.so` shared lib for linking PHP (`-lphp`) which is located at `$(php-config --prefix)/lib`. So the complete command to compile ends up being:
3737
3838
```bash
3939
$ gcc \
4040
$(php-config --includes) \
41-
-I$(php-config --include-dir)/sapi \
4241
-L$(php-config --prefix)/lib \
4342
embed_sapi_basic_example.c \
4443
-lphp \

0 commit comments

Comments
 (0)