Commit Graph

561 Commits

Author SHA1 Message Date
Christoph M. Becker
0a1ab6ec2f Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix and improve test case
2018-10-30 18:55:16 +01:00
Christoph M. Becker
2816a3fdfa Fix and improve test case
We fix the erroneous doctype declaration, clarify the expectation, and
add a comment to clarify the purpose of the tag mismatch in the XML.
2018-10-30 18:53:03 +01:00
Christoph M. Becker
c37beb7eb5 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #71592: External entity processing never fails
2018-10-27 17:31:29 +02:00
Christoph M. Becker
829b0df77b Fix #71592: External entity processing never fails
If the callback set via `xml_set_external_entity_ref_handler()` returns
a falsy value, parsing is supposed to stop and the error number set to
`XML_ERROR_EXTERNAL_ENTITY_HANDLING`.  This is already correctly done
by the libexpat binding, but the libxml2 binding ignores the return
value.  We fix this by calling `xmlStopParser()` which is available as
of libxml 2.1.0[1] (PHP-7.1 requires at least libxml 2.6.11 anyway),
and setting the desired `errNo` ourselves.

[1] <http://xmlsoft.org/news.html>
2018-10-27 17:30:13 +02:00
Christoph M. Becker
fc0aa264c1 Merge branch 'PHP-7.3'
* PHP-7.3:
  Add support for getting SKIP_TAGSTART and SKIP_WHITE options
2018-10-16 18:51:51 +02:00
Christoph M. Becker
181fc483ed Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Add support for getting SKIP_TAGSTART and SKIP_WHITE options
2018-10-16 18:50:58 +02:00
Christoph M. Becker
310b95d7eb Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Add support for getting SKIP_TAGSTART and SKIP_WHITE options
2018-10-16 18:49:17 +02:00
Christoph M. Becker
b33124239a Add support for getting SKIP_TAGSTART and SKIP_WHITE options
When `XML_OPTION_SKIP_TAGSTART` and `XML_OPTION_SKIP_WHITE` had been
introduced[1], it had been overlooked to also support them for
`xml_parser_get_option()`.  We catch up on that.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=b57dc275950b228f2399990471c4f22b7d154c6c>
2018-10-16 18:47:31 +02:00
Peter Kokot
d679f02295 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:33:09 +02:00
Peter Kokot
b746e69887 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:32:30 +02:00
Peter Kokot
f1d7e3ca0b Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:31:31 +02:00
Peter Kokot
113213f027 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:29:24 +02:00
Peter Kokot
d7a3edd45d Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
Peter Kokot
782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Peter Kokot
17ccbeec32 Trim trailing whitespace in *.phpt 2018-10-14 19:44:14 +02:00
Peter Kokot
7af945e271 Trim trailing whitespace in *.phpt 2018-10-14 19:43:12 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Peter Kokot
7f6387b59a Trim trailing whitespace in source code files 2018-10-13 14:12:55 +02:00
Peter Kokot
3f72c77ce4 Convert CRLF line endings to LF
This patch simplifies line endings tracked in the Git repository and
syncs them to all include the LF style instead of the CRLF files.

Newline characters:
- LF (\n) (*nix and Mac)
- CRLF (\r\n) (Windows)
- CR (\r) (old Mac, obsolete)

To see which line endings are in the index and in the working copy the
following command can be used:
`git ls-files --eol`

Git additionally provides `.gitattributes` file to specify if some files
need to have specific line endings on all platforms (either CRLF or LF).

Changed files shouldn't cause issues on modern Windows platforms because
also Git can do output conversion is core.autocrlf=true is set on
Windows and use CRLF newlines in all files in the working tree.

