]> granicus.if.org Git - php/commitdiff
MFH
authorMarcus Boerger <helly@php.net>
Thu, 5 Dec 2002 21:09:19 +0000 (21:09 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 5 Dec 2002 21:09:19 +0000 (21:09 +0000)
14 files changed:
ext/ereg/ereg.c
ext/standard/dl.c
ext/standard/exec.c
ext/standard/http_fopen_wrapper.c
ext/standard/incomplete_class.c
ext/standard/levenshtein.c
ext/standard/link.c
ext/standard/math.c
ext/standard/pack.c
ext/standard/reg.c
ext/standard/scanf.c
ext/standard/uniqid.c
ext/standard/url.c
ext/standard/var.c

index b30d0d527b63a892c5245a7f7c479341d3fa957b..9a5865c33e1cc0a86fb60f98c57fdc8771e47956 100644 (file)
@@ -128,6 +128,8 @@ static void php_reg_eprint(int err, regex_t *re) {
 #endif
        len = regerror(err, re, NULL, 0);
        if (len) {
+               TSRMLS_FETCH();
+
                message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
                if (!message) {
                        return; /* fail silently */
@@ -139,7 +141,7 @@ static void php_reg_eprint(int err, regex_t *re) {
                /* drop the message into place */
                regerror(err, re, message + buf_len, len);
 
-               php_error(E_WARNING, "%s", message);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message);
        }
 
        STR_FREE(buf);
@@ -198,10 +200,6 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
 
        /* allocate storage for (sub-)expression-matches */
        subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
-       if (!subs) {
-               php_error(E_WARNING, "Unable to allocate memory in php_ereg");
-               RETURN_FALSE;
-       }
        
        /* actually execute the regular expression */
        err = regexec(&re, string, re.re_nsub+1, subs, 0);
@@ -218,12 +216,6 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
                string_len = Z_STRLEN_PP(findin) + 1;
 
                buf = emalloc(string_len);
-               if (!buf) {
-                       php_error(E_WARNING, "Unable to allocate memory in php_ereg");
-                       regfree(&re);
-                       efree(subs);
-                       RETURN_FALSE;
-               }
 
                zval_dtor(*array);      /* start with clean array */
                array_init(*array);
@@ -300,21 +292,11 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
 
        /* allocate storage for (sub-)expression-matches */
        subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
-       if (!subs) {
-               php_error(E_WARNING, "Unable to allocate memory in php_ereg_replace");
-               return ((char *) -1);
-       }
 
        /* start with a buffer that is twice the size of the stringo
           we're doing replacements in */
        buf_len = 2 * string_len + 1;
        buf = emalloc(buf_len * sizeof(char));
-       if (!buf) {
-               php_error(E_WARNING, "Unable to allocate memory in php_ereg_replace");
-               efree(subs);
-               regfree(&re);
-               return ((char *) -1);
-       }
 
        err = pos = 0;
        buf[0] = '\0';
@@ -550,7 +532,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
                } else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
                        /* No more matches */
                        regfree(&re);
-                       php_error(E_WARNING, "Invalid Regular Expression to split()");
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression to split()");
                        zend_hash_destroy(Z_ARRVAL_P(return_value));
                        efree(Z_ARRVAL_P(return_value));
                        RETURN_FALSE;
index 3784c9e9b7d488b9ec49abfc9ae1015133566d31..83cec146da2d7531adce87f5725ebb62a3af1ab0 100644 (file)
@@ -220,7 +220,7 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
                                zts        = module_entry->zts; 
                        }
 
-                       php_error(error_type,
+                       php_error_docref(NULL TSRMLS_CC, error_type,
                                          "%s: Unable to initialize module\n"
                                          "Module compiled with module API=%d, debug=%d, thread-safety=%d\n"
                                          "PHP    compiled with module API=%d, debug=%d, thread-safety=%d\n"
index e9bcd86b9f9f422626e7a897a0dac464707289b9..f83ca07f192fabff3ad6df7aa31728d372274842 100644 (file)
@@ -72,7 +72,7 @@ static int php_make_safe_mode_command(char *cmd, char **safecmd TSRMLS_DC)
        larg0 = strlen(arg0);
 
        if (strstr(arg0, "..")) {
-               php_error(E_WARNING, "No '..' components allowed in path");
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "No '..' components allowed in path");
                efree(arg0);
                return FAILURE;
        }
index 5b901b26ebec21300bf8195b99c4b942ebe44555..68d7f643ec7043f42808afa94a7d7be0e37da1f8 100644 (file)
@@ -221,7 +221,7 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch
                                ua[ua_len] = 0;
                                php_stream_write(stream, ua, ua_len);
                        } else {
-                               php_error(E_WARNING, "Cannot construct User-agent header");
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot construct User-agent header");
                        }
 
                        if (ua) {
index ef0e2116c2036d21c5f53e6622cf61f4680d88cd..315350013a579b492ef9ec712449904b470d9600 100644 (file)
@@ -37,17 +37,18 @@ static void incomplete_class_message(zend_property_reference *ref, int error_typ
 {
        char buf[1024];
        char *class_name;
+       TSRMLS_FETCH();
 
        class_name = php_lookup_class_name(ref->object, NULL, 0);
        
        if (!class_name)
                class_name = estrdup("unknown");
        
-       snprintf(buf, 1023, INCOMPLETE_CLASS_MSG, class_name);
+       snprintf(buf, sizeof(buf)-1, INCOMPLETE_CLASS_MSG, class_name);
        
        efree(class_name);
 
-       php_error(error_type, "%s", buf);
+       php_error_docref(NULL TSRMLS_CC, error_type, "%s", buf);
 }
 /* }}} */
 
index fbf2814036ab5b49fb783faccca1a78dc3a58c39..4661006e711ca68008d3ae52a9e10b4e5895caa1 100644 (file)
@@ -12,7 +12,7 @@
    | obtain it through the world-wide-web, please send a note to          |
    | license@php.net so we can mail you a copy immediately.               |
    +----------------------------------------------------------------------+
-   | Author: Hartmut Holzgraefe <hartmut@six.de>                          |
+   | Author: Hartmut Holzgraefe <hholzgra@php.net>                        |
    +----------------------------------------------------------------------+
  */
 /* $Id$ */
@@ -77,10 +77,12 @@ static int reference_levdist(const char *s1, int l1,
  */
 static int custom_levdist(char *str1, char *str2, char *callback_name) 
 {
-               php_error(E_WARNING, "the general Levenshtein support is not there yet");
-               /* not there yet */
+       TSRMLS_FETCH();
 
-               return -1;
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, "The general Levenshtein support is not there yet");
+       /* not there yet */
+
+       return -1;
 }
 /* }}} */
 
index 0730c4f9b6127d4a4a042231559d1d3b829bcc17..07388f892c137f27cba4b6acd17f95204d14c48a 100644 (file)
@@ -68,7 +68,7 @@ PHP_FUNCTION(readlink)
        ret = readlink(Z_STRVAL_PP(filename), buff, MAXPATHLEN-1);
 
        if (ret == -1) {
-               php_error(E_WARNING, "readlink failed (%s)", strerror(errno));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
                RETURN_FALSE;
        }
        /* Append NULL to the end of the string */
@@ -97,7 +97,7 @@ PHP_FUNCTION(linkinfo)
 
        ret = VCWD_LSTAT(Z_STRVAL_PP(filename), &sb);
        if (ret == -1) {
-               php_error(E_WARNING, "Linkinfo failed (%s)", strerror(errno));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
                RETURN_LONG(-1L);
        }
 
@@ -126,7 +126,7 @@ PHP_FUNCTION(symlink)
        if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ||
                php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ) 
        {
-               php_error(E_WARNING, "Unable to symlink to a URL");
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to symlink to a URL");
                RETURN_FALSE;   
        }
 
@@ -152,7 +152,7 @@ PHP_FUNCTION(symlink)
        ret = symlink(dest_p, source_p);
 #endif 
        if (ret == -1) {
-               php_error(E_WARNING, "Symlink failed (%s)", strerror(errno));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
                RETURN_FALSE;
        }
 
@@ -181,7 +181,7 @@ PHP_FUNCTION(link)
        if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ||
                php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ) 
        {
-               php_error(E_WARNING, "Unable to link to a URL");
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to link to a URL");
                RETURN_FALSE;   
        }
 
@@ -207,7 +207,7 @@ PHP_FUNCTION(link)
        ret = link(dest_p, source_p);   
 #endif 
        if (ret == -1) {
-               php_error(E_WARNING, "Link failed (%s)", strerror(errno));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
                RETURN_FALSE;
        }
 
index 751dc3b11f1db5f9fef40a383e2aa4a43e26cc9c..6abd00fbae8b695e2aa921b7371d132c56720baf 100644 (file)
@@ -675,8 +675,12 @@ _php_math_basetolong(zval *arg, int base) {
                if (num > onum)
                        continue;
 
-               php_error(E_WARNING, "base_to_long: number '%s' is too big to fit in long", s);
-               return LONG_MAX;
+               {
+                       TSRMLS_FETCH();
+
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s);
+                       return LONG_MAX;
+               }
        }
 
        return num;
@@ -956,11 +960,11 @@ PHP_FUNCTION(base_convert)
        convert_to_long_ex(frombase);
        convert_to_long_ex(tobase);
        if (Z_LVAL_PP(frombase) < 2 || Z_LVAL_PP(frombase) > 36) {
-               php_error(E_WARNING, "base_convert: invalid `from base' (%d)", Z_LVAL_PP(frombase));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `from base' (%d)", Z_LVAL_PP(frombase));
                RETURN_FALSE;
        }
        if (Z_LVAL_PP(tobase) < 2 || Z_LVAL_PP(tobase) > 36) {
-               php_error(E_WARNING, "base_convert: invalid `to base' (%d)", Z_LVAL_PP(tobase));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `to base' (%d)", Z_LVAL_PP(tobase));
                RETURN_FALSE;
        }
 
index cd5b7eb8d46f8f067dd7741400c5a7713a89f75f..eab6d2bac852eb8f1f48942675786d720dabc97d 100644 (file)
@@ -167,7 +167,7 @@ PHP_FUNCTION(pack)
                        case 'X':       
                        case '@':
                                if (arg < 0) {
-                                       php_error(E_WARNING, "pack type %c: '*' ignored", code);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: '*' ignored", code);
                                        arg = 1;
                                }
                                break;
