Skip to content

Commit 1c1de0c

Browse files
Girgiaspetk
authored andcommitted
Convert all php_error_docref0 to php_error_docref
Closes GH-4394
1 parent 33994eb commit 1c1de0c

File tree

10 files changed

+22
-24
lines changed

10 files changed

+22
-24
lines changed

ext/dba/dba_lmdb.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ DBA_FIRSTKEY_FUNC(lmdb)
251251

252252
rc = mdb_txn_begin(LMDB_IT(env), NULL, MDB_RDONLY, &LMDB_IT(txn));
253253
if (rc) {
254-
php_error_docref0(NULL, E_WARNING, "%s", mdb_strerror(rc));
254+
php_error_docref(NULL, E_WARNING, "%s", mdb_strerror(rc));
255255
return NULL;
256256
}
257257

258258
rc = mdb_cursor_open(LMDB_IT(txn), LMDB_IT(dbi), &LMDB_IT(cur));
259259
if (rc) {
260260
mdb_txn_abort(LMDB_IT(txn));
261-
php_error_docref0(NULL, E_WARNING, "%s", mdb_strerror(rc));
261+
php_error_docref(NULL, E_WARNING, "%s", mdb_strerror(rc));
262262
return NULL;
263263
}
264264

@@ -268,7 +268,7 @@ DBA_FIRSTKEY_FUNC(lmdb)
268268
mdb_cursor_close(LMDB_IT(cur));
269269
LMDB_IT(cur) = NULL;
270270
if (MDB_NOTFOUND != rc) {
271-
php_error_docref0(NULL, E_WARNING, "%s", mdb_strerror(rc));
271+
php_error_docref(NULL, E_WARNING, "%s", mdb_strerror(rc));
272272
}
273273
return NULL;
274274
}
@@ -291,7 +291,7 @@ DBA_NEXTKEY_FUNC(lmdb)
291291

292292
rc = mdb_txn_renew(LMDB_IT(txn));
293293
if (rc) {
294-
php_error_docref0(NULL, E_WARNING, "%s", mdb_strerror(rc));
294+
php_error_docref(NULL, E_WARNING, "%s", mdb_strerror(rc));
295295
return NULL;
296296
}
297297

@@ -301,7 +301,7 @@ DBA_NEXTKEY_FUNC(lmdb)
301301
mdb_cursor_close(LMDB_IT(cur));
302302
LMDB_IT(cur) = NULL;
303303
if (MDB_NOTFOUND != rc) {
304-
php_error_docref0(NULL, E_WARNING, "%s", mdb_strerror(rc));
304+
php_error_docref(NULL, E_WARNING, "%s", mdb_strerror(rc));
305305
}
306306
return NULL;
307307
}
@@ -327,7 +327,7 @@ DBA_SYNC_FUNC(lmdb)
327327

328328
rc = mdb_env_sync(LMDB_IT(env), 1);
329329
if (rc) {
330-
php_error_docref0(NULL, E_WARNING, "%s", mdb_strerror(rc));
330+
php_error_docref(NULL, E_WARNING, "%s", mdb_strerror(rc));
331331
return FAILURE;
332332
}
333333

ext/intl/idn/idn.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
287287

