Antony Dovgal wrote: > On 31.08.2006 12:22, Michael Wallner wrote: >> Antony Dovgal wrote: >>> tony2001 Wed Aug 30 22:52:18 2006 UTC >>> >>> Modified files: /php-src/ext/tidy tidy.c Log: >>> fix tidy problems caused by returning local static buffers >>> looks like somebody forgot to MFB this patch.. >> >> What problems? It's actually been an optimization attempt, not >> a forgotten MFB. > > # ./sapi/cli/php -r 'tidy_repair_string("");' > [Thu Aug 31 02:43:25 2006] Script: '-' > --------------------------------------- > /local/dev/orig/php-src_head/Zend/zend_variables.h(35) : Block > 0x083941B0 status: > /local/dev/orig/php-src_head/Zend/zend_variables.c(40) : Actual location > (location was relayed) > Invalid pointer: ((thread_id=0x00000108) != (expected=0x40528C60)) > --------------------------------------- > > Returning pointer to local static buffer is generally bad idea and it > was the reason for such warnings in ZTS mode. >
It's not a local static buffer, but somehow the alloc callbacks get only installed when one creates a tidy object, though it should happen on MINIT, IMHO. Index: ext/tidy/tidy.c =================================================================== RCS file: /repository/php-src/ext/tidy/tidy.c,v retrieving revision 1.93 diff -u -p -d -r1.93 tidy.c --- ext/tidy/tidy.c 14 Aug 2006 15:17:03 -0000 1.93 +++ ext/tidy/tidy.c 31 Aug 2006 12:31:07 -0000 @@ -560,11 +560,6 @@ static void tidy_object_new(zend_class_e break; case is_doc: - tidySetMallocCall(php_tidy_malloc); - tidySetReallocCall(php_tidy_realloc); - tidySetFreeCall(php_tidy_free); - tidySetPanicCall(php_tidy_panic); - intern->ptdoc = emalloc(sizeof(PHPTidyDoc)); intern->ptdoc->doc = tidyCreate(); intern->ptdoc->ref_count = 1; @@ -943,6 +938,11 @@ static int php_tidy_parse_string(PHPTidy static PHP_MINIT_FUNCTION(tidy) { + tidySetMallocCall(php_tidy_malloc); + tidySetReallocCall(php_tidy_realloc); + tidySetFreeCall(php_tidy_free); + tidySetPanicCall(php_tidy_panic); + REGISTER_INI_ENTRIES(); REGISTER_TIDY_CLASS(tidy, doc, NULL, 0); REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS); -- Michael -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php