1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 01:18:19 +02:00
Commit Graph

138 Commits

Author SHA1 Message Date
Xinchen Hui ffaee27478 Fixed bug #76427 (Segfault in zend_objects_store_put) 2018-06-11 21:00:38 +08:00
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00
Gabriel Caruso ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00
Gabriel Caruso 53dbc69a8d Use %d when expecting line number in tests 2018-02-02 22:35:13 +01:00
Nikita Popov cf70e1910b Merge branch 'PHP-7.1' into PHP-7.2 2018-01-13 11:06:46 +01:00
Nikita Popov 8c07170ddb Fix generator GC if yield from parent chain does not reach root
Parents may be unlinked while another generator sharing part of the
chain is running. As such, we cannot assume that the parent chain
goes all the way to the root. Instead walk backwards from root to
leaf, like we also do during destruction.
2018-01-13 11:04:26 +01:00
Nikita Popov e112b8474a Merge branch 'PHP-7.1' into PHP-7.2 2018-01-12 21:28:24 +01:00
Nikita Popov 420d11e8ca Fixed bug #75396
Do not run finally blocks in generators on unclean shutdown (e.g.
caused by exit). This is consistent with how finally blocks outside
of generators behave.
2018-01-12 21:27:23 +01:00
Bob Weinand 76ce874422 Merge branch 'PHP-7.1' into PHP-7.2 2017-07-22 11:16:48 +02:00
Bob Weinand 134e713be2 Merge branch 'PHP-7.0' into PHP-7.1 2017-07-22 11:14:54 +02:00
Bob Weinand bad5d0d6c5 Fixed bug #74954 (null deref and segfault in zend_generator_resume()) 2017-07-22 11:14:00 +02:00
Bob Weinand ccb5591728 Merge branch 'PHP-7.1' 2017-05-17 19:59:36 +02:00
Bob Weinand 649494c0ee Fixed bug #74606 (Segfault within try/catch/finally nesting in Generators)
Thanks to Nikita for pointing out the error source.
2017-05-17 19:58:51 +02:00
Sara Golemon 819e66599a Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix bug where `yield from` is captured too greedily
2017-03-23 13:40:09 -07:00
Sara Golemon 7835e2ebc5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug where `yield from` is captured too greedily
2017-03-23 13:38:58 -07:00
Sara Golemon 0fb640c717 Fix bug where yield from is captured too greedily
In the following piece of code:

```php
function from1234($x) {
  return $x;
}
function foo($x) {
  yield from1234($x);
}
```

The statement inside foo is taken as `yield from` `1234($x)`
which is neither the intent, nor even legal syntax for an fcall.

Do a lookahead for breaking non-label characters after the
`yield from` and only accept it if they occur.
2017-03-23 13:31:06 -07:00
Xinchen Hui b806287e43 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #74157 (Segfault with nested generators)
2017-02-26 12:07:03 +08:00
Xinchen Hui 6a584cf318 Fixed bug #74157 (Segfault with nested generators) 2017-02-26 12:05:56 +08:00
Rasmus Lerdorf 4f4a7f89ae These tests rely on gc being enabled 2017-01-10 11:57:59 -05:00
Rasmus Lerdorf 47fcb75a90 These tests expect gc to be enabled 2017-01-10 11:54:49 -05:00
Dmitry Stogov 3b4c9f18e0 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed calling generators through magic __call()
2016-11-28 12:30:16 +03:00
Dmitry Stogov 458c732ed4 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed calling generators through magic __call()
2016-11-28 12:30:01 +03:00
Dmitry Stogov 970f21be97 Fixed calling generators through magic __call() 2016-11-28 12:20:19 +03:00
Craig Duncan b000f5c341 Add tests for invalid count() operations 2016-11-17 09:33:04 +00:00
Bob Weinand 35764e3579 Merge remote-tracking branch 'origin/PHP-7.0' into PHP-7.1 2016-07-23 16:40:02 +02:00
Bob Weinand 6046acf93e Fix ClosedGeneratorException possibly thrown into wrong scope 2016-07-23 16:39:21 +02:00
Nikita Popov e3e400c983 Fix return from by-ref generators 2016-07-14 15:44:04 +02:00
Xinchen Hui d1dd474ff9 Fixed bug #72523 (dtrace issue with reflection (failed test)) 2016-07-01 18:50:35 +08:00
Nikita Popov 79de9fa4aa Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_vm_execute.h
2016-05-28 13:22:49 +02:00
Nikita Popov 4746e5efcb Forbid "yield from" in force closed generators
Same check we do for "yield", was missed when "yield from" was
added. We could make this more granular by only forbidding to
actually yield values and still allow something like "yield from []",
but this does not seem worthwhile.
2016-05-28 13:21:05 +02:00
Dmitry Stogov 97bf4e0b12 Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function 2016-05-16 12:42:13 +03:00
Dmitry Stogov 414c4c6776 Revert "Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function."
This reverts commit a9b517c614.
2016-05-16 11:51:29 +03:00
Dmitry Stogov a9b517c614 Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function. 2016-05-16 10:24:13 +03:00
Dmitry Stogov 515a61069a Added test 2016-05-11 12:55:33 +03:00
Bob Weinand 5085352464 Fix generator being a cycle to itself 2016-04-18 23:55:16 +02:00
Dmitry Stogov e7730fece6 Fised possible use-after-free 2016-04-04 09:35:48 +03:00
Bob Weinand 23b770f31f Fixed bug #71601 (finally block not executed after yield from) 2016-02-15 22:37:21 +01:00
Nikita Popov ccc06e252b Forbid yield from in by-reference generators
The current yield from implementation doesn't support by-ref
yields. It's likely not worthwhile to actually implement this,
but we should at least keep the door open for the future by
issuing a compile error.

Refs bug #71252.
2016-02-12 17:55:29 +01:00
Nikita Popov 1322672c0b Fix dangling send target when using yield from
Also drop some unnecessary TRY_DELREFs -- leftovers from the days
when null was refcounted.
2016-02-11 16:25:16 +01:00
Bob Weinand 001ce475ee Fixed bug #71441 (Typehinted Generator with return in try/finally crashes) 2016-01-24 19:55:16 +01:00
Bob Weinand 033d608771 Fixed bug #71297 (Memory leak with yield from) 2016-01-07 11:56:21 +01:00
Levi Morrison 2a7eeff33e Remove mentions of "type hint" and "typehint" 2015-12-24 15:19:31 +01:00
Bob Weinand 559ede17e1 Fixed bug #71013 (Incorrect exception handler with yield from) 2015-12-06 02:45:19 +01:00
Bob Weinand 2de8915dea Fixed bug causing exception not being thrown immediately into a generator yielding from an array 2015-11-25 23:09:44 +01:00
Bob Weinand 73a92964ff Fixed bug #70965 (yield from with a common iterator primes too much) 2015-11-25 09:54:24 +01:00
Bob Weinand 80d9dcafe0 Fixed bug #70904 (yield from incorrectly marks valid generator as finished) 2015-11-24 23:43:34 +01:00
Bob Weinand 7ca85d8875 Fully fix typed generator returns 2015-07-24 22:04:05 +02:00
Bob Weinand 2eb845d0fa Fix bug using not set temporary with typed generator returns 2015-07-24 20:31:18 +02:00
Nikita Popov ea5c66ec93 Avoid op_num = -1 in unfinished generator cleanup
Also add two tests showing that the -1 substraction in the
computation of op_num is really necessary.
2015-06-23 20:17:30 +02:00
Nikita Popov 6a4877ee17 Add test for previous commit 2015-06-20 18:38:59 +02:00