Add debug logging and fix test files
- Added error_log debugging to process-csv.php - Fixed test-csv.php syntax (removed use statements in code) - Created test-process2.php for step-by-step class loading test - All service classes load successfully in tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
0be9ddb946
commit
5fb6e1957d
3 changed files with 63 additions and 15 deletions
|
|
@ -23,13 +23,19 @@ try {
|
|||
$auth = new AuthMiddleware();
|
||||
$user = $auth->requireAuth();
|
||||
|
||||
// Debug: Log request
|
||||
error_log('process-csv.php: Started processing');
|
||||
error_log('FILES: ' . json_encode(array_keys($_FILES)));
|
||||
|
||||
// Check if file was uploaded
|
||||
if (!isset($_FILES['csvFile'])) {
|
||||
error_log('process-csv.php: No file in $_FILES');
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'stage' => 'upload',
|
||||
'error' => 'No file uploaded',
|
||||
'details' => 'Please select a CSV file to upload'
|
||||
'details' => 'Please select a CSV file to upload',
|
||||
'debug' => array_keys($_FILES)
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
19
test-csv.php
19
test-csv.php
|
|
@ -18,23 +18,14 @@ try {
|
|||
}
|
||||
|
||||
echo "<h2>2. League CSV</h2>";
|
||||
try {
|
||||
use League\Csv\Reader;
|
||||
use League\Csv\Writer;
|
||||
|
||||
echo "✅ League\\Csv\\Reader exists: " . (class_exists('League\Csv\Reader') ? 'YES' : 'NO') . "<br>";
|
||||
echo "✅ League\\Csv\\Writer exists: " . (class_exists('League\Csv\Writer') ? 'YES' : 'NO') . "<br>";
|
||||
} catch (Exception $e) {
|
||||
echo "❌ League CSV error: " . $e->getMessage() . "<br>";
|
||||
}
|
||||
echo "✅ League\\Csv\\Reader exists: " . (class_exists('League\Csv\Reader') ? 'YES' : 'NO') . "<br>";
|
||||
echo "✅ League\\Csv\\Writer exists: " . (class_exists('League\Csv\Writer') ? 'YES' : 'NO') . "<br>";
|
||||
|
||||
echo "<h2>3. Carbon</h2>";
|
||||
echo "✅ Carbon exists: " . (class_exists('Carbon\Carbon') ? 'YES' : 'NO') . "<br>";
|
||||
|
||||
try {
|
||||
use Carbon\Carbon;
|
||||
|
||||
echo "✅ Carbon exists: " . (class_exists('Carbon\Carbon') ? 'YES' : 'NO') . "<br>";
|
||||
|
||||
$date = Carbon::now();
|
||||
$date = \Carbon\Carbon::now();
|
||||
echo "✅ Carbon test: " . $date->format('Y-m-d H:i:s') . "<br>";
|
||||
} catch (Exception $e) {
|
||||
echo "❌ Carbon error: " . $e->getMessage() . "<br>";
|
||||
|
|
|
|||
51
test-process2.php
Normal file
51
test-process2.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
session_start();
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
try {
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
echo json_encode(['step' => 1, 'message' => 'Autoload OK']) . "\n";
|
||||
flush();
|
||||
|
||||
require_once __DIR__ . '/CSVTransformer.php';
|
||||
echo json_encode(['step' => 2, 'message' => 'CSVTransformer required']) . "\n";
|
||||
flush();
|
||||
|
||||
$transformer = new CSVTransformer();
|
||||
echo json_encode(['step' => 3, 'message' => 'CSVTransformer instantiated']) . "\n";
|
||||
flush();
|
||||
|
||||
require_once __DIR__ . '/OMGService.php';
|
||||
echo json_encode(['step' => 4, 'message' => 'OMGService required']) . "\n";
|
||||
flush();
|
||||
|
||||
$omg = new OMGService();
|
||||
echo json_encode(['step' => 5, 'message' => 'OMGService instantiated']) . "\n";
|
||||
flush();
|
||||
|
||||
require_once __DIR__ . '/EmailService.php';
|
||||
echo json_encode(['step' => 6, 'message' => 'EmailService required']) . "\n";
|
||||
flush();
|
||||
|
||||
$email = new EmailService();
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => 'All services loaded successfully'
|
||||
]);
|
||||
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'error' => $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
'trace' => $e->getTraceAsString()
|
||||
]);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue