Commit Graph

897 Commits

Author SHA1 Message Date
Nikita Popov
7991fc2753 Accept zend_object in zend_read_property 2020-08-07 16:40:27 +02:00
Nikita Popov
d92229d8c7 Implement named parameters
From an engine perspective, named parameters mainly add three
concepts:

 * The SEND_* opcodes now accept a CONST op2, which is the
   argument name. For now, it is looked up by linear scan and
   runtime cached.
 * This may leave UNDEF arguments on the stack. To avoid having
   to deal with them in other places, a CHECK_UNDEF_ARGS opcode
   is used to either replace them with defaults, or error.
 * For variadic functions, EX(extra_named_params) are collected
   and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS.

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

Closes GH-5357.
2020-07-31 15:53:36 +02:00
Benjamin Eberlei
8a6bc6767d Consolidate Parameter Names For ext/dom
Co-authored-by: Thomas Weinert <thomas@weinert.info>
2020-07-27 21:42:33 +02:00
Nikita Popov
d625c29df7 Remove spurious return true from DOMXPath::registerPhpFunctions()
Only one of three identical cases returned true, and the function
is documented to return void. Remove the outlier.
2020-07-17 16:11:30 +02:00
Nikita Popov
d449d1dbbf Use string|array type in DOMXPath::registerPhpFunctions() 2020-07-17 16:10:49 +02:00
Nikita Popov
70501b81a7 Fixed bug #79852 2020-07-14 12:31:06 +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
302933daea Remove no_separation flag 2020-07-07 09:30:24 +02:00
Nikita Popov
632766a561 Disallow separation in a number of callbacks
All of these clearly do not need separation support.
2020-07-07 09:02: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
312201dce4 Add get_gc handle for object iterators
Optional handler with the same semantics as the object handler.
2020-07-01 15:17:22 +02:00
Máté Kocsis
30067894fc
Update outdated arginfo hashes 2020-06-30 16:02:11 +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
ff19ec2df3 Introduce InternalIterator
Userland classes that implement Traversable must do so either
through Iterator or IteratorAggregate. The same requirement does
not exist for internal classes: They can implement the internal
get_iterator mechanism, without exposing either the Iterator or
IteratorAggregate APIs. This makes them usable in get_iterator(),
but incompatible with any Iterator based APIs.

A lot of internal classes do this, because exposing the userland
APIs is simply a lot of work. This patch alleviates this issue by
providing a generic InternalIterator class, which acts as an
adapater between get_iterator and Iterator, and can be easily
used by many internal classes. At the same time, we extend the
requirement that Traversable implies Iterator or IteratorAggregate
to internal classes as well.

Closes GH-5216.
2020-06-24 15:31:41 +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
Nikita Popov
15846ff115 Add ZVAL_OBJ_COPY macro
For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.
2020-06-17 16:36:56 +02:00
George Peter Banyard
706d4f3559 Fix invalid usage of zend_bool in DOM extension 2020-06-06 17:19:00 +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
62b1d2cb69 Fix [-Wundef] warning in DOM extension 2020-05-16 15:31:15 +02:00
Máté Kocsis
3ebce8e9fc
Fix UNKNOWN default values in various extensions
Closes GH-5514
2020-05-05 19:08:20 +02:00
Nikita Popov
bbda71b63d Merge branch 'PHP-7.4'
* PHP-7.4:
  Revert "Fix #79065: DOM classes do not expose properties to Reflection"
2020-04-28 15:10:23 +02:00
Nikita Popov
75470bc312 Revert "Fix #79065: DOM classes do not expose properties to Reflection"
This reverts commit 6bc8f7e5a9.

This causes an assertion failure in PHPUnit.
2020-04-28 15:09:41 +02:00
Christoph M. Becker
ecc6b8cc29 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79065: DOM classes do not expose properties to Reflection
2020-04-27 10:28:00 +02:00
Christoph M. Becker
6bc8f7e5a9 Fix #79065: DOM classes do not expose properties to Reflection
We add a `get_properties` handler which complements the already
existing `has_property` and `read_property`handlers.
2020-04-27 10:04:29 +02:00
Máté Kocsis
6111d64cda
Improve a last couple of argument error messages
Closes GH-5404
2020-04-20 13:09:00 +02:00
Máté Kocsis
dfd0acf0d7
Generate method entries for ext/dom
Closes GH-5374
2020-04-13 00:13:11 +02:00
Máté Kocsis
e088836bbc
Fix nullable types in PHPDoc 2020-04-12 00:25:33 +02:00
Máté Kocsis
3fe49d81f8
Generate method entries from stubs for a couple of extensions
Closes GH-5368
2020-04-11 13:28:53 +02:00
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Christoph M. Becker
d4f9d54f1a Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix memory leak introduced by fixing bug #78221
2020-04-08 10:37:28 +02:00
Christoph M. Becker
c3ee9d1bb7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix memory leak introduced by fixing bug #78221
2020-04-08 10:36:57 +02:00
Christoph M. Becker
7e91fcd7f9 Fix memory leak introduced by fixing bug #78221
We have to free the retrieved text content; to keep the code readable,
we extract a helper function to check for empty nodes.  Unfortunately,
we cannot use xmlIsBlankNode(), because that also recognizes whitespace
only text content.

We also make sure to properly handle NULL returns from
xmlNodeGetContent().
2020-04-08 10:35:54 +02:00
Christoph M. Becker
68139dbdd8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78221: DOMNode::normalize() doesn't remove empty text nodes
2020-04-07 13:09:10 +02:00
Christoph M. Becker
13c9572a79 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78221: DOMNode::normalize() doesn't remove empty text nodes
2020-04-07 13:07:33 +02:00
Christoph M. Becker
efec22b7be Fix #78221: DOMNode::normalize() doesn't remove empty text nodes
If a text node is not followed by another text node, we remove it, if
its textContent is empty.
2020-04-07 13:04:14 +02:00
Máté Kocsis
7c3078737f
Generate function entries from stubs for a couple of extensions
Closes GH-5347
2020-04-04 20:41:48 +02:00
Nikita Popov
2bcc4ab8f4 Verify that all stubs have a return type 2020-04-03 17:59:30 +02:00
Máté Kocsis
305b17e85f
Do not include the same stub multiple times
Closes GH-5322
2020-04-03 14:23:54 +02:00
Máté Kocsis
01b266aac4
Improve error messages of various extensions
Closes GH-5278
2020-03-23 18:59:04 +01:00
Nikita Popov
c5f091e47f Remove DOM_GET_THIS macro
This macro is trivial, it's more obvious to use ZEND_THIS directly.
2020-03-09 09:56:22 +01:00
Benjamin Eberlei
0d913f9acf Fix another memory leak in dom_zvals_to_fragment. 2020-03-06 00:03:13 +01:00
Nikita Popov
a7a2e9857e Fix memory leak in dom_zvals_to_fragment 2020-03-03 10:36:04 +01:00
Benjamin Eberlei
5acd86df8e [RFC] Implement new DOM Living Standard APIs in ext/dom 2020-02-28 16:13:39 +01:00
Christoph M. Becker
4804dc2b20 Rename php_dom_create_interator() to php_dom_create_iterator()
Thus fixing an obvious typo.
2020-02-17 22:49:59 +01:00
Christoph M. Becker
406c5d5956 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79271: DOMDocumentType::$childNodes is NULL
2020-02-17 09:10:39 +01:00
Christoph M. Becker
73a4c50309 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79271: DOMDocumentType::$childNodes is NULL
2020-02-17 09:09:30 +01:00
Christoph M. Becker
0966941130 Fix #79271: DOMDocumentType::$childNodes is NULL
Dom level 2 core, DOM level 3 core and the DOM living standard agree
that `childNodes` always return a `NodeList`, and never `null`.
2020-02-17 09:07:54 +01:00
Christoph M. Becker
95ea8b08b8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix typo in recent bugfix
2020-02-14 09:24:38 +01:00
Christoph M. Becker
8ec76366d0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix typo in recent bugfix
2020-02-14 09:23:43 +01:00
Christoph M. Becker
392dada1d6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix typo in recent bugfix
2020-02-14 09:22:51 +01:00