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 20, 2017
1 parent 6289a8c commit 96c968a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Resources/contao/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 96c968a

Please sign in to comment.