Commit Graph

115 Commits

Author SHA1 Message Date
Niels Dossche
8d5c3e6781
Introduce %S modifier and use it (#13168) 2024-01-16 22:51:02 +01:00
Cristian Rodríguez
782ffd761b
Use a single version of strnlen (#12015)
* Zend: Make zend_strnlen available for use outside zend_compile

* exif: remove local php_strnlen, use zend_strnlen instead

* main: remove local strnlen, use zend_strnlen instead

* phar: remove local strnlen, use zend_strnlen
2023-08-22 17:40:24 +02:00
Christoph M. Becker
c8955c078a
Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
Max Kellermann
9fdbefacd3 main/s[np]printf: include cleanup 2023-01-10 14:19:03 +00:00
Dmitry Stogov
067df26344 Use memrchr() when available
On x86_64 glibc memrchr() uses SSE/AVX CPU extensions and works much
faster then naive loop. On x86 32-bit we still use inlined version.

memrchr() is a GNU extension. Its prototype  becomes available when
<string.h> is included with defined _GNU_SOURCE macro. Previously, we
defined it in "php_config.h", but some sources may include <string.h>
befire it. To avod mess we also pass -D_GNU_SOURCE to C compiler.
2021-11-24 16:13:34 +03:00
Nikita Popov
e14fbc84ac Remove FORMAT_CONV_MAX_PRECISION
This used to be necessary in the past because the NUM_BUF_SIZE
was set to 512, which is shorter than DOUBLE_MAX_LENGTH. Now the
value is either DOUBLE_MAX_LENGTH or larger (2048).
2021-08-02 15:59:26 +02:00
Nikita Popov
d28f6e694d Move php_gcvt to zend_gcvt
Also move PHP_DOUBLE_MAX_LENGTH to ZEND_DOUBLE_MAX_LENGTH.
2021-08-02 14:51:46 +02:00
George Peter Banyard
02e48d99c9 Use standard 64bit signed int type 2021-07-15 10:40:36 +02:00
George Peter Banyard
97785545cf Use standard 64bit unsigned int type 2021-07-15 10:40:36 +02:00
George Peter Banyard
5e4d727f6a Use standard bool type instead of boolean_e 2021-07-15 10:40:36 +02:00
George Peter Banyard
10f416f5c2 Use standard bool type instead of bool_int 2021-07-15 10:40:36 +02:00
Nikita Popov
0d6358f2cf Drop support for printf p modifier
To be conservative, cause a fatal error if the p modifier is
encountered, in case this is still used by some extension.
2021-06-16 17:59:00 +02:00
Nikita Popov
dd91170ee2 Avoid make_printable_zval() in other printf implementations as well
This is the same as the previous commit, for copies of that code.
2021-06-10 10:19:05 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
George Peter Banyard
f91f72607b Drop unnecessary stdint and inttypes header checks
These are always available as of C99.

Closes GH-5323

Co-authored-by: "Christoph M. Becker" <cmbecker69@gmx.de>
2020-04-22 20:18:19 +02:00
George Peter Banyard
2b5fb76de6 Apply custom format/length modifier removal to spprintf
This mimicks the changes made to the custom snprintf implementation
by removing the custom 'v' format and custom 'I' length modifier
from the spprintf implementation.

Closes GH-5108
2020-01-23 13:45:28 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Peter Kokot
e06836a1a3 Remove checks for locale.h, setlocale, localeconv
The `<loccale.h>` header file, setlocale, and localeconv are part of the
standard C89 [1] and on current systems can be used unconditionally.

Since PHP 7.4 requires at least C89 or greater, the `HAVE_LOCALE_H`,
`HAVE_SETLOCALE`, and `HAVE_LOCALECONV` symbols defined by Autoconf in
configure.ac [2] can be ommitted and simplifed.

The bundled libmagic (file) has also been patched already in version
5.35 and up in upstream location so when it will be patched also in
php-src the check for locale.h header is still left in the configure.ac
and in windows headers definition file.

[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.4
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4

Omit the bundled libmagic files
2019-04-07 18:32:54 +02:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
4a475a4976 Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Nikita Popov
5fc9aa9a95 Make printf_to_smart_str(ing) the primitive printf operation
vs(tr)pprintf is now implemented in Zend on top of
printf_to_smart_str(int), which is provided as a utility function.

This allows us to efficiently printf to the end of a smart string.
2017-01-01 21:28:20 +01:00
Nikita Popov
c7742e280a Export zend_s(tr)pprintf
It's annoying that in Zend you have to use zend_strpprintf instead
of strpprintf, while in PHP you have to use strpprintf instead of
zend_strpprintf.

Make zend_s(tr)pprintf always available and keep s(tr)pprintf as
macro aliases.
2017-01-01 21:28:20 +01:00
Nikita Popov
38f72cea1b Sync smart_string implementation with smart_str
Switch to using inline functions instead of macros, etc.
2017-01-01 21:28:20 +01:00
Nikita Popov
abb91ee9ea Move smart_string to Zend
smart_str is already in Zend.
2017-01-01 21:28:20 +01:00
Jakub Zelenka
3f13507dd2 Use one place to define max length of double
Introduce new constant PHP_DOUBLE_MAX_LENGTH for that purpose
2016-06-26 14:03:01 +01:00
Yasuo Ohgaki
3f23e6bca9 Enable 0 mode for echo/print 2016-06-26 13:26:43 +01:00
Dmitry Stogov
1433162083 Fixed compilation warnings 2016-06-21 20:12:29 +03:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Nikita Popov
75dc4486b2 Make s(tr)pprintf infallible
spprintf now always creates a buffer and strpprintf always returns
a zend_string. Previously, if the result of the format happened to
be empty, the spprintf buffer would be set to NULL and strpprintf
would return NULL.
2015-07-17 16:53:06 +02:00
Dmitry Stogov
7aa7627172 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 13:59:27 +03:00
Stanislav Malyshev
65aba8bd71 Merge branch 'PHP-5.6'
* PHP-5.6:
  add protection against nulls

Conflicts:
	main/spprintf.c
2015-01-20 11:47:46 -08:00
Stanislav Malyshev
a3cb69d63e Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  add protection against nulls
2015-01-20 11:46:39 -08:00
Stanislav Malyshev
ef4896d956 add protection against nulls 2015-01-20 11:46:10 -08:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
73c1be2653 Bump year 2015-01-15 23:26:03 +08:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Anatol Belski
42d7cb4c2c Merge branch 'PHP-5.6'
* PHP-5.6:
  C89 compat
  add include for missing localeconv_r proto
2014-12-06 12:18:36 +01:00
Anatol Belski
373aa7c81f add include for missing localeconv_r proto 2014-12-06 12:09:35 +01:00
Anatol Belski
3d68d843cb Merge branch 'PHP-5.6'
* PHP-5.6:
  updated NEWS
  Fixed bug #65230 setting locale randomly broken
2014-12-06 12:01:09 +01:00
Anatol Belski
1b4d5ad46a Fixed bug #65230 setting locale randomly broken 2014-12-06 11:59:43 +01:00
Anatol Belski
390182d8e6 fix datatype mismatch warning 2014-10-27 17:04:44 +01:00
Nikita Popov
e33f3d3b7c Move smart_str implementation into Zend/
So we can use it there as well...

For now I've retained the zend_smart_str_public.h header, though
it would probably be better to just move that one struct into
zend_types.h.
2014-09-21 20:49:39 +02:00