Doc #79937 [NEW]: I think the function call is not stronger than the static property operator
| From: | fy dot kenny at gmail dot com | Date: | Thu, 06 Aug 2020 10:23:10 +0000 |
| Subject: | Doc #79937 [NEW]: I think the function call is not stronger than the static property operator | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-17748@lists.php.net to get a copy of this message | ||
From: fy dot kenny at gmail dot com
Operating system: win10
PHP version: 7.4.8
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:I think the function call is not stronger than the static property operator
Description:
------------
---
From manual page: https://php.net/functions.variable-functions
---
When calling static methods, the function call is stronger than the
static property operator:
Example #3 Variable method example with static properties
<?php
class Foo
{
static $variable = 'static property';
static function Variable()
{
echo 'Method Variable called';
}
}
echo Foo::$variable; // This prints 'static property'. It does need a
$variable in this scope.
$variable = "Variable";
Foo::$variable(); // This calls $foo->Variable() reading $variable in
this scope.
?>
Test script:
---------------
<?php
class Foo
{
static $variable = 'static property';
static function variable()
{
echo 'method variable called';
}
}
$variable = "variable";
echo "<br>" . Foo::$variable; // This prints 'static property'. It does
need a $variable in this scope.
// Foo::$variable; == Foo::$variable This is not appended dynamic static
variable
echo "<br>" . Foo::$$variable;
// Foo::$$variable; == Foo::$variable This is appended dynamic static
variable
echo "<br>" . Foo::$variable(); // This calls $foo->Variable() reading
$variable in this scope.
// Foo::$variable(); == Foo::variable()
?>
Expected result:
----------------
static property
static property
method variable called
Actual result:
--------------
static property
static property
method variable called
--
Edit bug report at https://bugs.php.net/bug.php?id=79937&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79937&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79937&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79937&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79937&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79937&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79937&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79937&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79937&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79937&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79937&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79937&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79937&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79937&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79937&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79937&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79937&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79937&r=mysqlcfg