Skip to content

Commit 7c432e3

Browse files
committed
Retrieve logical values as bool
The former behavior to retrieve logical values as int(1) or int(0) isn't particularly useful with regard to strict_types, so now we're returning bool(true) and bool(false), respectively. git-svn-id: http://svn.php.net/repository/pecl/dbase/trunk@340799 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent ec3bb1d commit 7c432e3

13 files changed

+36
-36
lines changed

dbase.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,15 +425,15 @@ static void php_dbase_get_record(INTERNAL_FUNCTION_PARAMETERS, int assoc)
425425
decimals, which we don't care about. 3/14/2001 LEW */
426426
if ((*str_value == 'T') || (*str_value == 'Y')) {
427427
if (!assoc) {
428-
add_next_index_long(return_value, 1L);
428+
add_next_index_bool(return_value, 1);
429429
} else {
430-
add_assoc_long(return_value, cur_f->db_fname, 1L);
430+
add_assoc_bool(return_value, cur_f->db_fname, 1);
431431
}
432432
} else {
433433
if (!assoc) {
434-
add_next_index_long(return_value, 0L);
434+
add_next_index_bool(return_value, 0);
435435
} else {
436-
add_assoc_long(return_value, cur_f->db_fname, 0L);
436+
add_assoc_bool(return_value, cur_f->db_fname, 0);
437437
}
438438
}
439439
break;

tests/bug52112.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ array(7) {
3535
[3]=>
3636
string(18) "19840501000000.000"
3737
[4]=>
38-
int(1)
38+
bool(true)
3939
[5]=>
4040
float(123,45)
4141
["deleted"]=>
@@ -51,7 +51,7 @@ array(7) {
5151
["RELEASED_X"]=>
5252
string(18) "19840501000000.000"
5353
["SUPORTED"]=>
54-
int(1)
54+
bool(true)
5555
["PRICE"]=>
5656
float(123,45)
5757
["deleted"]=>

tests/dbase_add_record_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ array(7) {
3434
[3]=>
3535
string(18) "19730101104923.123"
3636
[4]=>
37-
int(0)
37+
bool(false)
3838
[5]=>
3939
float(1234567.89)
4040
["deleted"]=>

tests/dbase_add_record_variation1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ array(7) {
3636
[3]=>
3737
string(18) "19840501000000.000"
3838
[4]=>
39-
int(1)
39+
bool(true)
4040
[5]=>
4141
float(123.45)
4242
["deleted"]=>
@@ -53,7 +53,7 @@ array(7) {
5353
[3]=>
5454
string(18) "19840501000000.000"
5555
[4]=>
56-
int(1)
56+
bool(true)
5757
[5]=>
5858
float(123.45)
5959
["deleted"]=>

tests/dbase_add_record_variation2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ array(7) {
3737
["RELEASED_X"]=>
3838
string(18) "19840501000000.000"
3939
["SUPORTED"]=>
40-
int(1)
40+
bool(true)
4141
["PRICE"]=>
4242
float(123.45)
4343
["deleted"]=>
@@ -54,7 +54,7 @@ array(7) {
5454
["RELEASED_X"]=>
5555
string(18) "19840501000000.000"
5656
["SUPORTED"]=>
57-
int(1)
57+
bool(true)
5858
["PRICE"]=>
5959
float(123.45)
6060
["deleted"]=>

tests/dbase_delete_record_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ array(7) {
3434
[3]=>
3535
string(18) "19850525120000.000"
3636
[4]=>
37-
int(0)
37+
bool(false)
3838
[5]=>
3939
float(56.78)
4040
["deleted"]=>

tests/dbase_get_record_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ array(7) {
2929
[3]=>
3030
string(18) "20010627235959.999"
3131
[4]=>
32-
int(0)
32+
bool(false)
3333
[5]=>
3434
float(0.9)
3535
["deleted"]=>

tests/dbase_get_record_with_names_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ array(7) {
2929
["RELEASED_X"]=>
3030
string(18) "19840501000000.000"
3131
["SUPORTED"]=>
32-
int(1)
32+
bool(true)
3333
["PRICE"]=>
3434
float(123.45)
3535
["deleted"]=>

tests/dbase_pack_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ array(7) {
3636
[3]=>
3737
string(18) "20010627235959.999"
3838
[4]=>
39-
int(0)
39+
bool(false)
4040
[5]=>
4141
float(0.9)
4242
["deleted"]=>

tests/dbase_replace_record_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ array(7) {
3434
[3]=>
3535
string(18) "19730101123456.789"
3636
[4]=>
37-
int(0)
37+
bool(false)
3838
[5]=>
3939
float(1234567.89)
4040
["deleted"]=>

tests/dbase_replace_record_variation1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ array(7) {
3737
[3]=>
3838
string(18) "19840501000000.000"
3939
[4]=>
40-
int(1)
40+
bool(true)
4141
[5]=>
4242
float(123.45)
4343
["deleted"]=>
@@ -54,7 +54,7 @@ array(7) {
5454
[3]=>
5555
string(18) "19840501000000.000"
5656
[4]=>
57-
int(1)
57+
bool(true)
5858
[5]=>
5959
float(12.34)
6060
["deleted"]=>

tests/dbase_replace_record_variation2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ array(7) {
3838
["RELEASED_X"]=>
3939
string(18) "19840501000000.000"
4040
["SUPORTED"]=>
41-
int(1)
41+
bool(true)
4242
["PRICE"]=>
4343
float(123.45)
4444
["deleted"]=>
@@ -55,7 +55,7 @@ array(7) {
5555
["RELEASED_X"]=>
5656
string(18) "19840501000000.000"
5757
["SUPORTED"]=>
58-
int(1)
58+
bool(true)
5959
["PRICE"]=>
6060
float(12.34)
6161
["deleted"]=>

tests/type_logical.phpt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (!extension_loaded('dbase')) die('skip dbase extension not available');
77
--FILE--
88
<?php
99
$db = dbase_create(
10-
__DIR__ . DIRECTORY_SEPARATOR . 'dbase-logical.dbf',
10+
__DIR__ . DIRECTORY_SEPARATOR . 'type_logical.dbf',
1111
array(
1212
array('flag', 'L')
1313
)
@@ -26,22 +26,22 @@ for ($i = 1; $i <= dbase_numrecords($db); $i++) {
2626
?>
2727
===DONE===
2828
--EXPECT--
29-
int(1)
30-
int(1)
31-
int(1)
32-
int(1)
33-
int(0)
34-
int(0)
35-
int(0)
36-
int(0)
37-
int(0)
38-
int(0)
39-
int(0)
40-
int(0)
41-
int(0)
42-
int(0)
29+
bool(true)
30+
bool(true)
31+
bool(true)
32+
bool(true)
33+
bool(false)
34+
bool(false)
35+
bool(false)
36+
bool(false)
37+
bool(false)
38+
bool(false)
39+
bool(false)
40+
bool(false)
41+
bool(false)
42+
bool(false)
4343
===DONE===
4444
--CLEAN--
4545
<?php
46-
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'dbase-logical.dbf');
46+
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'type_logical.dbf');
4747
?>

0 commit comments

Comments
 (0)