@@ -181,7 +181,7 @@ PHP_FUNCTION(pack)
                                        efree(argv);
                                        efree(formatcodes);
                                        efree(formatargs);
-                                       php_error(E_WARNING, "pack type %c: not enough arguments", code);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough arguments", code);
                                        RETURN_FALSE;
                                }
 
@@ -217,7 +217,7 @@ PHP_FUNCTION(pack)
                                        efree(argv);
                                        efree(formatcodes);
                                        efree(formatargs);
-                                       php_error(E_WARNING, "pack type %c: too few arguments", code);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: too few arguments", code);
                                        RETURN_FALSE;
                                }
                                break;
@@ -226,7 +226,7 @@ PHP_FUNCTION(pack)
                                efree(argv);
                                efree(formatcodes);
                                efree(formatargs);
-                               php_error(E_WARNING, "pack type %c: unknown format code", code);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: unknown format code", code);
                                RETURN_FALSE;
                }
 
@@ -235,7 +235,7 @@ PHP_FUNCTION(pack)
        }
 
        if (currentarg < argc) {
-               php_error(E_WARNING, "pack %d arguments unused", (argc - currentarg));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d arguments unused", (argc - currentarg));
        }
 
        /* Calculate output length and upper bound while processing*/
@@ -288,7 +288,7 @@ PHP_FUNCTION(pack)
                                outputpos -= arg;
 
                                if (outputpos < 0) {
-                                       php_error(E_WARNING, "pack type %c: outside of string", code);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", code);
                                        outputpos = 0;
                                }
                                break;
@@ -335,7 +335,7 @@ PHP_FUNCTION(pack)
                                v = Z_STRVAL_PP(val);
                                outputpos--;
                                if(arg > Z_STRLEN_PP(val)) {
-                                       php_error(E_WARNING, "pack type %c: not enough characters in string", code);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough characters in string", code);
                                        arg = Z_STRLEN_PP(val);
                                }
 
@@ -349,7 +349,7 @@ PHP_FUNCTION(pack)
                                        } else if (n >= 'a' && n <= 'f') {
                                                n -= ('a' - 10);
                                        } else {
-                                               php_error(E_WARNING, "pack type %c: illegal hex digit %c", code, n);
+                                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: illegal hex digit %c", code, n);
                                                n = 0;
                                        }
 
