Files
michaelschiemer/docs/troubleshooting/AUTOLOADER_WORKAROUND.md
Michael Schiemer 5050c7d73a docs: consolidate documentation into organized structure
- Move 12 markdown files from root to docs/ subdirectories
- Organize documentation by category:
  • docs/troubleshooting/ (1 file)  - Technical troubleshooting guides
  • docs/deployment/      (4 files) - Deployment and security documentation
  • docs/guides/          (3 files) - Feature-specific guides
  • docs/planning/        (4 files) - Planning and improvement proposals

Root directory cleanup:
- Reduced from 16 to 4 markdown files in root
- Only essential project files remain:
  • CLAUDE.md (AI instructions)
  • README.md (Main project readme)
  • CLEANUP_PLAN.md (Current cleanup plan)
  • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements)

This improves:
 Documentation discoverability
 Logical organization by purpose
 Clean root directory
 Better maintainability
2025-10-05 11:05:04 +02:00

2.2 KiB

Autoloader Workaround

This document explains how to use the temporary workaround for the "Uninitialized string offset 0" warning in Composer's ClassLoader.php.

Problem Description

The application is experiencing warnings like:

Warning: Uninitialized string offset 0 in /var/www/html/vendor/composer/ClassLoader.php on line 497

This occurs when the Composer ClassLoader tries to process a class name that is empty or null. When it attempts to access the first character of this empty string, PHP generates the "Uninitialized string offset" warning.

Workaround Implementation

The autoloader_workaround.php file provides a temporary solution that:

  1. Catches empty class names passed to the autoloader
  2. Logs them with stack traces to help identify the source
  3. Allows the application to continue running without interruption

How to Use

For Web Applications

Add this line at the very beginning of your public/index.php file, before any other includes:

require __DIR__ . '/../autoloader_workaround.php';

For Console Applications

Add this line at the beginning of your console entry point (e.g., console.php):

require __DIR__ . '/autoloader_workaround.php';

For Docker Environments

If you're using Docker, make sure the workaround file is included in your container and loaded at application startup.

Logging

When an empty class name is detected, the workaround:

  1. Logs detailed information including a stack trace to empty_class_debug.log in the project root
  2. Also logs a brief message to the PHP error log

Check these logs to identify where empty class names are being generated.

Next Steps

This is a temporary workaround to prevent the warnings from affecting application functionality. The root cause should still be investigated and fixed. Use the logs generated by this workaround to:

  1. Identify which components are generating empty class names
  2. Look for patterns in when the issue occurs
  3. Fix the underlying code that's generating empty class names

Removing the Workaround

Once the root cause is fixed, you can remove the workaround by:

  1. Removing the include statement from your entry point files
  2. Optionally removing the autoloader_workaround.php file from your project