Commits

Tobias Dammers  committed 81d1956

Fixed: calling undefined templates in PHP class mode

  • Participants
  • Parent commits f7bdac0

Comments (0)

Files changed (1)

File hpaco-lib/Text/HPaco/Writers/PHP.hs

         CallStatement identifier -> do
             wrapMode <- woWrapMode `liftM` ask
             writeIndent
-            write "eval("
+            write "if (isset("
             when (wrapMode == WrapClass) $ write "self::"
             write "$_macro_"
             write identifier
-            write ");"
+            write ")) {"
             endl
+            withIndent $ do
+                writeIndent
+                write "eval("
+                when (wrapMode == WrapClass) $ write "self::"
+                write "$_macro_"
+                write identifier
+                write ");"
+                endl
+            writeLn "}"
         SourcePositionStatement fn ln -> do
             c <- asks woSourcePositionComments
             when c $ do