#56620 closed defect (bug) (fixed)
Deprecated: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated
Reported by: | imadarshakshat | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | minor | Version: | 6.1 |
Component: | Formatting | Keywords: | php81 has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
Deprecated: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated in D:\xampp\htdocs\wp\wp-includes\class-wp-theme-json.php on line 1762
Change History (17)
This ticket was mentioned in PR #3311 on WordPress/wordpress-develop by creedally-dev.
2 years ago
#2
- Keywords has-patch added
This ticket was mentioned in Slack in #core by adarshakshatcreedally. View the logs.
2 years ago
#4
@
2 years ago
- Milestone changed from Awaiting Review to 6.1
- Version set to trunk
Hi there, welcome to WordPress Trac! Thanks for the ticket.
Moving to 6.1, as this is a new issue that causes 35 errors when running tests on PHP 8.1, as seen in a recent test run.
Introduced in [54162], as the corresponding test run has 91 errors, while the one just before has 56 errors.
#5
@
2 years ago
Yes, as @SergeyBiryukov already said, this one is on our radar and a patch is being worked on (by @antonvlasenko).
Also note that I've looked at the patch in GH PR #3311 and I don't think that's the right fix.
This ticket was mentioned in Slack in #core-test by adarshakshatcreedally. View the logs.
2 years ago
This ticket was mentioned in PR #3307 on WordPress/wordpress-develop by anton-vlasenko.
2 years ago
#7
- Keywords has-unit-tests added
Trac ticket: https://core.trac.wordpress.org/ticket/56620
#8
@
2 years ago
For the record, the backtrace of these errors is along the lines of the below:
`1) Tests_Blocks_Editor::test_get_block_editor_settings_theme_json_settings strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated /var/www/src/wp-includes/class-wp-theme-json.php:1762 /var/www/src/wp-includes/class-wp-theme-json.php:1649 /var/www/src/wp-includes/class-wp-theme-json.php:2074 /var/www/src/wp-includes/class-wp-theme-json.php:1010 /var/www/src/wp-includes/class-wp-theme-json.php:906 /var/www/src/wp-includes/global-styles-and-settings.php:140 /var/www/src/wp-includes/block-editor.php:421 /var/www/tests/phpunit/tests/blocks/editor.php:388 /var/www/vendor/bin/phpunit:123 22) Tests_Theme_wpThemeJson::test_remove_insecure_properties_removes_unsafe_styles_sub_properties strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated /var/www/src/wp-includes/class-wp-theme-json.php:1762 /var/www/src/wp-includes/class-wp-theme-json.php:1649 /var/www/src/wp-includes/class-wp-theme-json.php:2633 /var/www/src/wp-includes/class-wp-theme-json.php:2512 /var/www/tests/phpunit/tests/theme/wpThemeJson.php:2011 /var/www/vendor/bin/phpunit:123
2 years ago
#9
@anton-vlasenko Please open a separate PR for each individual fix using atomic commits, i.e. fix + associated tests in one commit.
This PR is trying to do too much, which makes it unclear what is being addressed by it and why.
#10
@
2 years ago
- Keywords commit added
Reviewed the open PR by @anton-vlasenko and safe for some minor tidying up, GH PR #3307 is ready for commit.
anton-vlasenko commented on PR #3307:
2 years ago
#11
Thanks for setting up this patch & the associated test @anton-vlasenko !
All looks good and I have confirmed that the test would throw an error on PHP 8.1 without the patch and no longer does so with the patch.
I just left some small remarks about the test itself, mostly just nitpicks.
Thanks for the review, @jrfnl! I really appreciate it.
I've fixed the issues you mentioned.
#12
@
2 years ago
Testing Instructions
Steps to test https://github.com/WordPress/wordpress-develop/pull/3307:
- Go to https://github.com/WordPress/wordpress-develop/pull/3307.
- Make sure that the unit tests pass.
- Check the logs for the
PHPUnit Tests / 8.1 on ubuntu-latest (pull_request)
CI action, e.g.: https://github.com/WordPress/wordpress-develop/actions/runs/3153793903/jobs/5130675552 - Open the
Run PHPUnit tests
pane. - Make sure you see no
strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated
errors in the log.
anton-vlasenko commented on PR #3307:
2 years ago
#13
@anton-vlasenko Please open a separate PR for each individual fix using atomic commits, i.e. fix + associated tests in one commit.
This PR is trying to do too much, which makes it unclear what is being addressed by it and why.
You are absolutely right. I've removed unrelated commits from this PR.
These unrelated commits were supposed to fix the esc_url()
tests. I cannot reproduce these errors anymore (on the latest trunk).
2 years ago
#14
@anton-vlasenko Please open a separate PR for each individual fix using atomic commits, i.e. fix + associated tests in one commit.
This PR is trying to do too much, which makes it unclear what is being addressed by it and why.
You are absolutely right. I've removed unrelated commits from this PR. These unrelated commits were supposed to fix the
esc_url()
tests. I cannot reproduce these errors anymore (on the latest trunk).
I suspect that _might_ be related to two closely related patches for PHP 8.1 which got committed yesterday ([54349] and [54351]) (or some other PHP 8.1 patches committed earlier this week, so many moving parts... :joy:)
SergeyBiryukov commented on PR #3307:
2 years ago
#17
Thanks for the PR! Merged in r54362.
Fixed Deprecated Warning Passing null to parameter #1 in get_property_value()
Trac ticket: Ticket 56620