Skip to content

Commit a40a4ac

Browse files
committed
Capitalize most of the error messages
1 parent b670823 commit a40a4ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+339
-339
lines changed

Zend/zend_exceptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ ZEND_METHOD(exception, getTraceAsString)
627627

628628
trace = zend_read_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_TRACE), 1, &rv);
629629
if (Z_TYPE_P(trace) != IS_ARRAY) {
630-
zend_type_error("trace is not an array");
630+
zend_type_error("Trace is not an array");
631631
return;
632632
}
633633
ZEND_HASH_FOREACH_NUM_KEY_VAL(Z_ARRVAL_P(trace), index, frame) {

ext/bcmath/bcmath.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ static void php_str2num(bc_num *num, char *str)
138138

139139
if (!(p = strchr(str, '.'))) {
140140
if (!bc_str2num(num, str, 0)) {
141-
php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
141+
php_error_docref(NULL, E_WARNING, "Bcmath function argument is not well-formed");
142142
}
143143
return;
144144
}
145145

146146
if (!bc_str2num(num, str, strlen(p+1))) {
147-
php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
147+
php_error_docref(NULL, E_WARNING, "Bcmath function argument is not well-formed");
148148
}
149149
}
150150
/* }}} */
@@ -471,10 +471,10 @@ PHP_FUNCTION(bccomp)
471471
bc_init_num(&second);
472472

473473
if (!bc_str2num(&first, ZSTR_VAL(left), scale)) {
474-
php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
474+
php_error_docref(NULL, E_WARNING, "Bcmath function argument is not well-formed");
475475
}
476476
if (!bc_str2num(&second, ZSTR_VAL(right), scale)) {
477-
php_error_docref(NULL, E_WARNING, "bcmath function argument is not well-formed");
477+
php_error_docref(NULL, E_WARNING, "Bcmath function argument is not well-formed");
478478
}
479479
RETVAL_LONG(bc_compare(first, second));
480480

ext/bz2/bz2.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,12 @@ static PHP_FUNCTION(bzopen)
374374
/* If it's not a resource its a string containing the filename to open */
375375
if (Z_TYPE_P(file) == IS_STRING) {
376376
if (Z_STRLEN_P(file) == 0) {
377-
php_error_docref(NULL, E_WARNING, "filename cannot be empty");
377+
php_error_docref(NULL, E_WARNING, "Filename cannot be empty");
378378
RETURN_FALSE;
379379
}
380380

381381
if (CHECK_ZVAL_NULL_PATH(file)) {
382-
zend_type_error("filename must not contain null bytes");
382+
zend_type_error("Filename must not contain null bytes");
383383
RETURN_THROWS();
384384
}
385385

@@ -393,18 +393,18 @@ static PHP_FUNCTION(bzopen)
393393
stream_mode_len = strlen(stream->mode);
394394

395395
if (stream_mode_len != 1 && !(stream_mode_len == 2 && memchr(stream->mode, 'b', 2))) {
396-
php_error_docref(NULL, E_WARNING, "cannot use stream opened in mode '%s'", stream->mode);
396+
php_error_docref(NULL, E_WARNING, "Cannot use stream opened in mode '%s'", stream->mode);
397397
RETURN_FALSE;
398398
} else if (stream_mode_len == 1 && stream->mode[0] != 'r' && stream->mode[0] != 'w' && stream->mode[0] != 'a' && stream->mode[0] != 'x') {
399-
php_error_docref(NULL, E_WARNING, "cannot use stream opened in mode '%s'", stream->mode);
399+
php_error_docref(NULL, E_WARNING, "Cannot use stream opened in mode '%s'", stream->mode);
400400
RETURN_FALSE;
401401
}
402402

403403
switch(mode[0]) {
404404
case 'r':
405405
/* only "r" and "rb" are supported */
406406
if (stream->mode[0] != mode[0] && !(stream_mode_len == 2 && stream->mode[1] != mode[0])) {
407-
php_error_docref(NULL, E_WARNING, "cannot read from a stream opened in write only mode");
407+
php_error_docref(NULL, E_WARNING, "Cannot read from a stream opened in write only mode");
408408
RETURN_FALSE;
409409
}
410410
break;

ext/calendar/cal_unix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ PHP_FUNCTION(unixtojd)
3535
if (!ts) {
3636
ts = time(NULL);
3737
} else if (ts < 0) {
38-
zend_value_error("timestamp must not be negative");
38+
zend_value_error("Timestamp must not be negative");
3939
RETURN_THROWS();
4040
}
4141

@@ -59,7 +59,7 @@ PHP_FUNCTION(jdtounix)
5959
uday -= 2440588 /* J.D. of 1.1.1970 */;
6060

6161
if (uday < 0 || uday > 24755) {
62-
zend_value_error("jday must be within the Unix epoch");
62+
zend_value_error("Jday must be within the Unix epoch");
6363
RETURN_THROWS();
6464
}
6565

ext/calendar/calendar.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ PHP_FUNCTION(cal_info)
217217

218218

219219
if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
220-
zend_value_error("invalid calendar ID " ZEND_LONG_FMT, cal);
220+
zend_value_error("Invalid calendar ID " ZEND_LONG_FMT, cal);
221221
RETURN_THROWS();
222222
}
223223

@@ -239,7 +239,7 @@ PHP_FUNCTION(cal_days_in_month)
239239
}
240240