@@ -804,7 +804,7 @@ PHP_FUNCTION(unpack)
                                                        i = arg - 1;            /* Break out of for loop */
 
                                                        if (arg >= 0) {
-                                                               php_error(E_WARNING, "pack type %c: outside of string", type);
+                                                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type);
                                                        }
                                                }
                                                break;
@@ -813,7 +813,7 @@ PHP_FUNCTION(unpack)
                                                if (arg <= inputlen) {
                                                        inputpos = arg;
                                                } else {
-                                                       php_error(E_WARNING, "pack type %c: outside of string", type);
+                                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type);
                                                }
 
                                                i = arg - 1;    /* Done, break out of for loop */
@@ -825,7 +825,7 @@ PHP_FUNCTION(unpack)
                                /* Reached end of input for '*' repeater */
                                break;
                        } else {
-                               php_error(E_WARNING, "pack type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
                                zval_dtor(return_value);
                                RETURN_FALSE;
                        }
index b30d0d527b63a892c5245a7f7c479341d3fa957b..9a5865c33e1cc0a86fb60f98c57fdc8771e47956 100644 (file)
@@ -128,6 +128,8 @@ static void php_reg_eprint(int err, regex_t *re) {
 #endif
        len = regerror(err, re, NULL, 0);
        if (len) {
+               TSRMLS_FETCH();
+
                message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
                if (!message) {
                        return; /* fail silently */
@@ -139,7 +141,7 @@ static void php_reg_eprint(int err, regex_t *re) {
                /* drop the message into place */
                regerror(err, re, message + buf_len, len);
 
-               php_error(E_WARNING, "%s", message);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message);
        }
 
        STR_FREE(buf);
@@ -198,10 +200,6 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
 
        /* allocate storage for (sub-)expression-matches */
        subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
-       if (!subs) {
-               php_error(E_WARNING, "Unable to allocate memory in php_ereg");
-               RETURN_FALSE;
-       }
        
        /* actually execute the regular expression */
        err = regexec(&re, string, re.re_nsub+1, subs, 0);
@@ -218,12 +216,6 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
                string_len = Z_STRLEN_PP(findin) + 1;
 
                buf = emalloc(string_len);
-               if (!buf) {
-                       php_error(E_WARNING, "Unable to allocate memory in php_ereg");
-                       regfree(&re);
-                       efree(subs);
-                       RETURN_FALSE;
-               }
 
                zval_dtor(*array);      /* start with clean array */
                array_init(*array);
@@ -300,21 +292,11 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
 
        /* allocate storage for (sub-)expression-matches */
        subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
-       if (!subs) {
-               php_error(E_WARNING, "Unable to allocate memory in php_ereg_replace");
-               return ((char *) -1);
-       }
 
        /* start with a buffer that is twice the size of the stringo
           we're doing replacements in */
        buf_len = 2 * string_len + 1;
        buf = emalloc(buf_len * sizeof(char));
-       if (!buf) {
-               php_error(E_WARNING, "Unable to allocate memory in php_ereg_replace");
-               efree(subs);
-               regfree(&re);
-               return ((char *) -1);
-       }
 
        err = pos = 0;
        buf[0] = '\0';
@@ -550,7 +532,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
                } else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
                        /* No more matches */
                        regfree(&re);
-                       php_error(E_WARNING, "Invalid Regular Expression to split()");
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression to split()");
                        zend_hash_destroy(Z_ARRVAL_P(return_value));
                        efree(Z_ARRVAL_P(return_value));
                        RETURN_FALSE;
index 137a16ce142c0b9fba159c719b34270454433bc2..94aa9a21b015ecd2d0de4246d62da208f0e4cc2a 100644 (file)
@@ -461,7 +461,7 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs)
                /* problem - cc                                               */
                 /*
                 if (flags & SCAN_WIDTH) {
-                    php_error(E_WARNING, "field width may not be specified in %c conversion");
+                    php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field width may not be specified in %c conversion");
                     goto error;
                 }
                 */
@@ -491,11 +491,11 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs)
             }
             break;
            badSet:
