refactor: reorganize project structure for better maintainability
- Move 45 debug/test files from root to organized scripts/ directories - Secure public/ directory by removing debug files (security improvement) - Create structured scripts organization: • scripts/debug/ (20 files) - Framework debugging tools • scripts/test/ (18 files) - Test and validation scripts • scripts/maintenance/ (5 files) - Maintenance utilities • scripts/dev/ (2 files) - Development tools Security improvements: - Removed all debug/test files from public/ directory - Only production files remain: index.php, health.php Root directory cleanup: - Reduced from 47 to 2 PHP files in root - Only essential production files: console.php, worker.php This improves: ✅ Security (no debug code in public/) ✅ Organization (clear separation of concerns) ✅ Maintainability (easy to find and manage scripts) ✅ Professional structure (clean root directory)
This commit is contained in:
38
scripts/maintenance/autoloader_workaround.php
Normal file
38
scripts/maintenance/autoloader_workaround.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Temporary workaround for the "Uninitialized string offset 0" warning in ClassLoader.php
|
||||
*
|
||||
* This file registers an autoloader hook that catches empty class names,
|
||||
* logs them with stack traces, but doesn't throw exceptions, allowing the
|
||||
* application to continue running.
|
||||
*
|
||||
* Usage: Include this file at the beginning of your application bootstrap process,
|
||||
* before any other autoloading occurs.
|
||||
*/
|
||||
|
||||
// Register the autoloader hook
|
||||
spl_autoload_register(function($class) {
|
||||
if (empty($class)) {
|
||||
// Log the empty class name with stack trace
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10);
|
||||
$logMessage = date('Y-m-d H:i:s') . " - Empty class name detected in autoloader.\nStack trace:\n" .
|
||||
json_encode($trace, JSON_PRETTY_PRINT) . "\n\n";
|
||||
|
||||
// Log to file
|
||||
file_put_contents(
|
||||
__DIR__ . '/empty_class_debug.log',
|
||||
$logMessage,
|
||||
FILE_APPEND
|
||||
);
|
||||
|
||||
// Also log to error_log for server logs
|
||||
error_log('Empty class name detected in autoloader. See empty_class_debug.log for details.');
|
||||
|
||||
// Return false to continue with other autoloaders
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not an empty class name, let other autoloaders handle it
|
||||
return false;
|
||||
}, true, true); // prepend=true to ensure this runs before other autoloaders
|
||||
Reference in New Issue
Block a user