Attached patch should fix this.

Comments

BarisW’s picture

Actually, this also fails for non-empty folders.

foreach($files) is never true, because all files are in $files->results. I've posted a similar solution that also tackles a use case where empty and filled folders are deleted: #1942360: Deleting a media folder term fails.

miroslavbanov’s picture

Issue is reproduced, but after patch I get errors when I try remove a folder. The directory is actually removed. Errors are:

Warning: rmdir(/var/www/drupalproject/sites/default/files/a) [function.rmdir]: No such file or directory in drupal_rmdir() (line 2374 of /var/www/drupalproject/includes/file.inc).
Error deleting folder a 
PHP 5.2.10-2ubuntu6.5 with Suhosin-Patch 0.9.7 (cli) (built: Sep 16 2010 19:48:40)
Drupal core  7.21

Media version:
69e9d2e525ec7311a48a6c8ba8be7e056fff6911
Date:   Sat Mar 2 12:47:00 2013 +0200

File Entity version:
commit e1fa3e05a8f849e54cddd703a9dc1b6e8f7c55de
Date:   Mon Mar 4 17:20:37 2013 -0500

Media Browser Plus for Media 2.x version:
commit 6fb3623675a20b160ba73ba6826d90b4ca58c0c3
Date:   Sat Mar 2 14:47:07 2013 +0100

BarisW’s picture

@MiroslavBanov: would you please test the patch in #1. Does this fix it?

miroslavbanov’s picture

[removed]
Oops, I got confused. Please ignore my post #2. I should have posted this, and my previous comment to a different issue.

das-peter’s picture

Status: Needs review » Fixed

As far as I understand this is fixed with #1942360: Deleting a media folder term fails, right?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.