Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#26091 closed defect (bug) (fixed)

Infinite loop in WP_FIlesystem_MockFS->mkdir()

Reported by: p_enrique's profile p_enrique Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.8 Priority: normal
Severity: major Version: 3.7
Component: Unit Tests Keywords: has-patch commit
Focuses: Cc:

Description

When running the unit tests under Windows/WampServer with command phpunit (no parameters): Fatal error: Maximum function nesting level of '100' reached, aborting! in C:\wamp\www\wordpress-svn\src\wp-includes\formatting.php on line 1413

The error stops the tests.

The PhpUnit output seems to point to an infinite loop in this code:

function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
	$path = trailingslashit( $path );

	$parent_node = $this->locate_parent_node( $path );
	if ( ! $parent_node ) {
		$this->mkdir( dirname( $path ) );
        [...]

Attachments (2)

phpunit_output.txt (12.2 KB) - added by p_enrique 11 years ago.
26091.patch (933 bytes) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
11 years ago

  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 3.8
  • Version changed from 3.7.1 to 3.7

Related: [25053]

Confirmed, the tests were failing for me too on Windows. Added some logs:

Iteration 1
$path: /var/www/wordpress/
dirname( $path ): /var/www
Iteration 2
$path: /var/www/
dirname( $path ): /var
Iteration 3
$path: /var/
dirname( $path ): \
Iteration 4
$path: \/
dirname( $path ): \
Iteration 5
$path: \/
dirname( $path ): \
...

26091.patch normalizes dirname() to prevent the infinite loop. Makes the filesystem tests pass on Windows.

#2 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 26246:

Normalize slashes in WP_Filesystem_MockFS::mkdir() and WP_Filesystem_MockFS::locate_parent_node() to avoid an infinite loop on Windows.

fixes #26091.

#3 @knutsp
11 years ago

Related #22267

Note: See TracTickets for help on using tickets.