1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

130 Commits

Author SHA1 Message Date
Niels Dossche 3167d07603 Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
The namespace data is freed and set to NULL, but there remain references
to the namespace declaration nodes. This (rightfully) confuses libxml2
because its invariants are broken. We also have to remove all remaining
references from the subtree. This fixes the data corruption bug.

Closes GH-12681.
2023-11-17 19:47:08 +01:00
Niels Dossche 08c4db7f36 Fix manually calling __construct() on DOM classes
Closes GH-11894.
2023-08-07 19:37:47 +02:00
Niels Dossche abb1d2e824 Fix empty argument cases for DOMParentNode methods
Closes GH-11768.
2023-07-24 18:58:39 +02:00
Niels Dossche 168bc8146f Fix incorrect attribute existence check in DOMElement::setAttributeNodeNS()
Closes GH-11776.
2023-07-24 18:57:16 +02:00
nielsdos c174ebfce0 Revert "Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM"
This reverts commit 7eb3e9cd17.

Although the fix follows the spec, it causes issues because a lot of old
code assumes the incorrect behaviour PHP had since a long time.
We cannot do this yet, especially not in a stable release.
We revert this for the time being.
See GH-11428.
2023-06-19 19:37:46 +02:00
nielsdos 7eb3e9cd17 Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM
The NULL namespace is only correct when there is no default namespace
override. When there is, we need to manually set it to the empty string
namespace.

Closes GH-11428.
2023-06-17 13:36:00 +02:00
Niels Dossche e309fd8461 Fix lifetime issue with getAttributeNodeNS()
It's the same issue that I fixed previously in GH-11402, but in a
different place.

Closes GH-11422.
2023-06-13 17:29:37 +02:00
nielsdos f2d673fb18 Fix #70359 and #78577: segfaults with DOMNameSpaceNode
* Fix type confusion and parent reference
* Manually manage the lifetime of the parent
* Add regression tests
* Break out to a helper, and apply the use-after-free fix to xpath

Closes GH-11402.
2023-06-09 21:35:55 +02:00
Niels Dossche 23f7002527 Fix bug #81642: DOMChildNode::replaceWith() bug when replacing a node with itself
Closes GH-11363.
2023-06-04 16:19:48 +02:00
Christoph M. Becker 9ffa3f9ba3 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
2021-09-13 12:14:32 +02:00
Christoph M. Becker 6fbdf69628 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
2021-09-13 12:13:09 +02:00
Viktor 424c265478 Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
We must only remove the attribute id, if the user requested that.

Closes GH-7482.
2021-09-13 12:11:36 +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
Máté Kocsis e0aab7413b Promote DOM invalid state errors during property access
Closes GH-6780
2021-03-16 20:22:32 +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
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
George Peter Banyard 8fef83dd3c Promote warnings to error in DOM extension
Closes GH-5418
2020-09-22 19:12:32 +01:00
Max Semenik 2b5de6f839 Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
George Peter Banyard 62b1d2cb69 Fix [-Wundef] warning in DOM extension 2020-05-16 15:31:15 +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 305b17e85f Do not include the same stub multiple times
Closes GH-5322
2020-04-03 14:23:54 +02: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
Máté Kocsis 2f7309b1e9 Use RETURN_THROWS() during ZPP in the date, dba and dom extensions 2019-12-31 00:21:37 +01:00
Benjamin Eberlei f905a81979 ext/dom: Replace usages of PHP_FUNCTION and aliases with PHP_METHOD. 2019-11-09 21:29:42 +01:00
Benjamin Eberlei 4253ca486d Convert ext/dom to use arginfo stub. 2019-11-08 15:05:35 +01:00
Christoph M. Becker 4008704f62 zend_parse_parameters_throw() is obsolete
Since `zend_parse_parameters()` throws now, there is no reason to
explicitly call `zend_parse_parameters_throw()` anymore, and since both
have actually the same implementation, we redefine the latter as macro.
2019-11-01 16:47:15 +01:00
Nikita Popov 504f7ffdd6 Small ext/dom cleanups 2019-10-29 11:16:23 +01:00
Gabriel Caruso 5d6e923d46 Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +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 0f7f1498be Use ZEND_THIS macro to hide implementation details in extensions code. 2018-11-15 19:54:19 +03:00
Dmitry Stogov 54a7d03934 Replace zend_parse_method_parameters() by zend_parse_parameters() and avoid useless checks. 2018-11-14 03:32:19 +03:00
Dmitry Stogov c6ad0b92b7 Replace getThis() by EX(This), when additional check is not necessary. 2018-11-14 02:44:25 +03: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
Dusta da82719f20 Update http to https 2018-06-25 08:31:32 +02:00
Gabriel Caruso 701437a948 Remove return types from some magic method in protos
__construct, __destruct, __wakeup does not have return types defined.
2018-03-09 12:04:46 +01:00
Gabriel Caruso affc20f891 Use bool instead of boolean in proto 2018-02-04 17:00:24 +01:00
Xinchen Hui a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Arnout Boks 721a189742 Fix bug #54382 (getAttributeNodeNS doesn't get xmlns* attributes)
The fix is based on the same strategy for handling namespace
declarations as used by getAttributeNode. Note that this strategy makes
these methods not return a DOMAttr for xmlns* attributes, but an
instance of the (undocumented) class DOMNameSpaceNode. This is not
really ideal, but at least this fix makes the behavior of
getAttributeNode and getAttributeNodeNS consistent.

A follow-up action would be to investigate whether DOMNameSpaceNode can
be made into a subclass of DOMAttr (which may be hard due to the way
libxml treats namespace declarations) or document this deviating return
value for xmlns* attributes.
2017-01-25 20:59:25 +00:00
Sammy Kaye Powers 478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06: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
Rasmus Lerdorf 41774bceff Fix more minor mistakes in the proto comments 2015-06-23 15:47:33 -04:00
Nikita Popov 122d759618 Always throw TypeException on throwing zpp failures
Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to
report FAILURE errors using a TypeException instead of a Warning,
like it would happen in strict mode.

Adds a zend_parse_parameters_throw() convenience function, which
invokes zpp with this flag.

Converts all cases I could identify, where we currently have
throwing zpp usage in constructors and replaces them with this API.
Error handling is still replaced to EH_THROW in some cases to handle
other, domain-specific errors in constructors.
2015-04-06 11:27:34 +02:00
Xinchen Hui fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui 0579e8278d bump year 2015-01-15 23:26:37 +08:00
Stanislav Malyshev b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00