Commit graph

381 commits

Author SHA1 Message Date
Gina Peter Banyard
fd2d869642
Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
Peter Kokot
5b35740098
Sync #if/ifdef/defined for LIBXML_EXPAT_COMPAT (#14435)
This one can be undefined or defined to value 1.
2024-06-02 15:39:42 +02:00
Cristian Rodríguez
8e62e2b829
Mark multple functions as static (#13864)
* Mark many functions as static

Multiple functions are missing the static qualifier.

* remove unused struct sigactions

struct sigaction act, old_term, old_quit, old_int;
all unused.

* optimizer: minXOR and maxXOR are unused
2024-05-22 13:11:46 +02:00
Niels Dossche
234b3cb241
Fix GH-14124: Segmentation fault on unknown address 0x0001ffff8041 with XML extension under certain memory limit (#14126)
The ltags were not initialized, so when an OOM happens before the new value is written, uninitialized data is used.
2024-05-04 13:57:50 +02:00
Niels Dossche
6b73fcc2b3
Convert ext/xml fields from int to bool (#12497) 2023-10-22 22:11:16 +02:00
Niels Dossche
98b08c52db
Implement request #68325: parse huge option for xml_parser_create (#12256) 2023-10-22 16:44:49 +02:00
George Peter Banyard
0e5d654409
ext/xml: Refactor extension to use FCC instead of zvals for handlers (#12340)
To get proper errors and sensible behaviour, as the current behaviour is somewhat insane and part of it should be axed ASAP.

The behaviour is mostly intact with some minor BC breaks which are mentioned in UPGRADING.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2023-10-20 13:14:55 +01:00
Niels Dossche
2bbe4fda75 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix memory leak when calling xml_parse_into_struct() twice
  Fix return type of stub of xml_parse_into_struct()
2023-09-21 19:52:21 +02:00
Niels Dossche
2aea9be3ea Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak when calling xml_parse_into_struct() twice
  Fix return type of stub of xml_parse_into_struct()
2023-09-21 19:51:14 +02:00
Niels Dossche
30f26b587a Fix memory leak when calling xml_parse_into_struct() twice
Closes GH-12254.
2023-09-21 19:49:46 +02:00
Niels Dossche
6d3433e60f Remove always-true condition from xml_utf8_decode()
decoder is already checked above
2023-07-11 11:47:54 +02:00
George Peter Banyard
d5ad75108e
More usage of known zend_str instead of C string (#11381) 2023-06-08 13:03:29 +01:00
George Peter Banyard
81e59c6497
Improve handling of XML options
Mark boolean options as such
Warn on invalid types
Stubs info

Closes GH-10675
2023-02-26 14:34:39 +00:00
George Peter Banyard
524391bcf6
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fixed ValueError message in count_chars()
  Fixed ValueError message in substr_compare()
  The userland constants do not start with PHP_
2023-02-26 14:28:49 +00:00
George Peter Banyard
f440911057
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed ValueError message in count_chars()
  Fixed ValueError message in substr_compare()
  The userland constants do not start with PHP_
2023-02-26 14:28:22 +00:00
George Peter Banyard
6a5b3f0ff9
The userland constants do not start with PHP_ 2023-02-26 14:18:12 +00:00
Máté Kocsis
fc11a8abcb
Declare XML_SAX_IMPL constant in stubs (#9732) 2022-10-12 11:42:24 +02:00
George Peter Banyard
572f180b8d
Merge branch 'PHP-8.2'
* PHP-8.2:
  Use true return type for XML functions which always return true
2022-09-23 13:22:35 +01:00
George Peter Banyard
85d10cc93d
Use true return type for XML functions which always return true
And fix xml_parser_set_option() which didn't return false on failure.

Closes GH-9539
2022-09-23 13:22:13 +01:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
George Peter Banyard
951bd74038 Do early returns in xml.c
This reduces nesting clarying what preconditions are needed in each of the handler functions
2022-09-13 13:56:52 +01:00
George Peter Banyard
6aef13402e Mark _xml_decode_tag() as taking a const XML_Char*
As this is always the case and this removes unnecessary pointer casts
2022-09-13 13:56:52 +01:00
George Peter Banyard
0b8ad94b91 Refactor _xml_add_to_info()
Mark char* as const, and compute it's length once to save an expensive strlen() call
2022-09-13 13:56:52 +01:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
867c514fe5
Declare ext/xml constants in stubs (#9131) 2022-07-25 21:31:24 +02:00
George Peter Banyard
dd62ec065e
Refactor php_next_utf8_char() to use zend_result 2022-03-13 13:48:21 +00:00
Tim Starling
8eee0d6130
Make strtolower() and strtoupper() do ASCII case conversion (#7506)
Implement RFC https://wiki.php.net/rfc/strtolower-ascii
2021-12-15 08:38:35 -05:00
Tim Starling
da0c70508e
Add upper case functions to zend_operators.c and use them (#7521)
Add a family of upper case conversion functions to zend_operators.c,
by analogy with the lower case functions.

Move the single-character conversion macros to the header so that they
can be used as a locale-independent replacement for tolower() and
toupper().

Factor out the ugly bits of the SSE2 case conversion so that the four
functions that use it are easy to read and processor-independent.

Use the new ASCII upper case functions in ext/xml, ext/pdo_dblib and as
an optimization for strtoupper() when the locale is "C".
2021-09-29 09:37:40 +02:00
Christoph M. Becker
cc5ec597b7
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #70962: XML_OPTION_SKIP_WHITE strips embedded whitespace
2021-09-16 12:42:07 +02:00
Christoph M. Becker
f55d78e817
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #70962: XML_OPTION_SKIP_WHITE strips embedded whitespace
2021-09-16 12:06:36 +02:00
Aliaksandr Bystry
a9661a5293
Fix #70962: XML_OPTION_SKIP_WHITE strips embedded whitespace
We must never strip embedded whitespace; we only need to skip values
when that option is set, and make sure that we keep BC regarding the
different behavior for "cdata" and "complete" elements (for the former,
the whole element is skipped; for the latter only the "value" key).

We also fix erroneous `int` types which should actually be `size_t`.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-7493.
2021-09-16 12:00:28 +02:00
Christoph M. Becker
6b1c47a50e
Remove full stop from error message
Error messages shouldn't have a full stop.  Period.

Closes GH-7369.
2021-08-16 23:13:41 +02:00
Christoph M. Becker
6db4b972d0
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix return value of xml_parse(_into_struct) for recursive parsing
2021-08-13 19:01:19 +02:00
Christoph M. Becker
15e5cf856a
Fix return value of xml_parse(_into_struct) for recursive parsing
As of PHP 8.0.0, these functions are supposed to return int, so we
cannot return `false`.  Since calling the parser recursively is a
programmer error, we throw an `Error` in this case.

Cf. <https://github.com/php/php-src/pull/7363>.
2021-08-13 19:00:13 +02:00
Christoph M. Becker
0f1bf4bbd7
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81351: xml_parse may fail, but has no error code
2021-08-13 17:40:32 +02:00
Christoph M. Becker
2c6177a4a8
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81351: xml_parse may fail, but has no error code
2021-08-13 17:37:36 +02:00
Christoph M. Becker
80a377e69b
Fix #81351: xml_parse may fail, but has no error code
The fix for bug #73151[1] cured the symptoms, but not the root cause,
namely xmlParse() must not be called recursively.  Since that bugfix
also messed up the error handling, we basically revert it (but also
simplify the return), and then prevent calling the parser recursively.

[1] <f2a8a8c068>

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-7363.
2021-08-13 17:33:58 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +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
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
George Peter Banyard
a6fc427b8c Use zend_string_equals() API instead of strcmp() in various places
Closes GH-6784
2021-03-17 16:36:23 +00:00
Nikita Popov
ce0bc58c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Mark resource-like objects as non-comparable
2021-02-16 14:22:03 +01:00
Nikita Popov
b63ea1047a Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
2021-02-16 14:20:45 +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
422d1665a2 Make convert_to_*_ex simple aliases of convert_to_*
Historically, the _ex variants separated the zval first, if a
conversion was necessary. This distinction no longer makes sense
since PHP 7.

The only difference that was still left is that _ex checked whether
the type is the same first, but the usage of these macros did not
actually distinguish on whether such an inlined check is valuable
or not in a given context.

Also drop the unused convert_to_explicit_type macros.
2021-01-14 12:11:11 +01:00
George Peter Banyard
a55402d07c Rename XmlParser to XMLParser for consistency with XMLWriter/XMLReader 2020-11-30 14:08:31 +00:00
Máté Kocsis
686d6c3dd4
Fix XmlParser classname in stubs 2020-10-09 10:43:35 +02:00
Máté Kocsis
3e800e997b
Move custom type checks to ZPP
Closes GH-6034
2020-09-02 11:11:38 +02:00