[wp-trac] [WordPress Trac] #58876: Calling get_class() without arguments is deprecated in class-wp-http.php

WordPress Trac noreply at wordpress.org
Mon Jul 24 13:27:20 UTC 2023


#58876: Calling get_class() without arguments is deprecated in class-wp-http.php
-----------------------------+---------------------
 Reporter:  ipajen           |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  6.4
Component:  HTTP API         |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  php83 has-patch  |     Focuses:
-----------------------------+---------------------

Comment (by jrf):

 Replying to [comment:7 SergeyBiryukov]:
 > Replying to [comment:6 jrf]:
 > > ... it will be deprecated in PHP 8.3.
 > >
 > > PHP 7.2
 [https://www.php.net/manual/en/migration72.incompatible.php#migration72.incompatible
 .no-null-to-get_class introduced a warning] about `get_class(null)`
 though, which became a fatal error in PHP 8.0. You might be confused with
 that ?
 >
 > I was confused for a bit here too, because calling `get_class()` without
 an argument
 [https://wiki.php.net/rfc/deprecations_php_8_1#get_class_get_parent_class_and_get_called_class_without_argument
 was proposed for deprecation in PHP 8.1], but apparently did not get
 enough votes (50/50 split) at the time.
 >
 > I see now that there is a
 [https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#get_class_and_get_parent_class
 newer proposal] as part of deprecating functions with overloaded
 signatures, which did get accepted in PHP 8.3. Thanks for the correction
 :)

 I'd nearly forgotten about that PHP 8.1 vote (as it didn't pass). I try to
 purge failed RFCs from my memory as soon as I can as otherwise they just
 confuse me ;-)

 If we're talking failed RFCs, `get_called_class()` was up for
 [https://wiki.php.net/rfc/deprecations_php_7_4#changelog deprecation in
 7.4] (but got pulled before it went to vote) and there has been discussion
 about `get_class()` on an off for years now. I think they finally managed
 to get it to pass now as enough time has passed since the introduction of
 the `::class` syntax that the bc-break isn't significant enough anymore
 and what with named parameters not being supported with overloaded
 signatures, they managed to sway the 2/3s needed for the vote.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58876#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list