WordPress.org

Make WordPress Core

Ticket #21520: recursion.patch

File recursion.patch, 639 bytes (added by pross, 5 years ago)
  • wp-includes/class.wp-dependencies.php

    diff --git a/wp-includes/class.wp-dependencies.php b/wp-includes/class.wp-dependencies.php
    index 0348418..bf291bd 100644
    a b class _WP_Dependency { 
    487487                @list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
    488488                if ( ! is_array($this->deps) )
    489489                        $this->deps = array();
     490
     491                /**
     492                 * If the script has a set dependency of itself we get a recursion fatal error.
     493                 */
     494                foreach( $this->deps as $k => $dep ) {
     495                        if( $this->handle === $dep ) {
     496                                unset( $this->deps[$k] );
     497                        }
     498                }
    490499        }
    491500
    492501        /**