WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#26091 closed defect (bug) (fixed)

Infinite loop in WP_FIlesystem_MockFS->mkdir()

Reported by: p_enrique Owned by: 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 5 months ago.
26091.patch (933 bytes) - added by SergeyBiryukov 5 months ago.

Download all attachments as: .zip

Change History (5)

p_enrique5 months ago

SergeyBiryukov5 months ago

comment:1 SergeyBiryukov5 months 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.

comment:2 SergeyBiryukov5 months 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.

comment:3 knutsp5 months ago

Related #22267

Note: See TracTickets for help on using tickets.