{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/comments/197405075","pull_request_review_id":131141418,"id":197405075,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzQwNTA3NQ==","diff_hunk":"@@ -0,0 +1,377 @@\n+/*\n+ * Copyright 2014-2017 MongoDB, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#ifdef HAVE_CONFIG_H\n+#include \"config.h\"\n+#endif\n+\n+#include <php.h>\n+#include <Zend/zend_interfaces.h>\n+#include <ext/standard/php_var.h>\n+#if PHP_VERSION_ID >= 70000\n+#include <zend_smart_str.h>\n+#else\n+#include <ext/standard/php_smart_str.h>\n+#endif\n+\n+#include \"phongo_compat.h\"\n+#include \"php_phongo.h\"\n+#include \"php_bson.h\"\n+\n+zend_class_entry* php_phongo_int64_ce;\n+\n+/* Initialize the object and return whether it was successful. */\n+static bool php_phongo_int64_init(php_phongo_int64_t* intern, int64_t integer) /* {{{ */\n+{\n+\tintern->integer     = integer;\n+\tintern->initialized = true;\n+\n+\treturn true;\n+} /* }}} */\n+\n+/* Initialize the object from a numeric string and return whether it was\n+ * successful. An exception will be thrown on error. */\n+static bool php_phongo_int64_init_from_string(php_phongo_int64_t* intern, const char* s_integer, phongo_zpp_char_len s_integer_len TSRMLS_DC) /* {{{ */\n+{\n+\tint64_t integer;\n+\tchar*   endptr = NULL;\n+\n+\t/* bson_ascii_strtoll() sets errno if conversion fails. If conversion\n+\t * succeeds, we still want to ensure that the entire string was parsed. */\n+\n+\tinteger = bson_ascii_strtoll(s_integer, &endptr, 10);\n+\n+\tif (errno || (endptr && endptr != ((const char*) s_integer + s_integer_len))) {\n+\t\tphongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, \"Error parsing \\\"%s\\\" as 64-bit integer for %s initialization\", s_integer, ZSTR_VAL(php_phongo_int64_ce->name));\n+\t\treturn false;\n+\t}\n+\n+\treturn php_phongo_int64_init(intern, integer);\n+} /* }}} */\n+\n+/* Initialize the object from a HashTable and return whether it was successful.\n+ * An exception will be thrown on error. */\n+static bool php_phongo_int64_init_from_hash(php_phongo_int64_t* intern, HashTable* props TSRMLS_DC) /* {{{ */\n+{\n+#if PHP_VERSION_ID >= 70000\n+\tzval* value;\n+\n+\tif ((value = zend_hash_str_find(props, \"int\", sizeof(\"int\") - 1)) && Z_TYPE_P(value) == IS_STRING) {\n+\t\treturn php_phongo_int64_init_from_string(intern, Z_STRVAL_P(value), Z_STRLEN_P(value) TSRMLS_CC);\n+\t}\n+#else\n+\tzval** value;\n+\n+\tif (zend_hash_find(props, \"int\", sizeof(\"int\"), (void**) &value) == SUCCESS && Z_TYPE_PP(value) == IS_STRING) {\n+\t\treturn php_phongo_int64_init_from_string(intern, Z_STRVAL_PP(value), Z_STRLEN_PP(value) TSRMLS_CC);\n+\t}\n+#endif\n+\n+\tphongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, \"%s initialization requires \\\"int\\\" string field\", ZSTR_VAL(php_phongo_int64_ce->name));\n+\treturn false;\n+} /* }}} */\n+\n+/* {{{ proto string MongoDB\\BSON\\Int64::__toString()\n+   Return the Int64's value as a string. */\n+static PHP_METHOD(Int64, __toString)\n+{\n+\tphp_phongo_int64_t* intern;\n+\tchar                s_integer[24];\n+\tint                 s_integer_len;\n+\n+\tif (zend_parse_parameters_none() == FAILURE) {\n+\t\treturn;\n+\t}\n+\n+\tintern = Z_INT64_OBJ_P(getThis());\n+\n+\ts_integer_len = snprintf(s_integer, sizeof(s_integer), \"%\" PRId64, intern->integer);","path":"src/BSON/Int64.c","position":101,"original_position":101,"commit_id":"1da07741c589bd95fbc8b4f1f04276f41b27a74b","original_commit_id":"1da07741c589bd95fbc8b4f1f04276f41b27a74b","user":{"login":"derickr","id":208074,"node_id":"MDQ6VXNlcjIwODA3NA==","avatar_url":"https://avatars3.githubusercontent.com/u/208074?v=4","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":"Although I prefer spprintf in general, I guess it makes sense to use a stack buffer here.","created_at":"2018-06-22T10:20:18Z","updated_at":"2018-06-22T10:35:10Z","html_url":"https://github.com/mongodb/mongo-php-driver/pull/858#discussion_r197405075","pull_request_url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/858","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/comments/197405075"},"html":{"href":"https://github.com/mongodb/mongo-php-driver/pull/858#discussion_r197405075"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/858"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/858","id":196555383,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2NTU1Mzgz","html_url":"https://github.com/mongodb/mongo-php-driver/pull/858","diff_url":"https://github.com/mongodb/mongo-php-driver/pull/858.diff","patch_url":"https://github.com/mongodb/mongo-php-driver/pull/858.patch","issue_url":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/858","number":858,"state":"open","locked":false,"title":"PHPC-1211: Int64 class to wrap 64-bit integers on 32-bit platforms","user":{"login":"jmikola","id":244663,"node_id":"MDQ6VXNlcjI0NDY2Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/244663?v=4","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":"https://jira.mongodb.org/browse/PHPC-1211","created_at":"2018-06-21T19:40:47Z","updated_at":"2018-06-22T10:35:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16bab3a6057ce4f0d4368ebe8e197fc461fdd5a7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/858/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/858/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/858/comments","statuses_url":"https://api.github.com/repos/mongodb/mongo-php-driver/statuses/1da07741c589bd95fbc8b4f1f04276f41b27a74b","head":{"label":"jmikola:phpc-1211","ref":"phpc-1211","sha":"1da07741c589bd95fbc8b4f1f04276f41b27a74b","user":{"login":"jmikola","id":244663,"node_id":"MDQ6VXNlcjI0NDY2Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/244663?v=4","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},"repo":{"id":32424485,"node_id":"MDEwOlJlcG9zaXRvcnkzMjQyNDQ4NQ==","name":"mongo-php-driver","full_name":"jmikola/mongo-php-driver","owner":{"login":"jmikola","id":244663,"node_id":"MDQ6VXNlcjI0NDY2Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/244663?v=4","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},"private":false,"html_url":"https://github.com/jmikola/mongo-php-driver","description":"MongoDB PHP driver","fork":true,"url":"https://api.github.com/repos/jmikola/mongo-php-driver","forks_url":"https://api.github.com/repos/jmikola/mongo-php-driver/forks","keys_url":"https://api.github.com/repos/jmikola/mongo-php-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmikola/mongo-php-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmikola/mongo-php-driver/teams","hooks_url":"https://api.github.com/repos/jmikola/mongo-php-driver/hooks","issue_events_url":"https://api.github.com/repos/jmikola/mongo-php-driver/issues/events{/number}","events_url":"https://api.github.com/repos/jmikola/mongo-php-driver/events","assignees_url":"https://api.github.com/repos/jmikola/mongo-php-driver/assignees{/user}","branches_url":"https://api.github.com/repos/jmikola/mongo-php-driver/branches{/branch}","tags_url":"https://api.github.com/repos/jmikola/mongo-php-driver/tags","blobs_url":"https://api.github.com/repos/jmikola/mongo-php-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmikola/mongo-php-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmikola/mongo-php-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmikola/mongo-php-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmikola/mongo-php-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/jmikola/mongo-php-driver/languages","stargazers_url":"https://api.github.com/repos/jmikola/mongo-php-driver/stargazers","contributors_url":"https://api.github.com/repos/jmikola/mongo-php-driver/contributors","subscribers_url":"https://api.github.com/repos/jmikola/mongo-php-driver/subscribers","subscription_url":"https://api.github.com/repos/jmikola/mongo-php-driver/subscription","commits_url":"https://api.github.com/repos/jmikola/mongo-php-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmikola/mongo-php-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmikola/mongo-php-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmikola/mongo-php-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmikola/mongo-php-driver/contents/{+path}","compare_url":"https://api.github.com/repos/jmikola/mongo-php-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmikola/mongo-php-driver/merges","archive_url":"https://api.github.com/repos/jmikola/mongo-php-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmikola/mongo-php-driver/downloads","issues_url":"https://api.github.com/repos/jmikola/mongo-php-driver/issues{/number}","pulls_url":"https://api.github.com/repos/jmikola/mongo-php-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/jmikola/mongo-php-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/jmikola/mongo-php-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmikola/mongo-php-driver/labels{/name}","releases_url":"https://api.github.com/repos/jmikola/mongo-php-driver/releases{/id}","deployments_url":"https://api.github.com/repos/jmikola/mongo-php-driver/deployments","created_at":"2015-03-17T22:38:23Z","updated_at":"2018-06-21T14:41:11Z","pushed_at":"2018-06-21T20:25:32Z","git_url":"git://github.com/jmikola/mongo-php-driver.git","ssh_url":"git@github.com:jmikola/mongo-php-driver.git","clone_url":"https://github.com/jmikola/mongo-php-driver.git","svn_url":"https://github.com/jmikola/mongo-php-driver","homepage":"https://pecl.php.net/package/mongodb","size":6667,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mongodb:master","ref":"master","sha":"4a56dfe57da17f48beaa16bca7c76519def2baaa","user":{"login":"mongodb","id":45120,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1MTIw","avatar_url":"https://avatars1.githubusercontent.com/u/45120?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxOTUxNDE1Mg==","name":"mongo-php-driver","full_name":"mongodb/mongo-php-driver","owner":{"login":"mongodb","id":45120,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1MTIw","avatar_url":"https://avatars1.githubusercontent.com/u/45120?v=4","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":"2018-06-21T14:41:18Z","pushed_at":"2018-06-21T20:25:33Z","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":6648,"stargazers_count":517,"watchers_count":517,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":135,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":135,"open_issues":13,"watchers":517,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/858"},"html":{"href":"https://github.com/mongodb/mongo-php-driver/pull/858"},"issue":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/858"},"comments":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/issues/858/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/pulls/858/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/858/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongo-php-driver/statuses/1da07741c589bd95fbc8b4f1f04276f41b27a74b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"derickr"}}