Alexander (HH): Sammelaktion: Fehlermeldungen von PHP

Beitrag lesen

Moin Moin!

Ich habe mir das gerade nochmal im Source-Code von Version (5.4.28 NTS VC9) angesehen. Das wird absolut schwierig, die Fehlermeldungen auszufiltern. Sie setzen sich zusammen aus den Teilmeldungen der beteiligten Hierarchiestufen. Mein Beispiel ist immer "fopen()". Da kommt die Grundmeldung "failed to open stream", dann wird z.B. angehängt ": %s:// wrapper is disabled in the server configuration by allow_url_fopen=0", usw.

Da sind also auch noch Stringersetzungen (%s) an diversen Stellen vorher fällig.

Schau Dir bitte mal perldiag an. %s und andere Format-Strings bleiben dort bewußt stehen.

Übrigens: Perl selbst nutzt die Dokumentation (also perldiag.pod), um im Fehlerfall weitere Informationen zu liefern, sofern man das diagnostics-Modul lädt (use diagnostics;). Das geht auch offline, ohne Eingriff in das Programm, mit dem splain-Programm.

Beispiel:

  

>perl -Mstrict -e '$x=1'  

Global symbol "$x" requires explicit package name at -e line 1.  
Execution of -e aborted due to compilation errors.  
  

>perl -Mdiagnostics -Mstrict -e '$x=1'  

Global symbol "$x" requires explicit package name at -e line 1.  
Execution of -e aborted due to compilation errors (#1)  
    (F) You've said "use strict" or "use strict vars", which indicates  
    that all variables must either be lexically scoped (using "my" or "state"),  
    declared beforehand using "our", or explicitly qualified to say  
    which package the global variable is in (using "::").  
  
Uncaught exception from user code:  
        Global symbol "$x" requires explicit package name at -e line 1.  
Execution of -e aborted due to compilation errors.  
 at -e line 1  
  

>  

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so".