-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate autovivification on false #7131
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
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d0cb145
Tyson's prototype
kamil-tekiela 2453adc
fix test case
kamil-tekiela 3badc5c
This one is redundant
kamil-tekiela 538ede3
Add deprecation notices to test case
kamil-tekiela 710976e
Unneeded?
kamil-tekiela 274eb70
Add more tests
kamil-tekiela 71eb2f1
Update JIT test case
kamil-tekiela 613d737
Added Nikita's suggestion
kamil-tekiela 1590246
Update Nikita's test
kamil-tekiela 6cebe70
Unify error messages
kamil-tekiela ca0d034
Handle autovivification warning in may_throw
nikic bcd43d4
Add JIT support
nikic 827a9df
Handle one more case in zend_jit_prepare_assign_dim_ref()
nikic 8c2c5d9
Fix may_throw and indirect_reference in tracing JIT
nikic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
--TEST-- | ||
Autovivification of false to array | ||
--FILE-- | ||
<?php | ||
|
||
// control | ||
$undef[] = 42; | ||
|
||
// control | ||
$null = null; | ||
$null[] = 42; | ||
|
||
// control | ||
$false = false; | ||
$false = [42]; | ||
|
||
print "[001]\n"; | ||
$false = false; | ||
$false[] = 42; | ||
|
||
print "[002]\n"; | ||
$ref = false; | ||
$ref2 = &$ref; | ||
$ref2[] = 42; | ||
|
||
echo "\nFunction\n"; | ||
function ffalse(bool $a, ?bool $b, &$c, ...$d) { | ||
print "[003]\n"; | ||
$a[] = 42; | ||
print "[004]\n"; | ||
$b[] = 42; | ||
print "[005]\n"; | ||
$c[] = 42; | ||
print "[006]\n"; | ||
$d[0][] = 42; | ||
} | ||
$ref = false; | ||
ffalse(false, false, $ref, false); | ||
|
||
echo "\nProperties\n"; | ||
class Cfalse { | ||
public $def; | ||
private $untyped = false; | ||
static private $st = false; | ||
static private $st2 = false; | ||
static private $st3 = false; | ||
public function __construct(public $pu, private $pr = false) { | ||
print "[007]\n"; | ||
$this->def = false; | ||
$this->def[] = 42; | ||
print "[008]\n"; | ||
$this->untyped[] = 42; | ||
print "[009]\n"; | ||
self::$st[] = 42; | ||
print "[010]\n"; | ||
static::$st2[] = 42; | ||
print "[011]\n"; | ||
$this::$st3[] = 42; | ||
print "[012]\n"; | ||
$this->pu[] = 42; | ||
print "[013]\n"; | ||
$this->pr[] = 42; | ||
} | ||
} | ||
new Cfalse(false, false); | ||
|
||
echo "\nDestructuring\n"; | ||
|
||
print "[014]\n"; | ||
$add = false; | ||
foreach ([42] as $add[]); | ||
|
||
print "[015]\n"; | ||
$arr = false; | ||
[$arr[]] = [42]; | ||
|
||
print "[016]\n"; | ||
$arr = [ 0 => [ 0 => false ] ]; | ||
$arr[0][0][0][] = 42; | ||
|
||
print "[017]\n"; | ||
$false = false; | ||
$r42 = 42; | ||
$false[] &= $r42; | ||
|
||
$false = false; | ||
$false2 = false; | ||
$false3 = false; | ||
function &g(){ | ||
print "[018]\n"; | ||
global $false; | ||
$false[] = 42; | ||
|
||
$var1 = false; | ||
$GLOBALS["false2"] =& $var1; | ||
|
||
print "[019]\n"; | ||
$GLOBALS["false3"][] = 42; | ||
|
||
print "[020]\n"; | ||
static $f2 = false; | ||
return $f2; | ||
} | ||
|
||
$false = &g(); | ||
$false[] = 42; | ||
print "[021]\n"; | ||
$false2[] = 42; | ||
|
||
print "[022]\n"; | ||
$a = false; | ||
unset($a[0][0]); | ||
|
||
print "[023]\n"; | ||
$a = false; | ||
unset($a[0]); | ||
|
||
?> | ||
--EXPECTF-- | ||
[001] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[002] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
|
||
Function | ||
[003] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[004] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[005] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[006] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
|
||
Properties | ||
[007] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[008] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[009] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[010] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[011] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[012] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[013] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
|
||
Destructuring | ||
[014] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[015] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[016] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[017] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[018] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[019] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[020] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[021] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[022] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s | ||
[023] | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.