Re: Crash in var_dump and print_r
| From: | George Schlossnagle | Date: | Sun, 26 Aug 2001 15:45:31 +0000 |
| Subject: | Re: Crash in var_dump and print_r | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-64352@lists.php.net to get a copy of this message | ||
Ahh... that makes much more sense. Should there be any protection though from populating a hash with NULL values, or is this solely the responsibility of the extension writer? While there is the zend_has_add_empty_element(), it appears as if there is no protection from adding a NULL pData pointer if you just call zend_hash_add_or_update().
On Sunday, August 26, 2001, at 11:32 AM, Andi Gutmans wrote:
What Zeev meant is that it should be a valid zval * but it isn't. Andi At 11:31 AM 8/26/2001 -0400, George Schlossnagle wrote:If NULL's a valid zval*, then both of thise routines need to be fixed to handle null pointers. Here's some patches: --- zend.c.orig Sun Aug 26 11:14:28 2001+++ zend.c Sun Aug 26 11:20:22 2001@@ -199,6 +199,10 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent) {+ if(expr == NULL) { + ZEND_PUTS(" (NULL)"); + return; + } switch(expr->type) { case IS_ARRAY: ZEND_PUTS("Array\n");--- var.c.orig Thu Aug 16 11:16:52 2001+++ var.c Sun Aug 26 11:24:54 2001@@ -63,7 +63,10 @@if (level>1) { php_printf("%*c", level-1, ' '); }-+ if ((*struc) == NULL) { + php_printf(" (NULL)"); + return; + } switch ((*struc)->type) { case IS_BOOL: php_printf("%sbool(%s)\n", COMMON, Z_LVAL_PP(struc)?"true":"false");On Sunday, August 26, 2001, at 06:15 AM, Zeev Suraski wrote:It looks like domxml is responsible here. The hash table that's sent to it contains a NULL value, which should be a valid zval *... Zeev At 13:04 26-08-01, Joey Smith wrote:-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list- admin@lists.php.netThis may be due to the way domxml is doing things, but the test script in bug #10936 still creates a crash, and the backtrace points to zend_print_zval_r_ex...see attachment 1. Attachment 2 show that var_dump() gives more or less the same result. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list- admin@lists.php.net-- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list- admin@lists.php.net