Index: kernel/application.php
===================================================================
--- kernel/application.php (revision 14103)
+++ kernel/application.php (working copy)
@@ -2786,6 +2786,46 @@
}
/**
+ * Prints trace, when debug mode is not available
+ *
+ * @param bool $return_result
+ * @param int $skip_levels
+ * @return string
+ */
+ function printTrace($return_result = false, $skip_levels = 1)
+ {
+ $ret = Array ();
+ $trace = debug_backtrace(false);
+
+ for ($i = 0; $i < $skip_levels; $i++) {
+ array_shift($trace);
+ }
+
+ foreach ($trace as $level => $trace_info) {
+ if ( isset($trace_info['class']) ) {
+ $object = $trace_info['class'];
+ }
+ elseif ( isset($trace_info['object']) ) {
+ $object = get_class( $trace_info['object'] );
+ }
+ else {
+ $object = '';
+ }
+
+ $type = isset($trace_info['type']) ? $trace_info['type'] : '';
+
+ // implode(', ', $trace_info['args'])
+ $ret[] = '#' . $level . ' ' . $object . $type . $trace_info['function'].'(...) called at [' . $trace_info['file'] . ':' . $trace_info['line'] . ']';
+ }
+
+ if ($return_result) {
+ return implode("\n", $ret);
+ }
+
+ echo implode("\n", $ret);
+ }
+
+ /**
* Returns & blocks next ResourceId available in system
*
* @return int
Index: kernel/utility/factory.php
===================================================================
--- kernel/utility/factory.php (revision 14103)
+++ kernel/utility/factory.php (working copy)
@@ -209,11 +209,11 @@
* @param string $real_class
* @access private
*/
- function includeClassFile($real_class)
+ function includeClassFile($real_class, $pseudo_class = null)
{
if (class_exists($real_class)) return;
if(!isset($this->Files[$real_class])) {
- trigger_error('Real Class '.$real_class.' is not registered with the Factory', E_USER_ERROR);
+ trigger_error('Real Class '.$real_class.' (for pseudo class ' . $pseudo_class . ') is not registered with the Factory', E_USER_ERROR);
}
if(!file_exists(FULL_PATH.$this->Files[$real_class])) {
if ($this->Application->isDebugMode()) {
@@ -227,7 +227,7 @@
{
foreach($this->Dependencies[$real_class] as $dep_class_name)
{
- $this->includeClassFile($dep_class_name);
+ $this->includeClassFile($dep_class_name, $pseudo_class);
}
}
@@ -248,7 +248,7 @@
function &makeClass($pseudo_class)
{
$real_class = $this->realClasses[$pseudo_class];
- if (!class_exists($real_class)) $this->includeClassFile($real_class);
+ if (!class_exists($real_class)) $this->includeClassFile($real_class, $pseudo_class);
$mem_before = memory_get_usage();
$time_before = getmicrotime();