Skip to content

Commit 3b0fecd

Browse files
committed
Fix UNKNOWN default values in ext/oci8
Closes GH-6089
1 parent 7e339a3 commit 3b0fecd

File tree

4 files changed

+67
-82
lines changed

4 files changed

+67
-82
lines changed

ext/oci8/oci8.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
877877
Z_PARAM_STRING(username, username_len)
878878
Z_PARAM_STRING(password, password_len)
879879
Z_PARAM_OPTIONAL
880-
Z_PARAM_STRING(dbname, dbname_len)
880+
Z_PARAM_STRING_OR_NULL(dbname, dbname_len)
881881
Z_PARAM_STRING(charset, charset_len)
882882
Z_PARAM_LONG(session_mode)
883883
ZEND_PARSE_PARAMETERS_END();

ext/oci8/oci8.stub.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,31 +69,31 @@ function oci_lob_seek(OCILob $lob_descriptor, int $offset, int $whence = OCI_SEE
6969

7070
function oci_lob_size(OCILob $lob_descriptor): int|false {}
7171

72-
function oci_lob_write(OCILob $lob_descriptor, string $string, int $length = UNKNOWN): int|false {}
72+
function oci_lob_write(OCILob $lob_descriptor, string $string, ?int $length = null): int|false {}
7373

7474
function oci_lob_append(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from): bool {}
7575

7676
function oci_lob_truncate(OCILob $lob_descriptor, int $length = 0): bool {}
7777

78-
function oci_lob_erase(OCILob $lob_descriptor, int $offset = UNKNOWN, int $length = UNKNOWN): int|false {}
78+
function oci_lob_erase(OCILob $lob_descriptor, ?int $offset = null, ?int $length = null): int|false {}
7979

8080
function oci_lob_flush(OCILob $lob_descriptor, int $flag = 0): bool {}
8181

8282
function ocisetbufferinglob(OCILob $lob_descriptor, bool $mode): bool {}
8383

8484
function ocigetbufferinglob(OCILob $lob_descriptor): bool {}
8585

86-
function oci_lob_copy(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from, int $length = UNKNOWN): bool {}
86+
function oci_lob_copy(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from, ?int $length = null): bool {}
8787

8888
function oci_lob_is_equal(OCILob $lob_descriptor_first, OCILob $lob_descriptor_second): bool {}
8989

90-
function oci_lob_export(OCILob $lob_descriptor, string $path, int $start = UNKNOWN, int $length = UNKNOWN): bool {}
90+
function oci_lob_export(OCILob $lob_descriptor, string $path, ?int $start = null, ?int $length = null): bool {}
9191

9292
/**
9393
* @alias oci_lob_export
9494
* @deprecated
9595
*/
96-
function ociwritelobtofile(OCILob $lob_descriptor, string $path, int $start = UNKNOWN, int $length = UNKNOWN): bool {}
96+
function ociwritelobtofile(OCILob $lob_descriptor, string $path, ?int $start = null, ?int $length = null): bool {}
9797

9898
/**
9999
* @param resource $connection_resource
@@ -332,50 +332,50 @@ function ocilogoff($connection_resource): bool|null {}
332332
/**
333333
* @return resource|false
334334
*/
335-
function oci_new_connect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
335+
function oci_new_connect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
336336

337337
/**
338338
* @return resource|false
339339
* @alias oci_new_connect
340340
* @deprecated
341341
*/
342-
function ocinlogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
342+
function ocinlogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
343343

344344
/**
345345
* @return resource|false
346346
*/
347-
function oci_connect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
347+
function oci_connect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
348348

349349
/**
350350
* @return resource|false
351351
* @alias oci_connect
352352
* @deprecated
353353
*/
354-
function ocilogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
354+
function ocilogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
355355

356356
/**
357357
* @return resource|false
358358
*/
359-
function oci_pconnect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
359+
function oci_pconnect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
360360

361361
/**
362362
* @return resource|false
363363
* @alias oci_pconnect
364364
* @deprecated
365365
*/
366-
function ociplogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
366+
function ociplogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
367367

368368
/**
369-
* @param resource $connection_or_statement_resource
369+
* @param resource|null $connection_or_statement_resource
370370
*/
371-
function oci_error($connection_or_statement_resource = UNKNOWN): array|false {}
371+
function oci_error($connection_or_statement_resource = null): array|false {}
372372

373373
/**
374374
* @param resource|null $connection_or_statement_resource
375375
* @alias oci_error
376376
* @deprecated
377377
*/
378-
function ocierror($connection_or_statement_resource = UNKNOWN): array|false {}
378+
function ocierror($connection_or_statement_resource = null): array|false {}
379379

380380
/**
381381
* @param resource $statement_resource
@@ -592,14 +592,14 @@ function ocicolltrim(OCICollection $collection, int $number): bool {}
592592
/**
593593
* @param resource $connection_resource
594594
*/
595-
function oci_new_collection($connection_resource, string $type_name, string $schema_name = UNKNOWN): OCICollection|false {}
595+
function oci_new_collection($connection_resource, string $type_name, ?string $schema_name = null): OCICollection|false {}
596596

597597
/**
598598
* @param resource $connection_resource
599599
* @alias oci_new_collection
600600
* @deprecated
601601
*/
602-
function ocinewcollection($connection_resource, string $type_name, string $schema_name = UNKNOWN): OCICollection|false {}
602+
function ocinewcollection($connection_resource, string $type_name, ?string $schema_name = null): OCICollection|false {}
603603

604604
/**
605605
* @param resource $connection_resource
@@ -676,7 +676,7 @@ public function size() {}
676676
* @alias oci_lob_write
677677
* @return int|false
678678
*/
679-
public function write(string $string, int $length = UNKNOWN) {}
679+
public function write(string $string, ?int $length = null) {}
680680

681681
/**
682682
* @alias oci_lob_append
@@ -694,7 +694,7 @@ public function truncate(int $length = 0) {}
694694
* @alias oci_lob_erase
695695
* @return int|false
696696
*/
697-
public function erase(int $offset = UNKNOWN, int $length = UNKNOWN) {}
697+
public function erase(?int $offset = null, ?int $length = null) {}
698698

699699
/**
700700
* @alias oci_lob_flush
@@ -718,13 +718,13 @@ public function getbuffering() {}
718718
* @alias oci_lob_export
719719
* @return bool
720720
*/
721-
public function writetofile(string $path, int $start = UNKNOWN, int $length = UNKNOWN) {}
721+
public function writetofile(string $path, ?int $start = null, ?int $length = null) {}
722722

723723
/**
724724
* @alias oci_lob_export
725725
* @return bool
726726
*/
727-
public function export(string $path, int $start = UNKNOWN, int $length = UNKNOWN) {}
727+
public function export(string $path, ?int $start = null, ?int $length = null) {}
728728

729729
/**
730730
* @alias oci_lob_write_temporary

ext/oci8/oci8_arginfo.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 447880a4bc4add36beab835cc07c09a254dc0c2b */
2+
* Stub hash: 2d553815c21edd58bc29b1ca8d294d5750fd7312 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
55
ZEND_ARG_INFO(0, statement_resource)
@@ -80,7 +80,7 @@ ZEND_END_ARG_INFO()
8080
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_write, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
8181
ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0)
8282
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
83-
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
83+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
8484
ZEND_END_ARG_INFO()
8585

