Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#11712 closed defect (bug) (invalid)

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

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

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
17 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
17 years ago

  • Milestone Unassigned
  • Resolution → invalid
  • Status new → 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
17 years ago

  • Resolution invalid
  • Status closed → 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
17 years ago

  • Component General → Filesystem
  • Milestone → 3.0

#5 @scribu
17 years ago

  • Type defect (bug) → 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
17 years ago

its returning a value of 3, not 2

#7 @Frumph
17 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
17 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
17 years ago

  • Type enhancement → defect (bug)

So it is. I need some sleep.

#10 @hakre
17 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
17 years ago

  • Resolution → invalid
  • Status reopened → 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
17 years ago

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