Re: cvs: php4 /ext/standard php_smart_str.h var.c
| From: | Thies C. Arntzen | Date: | Wed, 20 Mar 2002 13:08:19 +0000 |
| Subject: | Re: cvs: php4 /ext/standard php_smart_str.h var.c | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-10479@lists.php.net to get a copy of this message | ||
On Wed, Mar 20, 2002 at 01:33:30PM +0100, Derick Rethans wrote:
> Hello Thies,
>
> do you want to merge this to the release branch?
no really crucial - but will do.
>
> Derick
>
> On Tue, 19 Mar 2002, Thies C. Arntzen wrote:
>
> > thies Tue Mar 19 06:25:23 2002 EDT
> >
> > Modified files:
> > /php4/ext/standard php_smart_str.h var.c
> > Log:
> > fix #12793 - serialize will now spit a notice if the return value of __sleep is
> > bogus.
> >
> >
> > Index: php4/ext/standard/php_smart_str.h
> > diff -u php4/ext/standard/php_smart_str.h:1.15 php4/ext/standard/php_smart_str.h:1.16
> > --- php4/ext/standard/php_smart_str.h:1.15 Thu Feb 28 03:26:48 2002
> > +++ php4/ext/standard/php_smart_str.h Tue Mar 19 06:25:21 2002
> > @@ -24,7 +24,7 @@
> > #include <stdlib.h>
> > #include <zend.h>
> >
> > -#define smart_str_0(x) ((x)->c[(x)->len] = '\0')
> > +#define smart_str_0(x) do { if ((x)->c) { (x)->c[(x)->len] = '\0'; } }
> > while (0);
> >
> > #ifndef SMART_STR_PREALLOC
> > #define SMART_STR_PREALLOC 128
> > Index: php4/ext/standard/var.c
> > diff -u php4/ext/standard/var.c:1.137 php4/ext/standard/var.c:1.138
> > --- php4/ext/standard/var.c:1.137 Thu Mar 14 21:06:08 2002
> > +++ php4/ext/standard/var.c Tue Mar 19 06:25:21 2002
> > @@ -536,9 +536,15 @@
> >
> > if (res == SUCCESS) {
> > if (retval_ptr) {
> > - if (HASH_OF(retval_ptr))
> > + if (HASH_OF(retval_ptr)) {
> > php_var_serialize_class(buf, struc, retval_ptr,
> > var_hash TSRMLS_CC);
> > + } else {
> > + php_error(E_NOTICE, "__sleep should return an array only "
> > + "containing the names of instance-variables to "
> > + "serialize.");
> > + }
> > +
> > zval_ptr_dtor(&retval_ptr);
> > }
> > return;
> > @@ -623,7 +629,12 @@
> > PHP_VAR_SERIALIZE_INIT(var_hash);
> > php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
> > PHP_VAR_SERIALIZE_DESTROY(var_hash);
> > - RETVAL_STRINGL(buf.c, buf.len, 0);
> > +
> > + if (buf.c) {
> > + RETURN_STRINGL(buf.c, buf.len, 0);
> > + } else {
> > + RETURN_NULL();
> > + }
> > }
> >
> > /* }}} */
> >
> >
> >
> > --
> > PHP CVS Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> Derick Rethans
>
> ---------------------------------------------------------------------
> PHP: Scripting the Web - www.php.net - derick@php.net
> All your branches are belong to me!
> SRM: Script Running Machine - www.vl-srm.net
> ---------------------------------------------------------------------