|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-09-06 09:49 UTC] thies@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 02:00:01 2025 UTC |
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;