[BUGFIX] Fatal error: Call to undefined function posix_getgid()
authorPhilipp Gampe <forge.typo3.org@philippgampe.info>
Sat, 3 Mar 2012 12:11:21 +0000 (13:11 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Wed, 7 Mar 2012 18:38:57 +0000 (19:38 +0100)
Limit the data to entries which can be created without posix_getgid().

Change-Id: I26f8950e2d69185ff990489f573e3dde8f870aca
Fixes: #34482
Releases: 4.8
Reviewed-on: http://review.typo3.org/9333
Reviewed-by: Oliver Klee
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
tests/t3lib/file/Driver/LocalDriverTest.php

index 0683623..c054f91 100644 (file)
@@ -869,23 +869,36 @@ class t3lib_file_Driver_LocalDriverTest extends t3lib_file_BaseTestCase {
                $this->assertEquals(array('r' => FALSE, 'w' => FALSE), $fixture->getFolderPermissions($this->getSimpleFolderMock('/someForbiddenFolder')));
        }
 
+       /**
+        * Dataprovider for getFilePermissionsReturnsCorrectPermissionsForFilesNotOwnedByCurrentUser test
+        *
+        * @return array group, filemode and expected result
+        */
        public function getFilePermissionsReturnsCorrectPermissionsForFilesNotOwnedByCurrentUser_dataProvider() {
-               return array(
-                       'current group, readable/writable' => array(
-                               posix_getgid(),
-                               0060,
-                               array('r' => TRUE, 'w' => TRUE)
-                       ),
-                       'current group, readable/not writable' => array(
-                               posix_getgid(),
-                               0040,
-                               array('r' => TRUE, 'w' => FALSE)
-                       ),
-                       'current group, not readable/not writable' => array(
-                               posix_getgid(),
-                               0000,
-                               array('r' => FALSE, 'w' => FALSE)
-                       ),
+               $data = array();
+
+                       // On some OS, the posix_* functions do not exits
+               if (function_exists('posix_getgid')) {
+                       $data = array(
+                               'current group, readable/writable' => array(
+                                       posix_getgid(),
+                                       0060,
+                                       array('r' => TRUE, 'w' => TRUE)
+                               ),
+                               'current group, readable/not writable' => array(
+                                       posix_getgid(),
+                                       0040,
+                                       array('r' => TRUE, 'w' => FALSE)
+                               ),
+                               'current group, not readable/not writable' => array(
+                                       posix_getgid(),
+                                       0000,
+                                       array('r' => FALSE, 'w' => FALSE)
+                               ),
+                       );
+               }
+
+               $data = array_merge_recursive($data, array(
                        'arbitrary group, readable/writable' => array(
                                vfsStream::GROUP_USER_1,
                                0006,
@@ -900,8 +913,10 @@ class t3lib_file_Driver_LocalDriverTest extends t3lib_file_BaseTestCase {
                                vfsStream::GROUP_USER_1,
                                0660,
                                array('r' => FALSE, 'w' => FALSE)
-                       )
-               );
+                       ),
+               ));
+
+               return $data;
        }
 
        /**