Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Notice: Undefined property: stdClass::$table_name when enable database options on apache server #7028

Closed
Mai-Saad opened this issue Oct 11, 2024 · 4 comments · Fixed by #7031
Assignees
Labels
module: database priority: low Issues that can wait severity: moderate Feature isn't working as expected but has work around to get same value type: bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@Mai-Saad
Copy link
Contributor

Describe the bug
When enabling database options and saving, many entries like this appear in debug.log
[11-Oct-2024 05:14:07 UTC] PHP Notice: Undefined property: stdClass::$table_name in /home/wpquicki/mega/avada/wp-content/plugins/wp-rocket/inc/Engine/Admin/Database/OptimizationProcess.php on line 131

To Reproduce
Steps to reproduce the behavior:

  1. fresh install of WPR 3.17.1 or 3.17.0.2 on apache server i.e https://mega.wp-rocket.me/divi/
  2. Enable database options and save
  3. Check debug.log

Expected behavior
No undefined notice added to debug when enabling DB options at WPR

Desktop (please complete the following information):

Additional context
Add any other context about the problem here.

@Mai-Saad Mai-Saad added module: database priority: low Issues that can wait severity: moderate Feature isn't working as expected but has work around to get same value type: bug Indicates an unexpected problem or unintended behavior labels Oct 11, 2024
@piotrbak
Copy link
Contributor

Related:
#5572

@Khadreal
Copy link
Contributor

The query in

$query = $wpdb->get_results( "SELECT table_name, data_free FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "' and Engine <> 'InnoDB' and data_free > 0" );
is returning the column names in upper case(this is likely from the mysql/pdo setup of the server).
To solve this we can add an alias to the columns in the query.

@Khadreal
Copy link
Contributor

Created a PR here for review

@Khadreal Khadreal self-assigned this Oct 11, 2024
@Mai-Saad
Copy link
Contributor Author

Mai-Saad commented Oct 14, 2024

For testing:

@Mai-Saad Mai-Saad self-assigned this Oct 16, 2024
@piotrbak piotrbak added this to the 3.17.2 milestone Oct 17, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 17, 2024
…n enable database options on apache server (#7031)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: database priority: low Issues that can wait severity: moderate Feature isn't working as expected but has work around to get same value type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
3 participants