{
  "id": "php/stream-wrapper-register-invalid-class",
  "signature": "Warning: stream_wrapper_register(): class 'App\\Storage\\CustomStream' does not exist in /var/www/app/src/Storage/StreamManager.php on line 10",
  "signature_zh": "警告：stream_wrapper_register()：类 'App\\Storage\\CustomStream' 不存在，位于 /var/www/app/src/Storage/StreamManager.php 第 10 行",
  "regex": "stream_wrapper_register\\(\\): class '.+' does not exist",
  "domain": "php",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The class passed to stream_wrapper_register() has not been loaded or defined before the call, often due to missing autoloader configuration or a typo in the class name.",
  "root_cause_type": "generic",
  "root_cause_zh": "传递给 stream_wrapper_register() 的类在调用之前尚未加载或定义，通常由于缺少自动加载器配置或类名拼写错误。",
  "versions": [
    {
      "version": "PHP 8.1.31",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.2.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.3.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Adding require_once for the class file after the stream_wrapper_register() call does not work because the function checks for class existence at call time.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using spl_autoload_register() with a custom autoloader that has a lower priority may never be triggered for the stream wrapper class if another autoloader returns false first.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the class is autoloaded before registration by adding a use statement or require: require_once __DIR__ . '/CustomStream.php'; stream_wrapper_register('custom', 'App\\Storage\\CustomStream');",
      "success_rate": 0.9,
      "how": "Ensure the class is autoloaded before registration by adding a use statement or require: require_once __DIR__ . '/CustomStream.php'; stream_wrapper_register('custom', 'App\\Storage\\CustomStream');",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check composer autoload configuration: ensure the namespace 'App\\Storage' maps to the correct directory in composer.json and run composer dump-autoload.",
      "success_rate": 0.85,
      "how": "Check composer autoload configuration: ensure the namespace 'App\\Storage' maps to the correct directory in composer.json and run composer dump-autoload.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure the class is autoloaded before registration by adding a use statement or require: require_once __DIR__ . '/CustomStream.php'; stream_wrapper_register('custom', 'App\\Storage\\CustomStream');",
    "Check composer autoload configuration: ensure the namespace 'App\\Storage' maps to the correct directory in composer.json and run composer dump-autoload."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.php.net/manual/en/function.stream-wrapper-register.php",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.81,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2024-11-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}