wez Fri Nov 28 10:42:59 2003 EDT Modified files: /php-src/ext/standard var.c Log: fix #26001; serialize crashes when accessing an overloaded object that has no properties (NULL hashtable). Index: php-src/ext/standard/var.c diff -u php-src/ext/standard/var.c:1.175 php-src/ext/standard/var.c:1.176 --- php-src/ext/standard/var.c:1.175 Tue Nov 4 11:08:10 2003 +++ php-src/ext/standard/var.c Fri Nov 28 10:42:58 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.175 2003/11/04 16:08:10 moriyoshi Exp $ */ +/* $Id: var.c,v 1.176 2003/11/28 15:42:58 wez Exp $ */ /* {{{ includes @@ -585,15 +585,16 @@ /* fall-through */ } case IS_ARRAY: - myht = HASH_OF(*struc); if (Z_TYPE_PP(struc) == IS_ARRAY) { smart_str_appendl(buf, "a:", 2); + myht = HASH_OF(*struc); } else { php_var_serialize_class_name(buf, struc TSRMLS_CC); + myht = Z_OBJPROP_PP(struc); } /* count after serializing name, since php_var_serialize_class_name changes the count if the variable is incomplete class */ - i = zend_hash_num_elements(myht); + i = myht ? zend_hash_num_elements(myht) : 0; smart_str_append_long(buf, i); smart_str_appendl(buf, ":{", 2); if (i > 0) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php