Commit Graph

111 Commits

Author SHA1 Message Date
Peter Kokot
1c850bfcca Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-14 12:55:24 +02:00
Dmitry Stogov
f2b4ec4bdc Export standard object handlers, to avoid indirect access 2018-05-31 11:57:22 +03:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Anatol Belski
d8200e4885 Simplify namespace access
The icu namespace is an alias which resolves to the real namespace.
2018-04-01 01:03:40 +02:00
Anatol Belski
8d35a42383 Utilize the recommended way to handle the icu namespace 2018-03-31 18:51:56 +02:00
Anatol Belski
0e52da475a Reduce variable scope 2018-02-16 12:52:58 +01:00
Gabriel Caruso
8034fdc9d9 Use int instead of integer in proto 2018-02-02 22:32:15 +01:00
Dmitry Stogov
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Dmitry Stogov
6a9d2b2190 Cleanup type conversion 2017-12-07 19:24:55 +03:00
Nikita Popov
b72b1a4e4d Add zend_object_alloc() API
Using ecalloc() to create objects is expensive, because the
dynamic-size memset() is unreasonably slow. Make sure we only
zero the main object structure with known size, as the properties
are intialized separately anyway.

Technically we do not need to zero the embedded zend_object
structure either, but as long as the memset argument is constant,
a couple more bytes don't really matter.
2017-11-25 17:12:37 +01:00
Xinchen Hui
5c697ccb9d Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #75378 ([REGRESSION] IntlDateFormatter::parse() does not change $position argument)
2017-10-16 19:09:13 +08:00
Xinchen Hui
863acd7753 Fixed bug #75378 ([REGRESSION] IntlDateFormatter::parse() does not change $position argument) 2017-10-16 19:07:34 +08:00
Nikita Popov
fc7cfe1c0e Remove superfluous checks of register_internal_class retval 2017-08-25 22:08:59 +02:00
Sara Golemon
24030d54d8
Release temporary string reference 2017-06-25 19:39:13 -04:00
Sara Golemon
ecaf408d30
Produce a better exception message when IntlDateFormatter constructor fails. 2017-06-25 17:44:59 -04:00
Dmitry Stogov
40ecad3402 Fixed wrong usage of old ZPP API. 2017-06-19 18:08:50 +03:00
Anatol Belski
4a522e3b17 fix error text 2016-07-05 15:58:55 +02:00
Anatol Belski
28ed30df53 fix datatypes and add range checks 2016-07-05 15:54:57 +02:00
Dmitry Stogov
323b2733f6 Fixed compilation warnings 2016-06-22 00:40:50 +03:00
Anatol Belski
da15af8b3f fix include order 2016-06-21 18:58:11 +02:00
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Mic
0112b64a34 Fixed bug #69398 IntlDateFormatter formatObject returns wrong value when time style is NONE 2016-06-02 22:40:27 +02:00
Mic
527ddacd20 Fixed bug #69374 IntlDateFormatter formatObject returns wrong utf8 value
Relying on invariant strings is a mistake. Not only UTF-8, but also
many charsets are not single byte. Actual date formats can be mixed
with arbitrary strings, and this can bring erroneous results in the
out. Thus, instead it is more convenient to say, that a format string
can consist either on UTF-8 or on pure ASCII as its subset. This is
what is currently being done in other classes like Formatter, etc.
as well.
2016-06-02 22:27:48 +02:00
Anatol Belski
f62943edc8 fix version macro to check 2016-04-11 15:01:22 +02:00
Anatol Belski
73815573e0 fix indent 2016-04-08 14:17:57 +02:00
Anatol Belski
45d9efaac3 fix compat for ICU < 50 2016-04-08 12:48:26 +02:00
Anatol Belski
1541a55a4f Fixed bug #68893 Stackoverflow in datefmt_create 2016-04-08 12:31:19 +02:00
Anatol Belski
49d31fa01d Fixed bug #71516 IntlDateFormatter losts locale if pattern is set via constructor 2016-04-08 08:59:43 +02:00
Dmitry Stogov
f7b6de5b5e Cleanup (avoid string reallocations) 2015-07-01 13:26:39 +03:00
Nikita Popov
e74b84a9fe Fix Intl constructor leaks
Drop the Z_OBJ(return_value) = NULL hack and return status code
from ctor function instead.
2015-04-17 10:33:59 +02:00
Nikita Popov
8138756295 Fix leak in IntlDateFormatter::getTimeZone() 2015-04-17 09:28:38 +02:00
Nikita Popov
122d759618 Always throw TypeException on throwing zpp failures
Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to
report FAILURE errors using a TypeException instead of a Warning,
like it would happen in strict mode.

Adds a zend_parse_parameters_throw() convenience function, which
invokes zpp with this flag.

Converts all cases I could identify, where we currently have
throwing zpp usage in constructors and replaces them with this API.
Error handling is still replaced to EH_THROW in some cases to handle
other, domain-specific errors in constructors.
2015-04-06 11:27:34 +02:00
Nikita Popov
cf0ffa8e4c Remove datefmt_set_timezone_id and OO variant 2015-04-01 12:34:28 +02:00
Dmitry Stogov
1018f462d8 Patch improvement:
Removed the corresponding core code.
Fixed ext/com_dotnet and ext/date.
Refactored ext/intl changes.
Improved ext/fileinfo and ext/pdo changes.
Fixed tests.
2015-03-30 18:53:38 +03:00
Danack
910a324306 Fixed indentation. Fixed comment style. Fixed commented out code. 2015-03-16 23:14:56 +00:00
Danack
99dae96dc0 Converted intl extension to use IntlException in constructors. 2015-03-15 13:59:48 +00:00
Dmitry Stogov
bc630ad6da Get rid of old HashTable iteration API (it doesn't work with constant arrays) 2015-02-13 20:18:29 +03:00
Dmitry Stogov
9e70d7672d Move zend_object->guards into additional slot of zend_object->properties_table[]. As result size of objects without __get/__set/__unset/__isset magic methods is reduced. 2015-02-04 15:24:13 +03:00
Dmitry Stogov
8aa146b810 Fixed use after free 2015-01-26 12:24:33 +03:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Stanislav Malyshev
82f3d36583 cleanup intl types 2014-12-29 14:06:12 -08:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Johannes Schlüter
d0cb715373 s/PHP 5/PHP 7/ 2014-09-19 18:33:14 +02:00
Anatol Belski
6db8d4f829 's' works with size_t round 3 2014-08-27 20:49:36 +02:00
Anatol Belski
3234480827 first show to make 's' work with size_t 2014-08-27 20:49:31 +02:00
Anatol Belski
af59e92b24 master renames phase 7 2014-08-25 21:51:49 +02:00
Anatol Belski
c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Anatol Belski
70de6180d5 fixes to %pd format usage 2014-08-24 02:35:34 +02:00
Anatol Belski
063079b62e ported ext/intl, bugfixes to go 2014-08-19 22:57:17 +02:00
Anatol Belski
63d3f0b844 basic macro replacements, all at once 2014-08-19 08:07:31 +02:00