Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0ac57d5
Make zend_type a 2-field struct
nikic Sep 20, 2019
8b62d66
Store pass_by_reference+is_variadic in type mask
nikic Sep 24, 2019
4a9735f
WIP Union types
nikic Sep 25, 2019
8f9c57f
Fetch unresolved classes from autoload table
nikic Oct 18, 2019
9c58da4
Fix coercion error
nikic Oct 18, 2019
48e3379
Remove special exceptions when failing to resolve prop type class
nikic Oct 18, 2019
82cfa0c
Fix the typed reference assignment logic
nikic Oct 18, 2019
c786f78
Make loading in type errors robust
nikic Oct 18, 2019
67c0d29
Add tests for redundant types
nikic Oct 18, 2019
af73a41
Tweak error messages
nikic Oct 18, 2019
4a8d0af
Handle iterable + Traversable
nikic Oct 18, 2019
471c27f
Move test files
nikic Oct 18, 2019
f681fb6
More tests
nikic Oct 18, 2019
20495e1
Check for standalone null/false
nikic Oct 18, 2019
291f52c
Use smart_str for type error
nikic Oct 18, 2019
b49438b
Proper type error for union types
nikic Oct 18, 2019
887656d
Fix weak typing logic
nikic Oct 18, 2019
24f863a
Cleanup MAY_BE_BOOL
nikic Oct 18, 2019
37b3997
Add weak typing tests
nikic Oct 18, 2019
ccf57e9
Support union types in AST printer
nikic Oct 18, 2019
c1152c9
Add strict type variant of test
nikic Oct 21, 2019
7fc7982
Implement correct incdec handling
nikic Oct 21, 2019
209f7f1
Test property references
nikic Oct 21, 2019
5213df3
Implement full property invariance check
nikic Oct 21, 2019
9e50dfe
Add ReflectionUnionType
nikic Oct 21, 2019
b0f545c
Add a class loading test
nikic Oct 21, 2019
824ed44
Remove unused variable
nikic Oct 21, 2019
f1d05a4
Try to fix ZTS build (untested)
nikic Oct 21, 2019
fad9419
Allocate property type lists on arena
nikic Oct 22, 2019
686e61f
Remove duplicate test
nikic Oct 23, 2019
e0e204d
Add test for void + class
nikic Oct 23, 2019
476adfa
Run coverage job
nikic Oct 23, 2019
e7aecad
Adjust test after property type loading changes
nikic Oct 23, 2019
716cd38
Add test for generator with multiple class return types
nikic Oct 23, 2019
7e7d240
Add test for iterable+Traversable redundancy with extra class
nikic Oct 23, 2019
6abe540
Add inheritance test and fix some related issues
nikic Oct 23, 2019
59802bb
Fixup reflection after rebase
nikic Nov 7, 2019
f85a717
Revert "Run coverage job"
nikic Nov 8, 2019
c06e6c9
Add json skipifs
nikic Nov 8, 2019
956d3a3
Extra variance test
nikic Nov 8, 2019
8bb01a8
Fix issues related to inheritance of internal union types
nikic Nov 8, 2019
3a9ff5d
Properly destroy internal property types
nikic Nov 8, 2019
edcd6d9
Fix missing cache slot increment
nikic Nov 8, 2019
b036ffa
Use goto for common code-paths
nikic Nov 8, 2019
ccbd868
Add test for iterable variance
nikic Nov 8, 2019
54f9bd4
Fix accidental whitespace change
nikic Nov 8, 2019
c443f3b
Apply cache slot fix to jit as well
nikic Nov 8, 2019
b1615d1
Fix file cache
nikic Nov 8, 2019
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
Prev Previous commit
Next Next commit
Fix missing cache slot increment
  • Loading branch information
nikic committed Nov 8, 2019
commit edcd6d959f5d786980df4bffed734f74f2ae2964
12 changes: 12 additions & 0 deletions Zend/tests/type_declarations/union_types/multiple_classes.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ $test->prop = new Z;
var_dump($test->prop);
var_dump($test->method(new Z));

if (true) {
class Y {}
}

$test->prop = new Y;
var_dump($test->prop);
var_dump($test->method(new Y));

?>
--EXPECTF--
int(42)
Expand All @@ -69,3 +77,7 @@ object(Z)#6 (0) {
}
object(Z)#4 (0) {
}
object(Y)#4 (0) {
}
object(Y)#6 (0) {
}
3 changes: 2 additions & 1 deletion Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ static zend_bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg

/* Type preference order: int -> float -> string -> bool */
if (type_mask & MAY_BE_LONG) {
/* For a int|float union type and string value,
/* For an int|float union type and string value,
* determine chosen type by is_numeric_string() semantics. */
if ((type_mask & MAY_BE_DOUBLE) && Z_TYPE_P(arg) == IS_STRING) {
zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, -1);
Expand Down Expand Up @@ -1056,6 +1056,7 @@ static zend_always_inline zend_bool zend_check_type(
ce = zend_fetch_class(ZEND_TYPE_LIST_GET_NAME(entry),
(ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
if (!ce) {
cache_slot++;
continue;
}
*cache_slot = ce;
Expand Down