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

#1041 Check that the result is a resource before executing mysqli_free_result #158

Closed
wants to merge 1 commit into from

Conversation

Quy
Copy link
Member

@Quy Quy commented Oct 3, 2015

No description provided.

@@ -182,7 +182,7 @@ function close()
{
if ($this->link_id)
{
if ($this->query_result)
if (is_object($this->query_result))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think is_resource() would be a better fit here, since that is the actual return type of a valid response.

Copy link
Member Author

Choose a reason for hiding this comment

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

Per the PHP manual, it returns an object, but if you think is_resource is better then this can be changed.
Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Quy That is the mysqli_ function documentation. The mysql_ functions return a resource as describe here.

@Quy
Copy link
Member Author

Quy commented Oct 5, 2015

Thanks.

@Quy Quy closed this Oct 5, 2015
@Quy Quy deleted the 1041-mysqli_free_result branch January 15, 2016 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants