{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/7518","labels_url":"https://api.github.com/repos/laravel/framework/issues/7518/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/7518/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/7518/events","html_url":"https://github.com/laravel/framework/issues/7518","id":58281582,"number":7518,"title":"Blade bug: exception in some cases when the word \"or\" is in a comment","user":{"login":"tremby","id":199635,"avatar_url":"https://avatars.githubusercontent.com/u/199635?v=3","gravatar_id":"","url":"https://api.github.com/users/tremby","html_url":"https://github.com/tremby","followers_url":"https://api.github.com/users/tremby/followers","following_url":"https://api.github.com/users/tremby/following{/other_user}","gists_url":"https://api.github.com/users/tremby/gists{/gist_id}","starred_url":"https://api.github.com/users/tremby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tremby/subscriptions","organizations_url":"https://api.github.com/users/tremby/orgs","repos_url":"https://api.github.com/users/tremby/repos","events_url":"https://api.github.com/users/tremby/events{/privacy}","received_events_url":"https://api.github.com/users/tremby/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-19T22:36:45Z","updated_at":"2015-02-19T22:41:40Z","closed_at":"2015-02-19T22:41:25Z","body":"I hit a strange bug earlier and have boiled it down to a failing template.\r\n\r\nWith a fresh Laravel 5 project, if I replace welcome.blade.php with this:\r\n\r\n```php\r\n<?php\r\nclass Foo {\r\n\tpublic function bar($callback) {\r\n\t\treturn $callback();\r\n\t}\r\n}\r\n$foo = new Foo();\r\n?>\r\n{{ $foo->bar(function() {\r\n\t// Comments are okay here but if one contains the following word we get an exception.\r\n\r\n\t// or\r\n\r\n\treturn \"baz\";\r\n}) }}\r\n```\r\n\r\nAn exception is thrown.\r\n\r\n```\r\nFatalErrorException in e05da09885ea068f3fec7a1a33d8fad4 line 16: Cannot use isset() on the result of a function call (you can use \"null !== func()\" instead)\r\n```\r\n\r\nOn inspecting the compiled template we have\r\n\r\n```php\r\n<?php\r\nclass Foo {\r\n\tpublic function bar($callback) {\r\n\t\treturn $callback();\r\n\t}\r\n}\r\n$foo = new Foo();\r\n?>\r\n<?php echo e(isset($foo->bar(function() {\r\n\t// Comments are okay here but if one contains the following word we get an exception.\r\n\r\n\t//) ? $foo->bar(function() {\r\n\t// Comments are okay here but if one contains the following word we get an exception.\r\n\r\n\t// : return \"baz\";\r\n})); ?>\r\n```\r\n\r\nLooks like something is going quite wrong in the Blade compiler.\r\n\r\nIf you remove the comment `// or`, the file runs properly and we get output of \"baz\". In that case it compiles to\r\n\r\n```php\r\n<?php\r\nclass Foo {\r\n\tpublic function bar($callback) {\r\n\t\treturn $callback();\r\n\t}\r\n}\r\n$foo = new Foo();\r\n?>\r\n<?php echo e($foo->bar(function() {\r\n\t// Comments are okay here but if one contains the following word we get an exception.\r\n\r\n\treturn \"baz\";\r\n})); ?>\r\n```\r\n\r\nThe bug also exists in Laravel 4, which is where I found it, and also when the comment is the `# or` style or the `/* or */` style.\r\n\r\n(I know it is unwise to put logic like this in a Blade template, but it's a bug all the same.)"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/75154437","html_url":"https://github.com/laravel/framework/issues/7518#issuecomment-75154437","issue_url":"https://api.github.com/repos/laravel/framework/issues/7518","id":75154437,"user":{"login":"GrahamCampbell","id":2829600,"avatar_url":"https://avatars.githubusercontent.com/u/2829600?v=3","gravatar_id":"","url":"https://api.github.com/users/GrahamCampbell","html_url":"https://github.com/GrahamCampbell","followers_url":"https://api.github.com/users/GrahamCampbell/followers","following_url":"https://api.github.com/users/GrahamCampbell/following{/other_user}","gists_url":"https://api.github.com/users/GrahamCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/GrahamCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrahamCampbell/subscriptions","organizations_url":"https://api.github.com/users/GrahamCampbell/orgs","repos_url":"https://api.github.com/users/GrahamCampbell/repos","events_url":"https://api.github.com/users/GrahamCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/GrahamCampbell/received_events","type":"User","site_admin":false},"created_at":"2015-02-19T22:41:40Z","updated_at":"2015-02-19T22:41:40Z","body":"This is known I'm afraid. The or syntax is very limited. Sorry."}}