[wp-trac] [WordPress Trac] #49143: Deprecated constructor warning in Blogger Importer
WordPress Trac
noreply at wordpress.org
Fri Oct 14 19:05:05 UTC 2022
#49143: Deprecated constructor warning in Blogger Importer
-------------------------------------------------+-------------------------
Reporter: leemon | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone:
| WordPress.org
Component: Import | Version: 5.3.2
Severity: normal | Resolution:
Keywords: has-patch needs-testing has- | Focuses:
testing-info |
-------------------------------------------------+-------------------------
Changes (by ironprogrammer):
* keywords: => has-patch needs-testing has-testing-info
Comment:
I've submitted [https://github.com/WordPress/blogger-importer/pull/3
blogger-importer PR #3] to resolve this PHP 7 deprecation. (This repo is
separate from `wordpress-develop` so does not appear in [#section-pr]
above.)
=== Background
- PHP 5 [https://www.php.net/manual/en/language.oop5.decon.php
introduced the `__construct()` method], but continued to allow "old style"
PHP 4 constructors.
- PHP 7 [https://wiki.php.net/rfc/remove_php4_constructors began to emit
`E_DEPRECATED` whenever a PHP 4 constructor was defined].
- PHP 8 stops emitting `E_DEPRECATED`, and the same named methods will
not be recognized as constructors.
== Testing Instructions
=== Steps to Test
1. Ensure site is running PHP 7, where this deprecation applies.
2. In `wp-config.php`, make sure that debugging is enabled (e.g. `define(
'WP_DEBUG', true );` and `define( 'WP_DEBUG_LOG', true );`).
3. Install and activate the [https://wordpress.org/plugins/blogger-
importer/ Blogger Importer] plugin.
4. 🐞 After activation, note the deprecation logged to `wp-
content/debug.log`.
5. Deactivate the plugin.
6. 🩹 Apply [https://github.com/WordPress/blogger-importer/pull/3.diff the
patch]. Or as an alternative, you can replace the plugin's `blogger-
importer.php` file with the one from the following zip:
[https://github.com/ironprogrammer/blogger-importer/archive/refs/heads
/same-name-class-constructor.zip same-name-class-constructor.zip] (this is
the working branch for [https://github.com/WordPress/blogger-
importer/pull/3 PR #3]).
7. Activate the updated plugin.
8. ✅ Note that the deprecation notice is no longer logged.
=== Expected Results
- ✅ The deprecation notice is not logged after patching.
''(I'd like to give a hat tip to @SergeyBiryukov, @dd32, and @vishnugopal
for [https://meta.trac.wordpress.org/ticket/5550#comment:4 moving the
current importers into GitHub], which should help ease future maintenance
efforts like this 🙌🏻)''
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49143#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list