Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Update wpsnapshots image to use PHP 7.4/8.0 #28

Closed
1 task done
kirtangajjar opened this issue Jul 4, 2023 · 1 comment
Closed
1 task done

Update wpsnapshots image to use PHP 7.4/8.0 #28

kirtangajjar opened this issue Jul 4, 2023 · 1 comment
Labels

Comments

@kirtangajjar
Copy link
Member

Describe the bug

https://hub.docker.com/r/10up/wpsnapshots is using php7.3 internally. This causes issues while running wpsnapshot pull command if the project contains php7.4+ code. This is because wpnsapshot includes wp-settings.php file as a part of testing MySQL connection.

Steps to Reproduce

  1. Create a fresh new site with 10uplocaldocker
  2. Create a snapshot and push it
  3. Clone vip-go-mu-plugins in wp-content using git clone [email protected]:Automattic/vip-go-mu-plugins-built.git mu-plugins.
  4. Pull the snapshot.
  5. You'll see an error like this:
✔ Global services are running...
✔ MariaDB has started...
Security Warning: WP Snapshots creates copies of your codebase and database. This could result in data retention policy issues, please exercise extreme caution when using production data.
This snapshot exists locally. Do you want to overwrite it with the remote copy? (y/N) y
Getting snapshot information...
Downloading snapshot (18.2 MB)...
<!DOCTYPE html>
<html lang="en-US">
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width">
                <meta name='robots' content='max-image-preview:large, noindex, follow' />
        <title>WordPress &rsaquo; Error</title>
        <style type="text/css">
                html {
                        background: #f1f1f1;
                }
                body {
                        background: #fff;
                        border: 1px solid #ccd0d4;
                        color: #444;
                        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
                        margin: 2em auto;
                        padding: 1em 2em;
                        max-width: 700px;
                        -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
                        box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
                }
                h1 {
                        border-bottom: 1px solid #dadada;
                        clear: both;
                        color: #666;
                        font-size: 24px;
                        margin: 30px 0 0 0;
                        padding: 0;
                        padding-bottom: 7px;
                }
                #error-page {
                        margin-top: 50px;
                }
                #error-page p,
                #error-page .wp-die-message {
                        font-size: 14px;
                        line-height: 1.5;
                        margin: 25px 0 20px;
                }
                #error-page code {
                        font-family: Consolas, Monaco, monospace;
                }
                ul li {
                        margin-bottom: 10px;
                        font-size: 14px ;
                }
                a {
                        color: #0073aa;
                }
                a:hover,
                a:active {
                        color: #006799;
                }
                a:focus {
                        color: #124964;
                        -webkit-box-shadow:
                                0 0 0 1px #5b9dd9,
                                0 0 2px 1px rgba(30, 140, 190, 0.8);
                        box-shadow:
                                0 0 0 1px #5b9dd9,
                                0 0 2px 1px rgba(30, 140, 190, 0.8);
                        outline: none;
                }
                .button {
                        background: #f3f5f6;
                        border: 1px solid #016087;
                        color: #016087;
                        display: inline-block;
                        text-decoration: none;
                        font-size: 13px;
                        line-height: 2;
                        height: 28px;
                        margin: 0;
                        padding: 0 10px 1px;
                        cursor: pointer;
                        -webkit-border-radius: 3px;
                        -webkit-appearance: none;
                        border-radius: 3px;
                        white-space: nowrap;
                        -webkit-box-sizing: border-box;
                        -moz-box-sizing:    border-box;
                        box-sizing:         border-box;

                        vertical-align: top;
                }

                .button.button-large {
                        line-height: 2.30769231;
                        min-height: 32px;
                        padding: 0 12px;
                }

                .button:hover,
                .button:focus {
                        background: #f1f1f1;
                }

                .button:focus {
                        background: #f3f5f6;
                        border-color: #007cba;
                        -webkit-box-shadow: 0 0 0 1px #007cba;
                        box-shadow: 0 0 0 1px #007cba;
                        color: #016087;
                        outline: 2px solid transparent;
                        outline-offset: 0;
                }

                .button:active {
                        background: #f3f5f6;
                        border-color: #7e8993;
                        -webkit-box-shadow: none;
                        box-shadow: none;
                }

                        </style>
</head>
<body id="error-page">
        <div class="wp-die-message"><p>There has been a critical error on this website.</p><p><a href="https://wordpress.org/documentation/article/faq-troubleshooting/">Learn more about troubleshooting WordPress.</a></p></div></body>
</html>
        ✖

debug.log will show you this error:

