[wp-trac] [WordPress Trac] #57350: The trunk of WordPress Core may stops CI of plugin developer by trigger_error: E_USER_DEPRECATED "The PSR-0 `Requests_...` class names in the Request library are deprecated."

WordPress Trac noreply at wordpress.org
Sun Dec 18 11:35:43 UTC 2022


#57350: The trunk of WordPress Core may stops CI of plugin developer by
trigger_error: E_USER_DEPRECATED "The PSR-0 `Requests_...` class names in
the Request library are deprecated."
--------------------------+-----------------------------
 Reporter:  yshinoda      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When I run PHPUnit with current trunk version of WordPress Core, our
 PHPUnit failed due to Error with following error message:
 > Deprecated: The PSR-0 `Requests_...` class names in the Request library
 are deprecated.
 > Switch to the PSR-4 `WpOrg\Requests\...` class names at your earliest
 convenience.
 > in /usr/src/wordpress/wp-includes/Requests/src/Autoload.php on line 171.

 This is caused when instantiate \Requests_Response class to mock
 WP_HTTP_Requests_Response in test case.

 cf.
 - Job #55.2 - yukihiko-shinoda/staticpress2019 - Travis CI
   https://app.travis-ci.com/github/yukihiko-
 shinoda/staticpress2019/jobs/591451062

 I confirmed it by updatting arround line 171 of Autoload.php:

 {{{#!php
 <?php
                                         trigger_error(
                                                 'The PSR-0 `Requests_...`
 class names in the Request library are deprecated.'
                                                 . ' Switch to the PSR-4
 `WpOrg\Requests\...` class names at your earliest convenience.',
                                                 E_USER_DEPRECATED
                                         );
 }}}

 🔽

 {{{#!php
 <?php
                                         trigger_error(
                                                 'The PSR-0 `Requests_...`
 class names in the Request library are deprecated.'
                                                 . ' Switch to the PSR-4
 `WpOrg\Requests\...` class names at your earliest convenience. ' .
 $class_name,
                                                 E_USER_DEPRECATED
                                         );
 }}}


 This doesn't happen with WordPress 6.1.1 and lesser and I already ignored
 by using set_error_handler() with empty callback function, so, it's not so
 hurry for me.

 I think that the class: Requests_Response is published to developer and
 instantiating it in PHPUnit is no ploblem:
 - Requests_Response | Class | WordPress Developer Resources
   https://developer.wordpress.org/reference/classes/requests_response/

 Therefore, I think that it should fix on the side of WordPress Core since
 this error occurs even if the case when plugin developers are testing, and
 their CI stops.

 Plugin developers are using also trunk version in CI now:
 - scaffold-command/plugin-travis.mustache at v2.0.18 · wp-cli/scaffold-
 command
   https://github.com/wp-cli/scaffold-command/blob/v2.0.18/templates
 /plugin-travis.mustache#L33
 - scaffold-command/Scaffold_Command.php at v2.0.18 · wp-cli/scaffold-
 command
   https://github.com/wp-cli/scaffold-
 command/blob/v2.0.18/src/Scaffold_Command.php#L881

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57350>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list