{"action":"created","comment":{"url":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/comments/29218057","id":29218057,"diff_hunk":"@@ -297,6 +297,15 @@ public function toArray()\n         }\n \n         // return after filtering false, null and empty strings\n-        return array_filter($message, 'strlen');\n+        return array_filter($message, array($this, 'filter'));\n+    }\n+\n+    /**","path":"src/Gelf/Message.php","position":8,"original_position":8,"commit_id":"262e7ffce7ed07fdb1a6f6c2e7f2c602a891f3bd","original_commit_id":"262e7ffce7ed07fdb1a6f6c2e7f2c602a891f3bd","user":{"login":"bzikarsky","id":225374,"avatar_url":"https://avatars.githubusercontent.com/u/225374?v=3","gravatar_id":"","url":"https://api.github.com/users/bzikarsky","html_url":"https://github.com/bzikarsky","followers_url":"https://api.github.com/users/bzikarsky/followers","following_url":"https://api.github.com/users/bzikarsky/following{/other_user}","gists_url":"https://api.github.com/users/bzikarsky/gists{/gist_id}","starred_url":"https://api.github.com/users/bzikarsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bzikarsky/subscriptions","organizations_url":"https://api.github.com/users/bzikarsky/orgs","repos_url":"https://api.github.com/users/bzikarsky/repos","events_url":"https://api.github.com/users/bzikarsky/events{/privacy}","received_events_url":"https://api.github.com/users/bzikarsky/received_events","type":"User","site_admin":false},"body":"You may be right. I'll try to find out why the initial implementation was/is that way.","created_at":"2015-04-28T06:54:04Z","updated_at":"2015-04-28T06:54:04Z","html_url":"https://github.com/bzikarsky/gelf-php/pull/38#discussion_r29218057","pull_request_url":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/comments/29218057"},"html":{"href":"https://github.com/bzikarsky/gelf-php/pull/38#discussion_r29218057"},"pull_request":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/38","id":34115670,"html_url":"https://github.com/bzikarsky/gelf-php/pull/38","diff_url":"https://github.com/bzikarsky/gelf-php/pull/38.diff","patch_url":"https://github.com/bzikarsky/gelf-php/pull/38.patch","issue_url":"https://api.github.com/repos/bzikarsky/gelf-php/issues/38","number":38,"state":"open","locked":false,"title":"Pass arrays","user":{"login":"AlexeyKupershtokh","id":499778,"avatar_url":"https://avatars.githubusercontent.com/u/499778?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexeyKupershtokh","html_url":"https://github.com/AlexeyKupershtokh","followers_url":"https://api.github.com/users/AlexeyKupershtokh/followers","following_url":"https://api.github.com/users/AlexeyKupershtokh/following{/other_user}","gists_url":"https://api.github.com/users/AlexeyKupershtokh/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexeyKupershtokh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexeyKupershtokh/subscriptions","organizations_url":"https://api.github.com/users/AlexeyKupershtokh/orgs","repos_url":"https://api.github.com/users/AlexeyKupershtokh/repos","events_url":"https://api.github.com/users/AlexeyKupershtokh/events{/privacy}","received_events_url":"https://api.github.com/users/AlexeyKupershtokh/received_events","type":"User","site_admin":false},"body":"This fix allows to pass array values in the context. The original version fails on this code:\r\n```php\r\n// Now we can log...\r\n$logger->alert(\"Foobaz!\", array('test' => array('x' => '1', 'y' => '2')));\r\n```\r\nWith the following message:\r\n```\r\nPHP Notice:  Array to string conversion in gelf-php-wicked/src/Gelf/Logger.php on line 188\r\nPHP Warning:  strlen() expects parameter 1 to be string, array given in gelf-php-wicked/src/Gelf/Message.php on line 300\r\n```\r\nAnd the arrays are not send anywhere.\r\n\r\nWith this fix they don't raise errors and are sent correctly and are perfectly supported by the ELK stack.\r\n![kibana](https://cloud.githubusercontent.com/assets/499778/7335418/c6c412ce-ebd5-11e4-81b9-d78c2bd4264b.png)\r\n\r\nIf you aware this is an excerpt from the [PSR-3 documentation](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#13-context):\r\n```\r\nEvery method accepts an array as context data. This is meant to hold any extraneous\r\ninformation that does not fit well in a string. The array can contain anything.\r\nImplementors MUST ensure they treat context data with as much lenience as\r\npossible. A given value in the context MUST NOT throw an exception nor raise\r\nany php error, warning or notice.\r\n```\r\nThe only thing I haven't done is an interpolation for such nested arrays.","created_at":"2015-04-26T00:39:21Z","updated_at":"2015-04-28T06:54:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe18a885018b98ee123b3e5e0b65ad203f82c30d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/38/commits","review_comments_url":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/38/comments","review_comment_url":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bzikarsky/gelf-php/issues/38/comments","statuses_url":"https://api.github.com/repos/bzikarsky/gelf-php/statuses/262e7ffce7ed07fdb1a6f6c2e7f2c602a891f3bd","head":{"label":"AlexeyKupershtokh:pass_arrays","ref":"pass_arrays","sha":"262e7ffce7ed07fdb1a6f6c2e7f2c602a891f3bd","user":{"login":"AlexeyKupershtokh","id":499778,"avatar_url":"https://avatars.githubusercontent.com/u/499778?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexeyKupershtokh","html_url":"https://github.com/AlexeyKupershtokh","followers_url":"https://api.github.com/users/AlexeyKupershtokh/followers","following_url":"https://api.github.com/users/AlexeyKupershtokh/following{/other_user}","gists_url":"https://api.github.com/users/AlexeyKupershtokh/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexeyKupershtokh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexeyKupershtokh/subscriptions","organizations_url":"https://api.github.com/users/AlexeyKupershtokh/orgs","repos_url":"https://api.github.com/users/AlexeyKupershtokh/repos","events_url":"https://api.github.com/users/AlexeyKupershtokh/events{/privacy}","received_events_url":"https://api.github.com/users/AlexeyKupershtokh/received_events","type":"User","site_admin":false},"repo":{"id":34590989,"name":"gelf-php","full_name":"AlexeyKupershtokh/gelf-php","owner":{"login":"AlexeyKupershtokh","id":499778,"avatar_url":"https://avatars.githubusercontent.com/u/499778?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexeyKupershtokh","html_url":"https://github.com/AlexeyKupershtokh","followers_url":"https://api.github.com/users/AlexeyKupershtokh/followers","following_url":"https://api.github.com/users/AlexeyKupershtokh/following{/other_user}","gists_url":"https://api.github.com/users/AlexeyKupershtokh/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexeyKupershtokh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexeyKupershtokh/subscriptions","organizations_url":"https://api.github.com/users/AlexeyKupershtokh/orgs","repos_url":"https://api.github.com/users/AlexeyKupershtokh/repos","events_url":"https://api.github.com/users/AlexeyKupershtokh/events{/privacy}","received_events_url":"https://api.github.com/users/AlexeyKupershtokh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlexeyKupershtokh/gelf-php","description":"A php implementation to send log-files to a gelf compatible backend like graylog","fork":true,"url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php","forks_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/forks","keys_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/teams","hooks_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/hooks","issue_events_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/issues/events{/number}","events_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/events","assignees_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/assignees{/user}","branches_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/branches{/branch}","tags_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/tags","blobs_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/statuses/{sha}","languages_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/languages","stargazers_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/stargazers","contributors_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/contributors","subscribers_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/subscribers","subscription_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/subscription","commits_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/contents/{+path}","compare_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/merges","archive_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/downloads","issues_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/issues{/number}","pulls_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/pulls{/number}","milestones_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/milestones{/number}","notifications_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/labels{/name}","releases_url":"https://api.github.com/repos/AlexeyKupershtokh/gelf-php/releases{/id}","created_at":"2015-04-25T23:57:25Z","updated_at":"2015-04-25T23:57:25Z","pushed_at":"2015-04-26T00:25:46Z","git_url":"git://github.com/AlexeyKupershtokh/gelf-php.git","ssh_url":"git@github.com:AlexeyKupershtokh/gelf-php.git","clone_url":"https://github.com/AlexeyKupershtokh/gelf-php.git","svn_url":"https://github.com/AlexeyKupershtokh/gelf-php","homepage":null,"size":247,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bzikarsky:master","ref":"master","sha":"199bfcb100d398401b31345fe7cc784091bda944","user":{"login":"bzikarsky","id":225374,"avatar_url":"https://avatars.githubusercontent.com/u/225374?v=3","gravatar_id":"","url":"https://api.github.com/users/bzikarsky","html_url":"https://github.com/bzikarsky","followers_url":"https://api.github.com/users/bzikarsky/followers","following_url":"https://api.github.com/users/bzikarsky/following{/other_user}","gists_url":"https://api.github.com/users/bzikarsky/gists{/gist_id}","starred_url":"https://api.github.com/users/bzikarsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bzikarsky/subscriptions","organizations_url":"https://api.github.com/users/bzikarsky/orgs","repos_url":"https://api.github.com/users/bzikarsky/repos","events_url":"https://api.github.com/users/bzikarsky/events{/privacy}","received_events_url":"https://api.github.com/users/bzikarsky/received_events","type":"User","site_admin":false},"repo":{"id":9767200,"name":"gelf-php","full_name":"bzikarsky/gelf-php","owner":{"login":"bzikarsky","id":225374,"avatar_url":"https://avatars.githubusercontent.com/u/225374?v=3","gravatar_id":"","url":"https://api.github.com/users/bzikarsky","html_url":"https://github.com/bzikarsky","followers_url":"https://api.github.com/users/bzikarsky/followers","following_url":"https://api.github.com/users/bzikarsky/following{/other_user}","gists_url":"https://api.github.com/users/bzikarsky/gists{/gist_id}","starred_url":"https://api.github.com/users/bzikarsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bzikarsky/subscriptions","organizations_url":"https://api.github.com/users/bzikarsky/orgs","repos_url":"https://api.github.com/users/bzikarsky/repos","events_url":"https://api.github.com/users/bzikarsky/events{/privacy}","received_events_url":"https://api.github.com/users/bzikarsky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bzikarsky/gelf-php","description":"A php implementation to send log-files to a gelf compatible backend like graylog","fork":false,"url":"https://api.github.com/repos/bzikarsky/gelf-php","forks_url":"https://api.github.com/repos/bzikarsky/gelf-php/forks","keys_url":"https://api.github.com/repos/bzikarsky/gelf-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bzikarsky/gelf-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bzikarsky/gelf-php/teams","hooks_url":"https://api.github.com/repos/bzikarsky/gelf-php/hooks","issue_events_url":"https://api.github.com/repos/bzikarsky/gelf-php/issues/events{/number}","events_url":"https://api.github.com/repos/bzikarsky/gelf-php/events","assignees_url":"https://api.github.com/repos/bzikarsky/gelf-php/assignees{/user}","branches_url":"https://api.github.com/repos/bzikarsky/gelf-php/branches{/branch}","tags_url":"https://api.github.com/repos/bzikarsky/gelf-php/tags","blobs_url":"https://api.github.com/repos/bzikarsky/gelf-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bzikarsky/gelf-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bzikarsky/gelf-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/bzikarsky/gelf-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bzikarsky/gelf-php/statuses/{sha}","languages_url":"https://api.github.com/repos/bzikarsky/gelf-php/languages","stargazers_url":"https://api.github.com/repos/bzikarsky/gelf-php/stargazers","contributors_url":"https://api.github.com/repos/bzikarsky/gelf-php/contributors","subscribers_url":"https://api.github.com/repos/bzikarsky/gelf-php/subscribers","subscription_url":"https://api.github.com/repos/bzikarsky/gelf-php/subscription","commits_url":"https://api.github.com/repos/bzikarsky/gelf-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/bzikarsky/gelf-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/bzikarsky/gelf-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/bzikarsky/gelf-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/bzikarsky/gelf-php/contents/{+path}","compare_url":"https://api.github.com/repos/bzikarsky/gelf-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bzikarsky/gelf-php/merges","archive_url":"https://api.github.com/repos/bzikarsky/gelf-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bzikarsky/gelf-php/downloads","issues_url":"https://api.github.com/repos/bzikarsky/gelf-php/issues{/number}","pulls_url":"https://api.github.com/repos/bzikarsky/gelf-php/pulls{/number}","milestones_url":"https://api.github.com/repos/bzikarsky/gelf-php/milestones{/number}","notifications_url":"https://api.github.com/repos/bzikarsky/gelf-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bzikarsky/gelf-php/labels{/name}","releases_url":"https://api.github.com/repos/bzikarsky/gelf-php/releases{/id}","created_at":"2013-04-30T08:42:29Z","updated_at":"2015-04-25T23:55:58Z","pushed_at":"2015-04-26T00:39:21Z","git_url":"git://github.com/bzikarsky/gelf-php.git","ssh_url":"git@github.com:bzikarsky/gelf-php.git","clone_url":"https://github.com/bzikarsky/gelf-php.git","svn_url":"https://github.com/bzikarsky/gelf-php","homepage":null,"size":988,"stargazers_count":60,"watchers_count":60,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":60,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/38"},"html":{"href":"https://github.com/bzikarsky/gelf-php/pull/38"},"issue":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/issues/38"},"comments":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/bzikarsky/gelf-php/statuses/262e7ffce7ed07fdb1a6f6c2e7f2c602a891f3bd"}}}}