288288
if (idna_info != NULL) {
289289
if (variant == INTL_IDN_VARIANT_2003) {
290-
php_error_docref0(NULL, E_NOTICE,
290+
php_error_docref(NULL, E_NOTICE,
291291
"4 arguments were provided, but INTL_IDNA_VARIANT_2003 only "
292292
"takes 3 - extra argument ignored");
293293
} else {

ext/intl/timezone/timezone_class.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ U_CFUNC void timezone_register_IntlTimeZone_class(void)
505505
TimeZone_ce_ptr = zend_register_internal_class(&ce);
506506
if (!TimeZone_ce_ptr) {
507507
//can't happen now without bigger problems before
508-
php_error_docref0(NULL, E_ERROR,
508+
php_error_docref(NULL, E_ERROR,
509509
"IntlTimeZone: class registration has failed.");
510510
return;
511511
}

ext/intl/transliterator/transliterator_class.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static zval *Transliterator_read_property( zval *object, zval *member, int type,
241241
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
242242
Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
243243
{
244-
php_error_docref0( NULL, E_WARNING, "The property \"id\" is read-only" );
244+
php_error_docref(NULL, E_WARNING, "The property \"id\" is read-only" );
245245
retval = &EG( uninitialized_zval );
246246
}
247247
else
@@ -271,7 +271,7 @@ static zval *Transliterator_write_property( zval *object, zval *member, zval *va
271271
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
272272
Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
273273
{
274-
php_error_docref0( NULL, E_WARNING, "The property \"id\" is read-only" );
274+
php_error_docref(NULL, E_WARNING, "The property \"id\" is read-only" );
275275
}
276276
else
277277
{

ext/intl/transliterator/transliterator_methods.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ PHP_FUNCTION( transliterator_transliterate )
339339
if( res == FAILURE )
340340
{
341341
zend_string *message = intl_error_get_message( NULL );
342-
php_error_docref0( NULL, E_WARNING, "Could not create "
342+
php_error_docref(NULL, E_WARNING, "Could not create "
343343
"transliterator with ID \"%s\" (%s)", Z_STRVAL_P( arg1 ), ZSTR_VAL(message) );
344344
zend_string_free( message );
345345
ZVAL_UNDEF(&tmp_object);

ext/sockets/conversions.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static void do_to_zval_err(res_context *ctx, const char *fmt, ...)
199199
void err_msg_dispose(struct err_s *err)
200200
{
201201
if (err->msg != NULL) {
202-
php_error_docref0(NULL, err->level, "%s", err->msg);
202+
php_error_docref(NULL, err->level, "%s", err->msg);
203203
if (err->should_free) {
204204
efree(err->msg);
205205
}

ext/sockets/sendrecvmsg.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ inline ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags)
7171
#define LONG_CHECK_VALID_INT(l) \
7272
do { \
7373
if ((l) < INT_MIN && (l) > INT_MAX) { \
74-
php_error_docref0(NULL, E_WARNING, "The value " ZEND_LONG_FMT " does not fit inside " \
74+
php_error_docref(NULL, E_WARNING, "The value " ZEND_LONG_FMT " does not fit inside " \
7575
"the boundaries of a native integer", (l)); \
7676
return; \
7777
} \
@@ -292,22 +292,22 @@ PHP_FUNCTION(socket_cmsg_space)
292292
LONG_CHECK_VALID_INT(n);
293293

294294
if (n < 0) {
295-
php_error_docref0(NULL, E_WARNING, "The third argument "
295+
php_error_docref(NULL, E_WARNING, "The third argument "
296296
"cannot be negative");
297297
return;
298298
}
299299

300300
entry = get_ancillary_reg_entry(level, type);
301301
if (entry == NULL) {
302-
php_error_docref0(NULL, E_WARNING, "The pair level " ZEND_LONG_FMT "/type " ZEND_LONG_FMT " is "
302+
php_error_docref(NULL, E_WARNING, "The pair level " ZEND_LONG_FMT "/type " ZEND_LONG_FMT " is "
303303
"not supported by PHP", level, type);
304304
return;
305305
}
306306

307307
if (entry->var_el_size > 0 && n > (zend_long)((ZEND_LONG_MAX - entry->size -
308308
CMSG_SPACE(0) - 15L) / entry->var_el_size)) {
309309
/* the -15 is to account for any padding CMSG_SPACE may add after the data */
310-
php_error_docref0(NULL, E_WARNING, "The value for the "
310+
php_error_docref(NULL, E_WARNING, "The value for the "
311311
"third argument (" ZEND_LONG_FMT ") is too large", n);
312312
return;
313313
}
@@ -331,7 +331,7 @@ int php_do_setsockopt_ipv6_rfc3542(php_socket *php_sock, int level, int optname,
331331
case IPV6_PKTINFO:
332332
#ifdef PHP_WIN32
333333
if (Z_TYPE_P(arg4) == IS_ARRAY) {
334-
php_error_docref0(NULL, E_WARNING, "Windows does not "
334+
php_error_docref(NULL, E_WARNING, "Windows does not "
335335
"support sticky IPV6_PKTINFO");
336336
return FAILURE;
337337
} else {

ext/standard/html.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle
11871187

11881188
if (all) { /* replace with all named entities */
11891189
if (CHARSET_PARTIAL_SUPPORT(charset)) {
1190-
php_error_docref0(NULL, E_STRICT, "Only basic entities "
1190+
php_error_docref(NULL, E_STRICT, "Only basic entities "
11911191
"substitution is supported for multi-byte encodings other than UTF-8; "
11921192
"functionality is equivalent to htmlspecialchars");
11931193
}

main/main.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1163,9 +1163,9 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
11631163
}
11641164
/* }}} */
11651165

1166-
/* {{{ php_error_docref0 */
1167-
/* See: CODING_STANDARDS.md for details. */
1168-
PHPAPI ZEND_COLD void php_error_docref0(const char *docref, int type, const char *format, ...)
1166+
/* {{{ php_error_docref */
1167+
/* Generate an error which links to docref or the php.net documentation if docref is NULL */
1168+
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format, ...)
11691169
{
11701170
va_list args;
11711171

main/php.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {}
339339
PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int type, const char *format, va_list args) PHP_ATTRIBUTE_FORMAT(printf, 4, 0);
340340

341341
/* PHPAPI void php_error(int type, const char *format, ...); */
342-
PHPAPI ZEND_COLD void php_error_docref0(const char *docref, int type, const char *format, ...)
342+
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format, ...)
343343
PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
344344
PHPAPI ZEND_COLD void php_error_docref1(const char *docref, const char *param1, int type, const char *format, ...)
345345
PHP_ATTRIBUTE_FORMAT(printf, 4, 5);
@@ -350,8 +350,6 @@ PHPAPI ZEND_COLD void php_win32_docref2_from_error(DWORD error, const char *para
350350
#endif
351351
END_EXTERN_C()
352352

353-
#define php_error_docref php_error_docref0
354-
355353
#define zenderror phperror
356354
#define zendlex phplex
357355

0 commit comments

Comments
 (0)