{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/comments/78399836","id":78399836,"diff_hunk":"@@ -227,6 +233,116 @@ PHP_METHOD(Javascript, getScope)\n }\n /* }}} */\n \n+/* {{{ proto string Javascript::serialize()\n+*/\n+PHP_METHOD(Javascript, serialize)\n+{\n+\tphp_phongo_javascript_t  *intern;\n+#if PHP_VERSION_ID >= 70000\n+\tzval                      retval;\n+#else\n+\tzval                     *retval;\n+#endif\n+\tphp_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;\n+\n+\tphp_serialize_data_t      var_hash;\n+\tsmart_str                 buf = { 0 };\n+\n+\tintern = Z_JAVASCRIPT_OBJ_P(getThis());\n+\n+\tif (zend_parse_parameters_none() == FAILURE) {\n+\t\treturn;\n+\t}\n+\n+#if PHP_VERSION_ID >= 70000\n+\tif (intern->scope && intern->scope->len) {\n+\t\tphongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state);","path":"src/BSON/Javascript.c","position":40,"original_position":40,"commit_id":"1a196b8a8c4c3893315b2aeb93dcdc3b167878fd","original_commit_id":"1a196b8a8c4c3893315b2aeb93dcdc3b167878fd","user":{"login":"jmikola","id":244663,"avatar_url":"https://avatars.githubusercontent.com/u/244663?v=3","gravatar_id":"","url":"https://api.github.com/users/jmikola","html_url":"https://github.com/jmikola","followers_url":"https://api.github.com/users/jmikola/followers","following_url":"https://api.github.com/users/jmikola/following{/other_user}","gists_url":"https://api.github.com/users/jmikola/gists{/gist_id}","starred_url":"https://api.github.com/users/jmikola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmikola/subscriptions","organizations_url":"https://api.github.com/users/jmikola/orgs","repos_url":"https://api.github.com/users/jmikola/repos","events_url":"https://api.github.com/users/jmikola/events{/privacy}","received_events_url":"https://api.github.com/users/jmikola/received_events","type":"User","site_admin":false},"body":"This function can throw an exception and return zero. \r\n\r\nIf you look at `php_phongo_javascript_get_properties()`, it stores null for the \"scope\" field (as if it didn't exist at all) and allows the function to return. That works out because nothing later in the function would throw. In this case, it might make more sense to return early instead of continuing to call `php_var_serialize()` below.","created_at":"2016-09-12T15:53:45Z","updated_at":"2016-09-12T15:53:45Z","html_url":"https://github.com/mongodb/mongo-php-driver/pull/391#discussion_r78399836","pull_request_url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/391","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/comments/78399836"},"html":{"href":"https://github.com/mongodb/mongo-php-driver/pull/391#discussion_r78399836"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/391"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/391","id":84153424,"html_url":"https://github.com/mongodb/mongo-php-driver/pull/391","diff_url":"https://github.com/mongodb/mongo-php-driver/pull/391.diff","patch_url":"https://github.com/mongodb/mongo-php-driver/pull/391.patch","issue_url":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/391","number":391,"state":"open","locked":false,"title":"PHPC-779: Switch serialization from O type to C type","user":{"login":"derickr","id":208074,"avatar_url":"https://avatars.githubusercontent.com/u/208074?v=3","gravatar_id":"","url":"https://api.github.com/users/derickr","html_url":"https://github.com/derickr","followers_url":"https://api.github.com/users/derickr/followers","following_url":"https://api.github.com/users/derickr/following{/other_user}","gists_url":"https://api.github.com/users/derickr/gists{/gist_id}","starred_url":"https://api.github.com/users/derickr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derickr/subscriptions","organizations_url":"https://api.github.com/users/derickr/orgs","repos_url":"https://api.github.com/users/derickr/repos","events_url":"https://api.github.com/users/derickr/events{/privacy}","received_events_url":"https://api.github.com/users/derickr/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-06T16:22:59Z","updated_at":"2016-09-12T15:53:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86ff04a869b2fdee4cb6b6617ac08a13568d0dd7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/391/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/391/comments","review_comment_url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/391/comments","statuses_url":"https://api.github.com/repos/mongodb/mongo-php-driver/statuses/1a196b8a8c4c3893315b2aeb93dcdc3b167878fd","head":{"label":"derickr:PHPC-779-serialization-c-type","ref":"PHPC-779-serialization-c-type","sha":"1a196b8a8c4c3893315b2aeb93dcdc3b167878fd","user":{"login":"derickr","id":208074,"avatar_url":"https://avatars.githubusercontent.com/u/208074?v=3","gravatar_id":"","url":"https://api.github.com/users/derickr","html_url":"https://github.com/derickr","followers_url":"https://api.github.com/users/derickr/followers","following_url":"https://api.github.com/users/derickr/following{/other_user}","gists_url":"https://api.github.com/users/derickr/gists{/gist_id}","starred_url":"https://api.github.com/users/derickr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derickr/subscriptions","organizations_url":"https://api.github.com/users/derickr/orgs","repos_url":"https://api.github.com/users/derickr/repos","events_url":"https://api.github.com/users/derickr/events{/privacy}","received_events_url":"https://api.github.com/users/derickr/received_events","type":"User","site_admin":false},"repo":{"id":33925105,"name":"mongo-php-driver","full_name":"derickr/mongo-php-driver","owner":{"login":"derickr","id":208074,"avatar_url":"https://avatars.githubusercontent.com/u/208074?v=3","gravatar_id":"","url":"https://api.github.com/users/derickr","html_url":"https://github.com/derickr","followers_url":"https://api.github.com/users/derickr/followers","following_url":"https://api.github.com/users/derickr/following{/other_user}","gists_url":"https://api.github.com/users/derickr/gists{/gist_id}","starred_url":"https://api.github.com/users/derickr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derickr/subscriptions","organizations_url":"https://api.github.com/users/derickr/orgs","repos_url":"https://api.github.com/users/derickr/repos","events_url":"https://api.github.com/users/derickr/events{/privacy}","received_events_url":"https://api.github.com/users/derickr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/derickr/mongo-php-driver","description":"MongoDB PHP driver (experimental)","fork":true,"url":"https://api.github.com/repos/derickr/mongo-php-driver","forks_url":"https://api.github.com/repos/derickr/mongo-php-driver/forks","keys_url":"https://api.github.com/repos/derickr/mongo-php-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/derickr/mongo-php-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/derickr/mongo-php-driver/teams","hooks_url":"https://api.github.com/repos/derickr/mongo-php-driver/hooks","issue_events_url":"https://api.github.com/repos/derickr/mongo-php-driver/issues/events{/number}","events_url":"https://api.github.com/repos/derickr/mongo-php-driver/events","assignees_url":"https://api.github.com/repos/derickr/mongo-php-driver/assignees{/user}","branches_url":"https://api.github.com/repos/derickr/mongo-php-driver/branches{/branch}","tags_url":"https://api.github.com/repos/derickr/mongo-php-driver/tags","blobs_url":"https://api.github.com/repos/derickr/mongo-php-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/derickr/mongo-php-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/derickr/mongo-php-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/derickr/mongo-php-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/derickr/mongo-php-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/derickr/mongo-php-driver/languages","stargazers_url":"https://api.github.com/repos/derickr/mongo-php-driver/stargazers","contributors_url":"https://api.github.com/repos/derickr/mongo-php-driver/contributors","subscribers_url":"https://api.github.com/repos/derickr/mongo-php-driver/subscribers","subscription_url":"https://api.github.com/repos/derickr/mongo-php-driver/subscription","commits_url":"https://api.github.com/repos/derickr/mongo-php-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/derickr/mongo-php-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/derickr/mongo-php-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/derickr/mongo-php-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/derickr/mongo-php-driver/contents/{+path}","compare_url":"https://api.github.com/repos/derickr/mongo-php-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/derickr/mongo-php-driver/merges","archive_url":"https://api.github.com/repos/derickr/mongo-php-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/derickr/mongo-php-driver/downloads","issues_url":"https://api.github.com/repos/derickr/mongo-php-driver/issues{/number}","pulls_url":"https://api.github.com/repos/derickr/mongo-php-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/derickr/mongo-php-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/derickr/mongo-php-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/derickr/mongo-php-driver/labels{/name}","releases_url":"https://api.github.com/repos/derickr/mongo-php-driver/releases{/id}","deployments_url":"https://api.github.com/repos/derickr/mongo-php-driver/deployments","created_at":"2015-04-14T10:16:35Z","updated_at":"2016-03-10T16:00:34Z","pushed_at":"2016-09-09T12:36:33Z","git_url":"git://github.com/derickr/mongo-php-driver.git","ssh_url":"git@github.com:derickr/mongo-php-driver.git","clone_url":"https://github.com/derickr/mongo-php-driver.git","svn_url":"https://github.com/derickr/mongo-php-driver","homepage":"","size":3526,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"mongodb:master","ref":"master","sha":"0fa224607270721dc9fa3e25ec165aed8b8f3fef","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":19514152,"name":"mongo-php-driver","full_name":"mongodb/mongo-php-driver","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb/mongo-php-driver","description":"MongoDB PHP driver","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-php-driver","forks_url":"https://api.github.com/repos/mongodb/mongo-php-driver/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-php-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-php-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-php-driver/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-php-driver/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-php-driver/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-php-driver/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-php-driver/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-php-driver/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-php-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-php-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-php-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-php-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-php-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-php-driver/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-php-driver/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-php-driver/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-php-driver/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-php-driver/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-php-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-php-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-php-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-php-driver/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-php-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-php-driver/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-php-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-php-driver/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-php-driver/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-php-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-php-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-php-driver/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-php-driver/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/mongo-php-driver/deployments","created_at":"2014-05-06T23:18:32Z","updated_at":"2016-09-12T02:56:17Z","pushed_at":"2016-09-09T15:18:53Z","git_url":"git://github.com/mongodb/mongo-php-driver.git","ssh_url":"git@github.com:mongodb/mongo-php-driver.git","clone_url":"https://github.com/mongodb/mongo-php-driver.git","svn_url":"https://github.com/mongodb/mongo-php-driver","homepage":"https://pecl.php.net/package/mongodb","size":4764,"stargazers_count":261,"watchers_count":261,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":82,"mirror_url":null,"open_issues_count":22,"forks":82,"open_issues":22,"watchers":261,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/391"},"html":{"href":"https://github.com/mongodb/mongo-php-driver/pull/391"},"issue":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/391"},"comments":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/391/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/391/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/391/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/statuses/1a196b8a8c4c3893315b2aeb93dcdc3b167878fd"}}}}
{"actor":{"display_login":"jmikola"}}