From f8fbe3793680af1dae2db2829cfc84068831c52f Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 28 Jun 2017 00:58:03 +0700 Subject: [ticket/14972] replace all occurrences of sizeof() with the count() PHPBB3-14972 --- phpBB/phpbb/filesystem/filesystem.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb/filesystem') diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php index 2112882d1d..3f39448f05 100644 --- a/phpBB/phpbb/filesystem/filesystem.php +++ b/phpBB/phpbb/filesystem/filesystem.php @@ -171,7 +171,7 @@ class filesystem implements filesystem_interface continue; } - if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '.' && $filtered[sizeof($filtered) - 1] !== '..') + if ($part === '..' && !empty($filtered) && $filtered[count($filtered) - 1] !== '.' && $filtered[count($filtered) - 1] !== '..') { array_pop($filtered); } @@ -671,7 +671,7 @@ class filesystem implements filesystem_interface else if (function_exists('debug_backtrace')) { $call_stack = debug_backtrace(0); - $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[sizeof($call_stack) - 1]['file'])); + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[count($call_stack) - 1]['file'])); } else { @@ -683,7 +683,7 @@ class filesystem implements filesystem_interface //$dir_parts = explode(DIRECTORY_SEPARATOR, __DIR__); //$namespace_parts = explode('\\', trim(__NAMESPACE__, '\\')); - //$namespace_part_count = sizeof($namespace_parts); + //$namespace_part_count = count($namespace_parts); // Check if we still loading from root //if (array_slice($dir_parts, -$namespace_part_count) === $namespace_parts) @@ -807,7 +807,7 @@ class filesystem implements filesystem_interface array_pop($resolved); $resolved_path = false; } - else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[sizeof($resolved) - 1], array('.', '..'))) + else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[count($resolved) - 1], array('.', '..'))) { array_pop($resolved); $resolved_path = false; -- cgit v1.2.1 From bd91b6be8733082f7d3ee1f081e04b1e8a929fa7 Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 1 Jun 2018 22:51:53 +0700 Subject: [ticket/15678] Fix PHP warning in filesystem.php PHPBB3-15678 --- phpBB/phpbb/filesystem/filesystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/filesystem') diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php index 3f39448f05..bfafdf5ddd 100644 --- a/phpBB/phpbb/filesystem/filesystem.php +++ b/phpBB/phpbb/filesystem/filesystem.php @@ -367,7 +367,7 @@ class filesystem implements filesystem_interface $common_php_group = @filegroup(__FILE__); // And the owner and the groups PHP is running under. - $php_uid = (function_exists('posic_getuid')) ? @posix_getuid() : false; + $php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false; $php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false; // If we are unable to get owner/group, then do not try to set them by guessing -- cgit v1.2.1