Commit Graph

285 Commits

Author SHA1 Message Date
Nikita Popov
21d9931007 Fix user ini parsing under RC_DEBUG
Suppress checking during the actual parsing, but make sure to
duplicate strings on activate. The parsing result may be shared
across requests, but activation should work on per-request strings.
2021-07-21 09:14:31 +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
Nikita Popov
f0d783b7bf Free expanded filename in php_init_config()
This leak ends up getting suppressed, but is rather annoying when
not using ZEND_TRACKED_ALLOC.
2021-04-09 16:29:03 +02:00
George Peter Banyard
09efad615b
Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool()

Closes GH-6844
2021-04-09 02:34:50 +01:00
Dmitry Stogov
c732ab400a Change Zend Stream API to use zend_string* instead of char*.
This allows to eliminate re-calculation of string lenght and hash value.
See the detailed list of changes in UPGRADING.INTERNALS.
2021-03-16 20:31:36 +03: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
twosee
5998b2a3a6 Fix invalid memory read on libpath
Introduced in 3e33e1e86d.

Closes GH-6362.
2020-10-21 10:07:07 +02:00
Christoph M. Becker
3e33e1e86d Check linker compatibility directly from HMODULE
Checking the linker compatibility with extranous `ImageLoad()` calls is
possible, but unnecessary, since the modules are either already loaded
or loaded shortly afterwards, so that we can get the required
information directly from the module handles.  And actually, doing
`ImageLoad()` as well as `LoadLibrary()` leaves a tiny room for a race
condition, because both functions will lookup the module in the search
path, so there is no *guarantee* that both are dealing with the same
module.  Dropping the `ImageLoad()` calls also has the advantage to no
longer face the issue reported in bug #79557.  A very minor additional
advantage is that we no longer have to link against Imagehlp.dll.

Furthermore, there is no need to check for CRT compatibility multiple
times, so we can simplify the signature of `php_win32_crt_compatible`,
and at the same time clean up main.c a bit.

These changes require to change the signature of the exported
`php_win32_image_compatible` and `php_win32_crt_compatible` functions,
which now expect a `HMODULE` and nothing, respectively, instead of the
module name.
2020-09-21 16:25:31 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
twosee
88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Anatol Belski
9b5d66bd52 Fix signature and calls 2019-08-27 14:34:35 +02:00
Nikita Popov
46faf8f018 Introduce zend_stream_init_fp() API
Reduce the amount of code that mucks around with zend_file_handle
initialization.
2019-07-16 16:44:37 +02:00
Dmitry Stogov
072f28938f Put phpinfo() related code into cold code segment 2019-05-28 11:04:13 +03:00
Anatol Belski
e4a664ecf8 Fix return 2019-03-31 14:31:57 +02:00
Anatol Belski
ddce7ada4c Implement stricter extension compatibility check
This hardens the dynamic module loading by checking the linker compatibility
between the core and the dynamic module. This likely should be extended
for the CRT as well, as 2015, 2017 and 2019 versions of Visual Studio
all have same DLL name for the CRT.
2019-03-31 14:26:00 +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
Dmitry Stogov
cec091176c Replace zend_hash_apply... with ZEND_HASH_FOREACH... 2018-12-19 02:49:56 +03:00
Zeev Suraski
67e0138c0d Future-proof email addresses... 2018-11-01 18:30:28 +02:00
Anatol Belski
321c0cc349 Fix localized error messages and memory leaks
The FormatMessage API needs to LocalFree the delivered error messages.
In cases where messages are delivered in non ASCII compatible encoding,
the messages might be unreadable. This aligns the error message encoding
with the encoding settings in PHP, the focus is UTF-8 as default.

Initialize error buffer

