Skip to content

Commit 3d8e54f

Browse files
committed
Changed php_error to php_error_docref.
1 parent add3ec4 commit 3d8e54f

26 files changed

Lines changed: 344 additions & 389 deletions

File tree

ext/dbase/dbf_rec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void pack_dbf(dbhead_t *dbh)
136136

137137
/* Try to truncate the file to the right size. */
138138
if (ftruncate(dbh->db_fd, out_off) != 0) {
139-
php_error(E_WARNING, "dbase_pack() couldn't truncate the file to the right size. Some deleted records may still be left in there.");
139+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "dbase_pack() couldn't truncate the file to the right size. Some deleted records may still be left in there.");
140140
}
141141

142142
if (rec_cnt == 0)

ext/dio/dio.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ PHP_FUNCTION(dio_open)
161161
}
162162

163163
if (fd == -1) {
164-
php_error(E_WARNING, "%s(): cannot open file %s with flags %d and permissions %d: %s",
165-
get_active_function_name(TSRMLS_C), file_name, flags, mode, strerror(errno));
164+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot open file %s with flags %d and permissions %d: %s", file_name, flags, mode, strerror(errno));
166165
RETURN_FALSE;
167166
}
168167

@@ -218,8 +217,7 @@ PHP_FUNCTION(dio_write)
218217

219218
res = write(f->fd, data, trunc_len ? trunc_len : data_len);
220219
if (res == -1) {
221-
php_error(E_WARNING, "%s(): cannot write data to file descriptor %d, %s",
222-
get_active_function_name(TSRMLS_C), f->fd, strerror(errno));
220+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot write data to file descriptor %d, %s", f->fd, strerror(errno));
223221
}
224222

225223
RETURN_LONG(res);
@@ -240,8 +238,7 @@ PHP_FUNCTION(dio_truncate)
240238
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
241239

242240
if (ftruncate(f->fd, offset) == -1) {
243-
php_error(E_WARNING, "%s(): couldn't truncate %d to %d bytes: %s",
244-
get_active_function_name(TSRMLS_C), f->fd, offset, strerror(errno));
241+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %d bytes: %s", f->fd, offset, strerror(errno));
245242
RETURN_FALSE;
246243
}
247244

@@ -265,8 +262,7 @@ PHP_FUNCTION(dio_stat)
265262
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
266263

267264
if (fstat(f->fd, &s) == -1) {
268-
php_error(E_WARNING, "%s(): cannot stat %d: %s",
269-
get_active_function_name(TSRMLS_C), f->fd, strerror(errno));
265+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno));
270266
RETURN_FALSE;
271267
}
272268

@@ -327,8 +323,7 @@ PHP_FUNCTION(dio_fcntl)
327323
HashTable *fh;
328324

329325
if (!arg) {
330-
php_error(E_WARNING, "%s() expects argument 3 to be array or int, none given",
331-
get_active_function_name(TSRMLS_C));
326+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, none given");
332327
RETURN_FALSE;
333328
}
334329
if (Z_TYPE_P(arg) == IS_ARRAY) {
@@ -366,8 +361,7 @@ PHP_FUNCTION(dio_fcntl)
366361
lk.l_whence = SEEK_SET;
367362
lk.l_type = Z_LVAL_P(arg);
368363
} else {
369-
php_error(E_WARNING, "%s() expects argument 3 to be array or int, %s given",
370-
get_active_function_name(TSRMLS_C), zend_zval_type_name(arg));
364+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg));
371365
RETURN_FALSE;
372366
}
373367

@@ -392,8 +386,7 @@ PHP_FUNCTION(dio_fcntl)
392386
php_fd_t *new_f;
393387

394388
if (!arg || Z_TYPE_P(arg) != IS_LONG) {
395-
php_error(E_WARNING, "%s() expects argument 3 to be int",
396-
get_active_function_name(TSRMLS_C));
389+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int");
397390
RETURN_FALSE;
398391
}
399392

@@ -403,8 +396,7 @@ PHP_FUNCTION(dio_fcntl)
403396
}
404397
default:
405398
if (!arg || Z_TYPE_P(arg) != IS_LONG) {
406-
php_error(E_WARNING, "%s() expects argument 3 to be int",
407-
get_active_function_name(TSRMLS_C));
399+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int");
408400
RETURN_FALSE;
409401
}
410402