-            php_error(E_WARNING, "unmatched [ in format string");
+            php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unmatched [ in format string");
             goto error;
            default:
             {
-             php_error(E_WARNING, "bad scan conversion character \"%c\"", ch);
+             php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad scan conversion character \"%c\"", ch);
              goto error;
            }
        }
@@ -545,14 +545,14 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs)
     }
     for (i = 0; i < numVars; i++) {
         if (nassign[i] > 1) {
-            php_error(E_WARNING, "variable is assigned by multiple \"%n$\" conversion specifiers");
+            php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable is assigned by multiple \"%n$\" conversion specifiers");
             goto error;
         } else if (!xpgSize && (nassign[i] == 0)) {
             /*
              * If the space is empty, and xpgSize is 0 (means XPG wasn't
              * used, and/or numVars != 0), then too many vars were given
              */
-            php_error(E_WARNING, "variable is not assigned by any conversion specifiers");
+            php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable is not assigned by any conversion specifiers");
             goto error;
         }
     }
@@ -564,9 +564,9 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs)
 
     badIndex:
         if (gotXpg) {
-            php_error(E_WARNING, "\"%n$\" argument index out of range");
+            php_error_docref(NULL TSRMLS_CC, E_WARNING, "\"%n$\" argument index out of range");
         } else {
-            php_error(E_WARNING, "different numbers of variable names and field specifiers");
+            php_error_docref(NULL TSRMLS_CC, E_WARNING, "Different numbers of variable names and field specifiers");
         }
 
     error:
index c7a6bd58a7d8ac507fe1bbcc515798b90af395e1..feff29949c2a73d9751414612fdf91c3e5a60173 100644 (file)
@@ -57,7 +57,7 @@ PHP_FUNCTION(uniqid)
 
        /* Do some bounds checking since we are using a char array. */
        if (prefix_len > 114) {
-               php_error(E_WARNING, "The prefix to uniqid should not be more than 114 characters.");
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The prefix to uniqid should not be more than 114 characters.");
                return;
        }
 #if HAVE_USLEEP && !defined(PHP_WIN32)
index 9c8ce60c14740870a54351e5776d8fcaa112fc12..d59f6139cb012337c2b22d262aedb1a9c69caa43 100644 (file)
@@ -285,7 +285,7 @@ PHP_FUNCTION(parse_url)
 
        resource = php_url_parse(str);
        if (resource == NULL) {
-               php_error(E_WARNING, "unable to parse url (%s)", str);
+               php_error_docref1(NULL TSRMLS_CC, str, E_WARNING, "Unable to parse url");
                RETURN_FALSE;
        }
 
index bd42dc63b04472502a312a7dc971f13cf1a475a1..311c18b65ec9801014eddce7aad924ca80777223 100644 (file)
@@ -457,7 +457,7 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
                                        (void **) &name, &pos);
 
                        if (Z_TYPE_PP(name) != IS_STRING) {
-                               php_error(E_NOTICE, "__sleep should return an array only "
+                               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
                                                "containing the names of instance-variables to "
                                                "serialize.");
                                /* we should still add element even if it's not OK,
@@ -539,7 +539,7 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
                                                        php_var_serialize_class(buf, struc, retval_ptr, 
                                                                        var_hash TSRMLS_CC);
                                                } else {
-                                                       php_error(E_NOTICE, "__sleep should return an array only "
+                                                       php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
                                                                                                "containing the names of instance-variables to "
                                                                                                "serialize.");
                                                }
@@ -667,12 +667,12 @@ PHP_FUNCTION(unserialize)
                if (!php_var_unserialize(&return_value, &p, p + Z_STRLEN_PP(buf),  &var_hash TSRMLS_CC)) {
                        PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
                        zval_dtor(return_value);
-                       php_error(E_NOTICE, "unserialize() failed at offset %d of %d bytes", p - Z_STRVAL_PP(buf), Z_STRLEN_PP(buf));
+                       php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %d of %d bytes", p - Z_STRVAL_PP(buf), Z_STRLEN_PP(buf));
                        RETURN_FALSE;
                }
                PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
        } else {
-               php_error(E_NOTICE, "argument passed to unserialize() is not an string");
+               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Argument is not an string");
                RETURN_FALSE;
        }
 }