241241
if (cal < 0 || cal >= CAL_NUM_CALS) {
242-
zend_value_error("invalid calendar ID " ZEND_LONG_FMT, cal);
242+
zend_value_error("Invalid calendar ID " ZEND_LONG_FMT, cal);
243243
RETURN_THROWS();
244244
}
245245

@@ -248,7 +248,7 @@ PHP_FUNCTION(cal_days_in_month)
248248
sdn_start = calendar->to_jd(year, month, 1);
249249

250250
if (sdn_start == 0) {
251-
zend_value_error("invalid date");
251+
zend_value_error("Invalid date");
252252
RETURN_THROWS();
253253
}
254254

@@ -285,7 +285,7 @@ PHP_FUNCTION(cal_to_jd)
285285
}
286286

287287
if (cal < 0 || cal >= CAL_NUM_CALS) {
288-
zend_value_error("invalid calendar ID " ZEND_LONG_FMT, cal);
288+
zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
289289
RETURN_THROWS();
290290
}
291291

@@ -306,7 +306,7 @@ PHP_FUNCTION(cal_from_jd)
306306
}
307307

308308
if (cal < 0 || cal >= CAL_NUM_CALS) {
309-
zend_value_error("invalid calendar ID " ZEND_LONG_FMT, cal);
309+
zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
310310
RETURN_THROWS();
311311
}
312312
calendar = &cal_conversion_table[cal];

ext/com_dotnet/com_iterator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
148148
obj = CDNO_FETCH(object);
149149

150150
if (V_VT(&obj->v) != VT_DISPATCH && !V_ISARRAY(&obj->v)) {
151-
php_error_docref(NULL, E_WARNING, "variant is not an object or array VT=%d", V_VT(&obj->v));
151+
php_error_docref(NULL, E_WARNING, "Variant is not an object or array VT=%d", V_VT(&obj->v));
152152
return NULL;
153153
}
154154

ext/com_dotnet/com_variant.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
275275
}
276276

277277
if (ret == FAILURE) {
278-
php_error_docref(NULL, E_WARNING, "variant->zval: conversion from 0x%x ret=%d", V_VT(v), ret);
278+
php_error_docref(NULL, E_WARNING, "Variant->zval: conversion from 0x%x ret=%d", V_VT(v), ret);
279279
}
280280

281281
return ret;
@@ -425,7 +425,7 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar)
425425
return php_com_copy_variant(V_VARIANTREF(dstvar), srcvar);
426426

427427
default:
428-
php_error_docref(NULL, E_WARNING, "variant->variant: failed to copy from 0x%x to 0x%x", V_VT(dstvar), V_VT(srcvar));
428+
php_error_docref(NULL, E_WARNING, "Variant->variant: failed to copy from 0x%x to 0x%x", V_VT(dstvar), V_VT(srcvar));
429429
ret = FAILURE;
430430
}
431431
return ret;