8686
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_append, 0, 2, _IS_BOOL, 0)
@@ -95,8 +95,8 @@ ZEND_END_ARG_INFO()
9595

9696
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_erase, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
9797
ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0)
98-
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
99-
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
98+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
99+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
100100
ZEND_END_ARG_INFO()
101101

102102
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_flush, 0, 1, _IS_BOOL, 0)
@@ -114,7 +114,7 @@ ZEND_END_ARG_INFO()
114114
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_copy, 0, 2, _IS_BOOL, 0)
115115
ZEND_ARG_OBJ_INFO(0, lob_descriptor_to, OCILob, 0)
116116
ZEND_ARG_OBJ_INFO(0, lob_descriptor_from, OCILob, 0)
117-
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
117+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
118118
ZEND_END_ARG_INFO()
119119

120120
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_is_equal, 0, 2, _IS_BOOL, 0)
@@ -125,8 +125,8 @@ ZEND_END_ARG_INFO()
125125
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_export, 0, 2, _IS_BOOL, 0)
126126
ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0)
127127
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
128-
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
129-
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
128+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, start, IS_LONG, 1, "null")
129+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
130130
ZEND_END_ARG_INFO()
131131

132132
#define arginfo_ociwritelobtofile arginfo_oci_lob_export
@@ -254,7 +254,7 @@ ZEND_END_ARG_INFO()
254254
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_connect, 0, 0, 2)
255255
ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
256256
ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
257-
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
257+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_string, IS_STRING, 1, "null")
258258
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, character_set, IS_STRING, 0, "\'\'")
259259
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, session_mode, IS_LONG, 0, "OCI_DEFAULT")
260260
ZEND_END_ARG_INFO()
@@ -270,7 +270,7 @@ ZEND_END_ARG_INFO()
270270
#define arginfo_ociplogon arginfo_oci_new_connect
271271

272272
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_error, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
273-
ZEND_ARG_INFO(0, connection_or_statement_resource)
273+
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, connection_or_statement_resource, "null")
274274
ZEND_END_ARG_INFO()
275275

276276
#define arginfo_ocierror arginfo_oci_error
@@ -426,7 +426,7 @@ ZEND_END_ARG_INFO()
426426
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_new_collection, 0, 2, OCICollection, MAY_BE_FALSE)
427427
ZEND_ARG_INFO(0, connection_resource)
428428
ZEND_ARG_TYPE_INFO(0, type_name, IS_STRING, 0)
429-
ZEND_ARG_TYPE_INFO(0, schema_name, IS_STRING, 0)
429+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, schema_name, IS_STRING, 1, "null")
430430
ZEND_END_ARG_INFO()
431431

432432
#define arginfo_ocinewcollection arginfo_oci_new_collection
@@ -471,7 +471,7 @@ ZEND_END_ARG_INFO()
471471

472472
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_write, 0, 0, 1)
473473
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
474-
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
474+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
475475
ZEND_END_ARG_INFO()
476476

477477
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_append, 0, 0, 1)
@@ -483,8 +483,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_truncate, 0, 0, 0)
483483
ZEND_END_ARG_INFO()
484484

485485
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_erase, 0, 0, 0)
486-
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
487-
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
486+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
487+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
488488
ZEND_END_ARG_INFO()
489489

490490
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_flush, 0, 0, _IS_BOOL, 0)
@@ -499,8 +499,8 @@ ZEND_END_ARG_INFO()
499499

500500
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_writetofile, 0, 0, 1)
501501
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
502-
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
503-
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
502+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, start, IS_LONG, 1, "null")
503+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
504504
ZEND_END_ARG_INFO()
505505

506506
#define arginfo_class_OCILob_export arginfo_class_OCILob_writetofile

0 commit comments

Comments
 (0)