ID: 28306 User updated by: cunha17 at uol dot com dot br Reported By: cunha17 at uol dot com dot br Status: Open Bug Type: Reproducible crash Operating System: Redhat Linux 9/Fedora Core 1 PHP Version: 5CVS-2004-05-06 (dev) New Comment:
The debug_backtrace() just before the segmentation fault:
Array
(
[0] => Array
(
[file] =>
/home/ten_cunha/bug/templates_c/%%595^%%595330115^exception_bug.tpl.php
[line] => 10
[function] => smarty_test
[args] => Array
(
[0] => Array
(
[name] => ExceptionBugTest
)
[1] => Smarty Object
(
[template_dir] => templates
[compile_dir] => templates_c
[config_dir] => configs
[plugins_dir] => Array
(
[0] => plugins
)
[debugging] =>
[error_reporting] =>
[debug_tpl] =>
[debugging_ctrl] => NONE
[compile_check] => 1
[force_compile] =>
[caching] => 0
[cache_dir] => cache
[cache_lifetime] => 3600
[cache_modified_check] =>
[php_handling] => 0
[security] =>
[secure_dir] => Array
(
)
[security_settings] => Array
(
[PHP_HANDLING] =>
[IF_FUNCS] => Array
(
[0] => array
[1] => list
[2] => isset
[3] => empty
[4] => count
[5] => sizeof
[6] => in_array
[7] => is_array
[8] => true
[9] => false
)
[INCLUDE_ANY] =>
[PHP_TAGS] =>
[MODIFIER_FUNCS] => Array
(
[0] => count
)
[ALLOW_CONSTANTS] =>
)
[trusted_dir] => Array
(
)
[left_delimiter] => {
[right_delimiter] => }
[request_vars_order] => EGPCS
[request_use_auto_globals] => 1
[compile_id] =>
[use_sub_dirs] =>
[default_modifiers] => Array
(
)
[default_resource_type] => file
[cache_handler_func] =>
[autoload_filters] => Array
(
)
[config_overwrite] => 1
[config_booleanize] => 1
[config_read_hidden] =>
[config_fix_newlines] => 1
[default_template_handler_func] =>
[compiler_file] =>
Smarty_Compiler.class.php
[compiler_class] => Smarty_Compiler
[config_class] => Config_File
[_error_msg] =>
[_tpl_vars] => Array
(
[SCRIPT_NAME] => exception_bug.php
)
[_smarty_vars] =>
[_sections] => Array
(
)
[_foreach] => Array
(
)
[_tag_stack] => Array
(
)
[_conf_obj] =>
[_config] => Array
(
[0] => Array
(
[vars] => Array
(
)
[files] => Array
(
)
)
)
[_smarty_md5] =>
f8d698aea36fcbead2b9d5359ffca76f
[_version] => 2.6.2
[_inclusion_depth] => 0
[_compile_id] =>
[_smarty_debug_id] => SMARTY_DEBUG
[_smarty_debug_info] => Array
(
)
[_cache_info] => Array
(
)
[_file_perms] => 420
[_dir_perms] => 505
[_reg_objects] => Array
(
)
[_plugins] => Array
(
[modifier] => Array
(
)
[function] => Array
(
[test] => Array
(
[0] => smarty_test
[1] =>
exception_bug.tpl
[2] => 6
[3] => 1
[4] => 1
[5] =>
)
)
[block] => Array
(
)
[compiler] => Array
(
)
[prefilter] => Array
(
)
[postfilter] => Array
(
)
[outputfilter] => Array
(
)
[resource] => Array
(
)
[insert] => Array
(
)
)
[_cache_serials] => Array
(
)
[_cache_include] =>
[_cache_including] =>
)
)
)
[1] => Array
(
[file] =>
/home/ten_cunha/bug/Smarty-2.6.2/libs/Smarty.class.php
[line] => 1266
[args] => Array
(
[0] =>
/home/ten_cunha/bug/templates_c/%%595^%%595330115^exception_bug.tpl.php
)
[function] => include
)
[2] => Array
(
[file] =>
/home/ten_cunha/bug/Smarty-2.6.2/libs/Smarty.class.php
[line] => 1115
[function] => fetch
[class] => Smarty
[type] => ->
[args] => Array
(
[0] => exception_bug.tpl
[1] =>
[2] =>
[3] => 1
)
)
[3] => Array
(
[file] => /home/ten_cunha/bug/exception_bug.php
[line] => 21
[function] => display
[class] => Smarty
[type] => ->
[args] => Array
(
[0] => exception_bug.tpl
)
)
)
Previous Comments:
------------------------------------------------------------------------
[2004-05-06 19:55:00] cunha17 at uol dot com dot br
Description:
------------
First of all:
1. Using PHP-RC2 or PHP-CVS (2004-05-06)
2. Using Smarty-2.6.2 with customized tag(function)
3. Mapping PHP errors to exceptions(user error handler)
If there is an error inside the customized Smarty function, the error
handler routine raises an exception that doesn't reach any try/catch
block outside the Smarty class.
In fact, the exception doesn't propagate outside the fetch function in
file Smarty.class.php.
The exception is raised inside an "include" instruction and it's
possible to catch it inside the fetch function, but impossible anywhere
else.
The fetch function is called from Smarty.class.php:1115 and the
"include" instruction is placed at Smarty.class.php:1266.
Cristiano Duarte
Reproduce code:
---------------
<?php
include('Smarty-2.6.2/libs/Smarty.class.php');
function smarty_test($params, $smarty)
{
//Now we raise a notice about name not being defined
//This should get mapped to an Exception
return "{$params[name]}";
}
function my_error($nr, $text, $file, $line, $vars)
{
$e = new Exception($text);
throw $e;
}
error_reporting(E_ALL);
set_error_handler('my_error');
$s = new Smarty();
$s->register_function('test', 'smarty_test');
$s->display('exception_bug.tpl');
?>
Here is the template(exception_bug.tpl):
<html>
<head>
<title>Exception BUG</title>
</head>
<body>
{test name="ExceptionBugTest"}
</body>
</html>
Expected result:
----------------
Uncaught Exception
Actual result:
--------------
Segmentation Fault (core dumped)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28306&edit=1