ext/curl/interface.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ PHP_FUNCTION(curl_version)
16711671
ZEND_PARSE_PARAMETERS_END();
16721672

16731673
if (uversion == CURLVERSION_NOW) {
1674-
php_error_docref(NULL, E_DEPRECATED, "the $version parameter is deprecated");
1674+
php_error_docref(NULL, E_DEPRECATED, "The $version parameter is deprecated");
16751675
} else if (ZEND_NUM_ARGS() > 0) {
16761676
php_error_docref(NULL, E_WARNING, "$version argument ignored");
16771677
}
@@ -2576,7 +2576,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
25762576
ch->handlers->write->method = PHP_CURL_FILE;
25772577
ZVAL_COPY(&ch->handlers->write->stream, zvalue);
25782578
} else {
2579-
php_error_docref(NULL, E_WARNING, "the provided file handle is not writable");
2579+
php_error_docref(NULL, E_WARNING, "The provided file handle is not writable");
25802580
return FAILURE;
25812581
}
25822582
break;
@@ -2594,7 +2594,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
25942594
ch->handlers->write_header->method = PHP_CURL_FILE;
25952595
ZVAL_COPY(&ch->handlers->write_header->stream, zvalue);
25962596
} else {
2597-
php_error_docref(NULL, E_WARNING, "the provided file handle is not writable");
2597+
php_error_docref(NULL, E_WARNING, "The provided file handle is not writable");
25982598
return FAILURE;
25992599
}
26002600
break;
@@ -2623,7 +2623,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
26232623
zval_ptr_dtor(&ch->handlers->std_err);
26242624
ZVAL_COPY(&ch->handlers->std_err, zvalue);
26252625
} else {
2626-
php_error_docref(NULL, E_WARNING, "the provided file handle is not writable");
2626+
php_error_docref(NULL, E_WARNING, "The provided file handle is not writable");
26272627
return FAILURE;
26282628
}
26292629
/* break omitted intentionally */

ext/date/php_date.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ PHP_FUNCTION(idate)
11011101
ZEND_PARSE_PARAMETERS_END();
11021102

11031103
if (ZSTR_LEN(format) != 1) {
1104-
php_error_docref(NULL, E_WARNING, "idate format is one char");
1104+
php_error_docref(NULL, E_WARNING, "Idate format is one char");
11051105
RETURN_FALSE;
11061106
}
11071107

@@ -4642,7 +4642,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
46424642
case 6:
46434643
break;
46444644
default:
4645-
php_error_docref(NULL, E_WARNING, "invalid format");
4645+
php_error_docref(NULL, E_WARNING, "Invalid format");
46464646
RETURN_FALSE;
46474647
break;
46484648
}

