Skip to content

Commit 850ef17

Browse files
committed
Merge branch 'PHP-7.0'
2 parents be9e300 + 7be30eb commit 850ef17

File tree

2 files changed

+31
-28
lines changed

2 files changed

+31
-28
lines changed

ext/oci8/oci8.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,17 +2003,19 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
20032003

20042004
/* okay, the connection is open and the server is still alive */
20052005
connection->used_this_request = 1;
2006-
tmp_val = zend_hash_index_find(&EG(regular_list), connection->id->handle);
2007-
if ((tmp_val != NULL) && (Z_TYPE_P(tmp_val) == IS_RESOURCE)) {
2008-
tmp = Z_RES_VAL_P(tmp_val);
2009-
}
2006+
if (connection->id) {
2007+
tmp_val = zend_hash_index_find(&EG(regular_list), connection->id->handle);
2008+
if ((tmp_val != NULL) && (Z_TYPE_P(tmp_val) == IS_RESOURCE)) {
2009+
tmp = Z_RES_VAL_P(tmp_val);
2010+
}
20102011

2011-
if ((tmp_val != NULL) && (tmp != NULL) &&
2012-
(ZSTR_LEN(tmp->hash_key) == ZSTR_LEN(hashed_details.s)) &&
2013-
(memcmp(ZSTR_VAL(tmp->hash_key), ZSTR_VAL(hashed_details.s), ZSTR_LEN(tmp->hash_key)) == 0)) {
2014-
connection = tmp;
2015-
++GC_REFCOUNT(connection->id);
2016-
/* do nothing */
2012+
if ((tmp_val != NULL) && (tmp != NULL) &&
2013+
(ZSTR_LEN(tmp->hash_key) == ZSTR_LEN(hashed_details.s)) &&
2014+
(memcmp(ZSTR_VAL(tmp->hash_key), ZSTR_VAL(hashed_details.s),
2015+
ZSTR_LEN(tmp->hash_key)) == 0)) {
2016+
connection = tmp;
2017+
++GC_REFCOUNT(connection->id);
2018+
}
20172019
} else {
20182020
PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection);
20192021
/* Persistent connections: For old close semantics we artificially
@@ -2467,6 +2469,7 @@ int php_oci_connection_release(php_oci_connection *connection)
24672469
connection->svc = NULL;
24682470
connection->server = NULL;
24692471
connection->session = NULL;
2472+
connection->id = NULL;
24702473

24712474
connection->is_attached = connection->is_open = connection->rb_on_disconnect = connection->used_this_request = 0;
24722475
connection->is_stub = 1;

ext/oci8/tests/bind_sqltnum.phpt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ oci8_test_sql_execute($c, $stmtarray);
2929

3030
function check_col($c, $colname, $id)
3131
{
32-
$s = oci_parse($c, "select $colname from bind_sqltnum_tab where id = :id");
32+
$s = oci_parse($c, "select dump($colname) from bind_sqltnum_tab where id = :id");
3333
oci_bind_by_name($s, ":id", $id);
3434
oci_execute($s);
3535
oci_fetch_all($s, $r);
@@ -198,81 +198,81 @@ Warning: oci_execute(): ORA-12899: %s "%s"."BIND_SQLTNUM_TAB"."VARCHAR2_T10" (%s
198198

199199
TEST42 insert numbers SQLT_NUM
200200
array(1) {
201-
["NUMBER_T"]=>
201+
["DUMP(NUMBER_T)"]=>
202202
array(1) {
203203
[0]=>
204-
NULL
204+
string(29) "Typ=2 Len=8: 42,0,0,0,0,0,0,0"
205205
}
206206
}
207207

208208
TEST43 insert numbers SQLT_NUM
209209
array(1) {
210-
["NUMBER_T"]=>
210+
["DUMP(NUMBER_T)"]=>
211211
array(1) {
212212
[0]=>
213-
NULL
213+
string(29) "Typ=2 Len=8: 42,0,0,0,0,0,0,0"
214214
}
215215
}
216216

217217
TEST44
218218
array(1) {
219-
["NUMBER_T"]=>
219+
["DUMP(NUMBER_T)"]=>
220220
array(1) {
221221
[0]=>
222-
string(2) "-~"
222+
string(28) "Typ=2 Len=8: 0,0,0,0,0,0,0,0"
223223
}
224224
}
225225

226226
TEST45
227227
array(1) {
228-
["NUMBER_T"]=>
228+
["DUMP(NUMBER_T)"]=>
229229
array(1) {
230230
[0]=>
231-
NULL
231+
string(44) "Typ=2 Len=8: 233,255,255,255,255,255,255,255"
232232
}
233233
}
234234

235235
TEST46 insert numbers
236236
array(1) {
237-
["NUMBER_T"]=>
237+
["DUMP(NUMBER_T)"]=>
238238
array(1) {
239239
[0]=>
240-
NULL
240+
string(44) "Typ=2 Len=8: 233,255,255,255,255,255,255,255"
241241
}
242242
}
243243

244244
TEST47
245245
array(1) {
246-
["NUMBER_T"]=>
246+
["DUMP(NUMBER_T)"]=>
247247
array(1) {
248248
[0]=>
249-
NULL
249+
string(29) "Typ=2 Len=8: 23,0,0,0,0,0,0,0"
250250
}
251251
}
252252

253253
TEST48
254254
array(1) {
255-
["NUMBER_T92"]=>
255+
["DUMP(NUMBER_T92)"]=>
256256
array(1) {
257257
[0]=>
258-
string(1) "0"
258+
string(16) "Typ=2 Len=1: 128"
259259
}
260260
}
261261

262262
TEST49
263263
array(1) {
264-
["NUMBER_T92"]=>
264+
["DUMP(NUMBER_T92)"]=>
265265
array(1) {
266266
[0]=>
267-
string(1) "0"
267+
string(16) "Typ=2 Len=1: 128"
268268
}
269269
}
270270

271271
TEST50
272272

273273
Warning: oci_execute(): ORA-01438: %s in %sbind_sqltnum.php on line %d
274274
array(1) {
275-
["NUMBER_T92"]=>
275+
["DUMP(NUMBER_T92)"]=>
276276
array(0) {
277277
}
278278
}

0 commit comments

Comments
 (0)