Merge branch 'PHP-7.2' into PHP-7.3

* PHP-7.2:
  Fix #78473: odbc_close() closes arbitrary resources
This commit is contained in:
Christoph M. Becker 2019-08-28 17:56:23 +02:00
commit 195b8ae779
3 changed files with 21 additions and 1 deletions

3
NEWS
View File

@ -23,6 +23,9 @@ PHP NEWS
. Fixed connect_attr issues and added the _server_host connection attribute.
(Qianqian Bu)
- ODBC:
. Fixed bug #78473 (odbc_close() closes arbitrary resources). (cmb)
29 Aug 2019, PHP 7.3.9
- Core:

View File

@ -2695,7 +2695,10 @@ PHP_FUNCTION(odbc_close)
return;
}
conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn);
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
RETURN_FALSE;
}
if (Z_RES_P(pv_conn)->type == le_pconn) {
is_pconn = 1;
}

View File

@ -0,0 +1,14 @@
--TEST--
Bug #78473 (odbc_close() closes arbitrary resources)
--SKIPIF--
<?php
if (!extension_loaded('odbc')) die('skip odbc extension not available');
?>
--FILE--
<?php
odbc_close(STDIN);
var_dump(STDIN);
?>
--EXPECTF--
Warning: odbc_close(): supplied resource is not a valid ODBC-Link resource in %s on line %d
resource(%d) of type (stream)