Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-10844

Extensions are not located when front-end file has a diffferent phpbb_root_path

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-dev
    • Fix Version/s: 3.1.0-a1
    • Component/s: Extensions
    • Labels:
      None

      Description

      In the extension finder is some code which removes the phpbb_root_path (but only if it is "./") and reappends it for the checks later.

      When your front-end file is not inside the phpbb root, but a subfolder and therefor your root path is "../" it does not get removed, but is prepended later again. The the finder tries to locate the extensions in ../../ instead of ../

      	/**
      	* Removes occurances of /./ and makes sure path ends without trailing slash
      	*
      	* @param string $directory A directory pattern
      	* @return string A cleaned up directory pattern
      	*/
      	protected function sanitise_directory($directory)
      	{
      		$directory = preg_replace('#(?:^|/)\./#', '/', $directory);
      		$dir_len = strlen($directory);
       
      		if ($dir_len > 1 && $directory[$dir_len - 1] === '/')
      		{
      			$directory = substr($directory, 0, -1);
      		}
       
      		return $directory;
      	}

      This function in phpBB\includes\extension\finder.php must be modified to replace the first occurance of

      '/' . $phpbb_root_path

      with

      /

      and afterwards remove all

      /./

        Issue Links

          Activity

          Hide
          nickvergessen Joas Schilling added a comment -

          Smaple code that could be added:

          		if (strpos($directory, '/' . $this->phpbb_root_path) === 0)
          		{
          			$directory = substr($directory, strlen('/' . $this->phpbb_root_path));
          		}

          (I'd prefer if it is in the regex thou)

          Show
          nickvergessen Joas Schilling added a comment - Smaple code that could be added: if (strpos($directory, '/' . $this->phpbb_root_path) === 0) { $directory = substr($directory, strlen('/' . $this->phpbb_root_path)); } (I'd prefer if it is in the regex thou)

            People

            • Assignee:
              nickvergessen Joas Schilling
              Reporter:
              nickvergessen Joas Schilling
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development