Files
michaelschiemer/debug_discovery_minimal.php
Michael Schiemer e30753ba0e fix: resolve RedisCache array offset error and improve discovery diagnostics
- Fix RedisCache driver to handle MGET failures gracefully with fallback
- Add comprehensive discovery context comparison debug tools
- Identify root cause: WEB context discovery missing 166 items vs CLI
- WEB context missing RequestFactory class entirely (52 vs 69 commands)
- Improved exception handling with detailed binding diagnostics
2025-09-12 20:05:18 +02:00

59 lines
2.1 KiB
PHP

<?php
require_once __DIR__ . '/vendor/autoload.php';
use App\Framework\Http\Request;
use App\Framework\Http\HttpRequest;
use App\Framework\DI\DefaultContainer;
echo "=== Minimal Discovery Debug ===\n";
try {
// Create fresh container
$container = new DefaultContainer();
echo "1. Container created successfully\n";
// Try to get Request interface - this is where it fails
echo "2. Attempting to resolve Request interface...\n";
$request = $container->get(Request::class);
echo "3. SUCCESS: Request resolved as " . get_class($request) . "\n";
echo "4. Is HttpRequest instance: " . ($request instanceof HttpRequest ? 'YES' : 'NO') . "\n";
} catch (Throwable $e) {
echo "ERROR: " . $e->getMessage() . "\n";
echo "CLASS: " . get_class($e) . "\n";
// Look for more specific error info
if (str_contains($e->getMessage(), 'Cannot instantiate class')) {
echo "\n=== ANALYSIS ===\n";
echo "The issue is that Request is an interface and cannot be instantiated directly.\n";
echo "The Discovery system should have found RequestFactory::createFromGlobals() method\n";
echo "which has #[Initializer] attribute and should bind Request to HttpRequest.\n";
echo "\n=== CHECKING REQUESTFACTORY CLASS ===\n";
if (class_exists('App\\Framework\\Http\\RequestFactory')) {
echo "✓ RequestFactory class exists\n";
$reflection = new ReflectionClass('App\\Framework\\Http\\RequestFactory');
$methods = $reflection->getMethods();
echo "Methods in RequestFactory:\n";
foreach ($methods as $method) {
$attributes = $method->getAttributes();
echo " - {$method->getName()}";
if (!empty($attributes)) {
echo " [attributes: ";
foreach ($attributes as $attr) {
echo $attr->getName() . " ";
}
echo "]";
}
echo "\n";
}
} else {
echo "✗ RequestFactory class not found\n";
}
}
}