ext/ffi/ffi.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ static zval *zend_ffi_cdata_set(zend_object *obj, zend_string *member, zval *val
10091009
#endif
10101010

10111011
if (UNEXPECTED(!zend_string_equals_literal(member, "cdata"))) {
1012-
zend_throw_error(zend_ffi_exception_ce, "only 'cdata' property may be set");
1012+
zend_throw_error(zend_ffi_exception_ce, "Only 'cdata' property may be set");
10131013
return &EG(uninitialized_zval);;
10141014
}
10151015

@@ -4000,16 +4000,16 @@ ZEND_METHOD(FFI, arrayType) /* {{{ */
40004000
type = ZEND_FFI_TYPE(ctype->type);
40014001

40024002
if (type->kind == ZEND_FFI_TYPE_FUNC) {
4003-
zend_throw_error(zend_ffi_exception_ce, "array of functions is not allowed");
4003+
zend_throw_error(zend_ffi_exception_ce, "Array of functions is not allowed");
40044004
RETURN_THROWS();
40054005
} else if (type->kind == ZEND_FFI_TYPE_ARRAY && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) {
4006-
zend_throw_error(zend_ffi_exception_ce, "only the leftmost array can be undimensioned");
4006+
zend_throw_error(zend_ffi_exception_ce, "Only the leftmost array can be undimensioned");
40074007
RETURN_THROWS();
40084008
} else if (type->kind == ZEND_FFI_TYPE_VOID) {
4009-
zend_throw_error(zend_ffi_exception_ce, "array of 'void' is not allowed");
4009+
zend_throw_error(zend_ffi_exception_ce, "Array of 'void' is not allowed");
40104010
RETURN_THROWS();
40114011
} else if (type->attr & ZEND_FFI_ATTR_INCOMPLETE_TAG) {
4012-
zend_throw_error(zend_ffi_exception_ce, "array of incomplete type is not allowed");
4012+
zend_throw_error(zend_ffi_exception_ce, "Array of incomplete type is not allowed");
40134013
RETURN_THROWS();
40144014
}
40154015

@@ -4186,7 +4186,7 @@ ZEND_METHOD(FFI, memcpy) /* {{{ */
41864186
} else {
41874187
ptr1 = cdata1->ptr;
41884188
if (type1->kind != ZEND_FFI_TYPE_POINTER && size > type1->size) {
4189-
zend_throw_error(zend_ffi_exception_ce, "attempt to write over data boundary");
4189+
zend_throw_error(zend_ffi_exception_ce, "Attempt to write over data boundary");
41904190
RETURN_THROWS();
41914191
}
41924192
}
@@ -4195,7 +4195,7 @@ ZEND_METHOD(FFI, memcpy) /* {{{ */
41954195
if (Z_TYPE_P(zv2) == IS_STRING) {
41964196
ptr2 = Z_STRVAL_P(zv2);
41974197
if (size > Z_STRLEN_P(zv2)) {
4198-
zend_throw_error(zend_ffi_exception_ce, "attempt to read over string boundary");
4198+
zend_throw_error(zend_ffi_exception_ce, "Attempt to read over string boundary");
41994199
RETURN_THROWS();
42004200
}
42014201
} else if (Z_TYPE_P(zv2) == IS_OBJECT && Z_OBJCE_P(zv2) == zend_ffi_cdata_ce) {
@@ -4206,7 +4206,7 @@ ZEND_METHOD(FFI, memcpy) /* {{{ */
42064206
} else {
42074207
ptr2 = cdata2->ptr;
42084208
if (type2->kind != ZEND_FFI_TYPE_POINTER && size > type2->size) {
4209-
zend_throw_error(zend_ffi_exception_ce, "attempt to read over data boundary");
4209+
zend_throw_error(zend_ffi_exception_ce, "Attempt to read over data boundary");
42104210
RETURN_THROWS();
42114211
}
42124212
}
@@ -4263,7 +4263,7 @@ ZEND_METHOD(FFI, memcmp) /* {{{ */
42634263
if (Z_TYPE_P(zv2) == IS_STRING) {
42644264
ptr2 = Z_STRVAL_P(zv2);
42654265
if (size > Z_STRLEN_P(zv2)) {
4266-
zend_throw_error(zend_ffi_exception_ce, "attempt to read over string boundary");
4266+
zend_throw_error(zend_ffi_exception_ce, "Attempt to read over string boundary");
42674267
RETURN_THROWS();
42684268
}
42694269
} else if (Z_TYPE_P(zv2) == IS_OBJECT && Z_OBJCE_P(zv2) == zend_ffi_cdata_ce) {
@@ -4274,7 +4274,7 @@ ZEND_METHOD(FFI, memcmp) /* {{{ */
42744274
} else {
42754275
ptr2 = cdata2->ptr;
42764276
if (type2->kind != ZEND_FFI_TYPE_POINTER && size > type2->size) {
4277-
zend_throw_error(zend_ffi_exception_ce, "attempt to read over data boundary");
4277+
zend_throw_error(zend_ffi_exception_ce, "Attempt to read over data boundary");
42784278
RETURN_THROWS();
42794279
}
42804280
}

ext/filter/logical_filters.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
360360

361361
if (decimal_set) {
362362
if (decimal_len != 1) {
363-
php_error_docref(NULL, E_WARNING, "decimal separator must be one char");
363+
php_error_docref(NULL, E_WARNING, "Decimal separator must be one char");
364364
RETURN_VALIDATION_FAILED
365365
} else {
366366
dec_sep = *decimal;
@@ -371,7 +371,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
371371

372372
if (thousand_set) {
373373
if (thousand_len < 1) {
374-
php_error_docref(NULL, E_WARNING, "thousand separator must be at least one char");
374+
php_error_docref(NULL, E_WARNING, "Thousand separator must be at least one char");
375375
RETURN_VALIDATION_FAILED
376376
} else {
377377
tsd_sep = thousand;

ext/ftp/ftp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ ftp_open(const char *host, short port, zend_long timeout_sec)
139139
size = sizeof(ftp->localaddr);
140140
memset(&ftp->localaddr, 0, size);
141141
if (getsockname(ftp->fd, (struct sockaddr*) &ftp->localaddr, &size) != 0) {
142-
php_error_docref(NULL, E_WARNING, "getsockname failed: %s (%d)", strerror(errno), errno);
142+
php_error_docref(NULL, E_WARNING, "Getsockname failed: %s (%d)", strerror(errno), errno);
143143
goto bail;
144144
}
145145

@@ -272,7 +272,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const size_t user_len, const char *pa
272272

273273
ctx = SSL_CTX_new(SSLv23_client_method());
274274
if (ctx == NULL) {
275-
php_error_docref(NULL, E_WARNING, "failed to create the SSL context");
275+
php_error_docref(NULL, E_WARNING, "Failed to create the SSL context");
276276
return 0;
277277
}
278278

@@ -288,7 +288,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const size_t user_len, const char *pa
288288
SSL_CTX_free(ctx);
289289

290290
if (ftp->ssl_handle == NULL) {
291-
php_error_docref(NULL, E_WARNING, "failed to create the SSL handle");
291+
php_error_docref(NULL, E_WARNING, "Failed to create the SSL handle");
292292
return 0;
293293
}
294294

ext/ftp/php_ftp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ PHP_FUNCTION(ftp_nb_continue)
889889
}
890890

891891
if (!ftp->nb) {
892-
php_error_docref(NULL, E_WARNING, "no nbronous transfer to continue.");
892+
php_error_docref(NULL, E_WARNING, "No nbronous transfer to continue.");
893893
RETURN_LONG(PHP_FTP_FAILED);
894894
}
895895

ext/gd/gd_compat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ int overflow2(int a, int b)
1111
{
1212

1313
if(a <= 0 || b <= 0) {
14-
php_error_docref(NULL, E_WARNING, "one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
14+
php_error_docref(NULL, E_WARNING, "One parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
1515
return 1;
1616
}
1717
if(a > INT_MAX / b) {
18-
php_error_docref(NULL, E_WARNING, "product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
18+
php_error_docref(NULL, E_WARNING, "Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
1919
return 1;
2020
}
2121
return 0;

ext/gettext/gettext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ ZEND_GET_MODULE(php_gettext)
7777

7878
#define PHP_GETTEXT_DOMAIN_LENGTH_CHECK(domain_len) \
7979
if (UNEXPECTED(domain_len > PHP_GETTEXT_MAX_DOMAIN_LENGTH)) { \
80-
php_error_docref(NULL, E_WARNING, "domain passed too long"); \
80+
php_error_docref(NULL, E_WARNING, "Domain passed too long"); \
8181
RETURN_FALSE; \
8282
}
8383

ext/gmp/gmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ ZEND_FUNCTION(gmp_binomial)
12881288
}
12891289

12901290
if (k < 0) {
1291-
php_error_docref(NULL, E_WARNING, "k cannot be negative");
1291+
php_error_docref(NULL, E_WARNING, "K cannot be negative");
12921292
RETURN_FALSE;
12931293
}
12941294

ext/hash/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ PHP_FUNCTION(mhash_keygen_s2k)
10651065

10661066
bytes = (int)l_bytes;
10671067
if (bytes <= 0){
1068-
php_error_docref(NULL, E_WARNING, "the byte parameter must be greater than 0");
1068+
php_error_docref(NULL, E_WARNING, "The byte parameter must be greater than 0");
10691069
RETURN_FALSE;
10701070
}
10711071

0 commit comments

Comments
 (0)