Commit Graph

368 Commits

Author SHA1 Message Date
Máté Kocsis
e328c68305
Rename @cname to @cvalue in stubs (#9043)
@cname currently refers to the constant name in C. However, it is not always a (constant) name, but sometimes a function invocation, so naming it as @cvalue would be more appropriate.
2022-07-19 15:11:42 +02:00
Pierrick Charron
6fd2b39397
Indent with TAB in .h files generated by gen_stub 2022-06-13 08:55:54 -04:00
Máté Kocsis
7601068f3d
Declare ext/libxml constants in stubs (#8721) 2022-06-09 08:18:44 +02:00
Ilija Tovilo
2f5295692f
Optimize stripos/stristr
Closes GH-7847
Closes GH-7852

Previously stripos/stristr would lowercase both the haystack and the
needle to reuse strpos. The approach in this PR is similar to strpos.
memchr is highly optimized so we're using it to search for the first
character of the needle in the haystack. If we find it we compare the
remaining characters of the needle manually.

The new implementation seems to perform about half as well as strpos (as
two memchr calls are necessary to find the next candidate).
2022-01-31 21:44:31 +01:00
Nikita Popov
902d64390e Deprecate implicit dynamic properties
Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/__set().

RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
2021-11-26 14:10:11 +01:00
Stanislav Malyshev
9d74c5b40b
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #79971: special character is breaking the path in xml function
2021-11-14 23:29:37 -08:00
Stanislav Malyshev
0ef1dfc9f6
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79971: special character is breaking the path in xml function
2021-11-14 23:29:27 -08:00
Stanislav Malyshev
ca87d46a3e
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79971: special character is breaking the path in xml function
2021-11-14 23:28:13 -08:00
Christoph M. Becker
f15f8fc573
Fix #79971: special character is breaking the path in xml function
The libxml based XML functions accepting a filename actually accept
URIs with possibly percent-encoded characters.  Percent-encoded NUL
bytes lead to truncation, like non-encoded NUL bytes would.  We catch
those, and let the functions fail with a respective warning.
2021-11-14 23:24:33 -08:00
Máté Kocsis
6a47831e6e
Add more specific array return type hints for various extensions - part 3 (#7467) 2021-09-06 12:27:28 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00
Nikita Popov
7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
Nikita Popov
d818edeae2 Try to fix libxml 2.9.12 tests
The test expectations here were for PHP 8.0, try to adjust them
for PHP 7.4.
2021-06-02 12:21:45 +02:00
Nikita Popov
12a4b2249d Merge branch 'PHP-8.0'
* PHP-8.0:
  Make tests compatible with libxml2 2.9.12
2021-05-26 13:21:43 +02:00
Nikita Popov
0b232cf71d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Make tests compatible with libxml2 2.9.12
2021-05-26 13:20:36 +02:00
Stéphan Kochen
f3d1e9ed06 Make tests compatible with libxml2 2.9.12
This version of libxml introduced quite a few changes. Most of
them are differences in error reporting, while some also change
behavior, e.g. null bytes are no longer supported and xinclude
recursion is limited.

Closes GH-7030. Closes GH-7046.

Co-authored-by: Nikita Popov <nikic@php.net>
2021-05-26 13:19:34 +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
Christoph M. Becker
6adec555db Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
2021-03-24 11:53:53 +01:00
Christoph M. Becker
5832be768c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
2021-03-24 11:52:54 +01:00
Christoph M. Becker
498eb8e052 Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
A string passed to `php_libxml_xmlCheckUTF8()` may be longer than
1<<31-1 bytes, so we're better using a `size_t`.

Closes GH-6802.
2021-03-24 11:50:50 +01:00
Christoph M. Becker
9f826e8ce9 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #51903: simplexml_load_file() doesn't use HTTP headers
2021-03-08 15:16:55 +01:00
Christoph M. Becker
7931956805 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #51903: simplexml_load_file() doesn't use HTTP headers
2021-03-08 15:15:59 +01:00
Christoph M. Becker
f901bec494 Fix #51903: simplexml_load_file() doesn't use HTTP headers
The `encoding` attribute of the XML declaration is optional; it is good
practice to use external encoding information where available if it is
missing.  Thus, we check for `charset` info of `Content-Type` headers,
and see whether the encoding is supported.

We cater to trailing parameters and quoted-strings, but not to escaped
backslashes and quotes in quoted-strings, since no known character
encoding contains these anyway.

Co-authored-by: Michael Wallner <mike@php.net>

Closes GH-6747.
2021-03-08 15:07:01 +01:00
Máté Kocsis
cad66533f0
Generate class entries from stubs for ldap, libxml, mbstring and mysqli
Closes GH-6684
2021-02-16 14:46:19 +01:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Máté Kocsis
45fa7596dc
Add missing classes to stubs 2021-02-09 22:38:06 +01:00
Máté Kocsis
99b08ac281
Implicitly enable function entry generation when class entry generation is enabled
Closes GH-6675
2021-02-09 13:37:24 +01:00
Máté Kocsis
1954e59758
Add support for generating class entries from stubs
Closes GH-6289

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-01-26 11:50:36 +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
Nikita Popov
42a6ff4201 Try to fix windows build 2020-09-03 15:07:03 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Dik Takken
e0fa48f69d Deprecate libxml_disable_entity_loader()
This method was used to protect code against XXE processing attacks.
Since PHP now requires libxml >= 2.9.0 external entity loading no longer
needs to be disabled to prevent these attacks. It is disabled by default.
Also, the method has an unwanted side effect that causes a lot of
confusion: Parsing XML data from resources like files is no longer possible.

Closes GH-5867.
2020-08-03 21:53:29 +02:00
Dik Takken
691a09f291 Bump libxml version requirement 2.7.6 => 2.9.0
Since libxml version 2.9.0 external entity loading is disabled by default.
Bumping the version requirement means that XML processing in PHP is no
longer vulnerable to XXE processing attacks by default.
2020-08-03 21:51:10 +02:00
Christoph M. Becker
24495ba778 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Enable libxml entity loader test case on Windows
2020-08-03 09:15:50 +02:00
Christoph M. Becker
d4b32e82c8 Enable libxml entity loader test case on Windows 2020-08-03 09:13:30 +02:00
Máté Kocsis
d30cd7d7e7
Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02:00
Nikita Popov
22be60bb25 Add declared properties to LibXMLError
Partially addresses bug #79804.
2020-07-08 10:41:46 +02:00
Nikita Popov
302933daea Remove no_separation flag 2020-07-07 09:30:24 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
c9bc7dd110 Don't throw warning if exception thrown during dom validation 2020-06-25 15:24:35 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
Christoph M. Becker
68dd6cc92b Control VCRT leak reporting via environment variable in debug builds
Formerly, this had to be enabled by passing the configuration flag
`--enable-crt-debug`; now it can be enabled by setting the environment
variable `PHP_WIN32_DEBUG_HEAP`.  The advantage is that it is no longer
necessary to do separate builds, at the cost of a very minor
performance penalty during process startup.
2020-06-10 09:05:17 +02:00
Máté Kocsis
fbe30592d6
Improve type error messages when an object is given
From now on, we always display the given object's type instead of just reporting "object".
Additionally, make the format of return type errors match the format of argument errors.

Closes GH-5625
2020-05-26 19:06:19 +02:00
Christoph M. Becker
a582931f42 Revert "Revert "Merge branch 'PHP-7.4'""
This reverts commit 28e650a, which reverted commit 046dcfb, which had
to be reverted due to phpdbg issues.  The culprit was that we did not
properly reset `zend_handler_table` to `NULL`, which is required for
SAPIs which may restart the engine after shutdown.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=28e650abf8097a28789a005e5028fee095359583>
[2] <http://git.php.net/?p=php-src.git;a=commit;h=046dcfb531e242d36a7af2942b9b148290c3c7fe>
2020-05-20 14:11:42 +02:00
Máté Kocsis
1179686f62
Improve error messages for invalid property access
Closes GH-5446
Co-authored-by:  Nikita Popov <nikita.ppv@gmail.com>
2020-05-18 08:27:00 +02:00
George Peter Banyard
35e0a91db7 Fix [-Wundef] warnings in libxml extension 2020-05-16 15:31:23 +02:00
George Peter Banyard
197cac65fd Use ZEND_FCI_INITIALIZED macro
Instead of manually checking that the fci.size is different than 0
2020-05-16 00:36:15 +02:00
Nikita Popov
50a9f511cc Allow null callback to array_filter()
With same behavior as not passing it.
2020-05-13 17:24:13 +02:00
Máté Kocsis
3ebce8e9fc
Fix UNKNOWN default values in various extensions
Closes GH-5514
2020-05-05 19:08:20 +02:00