سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top