Skip to content

Commit 4c2dca5

Browse files
committed
Add quote marks around path and keys in error messages in DBA ext.
1 parent 6711785 commit 4c2dca5

File tree

9 files changed

+29
-29
lines changed

9 files changed

+29
-29
lines changed

ext/dba/dba.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
710710
if (ac==2) {
711711
hptr = DBA_G(default_hptr);
712712
if (!hptr) {
713-
php_error_docref(NULL, E_WARNING, "No default handler selected for path %s with mode %s",
713+
php_error_docref(NULL, E_WARNING, "No default handler selected for path \"%s\" with mode %s",
714714
Z_STRVAL(args[0]), Z_STRVAL(args[1]));
715715
FREENOW;
716716
RETURN_FALSE;
@@ -720,7 +720,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
720720
}
721721

722722
if (!hptr->name) {
723-
php_error_docref(NULL, E_WARNING, "No such handler: %s for path %s with mode %s",
723+
php_error_docref(NULL, E_WARNING, "No such handler: %s for path \"%s\" with mode %s",
724724
Z_STRVAL(args[2]), Z_STRVAL(args[0]), Z_STRVAL(args[1]));
725725
FREENOW;
726726
RETURN_FALSE;
@@ -832,7 +832,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
832832
break;
833833
default:
834834
/* Mode is second argument and path is first argument */
835-
php_error_docref(NULL, E_WARNING, "Illegal DBA mode %s for path %s", Z_STRVAL(args[1]), Z_STRVAL(args[0]));
835+
php_error_docref(NULL, E_WARNING, "Illegal DBA mode %s for path \"%s\"", Z_STRVAL(args[1]), Z_STRVAL(args[0]));
836836
FREENOW;
837837
RETURN_FALSE;
838838
}
@@ -846,21 +846,21 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
846846
pmode++;
847847
if (!lock_flag) {
848848
php_error_docref(NULL, E_WARNING,
849-
"Cannot combine modifiers - (no lock) and t (test lock) for path %s with mode %s",
849+
"Cannot combine modifiers - (no lock) and t (test lock) for path \"%s\" with mode %s",
850850
Z_STRVAL(args[0]), Z_STRVAL(args[1]));
851851
FREENOW;
852852
RETURN_FALSE;
853853
}
854854
if (!lock_mode) {
855855
if ((hptr->flags & DBA_LOCK_ALL) == 0) {
856856
php_error_docref(NULL, E_WARNING,
857-
"Handler %s uses its own locking which doesn't support mode modifier t (test lock) for path %s with mode %s",
857+
"Handler %s uses its own locking which doesn't support mode modifier t (test lock) for path \"%s\" with mode %s",
858858
hptr->name, Z_STRVAL(args[0]), Z_STRVAL(args[1]));
859859
FREENOW;
860860
RETURN_FALSE;
861861
} else {
862862
php_error_docref(NULL, E_WARNING,
863-
"Handler %s doesn't uses locking for this mode which makes modifier t (test lock) obsolete for path %s with mode %s",
863+
"Handler %s doesn't uses locking for this mode which makes modifier t (test lock) obsolete for path \"%s\" with mode %s",
864864
hptr->name, Z_STRVAL(args[0]), Z_STRVAL(args[1]));
865865
FREENOW;
866866
RETURN_FALSE;
@@ -871,7 +871,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
871871
}
872872
if (*pmode) {
873873
/* Mode is second argument and path is first argument */
874-
php_error_docref(NULL, E_WARNING, "Illegal DBA mode %s for path %s", Z_STRVAL(args[1]), Z_STRVAL(args[0]));
874+
php_error_docref(NULL, E_WARNING, "Illegal DBA mode %s for path \"%s\"", Z_STRVAL(args[1]), Z_STRVAL(args[0]));
875875
FREENOW;
876876
RETURN_FALSE;
877877
}
@@ -1005,7 +1005,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
10051005

10061006
if (error || hptr->open(info, &error) != SUCCESS) {
10071007
dba_close(info);
1008-
php_error_docref(NULL, E_WARNING, "Driver initialization failed for handler: %s%s%s for path %s with mode %s",
1008+
php_error_docref(NULL, E_WARNING, "Driver initialization failed for handler: %s%s%s for path \"%s\" with mode %s",
10091009
hptr->name, error?": ":"", error?error:"", Z_STRVAL(args[0]), Z_STRVAL(args[1]));
10101010
FREENOW;
10111011
RETURN_FALSE;
@@ -1018,7 +1018,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
10181018
if (persistent) {
10191019
if (zend_register_persistent_resource(key, keylen, info, le_pdb) == NULL) {
10201020
dba_close(info);
1021-
php_error_docref(NULL, E_WARNING, "Could not register persistent resource for path %s with mode %s",
1021+
php_error_docref(NULL, E_WARNING, "Could not register persistent resource for path \"%s\" with mode %s",
10221022
Z_STRVAL(args[0]), Z_STRVAL(args[1]));
10231023
FREENOW;
10241024
RETURN_FALSE;

ext/dba/dba_flatfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ DBA_UPDATE_FUNC(flatfile)
9191
case 1:
9292
return FAILURE;
9393
case -1:
94-
php_error_docref(NULL, E_WARNING, "Operation impossible with key %s", key);
94+
php_error_docref(NULL, E_WARNING, "Operation impossible with key \"%s\"", key);
9595
return FAILURE;
9696
default:
9797
php_error_docref(NULL, E_WARNING, "Unknown return value for key-value pair (%s, %s)", key, val);

ext/dba/dba_inifile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ DBA_UPDATE_FUNC(inifile)
9393
INIFILE_DONE;
9494
switch(res) {
9595
case -1:
96-
php_error_docref(NULL, E_WARNING, "Operation impossible with key %s", key);
96+
php_error_docref(NULL, E_WARNING, "Operation impossible with key \"%s\"", key);
9797
return FAILURE;
9898
default:
9999
case 0:

ext/dba/dba_lmdb.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ DBA_FETCH_FUNC(lmdb)
112112
rc = mdb_txn_begin(LMDB_IT(env), NULL, MDB_RDONLY, &LMDB_IT(txn));
113113
}
114114
if (rc) {
115-
php_error_docref(NULL, E_WARNING, "Error %s on key %s", mdb_strerror(rc), key);
115+
php_error_docref(NULL, E_WARNING, "Error %s on key \"%s\"", mdb_strerror(rc), key);
116116
return NULL;
117117
}
118118

@@ -122,7 +122,7 @@ DBA_FETCH_FUNC(lmdb)
122122
rc = mdb_get(LMDB_IT(txn), LMDB_IT(dbi), &k, &v);
123123
if (rc) {
124124
if (MDB_NOTFOUND != rc) {
125-
php_error_docref(NULL, E_WARNING, "Error %s on key %s", mdb_strerror(rc), key);
125+
php_error_docref(NULL, E_WARNING, "Error %s on key \"%s\"", mdb_strerror(rc), key);
126126
}
127127
mdb_txn_abort(LMDB_IT(txn));
128128
return NULL;
@@ -188,7 +188,7 @@ DBA_EXISTS_FUNC(lmdb)
188188
rc = mdb_txn_begin(LMDB_IT(env), NULL, MDB_RDONLY, &LMDB_IT(txn));
189189
}
190190
if (rc) {
191-
php_error_docref(NULL, E_WARNING, "Error %s on key %s", mdb_strerror(rc), key);
191+
php_error_docref(NULL, E_WARNING, "Error %s on key \"%s\"", mdb_strerror(rc), key);
192192
return FAILURE;
193193
}
194194

@@ -198,7 +198,7 @@ DBA_EXISTS_FUNC(lmdb)
198198
rc = mdb_get(LMDB_IT(txn), LMDB_IT(dbi), &k, &v);
199199
if (rc) {
200200
if (MDB_NOTFOUND != rc) {
201-
php_error_docref(NULL, E_WARNING, "Error %s on key %s", mdb_strerror(rc), key);
201+
php_error_docref(NULL, E_WARNING, "Error %s on key \"%s\"", mdb_strerror(rc), key);
202202
}
203203
mdb_txn_abort(LMDB_IT(txn));
204204
return FAILURE;
@@ -220,7 +220,7 @@ DBA_DELETE_FUNC(lmdb)
220220

221221
rc = mdb_txn_begin(LMDB_IT(env), NULL, 0, &LMDB_IT(txn));
222222
if (rc) {
223-
php_error_docref(NULL, E_WARNING, "Error %s on key %s", mdb_strerror(rc), key);
223+
php_error_docref(NULL, E_WARNING, "Error %s on key \"%s\"", mdb_strerror(rc), key);
224224
return FAILURE;
225225
}
226226

@@ -231,14 +231,14 @@ DBA_DELETE_FUNC(lmdb)
231231
if (!rc) {
232232
rc = mdb_txn_commit(LMDB_IT(txn));
233233
if (rc) {
234-
php_error_docref(NULL, E_WARNING, "Error %s on key %s", mdb_strerror(rc), key);
234+
php_error_docref(NULL, E_WARNING, "Error %s on key \"%s\"", mdb_strerror(rc), key);
235235
mdb_txn_abort(LMDB_IT(txn));
236236
return FAILURE;
237237
}
238238
return SUCCESS;
239239
}
240240

241-
php_error_docref(NULL, E_WARNING, "Error %s on key %s", mdb_strerror(rc), key);
241+
php_error_docref(NULL, E_WARNING, "Error %s on key \"%s\"", mdb_strerror(rc), key);
242242

243243
return FAILURE;
244244
}

ext/dba/tests/bug72157.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ $var5 = dba_open(null,$var0);
1313
$var5 = dba_open($var0,$var0);
1414
?>
1515
--EXPECTF--
16-
Warning: dba_open(): Illegal DBA mode Resource id #5 for path in %sbug72157.php on line %d
16+
Warning: dba_open(): Illegal DBA mode Resource id #5 for path "" in %sbug72157.php on line %d
1717

18-
Warning: dba_open(): Illegal DBA mode Resource id #5 for path in %sbug72157.php on line %d
18+
Warning: dba_open(): Illegal DBA mode Resource id #5 for path "" in %sbug72157.php on line %d
1919

20-
Warning: dba_open(): Illegal DBA mode Resource id #5 for path in %sbug72157.php on line %d
20+
Warning: dba_open(): Illegal DBA mode Resource id #5 for path "" in %sbug72157.php on line %d
2121

22-
Warning: dba_open(): Illegal DBA mode Resource id #5 for path Resource id #5 in %sbug72157.php on line %d
22+
Warning: dba_open(): Illegal DBA mode Resource id #5 for path "Resource id #5" in %sbug72157.php on line %d

ext/dba/tests/dba011.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ Warning: Wrong parameter count for dba_open() in %sdba011.php on line %d
2727
NULL
2828
resource(%d) of type (dba)
2929

30-
Warning: dba_open(): No such handler: bogus for path %stest0.dbm with mode n in %sdba011.php on line %d
30+
Warning: dba_open(): No such handler: bogus for path "%stest0.dbm" with mode n in %sdba011.php on line %d
3131
bool(false)
3232

33-
Warning: dba_open(): Illegal DBA mode q for path %stest0.dbm in %sdba011.php on line %d
33+
Warning: dba_open(): Illegal DBA mode q for path "%stest0.dbm" in %sdba011.php on line %d
3434
bool(false)
3535

36-
Warning: dba_open(): Illegal DBA mode nq for path %stest0.dbm in %sdba011.php on line %d
36+
Warning: dba_open(): Illegal DBA mode nq for path "%stest0.dbm" in %sdba011.php on line %d
3737
bool(false)
3838
resource(%d) of type (dba)

ext/dba/tests/dba012.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ Warning: ini_set(): No such handler: does_not_exist in %sdba012.php on line %d
3838
resource(%d) of type (dba)
3939
Test 2
4040

41-
Warning: dba_open(): No default handler selected for path %stest0.dbm with mode n in %sdba012.php on line %d
41+
Warning: dba_open(): No default handler selected for path "%stest0.dbm" with mode n in %sdba012.php on line %d
4242
bool(false)

ext/dba/tests/dba016.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ $db_file1 = dba_popen($db_filename, 'n-t', 'flatfile');
2323
--EXPECTF--
2424
database handler: flatfile
2525

26-
Warning: dba_popen(): Cannot combine modifiers - (no lock) and t (test lock) for path %stest0.dbm with mode n-t in %sdba016.php on line %d
26+
Warning: dba_popen(): Cannot combine modifiers - (no lock) and t (test lock) for path "%stest0.dbm" with mode n-t in %sdba016.php on line %d
2727
===DONE===

ext/dba/tests/dba_cdb_001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ bool(true)
7777
bool(true)
7878
Test 1
7979

80-
Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported for path %stest0.dbm with mode c in %sdba_cdb_001.php on line %d
80+
Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported for path "%stest0.dbm" with mode c in %sdba_cdb_001.php on line %d
8181
Failed to open DB
8282
Test 2
8383

8484
Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_cdb_001.php on line %d
8585
Test 3
8686

87-
Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported for path %stest0.dbm with mode w in %sdba_cdb_001.php on line %d
87+
Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported for path "%stest0.dbm" with mode w in %sdba_cdb_001.php on line %d
8888
Failed to open DB
8989
===DONE===

0 commit comments

Comments
 (0)