Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Correctly handle custom namespaces when combining DCA files (see #8682).
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Apr 18, 2017
1 parent 7594240 commit bf11970
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions system/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Contao Open Source CMS changelog
Version 3.5.26 (2017-XX-XX)
---------------------------

### Fixed
Correctly handle custom namespaces when combining DCA files (see #8682).

### Fixed
Also check the X-Forwarded-Proto header when determining HTTPS (see #8691).

Expand Down
7 changes: 7 additions & 0 deletions system/modules/core/library/Contao/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,13 @@ protected static function readPhpFileWithoutTags($strName, $blnAddNamespace=fals

if ($blnAddNamespace)
{
$arrMatches = array();

if (preg_match('/^namespace ([A-Za-z0-9_\\\\]+);/m', $strCode, $arrMatches))
{
return sprintf("\nnamespace %s {%s\n\n}", $arrMatches[1], rtrim(preg_replace('/(\n|^)namespace [A-Za-z0-9_\\\\]+;\n?/m', '', $strCode)));
}

return sprintf("\nnamespace {%s\n\n}", rtrim($strCode));
}

Expand Down

0 comments on commit bf11970

Please sign in to comment.