ext/hwapi/hwapi.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,15 @@ static void *php_hwapi_get_object(zval *wrapper, int rsrc_type1) {
341341
int type;
342342

343343
if (Z_TYPE_P(wrapper) != IS_OBJECT) {
344-
php_error(E_ERROR, "Wrapper is not an object");
344+
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Wrapper is not an object");
345345
}
346346
if (zend_hash_find(Z_OBJPROP_P(wrapper), "this", sizeof("this"), (void **)&handle) == FAILURE) {
347-
php_error(E_ERROR, "Underlying object missing");
347+
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Underlying object missing");
348348
}
349349

350350
obj = zend_list_find(Z_LVAL_PP(handle), &type);
351351
if (!obj || (type != rsrc_type1)) {
352-
php_error(E_ERROR, "Underlying object missing or of invalid type");
352+
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Underlying object missing or of invalid type");
353353
}
354354
return obj;
355355
}
@@ -4255,7 +4255,7 @@ PHP_FUNCTION(hwapi_object_attribute) {
42554255
error = objp->attribute(HW_API_String(Z_STRVAL_PP(arg1)), attr);
42564256
break;
42574257
default:
4258-
php_error(E_WARNING, "HW_API_Object::attribute() needs string or long as parameter");
4258+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "HW_API_Object::attribute() needs string or long as parameter");
42594259
RETURN_FALSE;
42604260
}
42614261

@@ -4643,7 +4643,7 @@ PHP_FUNCTION(hwapi_error_reason) {
46434643
RETURN_FALSE;
46444644
}
46454645
if(!objp->error())
4646-
php_error(E_WARNING, "This is not an error");
4646+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "This is not an error");
46474647

