[xdebug-dev] xdebug xdebug/xdebug.c xdebug/tests/bug00176.phpt - Fixed bug #176: Segfault using SplTempFileObject.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Sun, 7 May 2006 23:36:38 +0200

Date: Sun May 7 23:36:38 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Fixed bug #176: Segfault using SplTempFileObject.

Modified files:
           xdebug/xdebug.c (version: 1.312)
Added files:
           xdebug/tests/bug00176.phpt (new version: 1.1)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.311
retrieving revision 1.312
diff -u -r1.311 -r1.312
--- xdebug/xdebug.c:1.311 Sun May 07 14:19:50 2006 GMT
+++ xdebug/xdebug.c Sun May 07 19:36:37 2006 GMT
@@ -1863,6 +1863,35 @@
 
         error_type_str = error_type(type);
 
+#if PHP_MAJOR_VERSION >= 5
+ /* according to error handling mode, suppress error, throw exception or show it */
+ if (PG(error_handling) != EH_NORMAL) {
+ switch (type) {
+ case E_CORE_ERROR:
+ case E_COMPILE_ERROR:
+ case E_PARSE:
+ /* fatal errors are real errors and cannot be made exceptions */
+ break;
+ case E_STRICT:
+ /* for the sake of BC to old damaged code */
+ break;
+ case E_NOTICE:
+ case E_USER_NOTICE:
+ /* notices are no errors and are not treated as such like E_WARNINGS */
+ break;
+ default:
+ /* throw an exception if we are in EH_THROW mode
+ * but DO NOT overwrite a pending exception
+ */
+ if (PG(error_handling) == EH_THROW && !EG(exception)) {
+ zend_throw_error_exception(PG(exception_class), buffer, 0, type TSRMLS_CC);
+ }
+ efree(buffer);
+ return;
+ }
+ }
+#endif
+
         if (XG(error_handler)) { /* If an error handler is set, use it */
 /*
                 call_handler(error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);

[FILE: /xdebug/tests/bug00176.phpt]

--TEST--
Test for bug #176: Segfault using SplTempFileObject
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_return=1
xdebug.collect_params=1
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
--FILE--
<?php
try {
$crap = new SplTempFileObject('foo');
$crap->fwrite('give me a crash');
}
catch ( Exception $e )
{
}
echo "DONE\n";
?>
--EXPECT--
DONE
Received on Sun May 07 2006 - 23:36:45 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST