Commit Graph

966 Commits

Author SHA1 Message Date
Máté Kocsis
267c24e9ee
Update property read handler comments for DOMEntity 2021-08-26 13:15:24 +02:00
Máté Kocsis
25cbd08470
Make a few unuseful DOMEntity properties readonly (#7406) 2021-08-26 10:37:45 +02:00
Máté Kocsis
cdf2f3eb16
DOMCharacterData::$data and DOMAttr::$value are writable 2021-08-25 09:25:22 +02:00
Nikita Popov
ca94d55a19 Mark DOM classes as not serializable 2021-08-10 14:22:26 +02:00
Máté Kocsis
da2cd931e5
Fix another DOMNameSpaceNode casing issue 2021-08-05 09:05:33 +02:00
Javier Eguiluz
7c9ac479eb Fix some mismatches in preprocessor directive comments 2021-08-02 11:18:36 +02:00
Máté Kocsis
23b1c4a982
Migrate to PHP-Parser 4.12.0 and regenerate some arginfos 2021-07-22 09:40:16 +02:00
Nikita Popov
239446c5cf Merge branch 'PHP-8.0'
* PHP-8.0:
  dom_import_simplexml() cannot return null
2021-07-21 11:14:03 +02:00
Nikita Popov
a0893865b3 dom_import_simplexml() cannot return null 2021-07-21 11:13:37 +02:00
Nikita Popov
1602db2d3f Fix return type of DOMNodeList::item()
It can also return DOMNameSpaceNode :(
2021-07-21 09:56:35 +02:00
Máté Kocsis
d9838e5453
Declare tentative return types for ext/dom (#6985) 2021-07-20 09:26:36 +02:00
Nikita Popov
c2a58ab07d Throw DomException for DOM out-of-memory error conditions
A number of error conditions in DOM can only occur if libxml2 runs
out of memory, at least as far as I can see. In such cases we
currently do a silent "return false", which violates the DOM spec,
and which code is very unlikely to handle sensibly.

Switch these to throw a DomException with INVALID_STATE_ERR type.
This error type is chosen because we use for similar checks
elsewhere, for example:
a733b1ada7/ext/dom/documentfragment.c (L45-L48)

This changes some of the more obvious cases I spotted, but there are probably more.

Closes GH-7049.
2021-07-19 14:43:31 +02:00
Nikita Popov
b9893c2a18 Actually add the tentative type marker... 2021-07-16 16:33:47 +02:00
Nikita Popov
cad6144d18 Add minimial tentative types to dom
Just for implementations of Countable. These (no longer) suffer
from an overly broad return type.
2021-07-16 16:32:12 +02:00
Nikita Popov
4cf0269e4e DOMNamedNodeMap::count() cannot return false 2021-07-16 16:27:53 +02:00
Nikita Popov
f089e8afbd DOMNodeList::count() cannot return false
Refactor the implementation to make this obvious, and make use
of early returns.
2021-07-16 16:22:52 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov
0ce2359233 Remove dom_nnodemap dtor_obj handler
Don't see any obvious reason why this would have to happen in a
dtor_obj handler. If there is a reason, we're lacking test
coverage for it.
2021-06-09 12:31:34 +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
Máté Kocsis
7da2151f7a
Declare typed properties in ext/dom
Closes GH-7013
2021-05-26 12:23:43 +02:00
Máté Kocsis
a5e938dc86
Declare dynamic properties in ext/dom
Closes GH-6644
2021-05-18 15:12:35 +02:00
George Peter Banyard
e7135cb817
Use zend_string_equals_* API in a couple of more place
Closes GH-6979
2021-05-14 13:45:17 +01: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
d842bc7e22
Refactor dom_has_feature() to use zend_string* 2021-04-09 18:45:08 +01:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Max Semenik
bd9f4fa676 Migrate skip checks to --EXTENSIONS--, p2
For rationale, see https://github.com/php/php-src/pull/6787

Make extension checks lowercase, add a special case for opcache
that has internal name not matching .so filename.

Extensions migrated in part 2:
* dom
* exif
* fileinfo
* ffi
2021-04-01 12:08:24 +01:00
Christoph M. Becker
e65f705ce3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #66783: UAF when appending DOMDocument to element
2021-03-17 12:40:40 +01:00
Christoph M. Becker
fddd0ac552 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #66783: UAF when appending DOMDocument to element
2021-03-17 12:40:03 +01:00
Christoph M. Becker
a08847ab39 Fix #66783: UAF when appending DOMDocument to element
According to the DOM standard, elements may only contain element, text,
processing instruction and comment nodes[1].  It is also specified that
a HierarchyRequestError should be thrown if a document is to be
inserted[2].  We follow that standard, and prevent the use-after-free
this way.

[1] <https://dom.spec.whatwg.org/#node-trees>
[2] <https://dom.spec.whatwg.org/#mutation-algorithms>

Closes GH-6765.
2021-03-17 12:37:18 +01:00
Máté Kocsis
e0aab7413b
Promote DOM invalid state errors during property access
Closes GH-6780
2021-03-16 20:22:32 +01:00
Máté Kocsis
87b263d2d7
Merge branch 'PHP-8.0' 2021-03-15 23:47:58 +01:00
Máté Kocsis
5ecc078a17
Add missing skipif sections to ext/dom tests 2021-03-15 23:45:37 +01:00
Dmitry Stogov
72c3ededed Change the order of properties used for var_dump(), serialize(), comparison, etc.
Now properties are ordered according to their layout in zend_object structure.
2021-03-01 13:29:49 +03:00
Nikita Popov
4a8b93425d Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix potential file collision in dom tests
  Fix bug #80757 (Exit code is 0 when could not open file)
  Update NEWS
2021-02-24 21:31:03 +01:00
Nikita Popov
44ef32ff2c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix potential file collision in dom tests
2021-02-24 21:30:44 +01:00
Nikita Popov
766f827e26 Fix potential file collision in dom tests 2021-02-24 21:30:20 +01:00
Máté Kocsis
4c6533c257
Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend
Closes GH-6706
2021-02-22 15:24:03 +01:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +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
Nikita Popov
e32d5e8fe7 Merge branch 'PHP-8.0'
* PHP-8.0:
  Make createDocument() $namespace nullable
2021-02-09 12:29:50 +01:00
Nikita Popov
3549f48edc Make createDocument() $namespace nullable
According to the DOM specification, this argument should be
nullable. It's also supposed to be a required argument, but
not changing that at this point.
2021-02-09 12:28:28 +01:00
Nikita Popov
cfb94b22d5 Merge branch 'PHP-8.0'
* PHP-8.0:
  Make getElementsByTagNameNS $namespace nullable
2021-02-09 12:20:56 +01:00
Nikita Popov
ab92ffee22 Make getElementsByTagNameNS $namespace nullable
According to the DOM specification, this argument is supposed to
be nullable.
2021-02-09 12:19:44 +01:00
Máté Kocsis
5f21062054
Generate class entries for a few extensions
Relates to GH-6644
2021-02-03 09:24:09 +01:00
Benjamin Eberlei
c5f4c3dddb [ci-skip] Merge branch 'PHP-8.0' 2021-02-02 20:30:30 +01:00