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

Fix PHP 7 support in the lexer #111

Closed
carolinan opened this issue May 3, 2024 · 5 comments
Closed

Fix PHP 7 support in the lexer #111

carolinan opened this issue May 3, 2024 · 5 comments

Comments

@carolinan
Copy link

carolinan commented May 3, 2024

As part of contributing to WordPress, those of us who test and write patches for the bundled themes (Twenty X) need to be able to test the theme on all WordPress versions that the theme supports.

For example, I should be able to test Twenty Sixteen on WordPress version 4.4, which is the first version that supports PHP 7.0,

But I get the following errors;

PS D:\> wp-now start --wp=4.4 --php=7.0
Starting the server......
directory: D:\
mode: playground
php: 7.0
wp: 4.4
WordPress 4.4 folder already exists. Skipping download.
SQLite folder already exists. Skipping download.
PHP.run() output was: {
  stdout: '<br />\n' +
    '<b>Fatal error</b>:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291\n' +
    'Stack trace:\n' +
    '#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer-&gt;parse_unknown()\n' +
    '#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer-&gt;lex()\n' +
    "#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer-&gt;__construct('SELECT option_v...')\n" +
    "#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator-&gt;execute_mysql_query('SELECT option_v...')\n" +
    "#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator-&gt;query('SELECT in <b>/var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php</b> on line <b>2291</b><br />\n",
  stderr: 'PHP Fatal error:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291\n' +
    'Stack trace:\n' +
    '#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer->parse_unknown()\n' +
    '#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer->lex()\n' +
    "#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer->__construct('SELECT option_v...')\n" +
    "#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator->execute_mysql_query('SELECT option_v...')\n" +
    "#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator->query('SELECT in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php on line 2291\n"
}
Error: PHP.run() failed with exit code 255 and the following output: PHP Fatal error:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291
Stack trace:
#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer->parse_unknown()
WordPress/playground-tools#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer->lex()
WordPress/playground-tools#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer->__construct('SELECT option_v...')
WordPress/playground-tools#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator->execute_mysql_query('SELECT option_v...')
WordPress/playground-tools#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator->query('SELECT in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php on line 2291

    at _NodePHP.run (D:\Users\myaza\AppData\Roaming\nvm\v20.10.0\node_modules\@wp-now\wp-now\node_modules\@php-wasm\node\index.cjs:72937:23)
    at async #dispatchToPHP (D:\Users\myaza\AppData\Roaming\nvm\v20.10.0\node_modules\@wp-now\wp-now\node_modules\@php-wasm\node\index.cjs:72470:14)
    at async PHPRequestHandler.request (D:\Users\myaza\AppData\Roaming\nvm\v20.10.0\node_modules\@wp-now\wp-now\node_modules\@php-wasm\node\index.cjs:72385:14)
    at async PHPBrowser.request (D:\Users\myaza\AppData\Roaming\nvm\v20.10.0\node_modules\@wp-now\wp-now\node_modules\@php-wasm\node\index.cjs:72170:22)
    at async startWPNow (file:///D:/Users/myaza/AppData/Roaming/nvm/v20.10.0/node_modules/@wp-now/wp-now/main.js:665:3)
    at async startServer (file:///D:/Users/myaza/AppData/Roaming/nvm/v20.10.0/node_modules/@wp-now/wp-now/main.js:981:42)
    at async Object.handler (file:///D:/Users/myaza/AppData/Roaming/nvm/v20.10.0/node_modules/@wp-now/wp-now/main.js:1167:25) {
  output: {
    stdout: '<br />\n' +
      '<b>Fatal error</b>:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291\n' +
      'Stack trace:\n' +
      '#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer-&gt;parse_unknown()\n' +
      '#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer-&gt;lex()\n' +
      "#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer-&gt;__construct('SELECT option_v...')\n" +        
      "#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator-&gt;execute_mysql_query('SELECT option_v...')\n" +
      "#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator-&gt;query('SELECT in <b>/var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php</b> on line <b>2291</b><br />\n",
    stderr: 'PHP Fatal error:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291\n' +
      'Stack trace:\n' +
      '#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer->parse_unknown()\n' +
      '#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer->lex()\n' +
      "#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer->__construct('SELECT option_v...')\n" +
      "#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator->execute_mysql_query('SELECT option_v...')\n" +
      "#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator->query('SELECT in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php on line 2291\n"
  },
  source: 'request'
}
Error: PHP.run() failed with exit code 255 and the following output: PHP Fatal error:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291
Stack trace:
#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer->parse_unknown()
WordPress/playground-tools#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer->lex()
WordPress/playground-tools#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer->__construct('SELECT option_v...')
WordPress/playground-tools#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator->execute_mysql_query('SELECT option_v...')
WordPress/playground-tools#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator->query('SELECT in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php on line 2291

    at _NodePHP.run (D:\Users\myaza\AppData\Roaming\nvm\v20.10.0\node_modules\@wp-now\wp-now\node_modules\@php-wasm\node\index.cjs:72937:23)
    at async #dispatchToPHP (D:\Users\myaza\AppData\Roaming\nvm\v20.10.0\node_modules\@wp-now\wp-now\node_modules\@php-wasm\node\index.cjs:72470:14)
    at async PHPRequestHandler.request (D:\Users\myaza\AppData\Roaming\nvm\v20.10.0\node_modules\@wp-now\wp-now\node_modules\@php-wasm\node\index.cjs:72385:14)
    at async PHPBrowser.request (D:\Users\myaza\AppData\Roaming\nvm\v20.10.0\node_modules\@wp-now\wp-now\node_modules\@php-wasm\node\index.cjs:72170:22)
    at async startWPNow (file:///D:/Users/myaza/AppData/Roaming/nvm/v20.10.0/node_modules/@wp-now/wp-now/main.js:665:3)
    at async startServer (file:///D:/Users/myaza/AppData/Roaming/nvm/v20.10.0/node_modules/@wp-now/wp-now/main.js:981:42)
    at async Object.handler (file:///D:/Users/myaza/AppData/Roaming/nvm/v20.10.0/node_modules/@wp-now/wp-now/main.js:1167:25) {
  output: {
    stdout: '<br />\n' +
      '<b>Fatal error</b>:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291\n' +
      'Stack trace:\n' +
      '#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer-&gt;parse_unknown()\n' +
      '#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer-&gt;lex()\n' +
      "#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer-&gt;__construct('SELECT option_v...')\n" +        
      "#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator-&gt;execute_mysql_query('SELECT option_v...')\n" +
      "#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator-&gt;query('SELECT in <b>/var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php</b> on line <b>2291</b><br />\n",
    stderr: 'PHP Fatal error:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291\n' +
      'Stack trace:\n' +
      '#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer->parse_unknown()\n' +
      '#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer->lex()\n' +
      "#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer->__construct('SELECT option_v...')\n" +
      "#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator->execute_mysql_query('SELECT option_v...')\n" +
      "#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator->query('SELECT in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php on line 2291\n"
  },
  source: 'request'
}
Failed to start the server: PHP.run() failed with exit code 255 and the following output: PHP Fatal error:  Uncaught Error: Call to undefined function str_ends_with() in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php:2291
Stack trace:
#0 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1490): WP_SQLite_Lexer->parse_unknown()
WordPress/playground-tools#1 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php(1442): WP_SQLite_Lexer->lex()
WordPress/playground-tools#2 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(767): WP_SQLite_Lexer->__construct('SELECT option_v...')
WordPress/playground-tools#3 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-translator.php(616): WP_SQLite_Translator->execute_mysql_query('SELECT option_v...')
WordPress/playground-tools#4 /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-db.php(280): WP_SQLite_Translator->query('SELECT in /var/www/html/wp-content/mu-plugins/sqlite-database-integration-main/wp-includes/sqlite/class-wp-sqlite-lexer.php on line 2291

@carolinan
Copy link
Author

But besides PHP 7.0, we also need PHP 5.2 and 5.6, because we sometimes need to test on WordPress versions before 4.4:

Twenty Ten: 3.0
Twenty Eleven: 3.2
Twenty Thirteen: 3.5
Twenty Fourteen: 3.6
Twenty Fifteen: 4.1 (first version to support PHP 5.6)

@bgrgicak
Copy link
Collaborator

bgrgicak commented May 3, 2024

This is an issue with the SQLite database integration plugin.
It should support PHP 7 and even has a polyfill for str_ends_with, but this line doesn't seem to load this function.

@bgrgicak bgrgicak transferred this issue from WordPress/playground-tools May 3, 2024
@bgrgicak bgrgicak changed the title Add support for older PHP and WP versions May 3, 2024
@aristath
Copy link
Member

Should be fixed now with v2.1.10.

Please note that it may take some time for the playground to pull the latest version of this plugin, AFAIK the change is not applied instantly (please correct me if I'm wrong @adamziel)
I'll go ahead and close this one as resolved, please feel free to reopen it if the problem remains 👍

@adamziel
Copy link
Collaborator

cc @sejas – what would be the best way for @carolinan to use the latest version of the SQLite integration plugin with wp-now?

@sejas
Copy link

sejas commented May 13, 2024

Deleting the ~/.wp-now/mu-plugins/sqlite-database-integration-main will force to download the latest version of SQLite plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants