{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/hhvm/issues/1627","labels_url":"https://api.github.com/repos/facebook/hhvm/issues/1627/labels{/name}","comments_url":"https://api.github.com/repos/facebook/hhvm/issues/1627/comments","events_url":"https://api.github.com/repos/facebook/hhvm/issues/1627/events","html_url":"https://github.com/facebook/hhvm/issues/1627","id":26130325,"number":1627,"title":"Zend incompatibility: yield syntax for sending values to generator","user":{"login":"stuartcarnie","id":52852,"avatar_url":"https://avatars.githubusercontent.com/u/52852?v=3","gravatar_id":"","url":"https://api.github.com/users/stuartcarnie","html_url":"https://github.com/stuartcarnie","followers_url":"https://api.github.com/users/stuartcarnie/followers","following_url":"https://api.github.com/users/stuartcarnie/following{/other_user}","gists_url":"https://api.github.com/users/stuartcarnie/gists{/gist_id}","starred_url":"https://api.github.com/users/stuartcarnie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuartcarnie/subscriptions","organizations_url":"https://api.github.com/users/stuartcarnie/orgs","repos_url":"https://api.github.com/users/stuartcarnie/repos","events_url":"https://api.github.com/users/stuartcarnie/events{/privacy}","received_events_url":"https://api.github.com/users/stuartcarnie/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/hhvm/labels/low-pri","name":"low-pri","color":"fef2c0"},{"url":"https://api.github.com/repos/facebook/hhvm/labels/php5%20incompatibility","name":"php5 incompatibility","color":"837ced"}],"state":"open","locked":false,"assignee":{"login":"paulbiss","id":1039792,"avatar_url":"https://avatars.githubusercontent.com/u/1039792?v=3","gravatar_id":"","url":"https://api.github.com/users/paulbiss","html_url":"https://github.com/paulbiss","followers_url":"https://api.github.com/users/paulbiss/followers","following_url":"https://api.github.com/users/paulbiss/following{/other_user}","gists_url":"https://api.github.com/users/paulbiss/gists{/gist_id}","starred_url":"https://api.github.com/users/paulbiss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulbiss/subscriptions","organizations_url":"https://api.github.com/users/paulbiss/orgs","repos_url":"https://api.github.com/users/paulbiss/repos","events_url":"https://api.github.com/users/paulbiss/events{/privacy}","received_events_url":"https://api.github.com/users/paulbiss/received_events","type":"User","site_admin":false},"milestone":null,"comments":14,"created_at":"2014-01-22T22:52:30Z","updated_at":"2015-06-23T21:23:40Z","closed_at":null,"body":"The following code fails to compile with hhvm\r\n```php\r\n<?php\r\n\r\nfunction get_gen() {\r\n    echo \"Starting generator\\n\";\r\n    $a = yield;\r\n    echo $a . \"\\n\";\r\n}\r\n\r\n$gen = get_gen();\r\n$gen->send(1);\r\n```\r\n\r\nReturns (hhvm):\r\n```\r\nHipHop Fatal error: syntax error, unexpected ';' in /home/contatta/tmp/generator_test.php on line 5\r\n```\r\n\r\nBy adding a simple expression (which is not compatible with Zend), it then complains ->next() must be called, which is also incompatible with Zend:\r\n\r\n```php\r\n<?php\r\n\r\nfunction get_gen() {\r\n    echo \"Starting generator\\n\";\r\n    $a = yield 0;\r\n    echo $a . \"\\n\";\r\n}\r\n\r\n$gen = get_gen();\r\n$gen->send(1);\r\n```\r\n\r\nReturns (hhvm):\r\n```\r\nHipHop Fatal error: Uncaught exception 'Exception' with message 'Need to call next() first' in :\r\nStack trace:\r\n#0 /home/contatta/tmp/generator_test.php(10): Continuation->send()\r\n#1 {main}\r\n```\r\n\r\nThe following is compatible with Zend (but not hhvm), and does not require ->next() be called:\r\n\r\n```php\r\n<?php\r\n\r\nfunction get_gen() {\r\n    echo \"Starting generator\\n\";\r\n    $a = (yield 0);\r\n    echo $a . \"\\n\";\r\n}\r\n\r\n$gen = get_gen();\r\n$gen->send(1);\r\n```\r\n\r\nReturns (hhvm):\r\n```\r\nHipHop Fatal error: syntax error, unexpected T_YIELD in /home/contatta/tmp/generator_test.php on line 5\r\n```\r\n\r\nReturns (Zend):\r\n```\r\nStarting generator\r\n1\r\nEnd\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/hhvm/issues/comments/114645575","html_url":"https://github.com/facebook/hhvm/issues/1627#issuecomment-114645575","issue_url":"https://api.github.com/repos/facebook/hhvm/issues/1627","id":114645575,"user":{"login":"EwanValentine","id":1155123,"avatar_url":"https://avatars.githubusercontent.com/u/1155123?v=3","gravatar_id":"","url":"https://api.github.com/users/EwanValentine","html_url":"https://github.com/EwanValentine","followers_url":"https://api.github.com/users/EwanValentine/followers","following_url":"https://api.github.com/users/EwanValentine/following{/other_user}","gists_url":"https://api.github.com/users/EwanValentine/gists{/gist_id}","starred_url":"https://api.github.com/users/EwanValentine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EwanValentine/subscriptions","organizations_url":"https://api.github.com/users/EwanValentine/orgs","repos_url":"https://api.github.com/users/EwanValentine/repos","events_url":"https://api.github.com/users/EwanValentine/events{/privacy}","received_events_url":"https://api.github.com/users/EwanValentine/received_events","type":"User","site_admin":false},"created_at":"2015-06-23T21:23:40Z","updated_at":"2015-06-23T21:23:40Z","body":"v2 works with HHVM, but v2 doesn't work with Laravel 5.1 unfortunately. I'll have to try the nightly HHVM build or revert back to php-fpm for now\r\n"}}