[BUGFIX] PHP warning if open_basedir is enabled
authorDmitry Dulepov <dmitry@typo3.org>
Sun, 27 Nov 2011 09:51:54 +0000 (11:51 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Sun, 18 Dec 2011 11:51:04 +0000 (12:51 +0100)
When using flexforms, a warning may appear in the Backend when
saving the form in BE (typically in a plugin). This happens
because TYPO3 checks if flexform DS is static (in the file)
using is_file. When the DS is not static, the parameter
to is_file is not a file name but an XML content. PHP
thinks this "file name" falls outside of the open_basedir
and complains with a warning. Possibly it can be solved
in other ways but this fix is the simplest possible.

Change-Id: I2c95522418e74e68c96c223f19b022d300467f7d
Resolves: #32109
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/6942
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Oliver Klee
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
t3lib/class.t3lib_befunc.php

index 8c9fb0e..e5c6e5d 100644 (file)
@@ -944,9 +944,13 @@ final class t3lib_BEfunc {
                                                if ($WSOL) {
                                                        self::workspaceOL($tName, $dataStructRec);
                                                }
-                                               if (is_file(PATH_site . $dataStructRec[$fName])) {
-                                                               // The value is a pointer to a file
-                                                       $dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl(PATH_site . $dataStructRec[$fName]));
+                                               if (strpos($dataStructRec[$fName], '<') === FALSE) {
+                                                       if (is_file(PATH_site . $dataStructRec[$fName])) {
+                                                                       // The value is a pointer to a file
+                                                               $dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl(PATH_site . $dataStructRec[$fName]));
+                                                       } else {
+                                                               $dataStructArray = sprintf('File \'%s\' was not found', $dataStructRec[$fName]);
+                                                       }
                                                } else {
                                                                // No file pointer, handle as being XML (default behaviour)
                                                        $dataStructArray = t3lib_div::xml2array($dataStructRec[$fName]);