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: spark may not show exceptions or show backtrace as json #7962

Merged
merged 2 commits into from
Oct 10, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Sep 23, 2023

Description

Fix a bug that spark may not show exceptions in production mode, or show backtrace as json.

How to Reproduce

(1) Setup MySQL and use the default Config (no .env). That is database is an empty string and in production mode.

Before:

$ php spark db:table

CodeIgniter v4.4.1 Command Line Tool - Server Time: 2023-09-25 02:24:59 UTC+00:00

After:

$ php spark db:table

CodeIgniter v4.4.1 Command Line Tool - Server Time: 2023-09-25 02:23:08 UTC+00:00

[mysqli_sql_exception]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

at SYSTEMPATH/Database/MySQLi/Connection.php:306

(2) Change to development mode.

Before:

$ php spark db:table

CodeIgniter v4.4.1 Command Line Tool - Server Time: 2023-09-25 01:52:27 UTC+00:00

{
    "title": "mysqli_sql_exception",
    "type": "mysqli_sql_exception",
    "code": 500,
    "message": "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1",
    "file": "/Users/kenji/work/codeigniter/official/CodeIgniter4/system/Database/MySQLi/Connection.php",
    "line": 306,
    "trace": [
        {
...

After:

$ php spark db:table

CodeIgniter v4.4.1 Command Line Tool - Server Time: 2023-09-25 02:36:43 UTC+00:00


[mysqli_sql_exception]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

at SYSTEMPATH/Database/MySQLi/Connection.php:306

Backtrace:
  1    SYSTEMPATH/Database/MySQLi/Connection.php:306
       mysqli()->query('SHOW TABLES FROM ', 0)
...

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 23, 2023
@kenjis kenjis changed the title fix: bug that spark does not show Exception fix: spark does not show Exception Sep 23, 2023
@kenjis kenjis added the 4.4 label Sep 23, 2023
@kenjis kenjis force-pushed the fix-spark-no-error-msg branch from 1aaeda2 to b19769c Compare September 25, 2023 00:30
@kenjis
Copy link
Member Author

kenjis commented Sep 25, 2023

Added the docs.

@kenjis kenjis changed the title fix: spark does not show Exception fix: spark may not show Exception Sep 25, 2023
@kenjis kenjis force-pushed the fix-spark-no-error-msg branch 2 times, most recently from e3e0c07 to 539a56b Compare September 25, 2023 01:34
@kenjis kenjis marked this pull request as draft September 25, 2023 01:36
@kenjis kenjis changed the title fix: spark may not show Exception fix: spark shows backtrace as json Sep 25, 2023
@kenjis kenjis changed the title fix: spark shows backtrace as json fix: spark may show backtrace as json Sep 25, 2023
@kenjis kenjis force-pushed the fix-spark-no-error-msg branch from 539a56b to aeed049 Compare September 25, 2023 01:55
@kenjis kenjis marked this pull request as ready for review September 25, 2023 01:56
@kenjis kenjis force-pushed the fix-spark-no-error-msg branch from aeed049 to c2829d9 Compare September 25, 2023 02:21
@kenjis kenjis changed the title fix: spark may show backtrace as json fix: spark may not show exceptions or show backtrace as json Sep 25, 2023
@kenjis kenjis force-pushed the fix-spark-no-error-msg branch 2 times, most recently from 9b86813 to 0bd18e8 Compare September 25, 2023 02:39
@github-actions github-actions bot added the stale Pull requests with conflicts label Oct 8, 2023
@github-actions
Copy link

github-actions bot commented Oct 8, 2023

👋 Hi, @kenjis!

We detected conflicts in your PR against the base branch 🙊
You may want to sync 🔄 your branch with upstream!

Ref: Syncing Your Branch

@kenjis kenjis force-pushed the fix-spark-no-error-msg branch from 0bd18e8 to b201faf Compare October 8, 2023 23:07
@kenjis
Copy link
Member Author

kenjis commented Oct 8, 2023

Rebased to resolve a conflict.

@kenjis kenjis removed the stale Pull requests with conflicts label Oct 8, 2023
@kenjis kenjis merged commit 49d3421 into codeigniter4:develop Oct 10, 2023
61 checks passed
@kenjis kenjis deleted the fix-spark-no-error-msg branch October 10, 2023 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.4 bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants