Edit report at https://bugs.php.net/bug.php?id=63180&edit=1
ID: 63180 Updated by: dmi...@php.net Reported by: vesselin dot atanasov at gmail dot com Summary: Corruption of hash tables (bugfix attached) -Status: Closed +Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: Any PHP Version: 5.4Git-2012-09-28 (Git) Assigned To: dmitry Block user comment: N Private report: N New Comment: Your proposal will work, but it will slowdown every HashTable update operation. However these checks are really necessary only for very few cases. I prefer to fix the problem with a hack. I've just committed the fix. Previous Comments: ------------------------------------------------------------------------ [2012-10-26 16:49:51] dmi...@php.net Automatic comment on behalf of dmi...@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=68b229ea73b5e975951b5ad02ffb315ec60fca1e Log: Fixed bug #63180 (Corruption of hash tables) ------------------------------------------------------------------------ [2012-10-01 12:23:06] vesselin dot atanasov at gmail dot com One option would be to store interned pointers without copying when one of the two is true: 1. Either the hash table is non-persistent. 2. Or when the hash table is persistent and (the interned string is below the interned snapshot top or there is no snapshot top defined at all). What do you think of this approach? ------------------------------------------------------------------------ [2012-10-01 11:49:34] dmi...@php.net These tables store internal entities, that are never changed from request to request, and also entities created during compilation and execution, that are destroyed at end of request. ------------------------------------------------------------------------ [2012-10-01 11:39:38] vesselin dot atanasov at gmail dot com I took a look at the EG(function_table), EG(class_table), EG(zend_constants) and indeed they are persistent. What were the reasons for making these tables persistent? Was it just for performance reasons? ------------------------------------------------------------------------ [2012-10-01 07:08:11] dmi...@php.net In general, this is the right observation and the right fix. However, this fix won't allow interned strings usage in EG(function_table), EG(class_table) and EG(zend_constants). This is going to lead to larger memory consumption and slower execution. I think, that might be better to workaround the problem in PCRE extension itself. I know, it's not "sexy" and some other places might need to be fixed as well. :( May be you can think about better solution? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=63180 -- Edit this bug report at https://bugs.php.net/bug.php?id=63180&edit=1