W pliku index.php mam m.in. :
<?php set_exception_handler('exception_handler'); function exception_handler( $e ) { } // end : function exception_handler(); function error_handler($severity, $message, $filepath, $line) { } // end : function error_handler(); require( DIR_LIB.'ccc'.EXT ); function __autoload( $class ) { CCC::loadClass( $class ); } // end : function __autoload($class); $config = CCC_Config::get_instance(); ?>
Klasa CCC_Config istnieje i ładuje ją jak trzeba.
Klasy CCC_Router nie ma, istnieje pusty plik router.php i po takiej próbie wczytania :
<?php $router = CCC::loadClass( 'CCC_Router' ); ?>
dostaję prawidłowy komunikat :
Exception : komunikat => Plik Router.php załadowany ale nie ma w nim klasy => CCC_Router plik => E:\xampp\xampp\htdocs\jg\lib\ccc.php linia => 91
jeśli spróbuję ją wczytać przez __autoload :
<?php $router = new CCC_Router; ?>
dostaję taki komunikat :
Fatal error: Class 'CCC_Router' not found in E:\xampp\xampp\htdocs\jg\index.php on line 137
czyli nie dość że nie używa mojego error_handler'a to - on line 137 - chociaż ostatnimi znakami w tym pliku są w lini 136 -> "?>", po nich nie ma nawet spacji.
Jeśli nie ma nawet pliku router.php to mam taki komunikat :
1. Klasa - CCC_Router 2. Klasa - CCC_Router Fatal error: Class 'CCC_Router' not found in E:\xampp\xampp\htdocs\jg\index.php on line 137
czyli znowu ani error_handler ani exception_handler. Coś chyba robię nie tak ale już nie wiem co.
no i jeszcze metoda loadClass z klasy CCC :
<?php { { throw new Exception('Security : Nielegalne znaki w nazwie klasy'); } if( class_exists( $class, false ) ) { return; } // Zamiana nazwy klasy na ścieżkę if( $path != $class ) { } else { $file = $class.EXT; } { require( DIR_APP_LIB.$dirs.'/'.$file ); } else { { require( DIR_LIB.$dirs.'/'.$file ); } else { throw new Exception('Pliku '.$file.' nie znalazłem'); } } if( ! class_exists( $class, false ) ) { throw new Exception( 'Plik '.$file.' załadowany ' . 'ale nie ma w nim klasy => '.$class ); } } // end : public static function loadClass(); ?>
To że pokazuje się 2. Klasa CCC_Router oznacza, jest w metodzie loadClass, (według mnie) że powinno wyświetlić komunikat z exception_handler'a bo do tego miejsca dochodzi a jednak Fatal error i to nawet nie z mojego error_handlera. Bardzo proszę o jakąś podpowiedź co zrobiłem nie tak ?
Zmieniając w loadClass na :
<?php { require( DIR_APP_LIB.$dirs.'/'.$file ); } else { require( DIR_LIB.$dirs.'/'.$file ); } ?>
przy braku pliku router.php mam taki komunikat :
1. Klasa - CCC_Config 1. Klasa - CCC_Router $severity - 2 $message - CCC::require(E:/xampp/xampp/htdocs/jg/lib/CCC/Router.php) [function.CCC-require]: failed to open stream: No such file or directory $filepath - E:\xampp\xampp\htdocs\jg\lib\ccc.php $line - 78 Fatal error: CCC::require() [function.require]: Failed opening required 'E:/xampp/xampp/htdocs/jg/lib/CCC/Router.php' (include_path='.;E:\xampp\xampp\php\pear') in E:\xampp\xampp\htdocs\jg\lib\ccc.php on line 78
natomiast jeśli jest pusty plik router.php
Fatal error: Class 'CCC_Router' not found in E:\xampp\xampp\htdocs\jg\index.php on line 137