46484648
error = objp->reason(Z_LVAL_PP(arg1), reason);
46494649
if(error) {

ext/ingres_ii/ii.c

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ static int _close_statement(II_LINK *link)
120120
/* rolls back transaction in given link
121121
after closing the active transaction (if any)
122122
*/
123-
static int _rollback_transaction(II_LINK *link)
123+
static int _rollback_transaction(II_LINK *link TSRMLS_DC)
124124
{
125125
IIAPI_ROLLBACKPARM rollbackParm;
126126

127127
if (link->stmtHandle && _close_statement(link)) {
128-
php_error(E_WARNING, "Ingres II: Unable to close statement !!");
128+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to close statement !!");
129129
return 1;
130130
}
131131

@@ -149,8 +149,8 @@ static void _close_ii_link(II_LINK *link TSRMLS_DC)
149149
{
150150
IIAPI_DISCONNPARM disconnParm;
151151

152-
if (link->tranHandle && _rollback_transaction(link)) {
153-
php_error(E_WARNING, "Ingres II: Unable to rollback transaction !!");
152+
if (link->tranHandle && _rollback_transaction(link TSRMLS_CC)) {
153+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to rollback transaction !!");
154154
}
155155

156156
disconnParm.dc_genParm.gp_callback = NULL;
@@ -197,7 +197,7 @@ static void _clean_ii_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
197197
if (link->autocommit) {
198198

199199
if (link->stmtHandle && _close_statement(link)) {
200-
php_error(E_WARNING, "Ingres II: Unable to close statement !!");
200+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to close statement !!");
201201
}
202202

203203
autoParm.ac_genParm.gp_callback = NULL;
@@ -209,15 +209,15 @@ static void _clean_ii_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
209209
ii_sync(&(autoParm.ac_genParm));
210210

211211
if (ii_success(&(autoParm.ac_genParm)) == II_FAIL) {
212-
php_error(E_WARNING, "Ingres II: Unable to disable autocommit");
212+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to disable autocommit");
213213
}
214214

215215
link->autocommit = 0;
216216
link->tranHandle = NULL;
217217
}
218218

219-
if (link->tranHandle && _rollback_transaction(link)) {
220-
php_error(E_WARNING, "Ingres II: Unable to rollback transaction !!");
219+
if (link->tranHandle && _rollback_transaction(link TSRMLS_CC)) {
220+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to rollback transaction !!");
221221
}
222222
}
223223

@@ -348,7 +348,8 @@ static int ii_sync(IIAPI_GENPARM *genParm)
348348
}
349349

350350
if (waitParm.wt_status != IIAPI_ST_SUCCESS) {
351-
php_error(E_WARNING, "Ingres II: Unexpected failure of IIapi_wait()");
351+
TSRMLS_FETCH();
352+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unexpected failure of IIapi_wait()");
352353
return 0;
353354
}
354355
return 1;
@@ -368,14 +369,15 @@ static int ii_success(IIAPI_GENPARM *genParm)
368369

369370
default:
370371
if (genParm->gp_errorHandle == NULL) { /* no error message available */
371-
php_error(E_WARNING, "Ingres II: Server or API error - no error message available");
372+
TSRMLS_FETCH();
373+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Server or API error - no error message available");
372374
} else {
373375
IIAPI_GETEINFOPARM getEInfoParm;
374376

375377
getEInfoParm.ge_errorHandle = genParm->gp_errorHandle;
376378
IIapi_getErrorInfo(&getEInfoParm);
377-
php_error(E_WARNING, "Ingres II: Server or API error : %s", getEInfoParm.ge_message);
378-
php_error(E_WARNING, "Ingres II: SQLSTATE : %s", getEInfoParm.ge_SQLSTATE);
379+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Server or API error : %s", getEInfoParm.ge_message);
380+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: SQLSTATE : %s", getEInfoParm.ge_SQLSTATE);
379381
}
380382
return II_FAIL;
381383
}
@@ -399,7 +401,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
399401
if (PG(sql_safe_mode)) { /* sql_safe_mode */
400402

401403
if (argc > 0) {
402-
php_error(E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
404+
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
403405
}
404406

405407
db = pass = NULL;
@@ -451,7 +453,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
451453
/* if asked for unauthorized persistency, issue a warning
452454
and go for a non-persistent link */
453455
if (persistent && !IIG(allow_persistent)) {
454-
php_error(E_WARNING, "Ingres II: Persistent links disabled !");
456+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Persistent links disabled !");
455457
persistent = 0;
456458
}
457459

@@ -463,12 +465,12 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
463465
list_entry new_le;
464466

465467
if (IIG(max_links) != -1 && IIG(num_links) >= IIG(max_links)) {
466-
php_error(E_WARNING, "Ingres II: Too many open links (%d)", IIG(num_links));
468+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Too many open links (%d)", IIG(num_links));
467469
efree(hashed_details);
468470
RETURN_FALSE;
469471
}
470472
if (IIG(max_persistent) != -1 && IIG(num_persistent) >= IIG(max_persistent)) {
471-
php_error(E_WARNING, "Ingres II: Too many open persistent links (%d)", IIG(num_persistent));
473+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Too many open persistent links (%d)", IIG(num_persistent));
472474
efree(hashed_details);
473475
RETURN_FALSE;
474476
}
@@ -487,7 +489,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
487489

488490
if (!ii_sync(&(connParm.co_genParm)) || ii_success(&(connParm.co_genParm)) == II_FAIL) {
489491
efree(hashed_details);
490-
php_error(E_WARNING, "Ingres II: Unable to connect to database (%s)", db);
492+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to connect to database (%s)", db);
491493
RETURN_FALSE;
492494
}
493495

@@ -503,7 +505,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
503505
Z_TYPE(new_le) = le_ii_plink;
504506
new_le.ptr = link;
505507
if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void *) &new_le, sizeof(list_entry), NULL) == FAILURE) {
506-
php_error(E_WARNING, "Ingres II: Unable to hash (%s)", hashed_details);
508+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to hash (%s)", hashed_details);
507509
free(link);
508510
efree(hashed_details);
509511
RETURN_FALSE;
@@ -554,7 +556,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
554556
}
555557
}
556558
if (IIG(max_links) != -1 && IIG(num_links) >= IIG(max_links)) {
557-
php_error(E_WARNING, "Ingres II: Too many open links (%d)", IIG(num_links));
559+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Too many open links (%d)", IIG(num_links));
558560
efree(hashed_details);
559561
RETURN_FALSE;
560562
}
@@ -573,7 +575,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
573575

574576
if (!ii_sync(&(connParm.co_genParm)) || ii_success(&(connParm.co_genParm)) == II_FAIL) {
575577
efree(hashed_details);
576-
php_error(E_WARNING, "Ingres II: Unable to connect to database (%s)", db);
578+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to connect to database (%s)", db);
577579
RETURN_FALSE;
578580
}
579581

