rfc:notice-for-non-valid-array-container
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:notice-for-non-valid-array-container [2016/08/10 22:23] – bp1222 | rfc:notice-for-non-valid-array-container [2016/08/24 14:59] – bp1222 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: E_WARNING for invalid container read array-access ====== | ====== PHP RFC: E_WARNING for invalid container read array-access ====== | ||
- | * Version: | + | * Version: |
- | * Date: 2016-08-10 | + | * Date: 2016-08-16 |
* Author: David Walker (dave@mudsite.com) | * Author: David Walker (dave@mudsite.com) | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 35: | Line 35: | ||
This RFC aims to limit the quantity of warnings on a single line, however, large projects may have many locations that might need variable type checking around unknown container access. | This RFC aims to limit the quantity of warnings on a single line, however, large projects may have many locations that might need variable type checking around unknown container access. | ||
+ | |||
+ | ===== Performance Impact ===== | ||
+ | Test run was: | ||
+ | <file php> | ||
+ | <?php | ||
+ | $a = false; | ||
+ | for ($i = 0; $i < 1000000; $i++) { | ||
+ | $a[0]; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Execution Time (DualCore 3ghz; 2g ram) | ||
+ | * Current Master : ~0.09s (~489m operations) | ||
+ | * Current Master w/RFC Displaying Warnings: ~33.25s (~7.799b operations) | ||
+ | * Current Master w/RFC Hiding Warnings: ~0.82s (~4.091b operations) | ||
+ | |||
+ | We can see there is a significant increase in operations on huge loads. | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 49: | Line 66: | ||
No Opcodes are touched with this RFC | No Opcodes are touched with this RFC | ||
- | ===== Open Issues ===== | + | ==== To Documentation |
+ | It would probably be nice to document the E_WARNING behavior for accessing on non-array types in the Array Documentation either [[http:// | ||
+ | |||
+ | ===== Discussed | ||
+ | ==== E_NOTICE or E_WARNING ==== | ||
+ | I began this RFC with the implementation raising an E_NOTICE. | ||
==== NULL Identity ==== | ==== NULL Identity ==== | ||
Should NULL variables be treated as a special identity so that accessing array on a null just returns null. | Should NULL variables be treated as a special identity so that accessing array on a null just returns null. | ||
Line 60: | Line 83: | ||
* '' | * '' | ||
- | Per discussion on the [[https:// | + | Per discussion on the [[https:// |
==== Reference Assignment Access ==== | ==== Reference Assignment Access ==== | ||
Line 68: | Line 91: | ||
$value = null; | $value = null; | ||
$dim = 0; | $dim = 0; | ||
- | $new_val =& $null[$dim]; | + | $new_val =& $value[$dim]; |
- | var_dump($null); | + | var_dump($value); |
/* | /* | ||
| | ||
Line 79: | Line 102: | ||
</ | </ | ||
- | In the above example the variable '' | + | In the above example the variable '' |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | No syntax is changed, a vote of 50%+1 will be necessary | + | Requires 2/3 Vote |
+ | <doodle title=" | ||
+ | * Yes | ||
+ | | ||
+ | </ | ||
+ | Vote Start: 2016-08-16 15:36 | ||
+ | |||
+ | Vote End: | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/notice-for-non-valid-array-container.txt · Last modified: 2019/07/10 12:20 by nikic