doujiao4710 2014-06-02 20:42
浏览 166
已采纳

Laravel 4.2无法正确渲染Blade视图

Running on Ubuntu 12.04 using HHVM 3.1.0 (the latest release). I've just recently tried updating from Laravel 4.1 to 4.2, and am having a really strange issue with Blade views not compiling correctly. There were no errors in the Laravel logs, so I checked out the HHVM logs. Turns out when trying to load a stored view using blade, HHVM was having compile errors. I opened up the stored view, and found that different uses of Blade aren't compiling correctly.

Original Blade Code:

<head>
  @include('layouts.partials._favicon')
</head>

<body id="signup-rotate">
  @include('layouts.partials._flash-messages')
...

Incorrect Compilation:

<head>
 <?php echo $__env->make(, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>('layouts.partials._favicon')
</head>

<body id="signup-rotate">
  <?php echo $__env->make('layouts.partials._flash-messages', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
...

As you can see, the code in the header is for some reason not adding the view to be included into the function, and is appending it to the end. This is obviously causing HHVM to not be able to compile the code, and an error is thrown. It seems strange to me that most of these includes are working, but others aren't.

Is this a known issue with Laravel 4.2, or is there something unique in my case that would cause this? It seems like Blade is also missing some tags, and so I'll have random blade syntax in my view files when they display (I can provide some code examples if requested).

Update This is actually a known issue and has been reported both in the Laravel and HHVM git repositories. It has apparently been fixed in HHVM nightlies, and will be working properly in the next release.

https://github.com/facebook/hhvm/issues/2841

  • 写回答

1条回答 默认 最新

  • doudao1282 2014-08-07 17:28
    关注

    As this comes up pretty high on search results, it is probably worth noting that this is indeed fixed as of the HHVM 3.2.0 release.

    If you are still stuck on a release < 3.2.0 for whatever reason, I was able to deal with it by finding the line on which HHVM threw the error (check the log files) and adding in a {{ "" }}. The GitHub issue you mentioned explains this in greater detail, but it seems that the Blade parsing was causing some statements to fall on an array boundary -- the "fix" I mentioned just pushes your Blade code onto the next array. It's not pretty, but it works if you need it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?