RE: [PHP-DEV] PHP 4.0 Bug #6552: assert_options( ASSERT_CALLBACK ) problem

From: Date: Tue, 05 Sep 2000 14:34:11 +0000
Subject: RE: [PHP-DEV] PHP 4.0 Bug #6552: assert_options( ASSERT_CALLBACK ) problem
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-32178@lists.php.net to get a copy of this message
After looking more closely, I think the fix should be: case ASSERT_CALLBACK: oldstr = ASSERT(callback); RETVAL_STRING(SAFE_STRING(oldstr),1); if (ac == 2) { if (oldstr) { efree(oldstr); } convert_to_string_ex(value); ASSERT(callback) = estrndup((*value)->value.str.val,(*value)->value.str.len); } return; break; -----Original Message----- From: blake@intechra.net [mailto:blake@intechra.net] Sent: Tuesday, September 05, 2000 8:25 AM To: php-dev@lists.php.net Subject: [PHP-DEV] PHP 4.0 Bug #6552: assert_options( ASSERT_CALLBACK ) problem From: blake@intechra.net Operating system: Linux (RedHat 6.2) PHP version: 4.0.2 PHP Bug Type: Misbehaving function Bug description: assert_options( ASSERT_CALLBACK ) problem 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; -- 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

« previous php.dev (#32178) next »