{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/msphpsql/issues/84","repository_url":"https://api.github.com/repos/Azure/msphpsql","labels_url":"https://api.github.com/repos/Azure/msphpsql/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/Azure/msphpsql/issues/84/comments","events_url":"https://api.github.com/repos/Azure/msphpsql/issues/84/events","html_url":"https://github.com/Azure/msphpsql/issues/84","id":148757221,"number":84,"title":"sqlsrv_free_stmt no longer sets stmt to null","user":{"login":"theodorejb","id":3053271,"avatar_url":"https://avatars.githubusercontent.com/u/3053271?v=3","gravatar_id":"","url":"https://api.github.com/users/theodorejb","html_url":"https://github.com/theodorejb","followers_url":"https://api.github.com/users/theodorejb/followers","following_url":"https://api.github.com/users/theodorejb/following{/other_user}","gists_url":"https://api.github.com/users/theodorejb/gists{/gist_id}","starred_url":"https://api.github.com/users/theodorejb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theodorejb/subscriptions","organizations_url":"https://api.github.com/users/theodorejb/orgs","repos_url":"https://api.github.com/users/theodorejb/repos","events_url":"https://api.github.com/users/theodorejb/events{/privacy}","received_events_url":"https://api.github.com/users/theodorejb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/msphpsql/labels/php7","name":"php7","color":"5319e7"},{"url":"https://api.github.com/repos/Azure/msphpsql/labels/SQLSRV","name":"SQLSRV","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-15T20:13:46Z","updated_at":"2016-04-15T22:13:49Z","closed_at":null,"body":"I'm not sure if this is a bug or not, but it is a difference from the PHP 5.6 driver which I thought should be brought to your attention.\r\n\r\nCompare running the following code in PHP 5.6 and PHP 7:\r\n\r\n```php\r\n$connection = sqlsrv_connect('Computer-Name\\SQLEXPRESS', ['Database' => 'MyDatabase']);\r\n$sql = \"SELECT 'result' AS test\";\r\n\r\n$stmt = sqlsrv_query($connection, $sql);\r\n$row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);\r\nsqlsrv_free_stmt($stmt);\r\n\r\nvar_dump($row['test'], $stmt);\r\n```\r\n\r\nIn PHP 5.6 the output is:\r\n```\r\nstring(6) \"result\"\r\nNULL\r\n```\r\n\r\nWith the PHP 7 driver, it outputs:\r\n\r\n```\r\nstring(6) \"result\"\r\nresource(5) of type (Unknown)\r\n```\r\n\r\nThis broke some of my code which assumed that `$stmt` would be null if it is closed. I was able to fix my code by manually setting `$stmt` to null after freeing the statement, so feel free to close this issue if the new behavior is intended."},"comment":{"url":"https://api.github.com/repos/Azure/msphpsql/issues/comments/210666112","html_url":"https://github.com/Azure/msphpsql/issues/84#issuecomment-210666112","issue_url":"https://api.github.com/repos/Azure/msphpsql/issues/84","id":210666112,"user":{"login":"meet-bhagdev","id":11928821,"avatar_url":"https://avatars.githubusercontent.com/u/11928821?v=3","gravatar_id":"","url":"https://api.github.com/users/meet-bhagdev","html_url":"https://github.com/meet-bhagdev","followers_url":"https://api.github.com/users/meet-bhagdev/followers","following_url":"https://api.github.com/users/meet-bhagdev/following{/other_user}","gists_url":"https://api.github.com/users/meet-bhagdev/gists{/gist_id}","starred_url":"https://api.github.com/users/meet-bhagdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meet-bhagdev/subscriptions","organizations_url":"https://api.github.com/users/meet-bhagdev/orgs","repos_url":"https://api.github.com/users/meet-bhagdev/repos","events_url":"https://api.github.com/users/meet-bhagdev/events{/privacy}","received_events_url":"https://api.github.com/users/meet-bhagdev/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T22:13:49Z","updated_at":"2016-04-15T22:13:49Z","body":"Hi Theodore, this is expected behavior. We will document such changes clearly to avoid confusion. Instead of checking for null I recommend you use [is_resource](http://php.net/manual/en/function.is-resource.php). Statements are resources, and that function will indicate false if the resource has been closed.\r\n \r\nCheers,\r\nMeet"}}