Skip to content

fix: replace deprecated mysql_* with mysqli_* in upgrade scripts#771

Open
Frankli9986 wants to merge 1 commit into
opencats:masterfrom
Frankli9986:fix/572-mysql-to-mysqli
Open

fix: replace deprecated mysql_* with mysqli_* in upgrade scripts#771
Frankli9986 wants to merge 1 commit into
opencats:masterfrom
Frankli9986:fix/572-mysql-to-mysqli

Conversation

@Frankli9986
Copy link
Copy Markdown

Problem

Fixes #572

When installing OpenCATS with demo content on PHP 7+, the installation fails because database upgrade scripts still use the deprecated mysql_* functions, which were removed in PHP 7.0.

Changes

  • mysql_real_escape_string()mysqli_real_escape_string() (2 occurrences)
  • mysql_fetch_row()mysqli_fetch_row() (1 occurrence)
  • Added global \; where needed to ensure the mysqli connection resource is available in the upgrade script context.

Files Modified

  • modules/install/Schema.php

Testing

  • Verified that no other mysql_* function calls remain in the codebase (only these 3 were found in upgrade script strings).
  • The fix aligns with the existing mysqli_* usage already present in modules/install/ajax/ui.php.

Related Issue

…ipts

Fixes opencats#572 where demo content installation fails on PHP 7+
because upgrade scripts still used removed mysql_* functions.

Changes:
- mysql_real_escape_string() -> mysqli_real_escape_string()
- mysql_fetch_row() -> mysqli_fetch_row()
- Added global \ where needed for mysqli context
@anonymoususer72041
Copy link
Copy Markdown
Contributor

Hi @Frankli9986, thanks for looking into this. This looks closely related to and partly overlapping with my existing PR #765.

From what I can see, this PR fixes the same obsolete mysql_* calls in modules/install/Schema.php that are already covered in #765. The main difference is that #771 replaces them with direct mysqli_* calls, while #765 routes them through the existing DatabaseConnection API where possible. In particular, #765 also touches the same install schema areas and includes a broader cleanup of legacy database result handling around install, backup and control panel code.

I think it would be better to consolidate the work in one PR rather than having two separate fixes for the same issue. You are very welcome to join #765 and submit suggestions there, especially because there are small differences between both approaches that may still be useful to discuss or incorporate.

I also started a discussion in the comments of #765 about a few open questions before merging, including whether changing previous migrations is the right approach. I would be happy if you joined that discussion as well.

@anonymoususer72041 anonymoususer72041 changed the title fix(install): replace deprecated mysql_* with mysqli_* in upgrade scripts fix: replace deprecated mysql_* with mysqli_* in upgrade scripts May 5, 2026
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.

Demo content doesn't work

2 participants