Unless CRLF files are tracked specifically, Git by default tracks all
files in the index using LF newlines.
2018-10-13 11:21:27 +02:00
Christoph M. Becker
f2856da6e8 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #30875: xml_parse_into_struct() does not resolve entities
2018-10-09 16:09:46 +02:00
Christoph M. Becker
54e152cb92 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #30875: xml_parse_into_struct() does not resolve entities
2018-10-09 16:08:55 +02:00
Christoph M. Becker
ebecf569f9 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #30875: xml_parse_into_struct() does not resolve entities
2018-10-09 16:06:56 +02:00
Christoph M. Becker
2845f859c1 Fix #30875: xml_parse_into_struct() does not resolve entities
Setting up an empty default handler is not only useless, but actually
harmful, since internal entity-references are not resolved anymore.
From the libexpat docs[1]:

| Setting the handler with this call has the side effect of
| turning off expansion of references to internally defined general
| entities. Instead these references are passed to the default
| handler.

[1] <https://www.xml.com/pub/1999/09/expat/reference.html#setdefhandler>
2018-10-09 16:04:43 +02:00
Nikita Popov
74235ca5f3 Bump minimum libxml version to 2.7.6
Released Oct 2009, part of RHEL 6.
2018-09-23 15:51:09 +02:00
Nikita Popov
3e4b977df6 Remove PHP_XML_INTERNAL defines
This macro is no longer used.
2018-09-17 10:13:55 +02:00
Nikita Popov
1d0252a1c0 Remove IS_EXT_MODULE defines
I'm not sure what this was used for, but it doesn't look to be
relevant anymore.
2018-09-16 11:09:51 +02:00
Nikita Popov
ca6caa0cb2 Make ext/xml API private
Also remove dead functions
2018-09-16 11:07:40 +02:00
Christoph M. Becker
ae46e20879 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #76886: Can't build xmlrpc with expat
2018-09-15 13:24:48 +02:00
Thomas Petazzoni
3691b6d245 Fix #76886: Can't build xmlrpc with expat
We fix it by including "php.h" in the HAVE_LIBEXPAT case.
2018-09-15 13:21:53 +02:00
Peter Kokot
cf3b852109 Trim trailing whitespaces in build files
Some editors utilizing .editorconfig automatically trim whitespaces. For
convenience this patch removes whitespaces in certain build files:
- ext/*/config*.m4
- configure.ac
- acinclude.m4
2018-07-29 03:43:45 +02: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
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Nikita Popov
c069adb4ba Merge branch 'PHP-7.2' 2018-03-23 22:04:18 +01:00
Tom Van Looy
7f4327bc24 Fix expat_compat.h path used in #include
Using ext/xml/expat_compat.h does not work if the extension is
compiled out-of-tree.
2018-03-23 22:01:25 +01:00
Gabriel Caruso
ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00
Anatol Belski
b2d38ed9ca Reduce variable scope 2018-02-17 13:02:50 +01:00
Joe
47b90e910b
Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixes bug #75871 Use pkg-config for libxml2 if available
2018-02-08 10:51:47 +01:00
Joe
f9a16d492e
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixes bug #75871 Use pkg-config for libxml2 if available
2018-02-08 10:51:07 +01:00
Pedro Magalhães
5673c641dc
Fixes bug #75871 Use pkg-config for libxml2 if available 2018-02-08 10:50:22 +01:00
Gabriel Caruso
fef879a2d6 Use bool instead of boolean while throwing a type error
PHP requires boolean typehints to be written "bool" and disallows
"boolean" as an alias. This changes the error messages to match
the actual type name and avoids confusing messages like "must be
of type boolean, boolean given".

This a followup to ce1d69a1f6, which
implements the same change for integer->int.
2018-02-04 23:09:40 +01:00
Gabriel Caruso
ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00
Gabriel Caruso
c6c9e71a5b Add missing SKIPIF sections 2018-02-03 13:54:34 +01:00
Gabriel Caruso
2238403892 Trailing whitespaces on ext/*
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-04 02:38:32 -02:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Dmitry Stogov
83e495e0fd Move constants into read-only data segment 2017-12-14 22:14:36 +03:00
Dmitry Stogov
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00