Repository navigation
Conversation
…nput escape() is documented as returning a string but returns integers unchanged, and quote() accepts arrays as well as scalars. The docblocks now state the actual union types. Passing anything else to quote(), such as an object without __toString() or a resource, triggers a deprecation, preparing the native types planned for 5.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
escape()is documented as returningstring, but every driver returns integer input unchanged.quote()is documented forarray|string, but scalars of every kind are passed to it everywhere. Callers and static analysis cannot rely on the declared types.DatabaseInterface::escape()andquote()docblocks (andDatabaseDriver::quote()) now state the actual types:escape(string|int|float): string|int, andquote()accepts a scalar,nullor an array of those.quote()– an object without__toString(), a resource – now triggerstrigger_deprecation('joomla/database', …). In 5.0 native parameter types will reject it. The check lives in a new protectedDatabaseDriver::checkQuoteInput(), whichSqlsrvDriver::quote()calls as well, because it overridesquote()for scalars.No behaviour changes for supported input.
Testing Instructions
New
Tests/Sqlite/QuoteDeprecationTest.php(no server needed;vendor/bin/phpunit Tests/Sqlite/QuoteDeprecationTest.php): strings, integers and arrays raise nothing, and a resource raises one deprecation. It fails before the change.Documentation Changes Required
None on
4.x-dev. #373'sdocs/overview.mdanddocs/parameters-and-escaping.md("escape()returns mixed types") already describe the int return. Once both PRs are merged, they could add that non-scalar input toquote()is deprecated. The native types for 5.0 are not part of this PR.🤖 Generated with Claude Code