Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yourls_do_action calls yourls_apply_filter with all arguments in an array rather than as a list #1203

Open
ozh opened this issue Apr 6, 2013 · 1 comment
Labels
Milestone

Comments

@ozh
Copy link
Member

ozh commented Apr 6, 2013

This is a COPY of Issue 1203: yourls_do_action calls yourls_apply_filter with all arguments in an array rather than as a list, filed on Google Code before the project was moved on Github.

Please review the original issue and especially its comments. Comments here on closed issues will be ignored. Thanks.

Original description

yourls_do_action always sends all args to yourls_apply_filter as a single array, but yourls_apply_filter uses them as if they're sent as individual arguments. The fix is to use call_user_func_array to call yourls_apply_filter. Patch attached.
ozh referenced this issue Jan 26, 2014
* Allow to change the URL to access admin pages (why not `/god/tools`?)
* No more `.php` at the end => design ;-)

@ovh Tu en pense quoi ? Je les ai mis dans /includes/admin mais peu
importe, on peut changer.
ozh added a commit to YOURLS/YOURLS-unit-tests that referenced this issue May 26, 2015
@ozh
Copy link
Member Author

ozh commented May 26, 2015

Copying original patch, before Google Code goes missing:

Index: includes/functions-plugins.php
===================================================================
--- includes/functions-plugins.php  (revision 771)
+++ includes/functions-plugins.php  (working copy)
@@ -155,7 +155,7 @@
 }

 function yourls_do_action( $hook, $arg = '' ) {
-   $args = array();
+   $args = array( $hook );
    if ( is_array( $arg ) && 1 == count( $arg ) && isset( $arg[0] ) && is_object( $arg[0] ) ) // array(&$this)
        $args[] =& $arg[0];
    else
@@ -163,7 +163,7 @@
    for ( $a = 2; $a < func_num_args(); $a++ )
        $args[] = func_get_arg( $a );

-   yourls_apply_filter( $hook, $args );
+   call_user_func_array( 'yourls_apply_filter', $args );
 }


@@ -505,4 +505,4 @@
    yourls_html_footer();

    die();
-}
\ No newline at end of file
+}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant