Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ PHP NEWS
(nielsdos)
. Fixed exit code handling of sendmail cmd and added warnings.
(Jesse Hathaway)
. Fixed bug GH-18897 (printf: empty precision is interpreted as precision 6,
not as precision 0). (nielsdos)

- Streams:
. Fixed bug GH-16889 (stream_select() timeout useless for pipes on Windows).
Expand Down
5 changes: 5 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ PHP 8.5 UPGRADE NOTES
. SplFileObject::fwrite's parameter $length is now nullable. The default
value changed from 0 to null.

- Standard:
. Using a printf-family function with a formatter that did not specify the
precision previously incorrectly reset the precision instead of treating
it as a precision of 0. See GH-18897.

========================================
2. New Features
========================================
Expand Down
2 changes: 2 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ PHP 8.5 INTERNALS UPGRADE NOTES
. Added the zend_update_exception_properties() function for instantiating
Exception child classes. It updates the $message, $code, and $previous
properties.
. ZEND_IS_XDIGIT() macro was removed because it was unused and its name
did not match its actual behavior.

========================
2. Build system changes
Expand Down
1 change: 0 additions & 1 deletion Zend/zend_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ static zend_always_inline zend_long zend_dval_to_lval_safe(double d)
}

#define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
#define ZEND_IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))

static zend_always_inline uint8_t is_numeric_string_ex(const char *str, size_t length, zend_long *lval,
double *dval, bool allow_errors, int *oflow_info, bool *trailing_data)
Expand Down
1 change: 1 addition & 0 deletions ext/standard/formatted_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ php_formatted_print(char *format, size_t format_len, zval *args, int argc, int n
expprec = 1;
} else {
precision = 0;
adjusting |= ADJ_PRECISION;
}
} else {
precision = 0;
Expand Down
10 changes: 10 additions & 0 deletions ext/standard/tests/strings/gh18897.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--TEST--
GH-18897 (printf: empty precision is interpreted as precision 6, not as precision 0)
--FILE--
<?php
printf("%.f\n", 3.1415926535);
printf("%.0f\n", 3.1415926535);
?>
--EXPECT--
3
3
11 changes: 6 additions & 5 deletions main/debug_gdb_scripts.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions scripts/gdb/php_gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def children(self):
for field in self.val.type.fields():
if field.name == 'val':
yield ('val', format_zstr(self.val))
elif field.name == 'h':
yield (field.name, "0x%x" % self.val[field.name])
else:
yield (field.name, format_nested(self.val[field.name]))

Expand Down Expand Up @@ -81,12 +83,11 @@ def to_string(self):
def children(self):
for field in self.val.type.fields():
if field.name is None:
name = '<anonymous>'
val = self.val[field]
yield ('<anonymous>', format_nested(self.val[field]))
elif field.name == 'nTableMask':
yield (field.name, "0x%x" % self.val[field.name])
else:
name = field.name
val = self.val[field.name]
yield (name, format_nested(val))
yield (field.name, format_nested(self.val[field.name]))

pp_set.add_printer('zend_array', '^_zend_array$', ZendArrayPrettyPrinter)

Expand Down