Skip to content

Conversation

@GregMage
Copy link
Contributor

@GregMage GregMage commented Sep 3, 2025

This change ensures backward compatibility while signaling to developers that they should migrate to safer, modern methods for SQL escaping.

This change ensures backward compatibility while signaling to developers that they should migrate to safer, modern methods for SQL escaping.
@mambax7 mambax7 requested a review from Copilot September 3, 2025 19:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #1564 by restoring the actual SQL escaping functionality to the deprecated addSlashes() method while maintaining the deprecation warning. The change ensures backward compatibility for legacy code that still relies on this method while encouraging migration to modern alternatives.

  • Restored SQL escaping functionality using $xoopsDB->escape() instead of returning unescaped text
  • Enhanced deprecation message to suggest specific modern alternatives
  • Added global database connection reference for escaping functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

{
$GLOBALS['xoopsLogger']->addDeprecated(__METHOD__ . ' is deprecated');
return $text;
global $xoopsDB;
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a global variable for database access without null checking could lead to fatal errors if $xoopsDB is not initialized. Add a null check and appropriate error handling before calling $xoopsDB->escape().

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mambax7 mambax7 merged commit 1f7ba15 into XOOPS:master Sep 4, 2025
4 checks passed
@mambax7
Copy link
Collaborator

mambax7 commented Sep 4, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants