From cb584e9d3ad1c1399c2deddd018189852e5bb743 Mon Sep 17 00:00:00 2001 From: Keith Solomon Date: Mon, 3 Aug 2026 13:34:29 -0500 Subject: [PATCH] Restore consoleLog helper and remove test stub masking production fatal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v2 rewrite of processLogEntries() calls consoleLog(...) at two skip branches (no id, and no deposited/withdrawn). Commit 3ebc5e2 had removed the project helper from includes/utilities.php, leaving a production runtime fatal ("Call to undefined function consoleLog()") the first time a non-vault entry flowed through fetchAndStoreLogPage -> processLogEntries in real use. The previous test appeared to pass only because it defined a local no-op consoleLog stub via function_exists() guard — masking the defect behind a test fixture that never reached either skip branch. Fix: - Restore the original consoleLog() helper to includes/utilities.php (unchanged from the pre-3ebc5e2 codebase; spec lists it as unchanged). - Remove the local consoleLog stub from tests/process_log_entries_test.php so the test now exercises the real production code path. --- includes/utilities.php | 13 +++++++++++++ tests/process_log_entries_test.php | 9 --------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/includes/utilities.php b/includes/utilities.php index d2d2edc..7a846a4 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -287,3 +287,16 @@ function fetchAndStoreLogPage($pdo, $user, $url) { return $responseData['_metadata']['links']['next'] ?? null; } + +/** + * Print a variable to the console for debugging purposes. + * + * @param mixed $data The data to print to the console. + * + * @return void + */ +function consoleLog( $data ) { + echo ''; +} diff --git a/tests/process_log_entries_test.php b/tests/process_log_entries_test.php index 1c8acf6..c19359f 100644 --- a/tests/process_log_entries_test.php +++ b/tests/process_log_entries_test.php @@ -22,15 +22,6 @@ if (!defined('USER_KEYS')) { ]); } -// consoleLog was removed from includes/utilities.php (commit 3ebc5e2), but the -// rewritten processLogEntries() still calls it for skipped entries. Define a -// local no-op here so the test does not trigger a fatal error. -if (!function_exists('consoleLog')) { - function consoleLog(string $message): void { - // Intentionally silent — these are "skip" notices during the test. - } -} - require_once __DIR__ . '/../includes/exceptions.php'; require_once __DIR__ . '/../includes/utilities.php';