mirror of
https://github.com/php/php-src.git
synced 2025-01-26 13:44:22 +08:00
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #78473: odbc_close() closes arbitrary resources
This commit is contained in:
commit
195b8ae779
3
NEWS
3
NEWS
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
14
ext/odbc/tests/bug78473.phpt
Normal file
14
ext/odbc/tests/bug78473.phpt
Normal 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)
|
Loading…
Reference in New Issue
Block a user