Avoid code duplication
2018-09-17 10:56:50 +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
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
Thomas Petazzoni
2842aa2a07 main/php_ini.c: build empty php_load_zend_extension_cb() when !HAVE_LIBDL
Commit 0782a7fc63 ("Fixed bug #74866
extension_dir = "./ext" now use current directory for base") modified
the php_load_zend_extension_cb() function to use php_load_shlib(), and
pass a handle to the newly introduced zend_load_extension_handle()
function instead of passing the extension path to
zend_load_extension().

While doing so, it introduced a call to php_load_shlib() from code
that is built even when HAVE_LIBDL is not defined. However,
php_load_shlib() is not implemented when HAVE_LIBDL is not defined,
for obvious reasons.

It turns out that zend_load_extension_handle() anyway doesn't do
anything when ZEND_EXTENSIONS_SUPPORT is defined to 0, and
ZEND_EXTENSIONS_SUPPORT is not defined when HAVE_LIBDL is not defined
(Zend/zend_portability.h).

Fixes the following build failure when building on a system that
doesn't have libdl:

main/php_ini.o: In function `php_load_zend_extension_cb':
php_ini.c:(.text+0x478): undefined reference to `php_load_shlib'
php_ini.c:(.text+0x4b0): undefined reference to `php_load_shlib'
collect2: error: ld returned 1 exit status

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-03-23 21:13:45 +01:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Anatol Belski
7ec8b8d49f remove casts and ensure no out of bounds access 2017-07-21 22:26:37 +02:00
Francois Laupretre
0782a7fc63 Fixed bug #74866 extension_dir = "./ext" now use current directory for base 2017-07-13 14:27:19 +02:00
Anatol Belski
9ad0d0ca3c replace the stack var by a macro 2017-07-06 20:47:04 +02:00
Sara Golemon
d09edf7b34 Minor refactor of load extension by name impl
Minimize the #ifdef surface area
Localize orig_libpath to retry scope
Send errors to php_error() rathern than stderr
2017-06-22 13:13:45 -04:00
Francois Laupretre
fe5c8f2b80 Allow loading PHP and Zend extensions by name
Allow extension name as INI 'extension=' and dl() argument
No BC break, as file name is still accepted.
When using the '-z' command line option (CLI/CGI), an absolute file name must still be provided (nothing changed here)
Change comments in example INI files
2017-06-22 12:58:15 -04:00
Xinchen Hui
caf35c5cf5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Add simple cli test for PATH/HOST ini sections
  Fixed bug #74600
2017-06-12 17:21:35 +08:00
Manuel Mausz
ee0e6963f3 Fixed bug #74600
Make sure the hash entry is an array.

The origin fix broke support for HOST/PATH ini sections. Only the
beginning of the string has to match. Revert this check but use
zend_binary_strncasecmp instead of strncasecmp.
2017-06-09 01:43:08 +02:00
Xinchen Hui
c667bb94fa Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74600 (crash (SIGSEGV) in _zend_hash_add_or_update_i)
2017-05-16 19:32:59 +08:00
Xinchen Hui
9f49ebb5ba Fixed bug #74600 (crash (SIGSEGV) in _zend_hash_add_or_update_i) 2017-05-16 19:32:13 +08:00
Xinchen Hui
65d77812fc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed condition check
2017-04-10 14:47:42 +08:00
Xinchen Hui
4bebcb84ad Fixed condition check 2017-04-10 14:47:24 +08:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Lior Kaplan
3d5438bf7b Merge branch 'PHP-7.0'
* PHP-7.0:
  Update header to PHP Version 7
  Happy new year (Update copyright to 2016)
  Happy new year (Update copyright to 2016)
2016-01-01 20:04:31 +02: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
Elan Ruusamäe
694570ab54 Update php_ini.c
trivial typo fix
2015-11-11 00:06:06 +02:00
Richard Quadling
64990642cf Spelling
bugger => buffer
2015-09-30 12:59:16 +08:00
Richard Quadling
f4f4c79cf9 Spelling
bugger => buffer
2015-09-25 12:16:53 +01:00
Xinchen Hui
a8368ddc38 Fixed bug #70431 (Memory leak in php_ini.c) 2015-09-10 19:56:13 +08: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
Anatol Belski
c444c4172f further cleanups with S_IF* macros generalized declarations 2015-05-25 18:03:28 +02:00
Nikita Popov
40e465e357 Clean up some type conversions
While at it also fix some type checks in iconv and drop dead and
unported code in standard/filters.
2015-04-27 18:50:08 +02:00
Dmitry Stogov
2fa8d67a5c Use zend_string* instead of char* for opened_patch handling. Avoid reallocations and improve string reuse. 2015-03-04 02:05:28 +03:00
Dmitry Stogov
1eb4352143 Use new ZEND_HASH_FOREACH_... API. 2015-02-10 15:43:12 +03:00