/[cvs]/nfo/php/libs/org.netfrag.glib/utils/errors.php
ViewVC logotype

Annotation of /nfo/php/libs/org.netfrag.glib/utils/errors.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sat Apr 5 19:53:45 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
moved here from ../

1 joko 1.1 <?php
2    
3     /**
4     * This file contains some core functions extending php,
5     * especially regarding basic error handling.
6     *
7     * @author Andreas Motl <andreas.motl@ilo.de>
8     * @package org.netfrag.glib
9     * @name errors
10     *
11     */
12    
13     /**
14     * $Id: php_errors.php,v 1.1 2003/04/04 17:34:17 joko Exp $
15     *
16     * $Log: php_errors.php,v $
17     * Revision 1.1 2003/04/04 17:34:17 joko
18     * initial commit
19     *
20     *
21     */
22    
23    
24     /**
25     * --- functions supporting handling errors/exceptions
26     *
27     */
28    
29    
30     /**
31     * --- php error extension functions living in the global namespace
32     *
33     *
34     * @author Andreas Motl <andreas.motl@ilo.de>
35     * @copyright (c) 2003 - All Rights reserved.
36     * @license GNU LGPL (GNU Lesser General Public License)
37     *
38     * @link http://www.netfrag.org/~joko/
39     * @link http://www.gnu.org/licenses/lgpl.txt
40     *
41     * @package org.netfrag.glib
42     * @name errors
43     *
44     *
45     */
46    
47     //function error_handler($errno, $errstr, $errfile, $errline) {
48     function php_error_handler() {
49    
50     // build error hash
51     $error_raw = func_get_args();
52     $error = array(
53     'level' => $error_raw[0],
54     'message' => $error_raw[1],
55     'file' => $error_raw[2],
56     'line' => $error_raw[3],
57     'context' => &$error_raw[4],
58     'object_context' => &$error_raw[4][this],
59     );
60     $error[component] = $error[object_context]->_component_name;
61    
62    
63     // component errors / stack-backtrace
64    
65     /*
66     $level = $error[0];
67     $context = &$error[4];
68     $cc = &$context['this'];
69     */
70    
71     // tracing
72     //print Dumper($context);
73     //print Dumper($cc);
74     //print Dumper($cc->_component_name);
75    
76     // by level
77     //$do_trace = ($level <= 5);
78    
79     //$c_name = $context['this']['_component_name'];
80    
81     //print "c_error: $c_name<br/>";
82    
83     // if component
84     //$do_trace = isset($context[this][_component_name]);
85     //$do_trace = isset($context->this[_component_name]);
86     //$do_trace = isset($cc->_component_name);
87    
88     //print Dumper($context);
89    
90    
91    
92     // V0 - testing (always on)
93     //$do_trace = 1;
94    
95     // V1 - just for components
96     //$do_trace = isset($error[component]);
97    
98     // V2 - actions via constant definition(s)
99     $do_render = !constants::get('PHP_ERRORS_DISABLED') && constants::get('PHP_ERRORS_ENABLED');
100     $do_verbose = constants::get('PHP_ERRORS_MODE_VERBOSE');
101     $do_trace = constants::get('PHP_ERRORS_MODE_TRACE');
102     // ignore debugging-messages here if not explicitely requested
103     if (!constants::get('PHP_ERRORS_TRACE_LEVEL_DEBUG')) {
104     $do_verbose = $do_verbose && ($error[level] != 8);
105     $do_trace = $do_trace && ($error[level] != 8);
106     }
107    
108    
109     // Rendering
110    
111     if ($do_render) {
112    
113     // which box to draw?
114    
115     // V1 - fixed set of error attributes
116     //$output_order = array( 'message', 'component', 'file', 'line', 'level' );
117     //$output_order = array( 'message', 'level', 'file', 'line' );
118    
119     // V2 - build variable set dependent on defined constant(s)
120     $output_order = array();
121     $box_type = constants::get('PHP_ERRORS_BOX_TYPE');
122     //print "boxtype: $box_type<br/>";
123    
124     //print php::Dumper($error);
125     //exit;
126    
127     if ($do_trace) {
128    
129     if (loadModule('Tracer')) {
130     Tracer::event(array( code => $error[level], type => $box_type, error => $error ));
131     //if ($do_trace) {
132     //trace($out);
133     //}
134     }
135    
136     }
137    
138     if ($do_verbose) {
139     //print $out;
140     print Dumper($error);
141     }
142    
143     }
144    
145     }
146    
147    
148     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed