ID: 24519
User updated by: d dot stogov at turck dot spb dot ru
Reported By: d dot stogov at turck dot spb dot ru
-Status: Feedback
+Status: Open
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 4.3.3RC2-dev
New Comment:
--- aggregation.c.orig Tue Jul 08 05:25:12 2003
+++ aggregation.c Tue Jul 08 05:24:52 2003
@@ -155,6 +155,7 @@
if (zend_hash_add(&ce->function_table, func_name,
func_name_len,
(void*)function, sizeof(zend_function), NULL) ==
SUCCESS) {
+ function_add_ref(function);
add_next_index_stringl(aggr_methods, func_name,
func_name_len-1, 1);
}
Previous Comments:
------------------------------------------------------------------------
[2003-07-07 19:03:01] [EMAIL PROTECTED]
Can you please provide an unified diff against the snapshot sources..?
(diff -u)
------------------------------------------------------------------------
[2003-07-07 06:48:02] d dot stogov at turck dot spb dot ru
The snapshot fixes the problem for aggregate() but not for
aggregate_methods_by_list(). See the patch. The shapshot adds
"function_add_ref(function)" in one place but not in the second.
------------------------------------------------------------------------
[2003-07-07 05:58:21] [EMAIL PROTECTED]
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2003-07-07 02:41:35] d dot stogov at turck dot spb dot ru
Description:
------------
Function aggregate() doesn't increment refcount fielld for aggregeted
methods. The result is rundom crash in destroy_op_array().
The patch over PHP 4.3.2 that solves this problem follows:
*** \php-4.3.2.orig\ext\standard\aggregation.c Mon Jul 07 07:38:02
2003
--- \php-4.3.2\ext\standard\aggregation.c Mon Jul 07 07:37:04 2003
*************** static void aggregate_methods(zend_class
*** 134,140 ****
*/
if (zend_hash_add(&ce->function_table, func_name,
func_name_len,
(void*)function, sizeof(zend_function), NULL) ==
SUCCESS) {
!
add_next_index_stringl(aggr_methods, func_name,
func_name_len-1, 1);
}
--- 134,140 ----
*/
if (zend_hash_add(&ce->function_table, func_name,
func_name_len,
(void*)function, sizeof(zend_function), NULL) ==
SUCCESS) {
! function_add_ref(function);
add_next_index_stringl(aggr_methods, func_name,
func_name_len-1, 1);
}
*************** static void aggregate_methods(zend_class
*** 155,160 ****
--- 155,161 ----
if (zend_hash_add(&ce->function_table, func_name,
func_name_len,
(void*)function, sizeof(zend_function), NULL) ==
SUCCESS) {
+ function_add_ref(function);
add_next_index_stringl(aggr_methods, func_name,
func_name_len-1, 1);
}
Reproduce code:
---------------
<?
class bar
{
function bar()
{
print "::bar";
}
function myMethod()
{
}
}
class foo
{
function foo()
{
print "::foo ";
aggregate($this, "bar");
bar::bar();
}
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24519&edit=1