[04-Jul-2023 11:27:23 UTC] PHP Parse error:  syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST) in /var/www/html/wp-content/mu-plugins/healthcheck/class-healthcheck.php on line 18
[04-Jul-2023 11:27:23 UTC] PHP Notice:  Function is_embed was called <strong>incorrectly</strong>. Conditional query tags do not work before the query is run. Before then, they always return false. Please see <a href="https://wordpress.org/documentation/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 3.1.0.) in /var/www/html/wp-includes/functions.php on line 5865
[04-Jul-2023 11:27:23 UTC] PHP Stack trace:
[04-Jul-2023 11:27:23 UTC] PHP   1. WP_Fatal_Error_Handler->handle() /var/www/html/wp-includes/class-wp-fatal-error-handler.php:0
[04-Jul-2023 11:27:23 UTC] PHP   2. WP_Fatal_Error_Handler->display_error_template() /var/www/html/wp-includes/class-wp-fatal-error-handler.php:58
[04-Jul-2023 11:27:23 UTC] PHP   3. WP_Fatal_Error_Handler->display_default_error_template() /var/www/html/wp-includes/class-wp-fatal-error-handler.php:154
[04-Jul-2023 11:27:23 UTC] PHP   4. wp_die() /var/www/html/wp-includes/class-wp-fatal-error-handler.php:239
[04-Jul-2023 11:27:23 UTC] PHP   5. _default_wp_die_handler() /var/www/html/wp-includes/functions.php:3722
[04-Jul-2023 11:27:23 UTC] PHP   6. wp_robots() /var/www/html/wp-includes/functions.php:3798
[04-Jul-2023 11:27:23 UTC] PHP   7. apply_filters() /var/www/html/wp-includes/robots-template.php:32
[04-Jul-2023 11:27:23 UTC] PHP   8. WP_Hook->apply_filters() /var/www/html/wp-includes/plugin.php:205
[04-Jul-2023 11:27:23 UTC] PHP   9. wp_robots_noindex_embeds() /var/www/html/wp-includes/class-wp-hook.php:308
[04-Jul-2023 11:27:23 UTC] PHP  10. is_embed() /var/www/html/wp-includes/robots-template.php:93
[04-Jul-2023 11:27:23 UTC] PHP  11. _doing_it_wrong() /var/www/html/wp-includes/query.php:882
[04-Jul-2023 11:27:23 UTC] PHP  12. trigger_error() /var/www/html/wp-includes/functions.php:5865
[04-Jul-2023 11:27:23 UTC] PHP Notice:  Function is_search was called <strong>incorrectly</strong>. Conditional query tags do not work before the query is run. Before then, they always return false. Please see <a href="https://wordpress.org/documentation/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 3.1.0.) in /var/www/html/wp-includes/functions.php on line 5865
[04-Jul-2023 11:27:23 UTC] PHP Stack trace:
[04-Jul-2023 11:27:23 UTC] PHP   1. WP_Fatal_Error_Handler->handle() /var/www/html/wp-includes/class-wp-fatal-error-handler.php:0
[04-Jul-2023 11:27:23 UTC] PHP   2. WP_Fatal_Error_Handler->display_error_template() /var/www/html/wp-includes/class-wp-fatal-error-handler.php:58
[04-Jul-2023 11:27:23 UTC] PHP   3. WP_Fatal_Error_Handler->display_default_error_template() /var/www/html/wp-includes/class-wp-fatal-error-handler.php:154
[04-Jul-2023 11:27:23 UTC] PHP   4. wp_die() /var/www/html/wp-includes/class-wp-fatal-error-handler.php:239
[04-Jul-2023 11:27:23 UTC] PHP   5. _default_wp_die_handler() /var/www/html/wp-includes/functions.php:3722
[04-Jul-2023 11:27:23 UTC] PHP   6. wp_robots() /var/www/html/wp-includes/functions.php:3798
[04-Jul-2023 11:27:23 UTC] PHP   7. apply_filters() /var/www/html/wp-includes/robots-template.php:32
[04-Jul-2023 11:27:23 UTC] PHP   8. WP_Hook->apply_filters() /var/www/html/wp-includes/plugin.php:205
[04-Jul-2023 11:27:23 UTC] PHP   9. wp_robots_noindex_search() /var/www/html/wp-includes/class-wp-hook.php:308
[04-Jul-2023 11:27:23 UTC] PHP  10. is_search() /var/www/html/wp-includes/robots-template.php:119
[04-Jul-2023 11:27:23 UTC] PHP  11. _doing_it_wrong() /var/www/html/wp-includes/query.php:700
[04-Jul-2023 11:27:23 UTC] PHP  12. trigger_error() /var/www/html/wp-includes/functions.php:5865

This error came because https://github.com/Automattic/vip-go-mu-plugins-built/blob/master/healthcheck/class-healthcheck.php#L18 has a php7.4 syntax

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kirtangajjar
Copy link
Member Author

Closing as a duplicate of 10up/wpsnapshots#94

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant