Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#11712 closed defect (bug) (invalid)

Theme Editor -> "Sorry, that file cannot be edited."

Reported by: frumph's profile Frumph Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Filesystem API Keywords:
Focuses: Cc:

Description

What causes this error to come up, I heard it had something to do with a particular theme however it's still doing it with the default theme in wordpress 2.9.1 rc 1 and the svn 3.0 repo.

If this is a theme situation, what would cause this that I can look at in our code/plugins?

Change History (12)

#1 in reply to: ↑ description @Frumph
15 years ago

Replying to Frumph:

What causes this error to come up, I heard it had something to do with a particular theme however it's still doing it with the default theme in wordpress 2.9.1 rc 1 and the svn 3.0 repo.

If this is a theme situation, what would cause this that I can look at in our code/plugins?

Yeah sorry, *NOT* doing it on default theme, so I know it's our theme, I just want to figure out what would cause it and clean that up in our theme.

#2 @scribu
15 years ago

  • Milestone Unassigned deleted
  • Resolution set to invalid
  • Status changed from new to closed

Please post your question on the support forums or on the wp-hackers mailing list, providing the path of the file you're trying to edit.

#3 @Frumph
15 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Reopening

function validate_file( in wp-includes/functions.php 
}}

is returning $file as not a valid comparison to the array

example:
{{{
 string(29) "/themes/comicpress/footer.php" 
}}}

however the array:

{{{
array(78) { [0]=>  string(59) "C:\inetpub\localhost/wp-content/themes/comicpress/style.css" 
}}}

because the C:\inetpub\localhost is there it will never come back with a correct value





#4 @scribu
15 years ago

  • Component changed from General to Filesystem
  • Milestone set to 3.0

#5 @scribu
15 years ago

  • Type changed from defect (bug) to enhancement

From the function doc:

A return value of '2' means that the $file contains ':' after the first character.

So it's documented behaviour.

No ideea why that restriction is imposed, so I'll leave it to someone more knowledgeable.

#6 @Frumph
15 years ago

its returning a value of 3, not 2

#7 @Frumph
15 years ago

	if (':' == substr( $file, 1, 1 ))
		return 2;

Note that it's currently checking $file, while file is string(29) "/themes/comicpress/footer.php"

thats why it's returning 3 because it actually stop ahead of that line at this:

	if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
		return 3;

which is actually before the return 2 in the function validate_file

#8 @Frumph
15 years ago

..the bug here is that $file doesn't always return the full abspath with it so it doesn't match the array.

This is not an enhancement, it's a bug.

#9 @scribu
15 years ago

  • Type changed from enhancement to defect (bug)

So it is. I need some sleep.

#10 @hakre
15 years ago

Can you provide a link to the theme so other developers are more easy to reproduce the bug? That should help to solve the issue.

#11 @johncoswell
15 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

The theme was using a variable in the global scope -- $dir -- that theme-editor.php was expecting to have full use of. This has been fixed in the latest revision of the theme.

#12 @nacin
15 years ago

  • Milestone 3.0 deleted
Note: See TracTickets for help on using tickets.