- Issue created by @andypost
- Status changed to Needs review
over 1 year ago 8:27pm 12 July 2023 - last update
over 1 year ago 29,811 pass - 🇫🇷France andypost
It should wait for the first beta of 8.3 (in 1 week) but suppose following patch
- 🇫🇷France andypost
The
ReflectionMethod
deprecations should be delayed until 8.4 so version check could be added. Before that it makes no sense to slowdown the method - 🇫🇷France andypost
+++ b/core/lib/Drupal/Component/Plugin/PluginManagerBase.php @@ -125,7 +125,7 @@ protected function handlePluginNotFound($plugin_id, array $configuration) { - throw new \BadMethodCallException(get_class() . '::getFallbackPluginId() not implemented.'); + throw new \BadMethodCallException(self::class . '::getFallbackPluginId() not implemented.');
probably it could use separate issue to improve the message like self::class ... is not implemented in ... static::class
- 🇺🇸United States neclimdul Houston, TX
📌 Introduce CallableResolver to help standardise the DX and error handling for callbacks across various subsystems Fixed added the ReflectionMethod call to 11.x so its not even in php's audit. Neat!
> it makes no sense to slowdown the method
Since we bypassed the audit, should we raise that slowdown concern with the PHP mailing list? I expect with symfony, laminas, and nette in their list some form of "if you expect reflection to be fast you're doing it wrong" response which is probably accurate but maybe.Sample implementation post deprecation for reference:
// Optimized for arrays over strings. if (is_array($callable)) { return new \ReflectionMethod($callable[0], $callable[1]); } if (is_string($callable) && str_contains($callable, '::')) { $callable = explode('::', $callable, 2); return new \ReflectionMethod($callable[0], $callable[1]); } return new \ReflectionFunction($callable);
+++ b/core/lib/Drupal/Component/Plugin/PluginManagerBase.php @@ -125,7 +125,7 @@ protected function handlePluginNotFound($plugin_id, array $configuration) { - throw new \BadMethodCallException(get_class() . '::getFallbackPluginId() not implemented.'); + throw new \BadMethodCallException(self::class . '::getFallbackPluginId() not implemented.');
Don't we need static:: to get that sweet LSB to make it actually useful? Interesting that this passed testing...
- 🇫🇷France andypost
Don't we need static::
Using Google's Bard the suggested change is
protected function getFallbackPluginId($plugin_id, array $configuration = []) { throw new \BadMethodCallException(static::class . '::getFallbackPluginId() not implemented. This method must be implemented in order to use the fallback plugin.'); }
- 🇫🇷France andypost
Interesting that this passed testing...
Because there's no coverage for the method( Sounds like needs separate issue
- 🇫🇷France andypost
One more RFC landed https://wiki.php.net/rfc/saner-inc-dec-operators
- Status changed to RTBC
over 1 year ago 9:51pm 17 July 2023 - 🇺🇸United States smustgrave
Seems like a simple enough change.
Feel this conversation was just had about sections that never had testing, if they belong in follow ups or not.
Think with a change this small moving the testing to a follow up wouldn't be a problem.
Maybe we open a Meta for extended test coverage for items that must be included in D11. So pushing testing to follow ups don't just hang there.
May be a thread on slack conversation though. - last update
over 1 year ago 29,815 pass - 🇫🇷France andypost
This week the beta 1 will out and I bet we'll need to split assertion and new deprecations
- Status changed to Needs work
over 1 year ago 11:33am 18 July 2023 - 🇬🇧United Kingdom catch
The issue summary appears to be talking about more changes than the patch. The changes in the patch look fine, but I don't understand the mismatch.
- 🇫🇷France andypost
Filed separate issue for assertions 📌 Fix deprecated assert_options() function usage for PHP 8.3 Needs review as they are blocking linker now
Checking on beta1 and found that
/var/www/html/web $ php -v PHP 8.3.0beta1 (cli) (built: Jul 18 2023 23:53:10) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.0-dev, Copyright (c) Zend Technologies with Zend OPcache v8.3.0beta1, Copyright (c), by Zend Technologies with Xdebug v3.3.0-dev, Copyright (c) 2002-2022, by Derick Rethans
Reflection method is not deprecated yet but I added a fix (#5 suggested a bit different from the RFC)
the newcreateFromMethodName()
method is added/var/www/html/web $ php -r 'class aa { function b() {}}; var_dump(new ReflectionMethod(...explode("::", "aa::b")));' object(ReflectionMethod)#1 (2) { ["name"]=> string(1) "b" ["class"]=> string(2) "aa" } /var/www/html/web $ php -r 'class aa { function b() {}}; var_dump(new ReflectionMethod("aa::b"));' object(ReflectionMethod)#1 (2) { ["name"]=> string(1) "b" ["class"]=> string(2) "aa" } /var/www/html/web $ php -r 'class aa { function b() {}}; var_dump( ReflectionMethod::createFromMethodName("aa::b"));' object(ReflectionMethod)#1 (2) { ["name"]=> string(1) "b" ["class"]=> string(2) "aa" }
setValue()
now throws/var/www/html/web $ php -r 'class aa { public static $a; }; var_dump((new ReflectionProperty("aa", "a"))->setValue(null, null));' NULL /var/www/html/web $ php -r 'class aa { public static $a; }; var_dump((new ReflectionProperty("aa", "a"))->setValue(null));' PHP Deprecated: Calling ReflectionProperty::setValue() with a single argument is deprecated in Command line code on line 1 Deprecated: Calling ReflectionProperty::setValue() with a single argument is deprecated in Command line code on line 1 NULL
get_class()
throws, so replaced withstatic::
as implementation should live in called class/var/www/html/web $ php -r 'class aa { static function b() { var_dump(get_class()); } } aa::b();' PHP Deprecated: Calling get_class() without arguments is deprecated in Command line code on line 1 Deprecated: Calling get_class() without arguments is deprecated in Command line code on line 1 string(2) "aa"
- Status changed to Needs review
over 1 year ago 9:42pm 19 July 2023 - last update
over 1 year ago 29,819 pass, 1 fail - last update
over 1 year ago Custom Commands Failed - 🇫🇷France andypost
+++ b/core/lib/Drupal/Component/Utility/ArgumentsResolver.php @@ -123,7 +123,7 @@ protected function getReflector(callable $callable) { - return new \ReflectionMethod($callable); + return new \ReflectionMethod(...explode('::', $callable));
asked about it https://github.com/php/php-src/pull/11703#discussion_r1268709319
The last submitted patch, 12: 3374223-12.patch, failed testing. View results →
- 🇫🇷France andypost
+++ b/core/lib/Drupal/Component/Plugin/PluginManagerBase.php @@ -125,7 +125,7 @@ protected function handlePluginNotFound($plugin_id, array $configuration) { - throw new \BadMethodCallException(get_class() . '::getFallbackPluginId() not implemented.'); + throw new \BadMethodCallException(static::class . '::getFallbackPluginId() not implemented.');
this message is not covered with test as no test failed in #3375693-5: Fix deprecated assert_options() function usage for PHP 8.3 →
- Status changed to RTBC
over 1 year ago 5:41pm 20 July 2023 - last update
over 1 year ago 29,823 pass, 1 fail - 🇫🇷France andypost
Removed hunk for
ArgumentsResolver
because misread RFC https://github.com/php/php-src/pull/11703#discussion_r1269355095This RFC proposes to add the following new factory method in PHP 8.3 and deprecate the second constructor signature in PHP 8.4. Finally, the deprecated signature would become unsupported in either PHP 9.0 or 10.0
The last submitted patch, 19: 3374223-19.patch, failed testing. View results →
- last update
over 1 year ago 29,824 pass, 1 fail The last submitted patch, 19: 3374223-19.patch, failed testing. View results →
- last update
over 1 year ago 29,827 pass - last update
over 1 year ago 29,879 pass - last update
over 1 year ago 29,879 pass -
longwave →
committed d12b95d2 on 10.1.x
Issue #3374223 by andypost, smustgrave, neclimdul: Fix deprecated...
-
longwave →
committed d12b95d2 on 10.1.x
-
longwave →
committed 4912be31 on 11.x
Issue #3374223 by andypost, smustgrave, neclimdul: Fix deprecated...
-
longwave →
committed 4912be31 on 11.x
- Status changed to Fixed
over 1 year ago 4:11pm 25 July 2023 - 🇬🇧United Kingdom longwave UK
Backported to 10.1.x as a low risk bug fix to help keep the branches in sync.
Committed and pushed 4912be319e to 11.x and d12b95d2c8 to 10.1.x. Thanks!
- 🇫🇷France andypost
Tests revealed 2 more #3375693-16: Fix deprecated assert_options() function usage for PHP 8.3 →
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
about 1 year ago 10:57am 3 October 2023 - 🇫🇷France andypost
Filed follow-up 📌 Fix deprecated ReflectionProperty::setValue() usage for PHP 8.3 Needs review
- 🇮🇹Italy kopeboy Milan
There's a get_class deprecation in Core/Render as well, see 🐛 Calling get_class() without arguments is deprecated in Drupal\Core\Render\ElementInfoManager Active