PHP 4.0 Bug #6552 Updated: assert_options( ASSERT_CALLBACK ) problem

From: Date: Wed, 06 Sep 2000 13:49:07 +0000
Subject: PHP 4.0 Bug #6552 Updated: assert_options( ASSERT_CALLBACK ) problem
Groups: php.dev 
Request: Send a blank email to php-dev+get-32365@lists.php.net to get a copy of this message
ID: 6552 Updated by: thies Reported By: blake@intechra.net Status: Closed Bug Type: *General Issues Assigned To: Comments: fixed in CVS - thanx. Previous Comments: [2000-09-05 10:24:33] blake@intechra.net When calling assert_options( ASSERT_CALLBACK ), the callback function is freed. The expected behavior is that calling the function in this manner should return the name of the callback function and leave it in place. For example, I was doing the following: assert_options( ASSERT_CALLBACK, "MyACallback" ); print( "ASSERT_CALLBACK: " . assert_options( ASSERT_CALLBACK ) . "<br>" ); The printed output is correct, but the function MyACallback is never called. If the print line is commented out, the callback function is called with no problems. The code in ext/standard/assert.c (starting line 299) is as follows: case ASSERT_CALLBACK: oldstr = ASSERT(callback); RETVAL_STRING(SAFE_STRING(oldstr),1); if (ac == 2) { convert_to_string_ex(value); ASSERT(callback) = estrndup((*value)->value.str.val,(*value)->value.str.len); } if (oldstr) { efree(oldstr); } return; break; At first glance, I think it should be: case ASSERT_CALLBACK: oldstr = ASSERT(callback); RETVAL_STRING(SAFE_STRING(oldstr),1); if (ac == 2) { convert_to_string_ex(value); ASSERT(callback) = estrndup((*value)->value.str.val,(*value)->value.str.len); if (oldstr) { efree(oldstr); } } return; break; --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=6552

« previous php.dev (#32365) next »