@@ -592,7 +594,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
592594
new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
593595
Z_TYPE(new_index_ptr) = le_index_ptr;
594596
if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1, (void *) &new_index_ptr, sizeof(list_entry), NULL) == FAILURE) {
595-
php_error(E_WARNING, "Ingres II: Unable to hash (%s)", hashed_details);
597+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to hash (%s)", hashed_details);
596598
free(link);
597599
efree(hashed_details);
598600
RETURN_FALSE;
@@ -684,7 +686,7 @@ PHP_FUNCTION(ingres_query)
684686

685687
/* if there's already an active statement, close it */
686688
if (ii_link->stmtHandle && _close_statement(ii_link)) {
687-
php_error(E_WARNING, "Ingres II: Unable to close statement !!");
689+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to close statement !!");
688690
RETURN_FALSE;
689691
}
690692

@@ -861,7 +863,7 @@ static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type)
861863
fun_name = "foobar";
862864
break;
863865
}
864-
php_error(E_WARNING, "Ingres II: %s() called with wrong index (%d)", fun_name, index);
866+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: %s() called with wrong index (%d)", fun_name, index);
865867
RETURN_FALSE;
866868
}
867869

@@ -924,7 +926,7 @@ static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type)
924926
RETURN_STRING("IIAPI_VCH_TYPE", 1);
925927

926928
default:
927-
php_error(E_WARNING, "Ingres II: Unknown Ingres data type");
929+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unknown Ingres data type");
928930
RETURN_FALSE;
929931
break;
930932
}
@@ -960,7 +962,7 @@ static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type)
960962
static char *php_ii_field_name(II_LINK *ii_link, int index)
961963
{
962964
if (index < 1 || index > ii_link->fieldCount) {
963-
php_error(E_WARNING, "Ingres II: php_ii_field_name() called with wrong index (%d)", index);
965+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: php_ii_field_name() called with wrong index (%d)", index);
964966
return NULL;
965967
}
966968

@@ -1115,7 +1117,7 @@ static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int res
11151117
if (more) { /* more segments of LBYTE or LVCH element to come */
11161118

11171119
/* Multi segment LBYTE and LVCH elements not supported yet */
1118-
php_error(E_ERROR, "Ingres II: Multi segment LBYTE and LVCH elements not supported yet");
1120+
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Ingres II: Multi segment LBYTE and LVCH elements not supported yet");
11191121

11201122
} else {
11211123

@@ -1152,7 +1154,7 @@ static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int res
11521154
break;
11531155

11541156
default:
1155-
php_error(E_WARNING, "Ingres II: Invalid size for IIAPI_FLT_TYPE data (%d)", columnData[k - 1].dv_length);
1157+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Invalid size for IIAPI_FLT_TYPE data (%d)", columnData[k - 1].dv_length);
11561158
break;
11571159
}
11581160

@@ -1181,7 +1183,7 @@ static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int res
11811183
break;
11821184

11831185
default:
1184-
php_error(E_WARNING, "Ingres II: Invalid size for IIAPI_INT_TYPE data (%d)", columnData[k - 1].dv_length);
1186+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Invalid size for IIAPI_INT_TYPE data (%d)", columnData[k - 1].dv_length);
11851187
break;
11861188
}
11871189

@@ -1242,7 +1244,7 @@ static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int res
12421244
break;
12431245

12441246
default:
1245-
php_error(E_WARNING, "Ingres II: Invalid SQL data type in fetched field (%d -- length : %d)", (ii_link->descriptor[i + k - 2]).ds_dataType, columnData[k - 1].dv_length);
1247+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Invalid SQL data type in fetched field (%d -- length : %d)", (ii_link->descriptor[i + k - 2]).ds_dataType, columnData[k - 1].dv_length);
12461248
break;
12471249
}
12481250
}
@@ -1364,7 +1366,7 @@ PHP_FUNCTION(ingres_rollback)
13641366
}
13651367
ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
13661368

1367-
if (_rollback_transaction(ii_link)) {
1369+
if (_rollback_transaction(ii_link TSRMLS_CC)) {
13681370
RETURN_FALSE;
13691371
}
13701372
RETURN_TRUE;
@@ -1393,7 +1395,7 @@ PHP_FUNCTION(ingres_commit)
13931395
ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
13941396

13951397
if (ii_link->stmtHandle && _close_statement(ii_link)) {
1396-
php_error(E_WARNING, "Ingres II: Unable to close statement !!");
1398+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ingres II: Unable to close statement !!");
13971399
RETURN_FALSE;
13981400
}
13991401

0 commit comments

Comments
 (0)