Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/09/2016 02:08:07 PM (10 years ago)
Author:
xknown
Message:

Fix PHP 7 compat issues w.r.t. the use of func_get_arg().

func_get_arg() returns the current (modified) value of the given argument. Let's make sure the code behaves the same.

See #3033

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1/bb-includes/functions.bb-topics.php

    r2798 r6156  
    6060
    6161function get_latest_topics( $args = null ) {
     62        $_args = func_get_args();
    6263        $defaults = array( 'forum' => false, 'page' => 1, 'exclude' => false, 'number' => false );
    6364        if ( is_numeric( $args ) )
     
    6667                $args = wp_parse_args( $args ); // Make sure it's an array
    6768        if ( 1 < func_num_args() )
    68                 $args['page'] = func_get_arg(1);
     69                $args['page'] = $_args[1];
    6970        if ( 2 < func_num_args() )
    70                 $args['exclude'] = func_get_arg(2);
     71                $args['exclude'] = $_args[2];
    7172
    7273        $args = wp_parse_args( $args, $defaults );
     
    437438
    438439function get_thread( $topic_id, $args = null ) {
     440        $_args = func_get_args();
    439441        $defaults = array( 'page' => 1, 'order' => 'ASC' );
    440442        if ( is_numeric( $args ) )
    441443                $args = array( 'page' => $args );
    442         if ( @func_get_arg(2) )
     444        if ( @$_args[2] )
    443445                $defaults['order'] = 'DESC';
    444446
Note: See TracChangeset for help on using the changeset viewer.