0

I have HHVM running on a virtualbox VM, with the webroot mapping to my local laravel install, being served out at an internal IP.

Locally, I'm serving the site out under http://[localhost]:8000.

The codebase is identical.

code of MembersController.php (resourceful controller):

public function show($id)
{


        $member = Member::findOrFail($id);

        $data               = array();
        $data['id']         = $member->id;
        $data['first_name'] = $member->first_name;
        $data['last_name']  = $member->last_name;

        return Response::json($data);


}

Assuming everything is working normally:

When I run a GET request to LOCALHOST: http://[localhost]:8000/api/v1/member/1, the client returns the JSON as normal - all good.

When I run a GET request to HHVM (same client, identical codebase): http://[vm_ip_address]/api/v1/member/1, the client receives no data.

The data is being passed back through the calls within HHVM though, as if I change the 'return' to 'echo', the payload is returned in both cases (headers also)

It looks like HHVM is affecting with laravel's Response::json() function and disallowing the reply contents from being displayed in the client.

Has anyone else seen this?

This is not something I can set up a unit test for, as it always passes, because the final reply always has data in it :/

Any input would be great - I'm interested to learn how to get around this.

Thanks.

ArkadePaulG
  • 161
  • 2
  • 10
  • What kind of client are you using? Have you verified the `Content-Type: application/json` request and response headers? Are you using Nginx, Apache? Which Laravel version are you using? Also I'd recommend using [httpie](https://github.com/jakubroztocil/httpie) for API testing (if you're on a Mac). – mauvm Nov 07 '14 at 13:08

1 Answers1

0

Sadly you're probably going to have to get your hands dirty debugging. HHVM probably has a very slight difference in how it does something which this code-path is sensitive to. We pass 100% of laravel unit tests, but there probably isn't one covering this case.

If you can, please trace down the code to where the data changes. Put in echos and error_logs until you can build a very small test case then then open an issue on github and we'll get it fixed.

Paul Tarjan
  • 48,968
  • 59
  • 172
  • 213
  • Thanks Paul - I've done a deep-dive into the Laravel core and I think I can see where it's happening - I'll set up today to check if I can get it to work locally but fail on HHVM. Cheers for your reply! – ArkadePaulG Mar 06 '14 at 19:48