ssb             Sat Nov  9 21:09:27 2002 EDT

  Modified files:              
    /php4/main  main.c 
  Log:
  * honor track_errors ini setting in php_verror()
  
  
Index: php4/main/main.c
diff -u php4/main/main.c:1.508 php4/main/main.c:1.509
--- php4/main/main.c:1.508      Sun Oct 27 22:45:20 2002
+++ php4/main/main.c    Sat Nov  9 21:09:26 2002
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.508 2002/10/28 03:45:20 iliaa Exp $ */
+/* $Id: main.c,v 1.509 2002/11/10 02:09:26 ssb Exp $ */
 
 /* {{{ includes
  */
@@ -406,8 +406,9 @@
        char *buffer = NULL, *docref_buf = NULL, *ref = NULL, *target = NULL;
        char *docref_target = "", *docref_root = "";
        char *function, *p;
+    int buffer_len = 0;
        
-       vspprintf(&buffer, 0, format, args);
+       buffer_len = vspprintf(&buffer, 0, format, args);
        if (buffer) {
                if (docref && docref[0] == '#') {
                        docref_target = strchr(docref, '#');
@@ -464,9 +465,19 @@
                                docref = "Unknown";
                        php_error(type, "%s(%s): %s", docref, params, buffer);
                }
+        if (PG(track_errors) && EG(active_symbol_table)) {
+            pval *tmp;
+            ALLOC_ZVAL(tmp);
+            INIT_PZVAL(tmp);
+            Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len);
+            Z_STRLEN_P(tmp) = buffer_len;
+            Z_TYPE_P(tmp) = IS_STRING;
+            zend_hash_update(EG(active_symbol_table), "php_errormsg", 
+sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL);
+        }
                efree(buffer);
-               if (docref_buf)
+               if (docref_buf) {
                        efree(docref_buf);
+        }
        } else {
                php_error(E_ERROR, "%s(%s): Out of memory", 
get_active_function_name(TSRMLS_C), params);
        }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to