rfc:this_var
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:this_var [2016/05/24 06:47] – typofix stas | rfc:this_var [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2016-05-23 | * Date: 2016-05-23 | ||
* Author: Dmitry Stogov, dmitry@zend.com | * Author: Dmitry Stogov, dmitry@zend.com | ||
- | * Status: | + | * Status: |
* First Published at: https:// | * First Published at: https:// | ||
Line 40: | Line 40: | ||
==== Disable using $this as static variable ==== | ==== Disable using $this as static variable ==== | ||
- | The following code worked in PHP 7, but will emit compilation error in PHP 7.1 | + | The following code leaded to " |
<code php> | <code php> | ||
Line 129: | Line 129: | ||
==== get_defined_vars() always doesn' | ==== get_defined_vars() always doesn' | ||
- | In PHP 7.0 and below get_defined_vars() might show or not show value of $this depending on some condition. (e.g. it was shownm | + | In PHP 7.0 and below get_defined_vars() might show or not show value of $this depending on some condition. (e.g. it was shown if we used $this variable itself, but not if it was used in a $this property reference or method call). In PHP 7.1 we won't show the value of $this in all cases. |
==== Always show true $this value in magic method __call() ==== | ==== Always show true $this value in magic method __call() ==== | ||
Line 147: | Line 147: | ||
$x = new C; | $x = new C; | ||
$x-> | $x-> | ||
+ | </ | ||
+ | |||
+ | ==== Using $this when not in object context ==== | ||
+ | |||
+ | Attempt to use $this in plain function or method now will lead to exception "Using $this when not in object context" | ||
+ | |||
+ | <code php> | ||
+ | function foo() { | ||
+ | var_dump($this); | ||
+ | // php-7.0 emitted " | ||
+ | } | ||
+ | foo(); | ||
</ | </ | ||
Line 170: | Line 182: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
The vote is a straight Yes/No vote, that requires a 2/3 majority. | The vote is a straight Yes/No vote, that requires a 2/3 majority. | ||
- | The voting | + | The voting |
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Line 178: | Line 194: | ||
After the project is implemented, | After the project is implemented, | ||
- the version(s) it was merged to | - the version(s) it was merged to | ||
- | - a link to the git commit(s) | + | - a link to the git commit |
- a link to the PHP manual entry for the feature | - a link to the PHP manual entry for the feature | ||
- | |||
- | ===== Rejected Features ===== | ||
- | Keep this updated with features that were discussed on the mail lists. |
rfc/this_var.1464072435.txt.gz · Last modified: 2017/09/22 13:28 (external edit)