php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #54043
Patch error.patch revision 2013-06-25 08:29 UTC by jwalton at m3hc dot com

Patch error.patch for Unknown/Other Function Bug #54043

Patch version 2013-06-25 08:29 UTC

Return to Bug #54043 | Download this patch
Patch Revisions:

Developer: jwalton@m3hc.com

diff -ur php-5.5.0/main/main.c php-5.5.0.patch2/main/main.c
--- php-5.5.0/main/main.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch2/main/main.c	2013-06-25 04:20:48.480301848 -0400
@@ -870,9 +870,11 @@
 {
 	va_list args;
 
+printf("start error\n");
 	va_start(args, format);
 	php_verror(docref, "", type, format, args TSRMLS_CC);
 	va_end(args);
+printf("end error\n");
 }
 /* }}} */
 
@@ -939,6 +941,8 @@
 {
 	char *buffer;
 	int buffer_len, display;
+    int returnout = 0;
+    int thrownexception = 0;
 	TSRMLS_FETCH();
 
 	buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args);
@@ -959,31 +963,6 @@
 		display = 1;
 	}
 
-	/* store the error if it has changed */
-	if (display) {
-#ifdef ZEND_SIGNALS
-		HANDLE_BLOCK_INTERRUPTIONS();
-#endif
-		if (PG(last_error_message)) {
-			free(PG(last_error_message));
-			PG(last_error_message) = NULL;
-		}
-		if (PG(last_error_file)) {
-			free(PG(last_error_file));
-			PG(last_error_file) = NULL;
-		}
-#ifdef ZEND_SIGNALS
-		HANDLE_UNBLOCK_INTERRUPTIONS();
-#endif
-		if (!error_filename) {
-			error_filename = "Unknown";
-		}
-		PG(last_error_type) = type;
-		PG(last_error_message) = strdup(buffer);
-		PG(last_error_file) = strdup(error_filename);
-		PG(last_error_lineno) = error_lineno;
-	}
-
 	/* according to error handling mode, suppress error, throw exception or show it */
 	if (EG(error_handling) != EH_NORMAL) {
 		switch (type) {
@@ -1009,12 +988,41 @@
 				 */
 				if (EG(error_handling) == EH_THROW && !EG(exception)) {
 					zend_throw_error_exception(EG(exception_class), buffer, 0, type TSRMLS_CC);
+                    thrownexception = 1;
 				}
 				efree(buffer);
-				return;
+                returnout = 1;
 		}
 	}
 
+	/* store the error if it has changed and has NOT thrown an exception */
+	if (display && !thrownexception ) {
+#ifdef ZEND_SIGNALS
+		HANDLE_BLOCK_INTERRUPTIONS();
+#endif
+		if (PG(last_error_message)) {
+			free(PG(last_error_message));
+			PG(last_error_message) = NULL;
+		}
+		if (PG(last_error_file)) {
+			free(PG(last_error_file));
+			PG(last_error_file) = NULL;
+		}
+#ifdef ZEND_SIGNALS
+		HANDLE_UNBLOCK_INTERRUPTIONS();
+#endif
+		if (!error_filename) {
+			error_filename = "Unknown";
+		}
+		PG(last_error_type) = type;
+		PG(last_error_message) = strdup(buffer);
+		PG(last_error_file) = strdup(error_filename);
+		PG(last_error_lineno) = error_lineno;
+	}
+    if( returnout ) {
+        return;
+    }
+
 	/* display/log the error if necessary */
 	if (display && (EG(error_reporting) & type || (type & E_CORE))
 		&& (PG(log_errors) || PG(display_errors) || (!module_initialized))) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 10:01:27 2024 UTC