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

feat: uniform rendering of stack trace from failed DB operations #9364

Draft
wants to merge 2 commits into
base: 4.6
Choose a base branch
from

Conversation

paulbalandan
Copy link
Member

Description
Closes #9338

All DB drivers except SQL Server logs (with 'error' level) a full stack trace of any failed DB executions via the thrown exception. For SQL Server, the log only includes the message produced by sqlsrv_errors(). Moreover, there's inconsistency with regard to Postgre and OCI8 drivers. Since pg_query() and oci8_execute() only throws because of our error handler, the stack trace also includes the error handler (the [internal function] stack).

This PR aims to make consistent the log output of these drivers by using the same trace rendering. This is already achieved by the private Exceptions::renderBacktrace() method for the thrown exceptions, so this PR extracts it to a new function render_backtrace and uses that to format the trace. Also, trace coming from the error handler are removed.

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

@paulbalandan paulbalandan added enhancement PRs that improve existing functionalities 4.6 labels Jan 2, 2025
@paulbalandan paulbalandan force-pushed the render-backtrace branch 5 times, most recently from 6f1ca05 to 79a9c97 Compare January 2, 2025 19:05
@paulbalandan paulbalandan marked this pull request as draft January 2, 2025 19:14
@michalsn
Copy link
Member

michalsn commented Jan 3, 2025

The last time I checked, the full stack track was available: #9338 (comment) and it looks the same for all the drivers.

Are there any differences (I may have missed something)? Can you give me an example?

@paulbalandan
Copy link
Member Author

I am assuming they did not see the full stack trace since $DBDebug is set to false, so only the log_message() call is seen. Here's the error logs:

Before this PR:

SQLite3 (stringified exception, (string) $e):

ERROR - 2025-01-06 04:24:30 --> SQLite3Exception: Unable to prepare statement: no such table: some_table in /Users/paul/Workspace/CodeIgniter4/system/Database/SQLite3/Connection.php:176
Stack trace:
#0 /Users/paul/Workspace/CodeIgniter4/system/Database/SQLite3/Connection.php(176): SQLite3->query('SELECT * FROM s...')
#1 /Users/paul/Workspace/CodeIgniter4/system/Database/BaseConnection.php(738): CodeIgniter\Database\SQLite3\Connection->execute('SELECT * FROM s...')
#2 /Users/paul/Workspace/CodeIgniter4/system/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM s...')
#3 /Users/paul/Workspace/CodeIgniter4/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM s...', Array)
#4 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
#5 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
#6 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
#7 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
#8 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
#9 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#10 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#11 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
#12 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
#13 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#14 /Users/paul/Workspace/CodeIgniter4/vendor/bin/phpunit(122): include('/Users/paul/Wor...')
#15 {main}

MySQLi (stringified exception (string) $e):

ERROR - 2025-01-06 04:30:30 --> mysqli_sql_exception: Table 'test.some_table' doesn't exist in /Users/paul/Workspace/CodeIgniter4/system/Database/MySQLi/Connection.php:327
Stack trace:
#0 /Users/paul/Workspace/CodeIgniter4/system/Database/MySQLi/Connection.php(327): mysqli->query('SELECT * FROM s...', 0)
#1 /Users/paul/Workspace/CodeIgniter4/system/Database/BaseConnection.php(738): CodeIgniter\Database\MySQLi\Connection->execute('SELECT * FROM s...')
#2 /Users/paul/Workspace/CodeIgniter4/system/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM s...')
#3 /Users/paul/Workspace/CodeIgniter4/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM s...', Array)
#4 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
#5 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
#6 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
#7 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
#8 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
#9 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#10 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#11 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
#12 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
#13 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#14 /Users/paul/Workspace/CodeIgniter4/vendor/bin/phpunit(122): include('/Users/paul/Wor...')
#15 {main}

SQLSRV (the 'message' offset value in sqlsrv_errors()):

ERROR - 2025-01-06 04:39:29 --> [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Invalid object name 'some_table'.

Postgres (stringified error exception)

ERROR - 2025-01-06 04:41:17 --> ErrorException: pg_query(): Query failed: ERROR:  relation "some_table" does not exist
LINE 1: SELECT * FROM some_table WHERE id = 3 AND status = 'live' AN...
                      ^ in /Users/paul/Workspace/CodeIgniter4/system/Database/Postgre/Connection.php:206
Stack trace:
#0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'pg_query(): Que...', '/Users/paul/Wor...', 206)
#1 /Users/paul/Workspace/CodeIgniter4/system/Database/Postgre/Connection.php(206): pg_query(Object(PgSql\Connection), 'SELECT * FROM s...')
#2 /Users/paul/Workspace/CodeIgniter4/system/Database/BaseConnection.php(738): CodeIgniter\Database\Postgre\Connection->execute('SELECT * FROM s...')
#3 /Users/paul/Workspace/CodeIgniter4/system/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM s...')
#4 /Users/paul/Workspace/CodeIgniter4/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM s...', Array)
#5 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
#6 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
#7 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
#8 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
#9 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
#10 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#11 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#12 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
#13 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
#14 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#15 /Users/paul/Workspace/CodeIgniter4/vendor/bin/phpunit(122): include('/Users/paul/Wor...')
#16 {main}

OCI8 (stringified error exception):

ERROR - 2025-01-06 05:22:30 --> ErrorException: oci_execute(): ORA-00942: table or view "ORACLE"."SOME_TABLE" does not exist
Help: https://docs.oracle.com/error-help/db/ora-00942/ in /Users/paul/Workspace/CodeIgniter4/system/Database/OCI8/Connection.php:220
Stack trace:
#0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'oci_execute(): ...', '/Users/paul/Wor...', 220)
#1 /Users/paul/Workspace/CodeIgniter4/system/Database/OCI8/Connection.php(220): oci_execute(Resource id #2234, 32)
#2 /Users/paul/Workspace/CodeIgniter4/system/Database/BaseConnection.php(738): CodeIgniter\Database\OCI8\Connection->execute('SELECT * FROM s...')
#3 /Users/paul/Workspace/CodeIgniter4/system/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM s...')
#4 /Users/paul/Workspace/CodeIgniter4/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM s...', Array)
#5 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
#6 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
#7 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
#8 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
#9 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
#10 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#11 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
#12 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
#13 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
#14 /Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#15 /Users/paul/Workspace/CodeIgniter4/vendor/bin/phpunit(122): include('/Users/paul/Wor...')
#16 {main}

@paulbalandan
Copy link
Member Author

After this PR:

MySQLi:

ERROR - 2025-01-06 05:25:22 --> Table 'test.some_table' doesn't exist
in SYSTEMPATH/Database/MySQLi/Connection.php on line 327.
 1 SYSTEMPATH/Database/MySQLi/Connection.php(327): mysqli->query('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'', 0)
 2 SYSTEMPATH/Database/BaseConnection.php(738): CodeIgniter\Database\MySQLi\Connection->execute('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 3 SYSTEMPATH/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 4 ROOTPATH/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?', [...])
 5 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
 6 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
 7 VENDORPATH/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
 8 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
 9 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
10 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
11 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
12 VENDORPATH/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
13 VENDORPATH/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
14 VENDORPATH/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run([...])
15 VENDORPATH/bin/phpunit(122): include('/Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit')

SQLite3:

ERROR - 2025-01-06 05:25:58 --> Unable to prepare statement: no such table: some_table
in SYSTEMPATH/Database/SQLite3/Connection.php on line 176.
 1 SYSTEMPATH/Database/SQLite3/Connection.php(176): SQLite3->query('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 2 SYSTEMPATH/Database/BaseConnection.php(738): CodeIgniter\Database\SQLite3\Connection->execute('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 3 SYSTEMPATH/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 4 ROOTPATH/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?', [...])
 5 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
 6 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
 7 VENDORPATH/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
 8 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
 9 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
10 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
11 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
12 VENDORPATH/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
13 VENDORPATH/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
14 VENDORPATH/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run([...])
15 VENDORPATH/bin/phpunit(122): include('/Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit')

Postgres:

ERROR - 2025-01-06 05:26:33 --> pg_query(): Query failed: ERROR:  relation "some_table" does not exist
LINE 1: SELECT * FROM some_table WHERE id = 3 AND status = 'live' AN...
                      ^
in SYSTEMPATH/Database/Postgre/Connection.php on line 206.
 1 SYSTEMPATH/Database/BaseConnection.php(738): CodeIgniter\Database\Postgre\Connection->execute('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 2 SYSTEMPATH/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 3 ROOTPATH/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?', [...])
 4 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
 5 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
 6 VENDORPATH/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
 7 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
 8 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
 9 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
10 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
11 VENDORPATH/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
12 VENDORPATH/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
13 VENDORPATH/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run([...])
14 VENDORPATH/bin/phpunit(122): include('/Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit')

SQLSRV:

ERROR - 2025-01-06 05:33:33 --> [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Invalid object name 'some_table'.
in SYSTEMPATH/Database/BaseConnection.php on line 738.
 1 SYSTEMPATH/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 2 ROOTPATH/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?', [...])
 3 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
 4 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
 5 VENDORPATH/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
 6 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
 7 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
 8 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
 9 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
10 VENDORPATH/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
11 VENDORPATH/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
12 VENDORPATH/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run([...])
13 VENDORPATH/bin/phpunit(122): include('/Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit')

OCI8:

ERROR - 2025-01-06 05:34:16 --> oci_execute(): ORA-00942: table or view "ORACLE"."SOME_TABLE" does not exist
Help: https://docs.oracle.com/error-help/db/ora-00942/
in SYSTEMPATH/Database/OCI8/Connection.php on line 220.
 1 SYSTEMPATH/Database/BaseConnection.php(738): CodeIgniter\Database\OCI8\Connection->execute('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 2 SYSTEMPATH/Database/BaseConnection.php(652): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT * FROM some_table WHERE id = 3 AND status = \'live\' AND author = \'Rick\'')
 3 ROOTPATH/tests/system/Database/Live/ExecuteLogMessageFormatTest.php(33): CodeIgniter\Database\BaseConnection->query('SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?', [...])
 4 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(1232): CodeIgniter\Database\Live\ExecuteLogMessageFormatTest->testLogMessageWhenExecuteFailsShowFullStructuredBacktrace()
 5 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(513): PHPUnit\Framework\TestCase->runTest()
 6 VENDORPATH/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(87): PHPUnit\Framework\TestCase->runBare()
 7 VENDORPATH/phpunit/phpunit/src/Framework/TestCase.php(360): PHPUnit\Framework\TestRunner->run(Object(CodeIgniter\Database\Live\ExecuteLogMessageFormatTest))
 8 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestCase->run()
 9 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
10 VENDORPATH/phpunit/phpunit/src/Framework/TestSuite.php(369): PHPUnit\Framework\TestSuite->run()
11 VENDORPATH/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
12 VENDORPATH/phpunit/phpunit/src/TextUI/Application.php(210): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
13 VENDORPATH/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run([...])
14 VENDORPATH/bin/phpunit(122): include('/Users/paul/Workspace/CodeIgniter4/vendor/phpunit/phpunit/phpunit')

@paulbalandan paulbalandan force-pushed the render-backtrace branch 2 times, most recently from bf0159a to 196c605 Compare January 6, 2025 07:50
@paulbalandan
Copy link
Member Author

The non-determinism of the tests is really frustrating 🤷🏻‍♂️

@neznaika0
Copy link
Contributor

Yes. the database package is very thick. I'm afraid to fix him.

@michalsn
Copy link
Member

michalsn commented Jan 6, 2025

@paulbalandan Ok, I get it now. Thanks!

@github-actions github-actions bot added the stale Pull requests with conflicts label Jan 6, 2025
Copy link

github-actions bot commented Jan 6, 2025

👋 Hi, @paulbalandan!

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

Ref: Syncing Your Branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.6 enhancement PRs that improve existing functionalities stale Pull requests with conflicts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants