Skip to content
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

Added data type validation passed to bind method #41

Merged
merged 1 commit into from
Sep 6, 2017

Conversation

dbalabka
Copy link
Contributor

@dbalabka dbalabka commented Sep 6, 2017

Changes for #39

lib/Stmt.php Outdated
@@ -86,6 +86,10 @@ public function bind($paramId, $data) {
$i = reset($array);
}

if (!is_scalar($data) && !(is_object($data) && method_exists($data, '__toString'))) {
throw new \InvalidArgumentException("Data must be scalar or object that implements __toString method");
Copy link
Member

Choose a reason for hiding this comment

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

I think I'd just throw a TypeError here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

@@ -0,0 +1,77 @@
<?php
/*
* This file is part of the OpCart software.
Copy link
Member

Choose a reason for hiding this comment

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

No, it's not. 😜

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ops... 😄 This should not be here

@bwoebi bwoebi merged commit 1660055 into amphp:master Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants