Skip to content

PHPC-313: BSON should throw when encountering 64-bit integer on 32-bit platform #436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

derickr
Copy link
Contributor

@derickr derickr commented Oct 13, 2016

No description provided.

Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with mongoc_log() removed and indentation changed.

tmp_len = spprintf(&tmp, 0, "%lld", value); \
ADD_INDEX_STRINGL(zval, index, tmp, tmp_len); \
efree(tmp); \
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Integer overflow detected on your platform: %lld", value); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is little value in continuing to call mongoc_log() if we're throwing a proper exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will remove it.

];

foreach ($tests as $json) {
throws(function() use ($json) { var_dump(toPHP(fromJSON($json))); }, 'MongoDB\Driver\Exception\InvalidArgumentException');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a tab. PHPT tests should be using 4-space indents.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whatever. I'd rather see .c and .h files following coding standards though. phongo_compat.h is all spaces...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integer macros in phongo_compat.h is evidently my fault from 6bcba59. I'll clean that up after this and #435 are merged if any offending lines remain.

That's not relevant to the PHPT indentation, though.

echo "\n";
}

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
%a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my earlier comment about mongoc_log() being useless, I think we should remove this and the --INI-- block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@derickr derickr force-pushed the PHPC-313-bson-64bit-on-32bit-platform branch from 8763aa3 to 22a39d6 Compare October 18, 2016 10:20
@derickr derickr merged commit 22a39d6 into mongodb:master Oct 18, 2016
derickr added a commit that referenced this pull request Oct 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants