Fix PHP 8.5 deprecation notices - #327
Conversation
- Use add_query_arg( [] ) instead of add_query_arg( null, null ) to get
the current request URI. Both return the same, but the latter uses null
as an array offset, which is deprecated since PHP 8.5 ("Using null as an
array offset is deprecated" in wp-includes/functions.php), shown on every
page with a search form when Search Queries tracking is enabled.
- Only call curl_close() on PHP < 8.0 in the bundled Guzzle, like Guzzle
7.10 does: it has had no effect since PHP 8.0 and is deprecated since
PHP 8.5, which showed on every API request.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe cURL handlers now call ChangescURL handle cleanup
Request URI calls
Priority: ⬇️ Low Change: Bug fix Merge Risk: ⚪ Minimal · up to The changes preserve request URI behavior and follow PHP-version-specific cURL cleanup; no material merge risk remains. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The reviewed changes appear to preserve the existing page-exclusion, search-referrer, and request-cleanup flows without adding an exposed interface. Risk remains low rather than minimal because runtime equivalence has not been fully verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
src/Client/lib/Lib is generated by Mozart, so hand edits are overwritten on the next run. The curl_close() deprecation is fixed by updating Guzzle instead, in a separate PR.
Fixes PHP 8.5 deprecation notices, reported on a site running the 2.6.2 beta:
Cause
add_query_arg( null, null )is used to get the current request URI. Internally WordPress then does$qs[ null ] = null, which PHP 8.5 deprecates. It's called:Search::get_referrer(), on every page with a search form when Search Queries tracking is enabled;InitOptions::get_current_request(), on every page as soon as Excluded Pages are configured.This isn't a regression in 2.6.2: 2.6.1 shows the same notice on PHP 8.5.
Changes
add_query_arg( [] )instead. It returns the same request URI, without the null offset.The bundled Guzzle's
curl_close()deprecation on PHP 8.5 is left for a separate PR that updates Guzzle.Testing
display_errorson:developThe
search_sourcereferrer still contains the current URL (including its query string), excluded pages are still excluded, and saving the settings works.