Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 352)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 353)
@@ -150,4 +150,7 @@
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/239">#239</a>] The &lt;xml&gt;
 			tag will not anymore cause troubles.</li>
+		<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1721787&group_id=75348&atid=543653">SF
+			BUG-1721787</a>] If the editor is run from a virtual dir, the PHP connector will detect that
+			and avoid generating a wrong folder.</li>
 	</ul>
 	<h3>
Index: /FCKeditor/trunk/editor/filemanager/browser/default/connectors/php/io.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/connectors/php/io.php	(revision 352)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/connectors/php/io.php	(revision 353)
@@ -97,5 +97,16 @@
 	$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;
 
-	return substr( $sRealPath, 0, strlen( $sRealPath ) - strlen( $sSelfPath ) ) ;
+	// Get the slash according to the filesystem
+	$slash = ( strpos( $sRealPath, '/' ) === false ) ? '\\' : '/' ;
+	$sSelfPath = str_replace('/', $slash, $sSelfPath) ;
+	
+	$position = strpos($sRealPath, $sSelfPath) ;
+
+	// This can check only that this script isn't run from a virtual dir
+	// But it avoids problems the problems that arise if it isn't checked
+	if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) )
+		SendError( 1, "Sorry, can't map 'UserFilesPath' to a physical path. You must set the 'UserFilesAbsolutePath' value " . $position) ;
+
+	return substr( $sRealPath, 0, $position ) ;
 }
 ?>
