[wp-trac] [WordPress Trac] #43592: Variadic hook callbacks
WordPress Trac
noreply at wordpress.org
Wed Mar 21 07:21:18 UTC 2018
#43592: Variadic hook callbacks
--------------------------+------------------------------
Reporter: soulseekah | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by dd32):
Previously: #14671 - The proposal here is a little different though, so
not a complete duplicate / wontfix.
> Make -1 the default. Because it's safe to do so, since all functions in
PHP are variadic.
Unfortunately this isn't true for Core PHP functions, this will throw a
PHP Warning: (This is just a random example)
{{{
var_dump( intval( 1, 2, 3 ) );
Warning: Wrong parameter count for intval()
}}}
While I don't mind using `-1`, but it's effectively the same as passing
`PHP_INT_MAX` here, unless I'm missing something:
{{{
add_action( 'testing', function( ...$args ) {
var_dump( $args );
var_dump( func_Get_args() );
}, 10, PHP_INT_MAX );
do_action( 'testing', 1, 2, 3, 4, 5, 5, 6, 7 );
}}}
That does effectively make this a wontfix to me.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43592#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list