| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2018-09-05 12:44 UTC] cmb@php.net
 
-Status:      Open
+Status:      Verified
-Assigned To:
+Assigned To: cmb
  [2018-09-05 12:44 UTC] cmb@php.net
  [2018-09-05 13:12 UTC] cmb@php.net
  [2018-09-05 13:12 UTC] cmb@php.net
 
-Status: Verified
+Status: Closed
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 14:00:01 2025 UTC | 
Description: ------------ Trying to get a reflection of method of class located inside a file with syntax error that is being included via autoloader results in a ReflectionException instead of ParseError. Note that if one tries `$x = new ReflectionClass('A');` instead, correct expected ParseError is thrown. Test script: --------------- --- FILE index.php <?php spl_autoload_register('load_file'); try { $x = new ReflectionMethod('A', 'b'); } catch (\Throwable $e) { echo get_class($e) . ': ' . $e->getMessage(); } function load_file() { require __DIR__ . '/syntaxerror.php'; } --- FILE syntaxerror.php <?php class A { if (wrongsyntax) } Expected result: ---------------- ParseError: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) Actual result: -------------- ReflectionException: Class A does not exist