summaryrefslogtreecommitdiff
path: root/ext/xml/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-08-101-0/+17
|\ | | | | | | | | * PHP-7.3: Fix #79922: Crash after multiple calls to xml_parser_free()
| * Fix #79922: Crash after multiple calls to xml_parser_free()Christoph M. Becker2020-08-101-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We must not call `zend_list_delete()` in resource closer functions exposed to userland, because decreasing the refcount there leads to use-after-free scenarios. In this case, commit 4a42fbb worked for typical use-cases where `xml_parser_free()` has been called exactly once for the resource, because there is an internal zval (`->index`) referencing the same resource which already increased the refcount by one. However, when `xml_parser_free()` is called multiple times on the same XML parser resource, the resource would be freed prematurely. Instead we forcefully close the resource in `xml_parser_free()`. We also could decrease the refcount of the resource there, but that would require to call `xml_parser_free()` which is somewhat uncommon, and would be particularly bad wrt. PHP 8 where that function is a NOP, and as such doesn't have to be called. So we do no longer increase the refcount of the resource when copying it to the internal zval, and let the usualy refcounting semantics take care of the resource destruction. [1] <http://git.php.net/?p=php-src.git;a=commit;h=4a42fbbbc73aad7427aef5c89974d1833636e082>
* | Replace dirname(__FILE__) by __DIR__ in testsFabien Villepinte2019-03-155-5/+5
| |
* | Remove more zpp error testsNikita Popov2019-03-0522-981/+0
| |
* | Added test for xml_parser_set_optionMark Niebergall2019-02-101-0/+25
| | | | | | | | - For skipping white space and triggering invalid encoding value error
* | Remove zpp variation testsNikita Popov2019-02-0525-5929/+0
| |
* | Remove local variablesPeter Kokot2019-02-033-3/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix and improve test caseChristoph M. Becker2018-10-301-3/+5
| | | | | We fix the erroneous doctype declaration, clarify the expectation, and add a comment to clarify the purpose of the tag mismatch in the XML.
* Fix #71592: External entity processing never failsChristoph M. Becker2018-10-271-0/+30
| | | | | | | | | | | | 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>
* Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2018-10-161-0/+29
|\ | | | | | | | | * PHP-7.2: Add support for getting SKIP_TAGSTART and SKIP_WHITE options
| * Merge branch 'PHP-7.1' into PHP-7.2Christoph M. Becker2018-10-161-0/+29
| |\ | | | | | | | | | | | | * PHP-7.1: Add support for getting SKIP_TAGSTART and SKIP_WHITE options
| | * Add support for getting SKIP_TAGSTART and SKIP_WHITE optionsChristoph M. Becker2018-10-161-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-1554-55/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * Trim trailing whitespace in *.phptPeter Kokot2018-10-1468-401/+401
| | |
| | * Convert CRLF line endings to LFPeter Kokot2018-10-131-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-1550-51/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Trim trailing whitespace in *.phptPeter Kokot2018-10-1464-380/+380
| | |
* | | Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-1549-50/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Trim trailing whitespace in *.phptPeter Kokot2018-10-1464-380/+380
| | |
* | | Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2018-10-091-0/+42
|\ \ \ | |/ / | | | | | | | | | * PHP-7.2: Fix #30875: xml_parse_into_struct() does not resolve entities
| * | Merge branch 'PHP-7.1' into PHP-7.2Christoph M. Becker2018-10-091-0/+42
| |\ \ | | |/ | | | | | | | | | * PHP-7.1: Fix #30875: xml_parse_into_struct() does not resolve entities
| | * Fix #30875: xml_parse_into_struct() does not resolve entitiesChristoph M. Becker2018-10-091-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Use EXPECT instead of EXPECTF when possibleGabriel Caruso2018-02-201-1/+1
| | | | | | | | | | | | EXPECTF logic in run-tests.php is considerable, so let's avoid it.
* | | Use bool instead of boolean while throwing a type errorGabriel Caruso2018-02-0420-80/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ce1d69a1f6dcf15d43029301059c25e5bc09a577, which implements the same change for integer->int.
* | | Use int instead of integer in type errorsGabriel Caruso2018-02-0423-111/+111
| | | | | | | | | | | | | | | | | | | | | 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".
* | | Add missing SKIPIF sectionsGabriel Caruso2018-02-031-1/+3
|/ /
* | Deprecate each()Nikita Popov2017-02-035-5/+5
| |
* | news entry for #1787Joe Watkins2016-11-131-0/+24
|\ \ | |/
| * phpt file to bug #73135Edgar R. Sandi2016-11-121-0/+24
| |
* | Move utf8_encode and utf8_decode to ext/standardAndrea Faulds2016-10-177-489/+0
|/
* Merge branch 'PHP-5.6' into PHP-7.0Christoph M. Becker2016-08-201-1/+1
|\
| * Improvements to fix #72714, suggested by nikicChristoph M. Becker2016-08-201-1/+1
| |
* | Merge branch 'PHP-5.6' into PHP-7.0Christoph M. Becker2016-08-201-0/+35
|\ \ | |/
| * Fix #72714: _xml_startElementHandler() segmentation faultChristoph M. Becker2016-08-201-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue is caused by an integer overflow when the `long` passed as XML_OPTION_SKIP_TAGSTART is assigned to `xml_parser::toffset` which is declared as `int`. We can simply work around this issue, by clipping resulting negative values to 0 (and raising a notice in this case), because the reasonable range for this value is certainly catered to by positive `int`s. However, there still remains the issue that `xml_parser::toffset` is later added to `char *`s, which can cause OOB reads, so we make sure that the upper bound never exceeds the strlen(). We eschew optimizing `SKIP_TAGSTART` wrt. to the potentially duplicate strlen() call, because that code path is unexpected anyway.
* | Merge branch 'PHP-5.6' into PHP-7.0Christoph M. Becker2016-08-171-0/+74
|\ \ | |/
| * #72085: SEGV on unknown address zif_xml_parseChristoph M. Becker2016-08-171-0/+74
| | | | | | | | | | We better make sure that the ZVALs we're accessing as arrays are indeed arrays.
* | Merge branch 'PHP-5.6' into PHP-7.0Anatol Belski2016-04-271-0/+17
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * PHP-5.6: Fix memory leak Fix bug #72099: xml_parse_into_struct segmentation fault 5.5.36 now Fix bug #72094 - Out of bounds heap read access in exif header processing Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definition Fix bug #72061 - Out-of-bounds reads in zif_grapheme_stripos with negative offset Fix for bug #71912 (libgd: signedness vulnerability) Typo in NEWS
| * Merge branch 'PHP-5.5' into PHP-5.6Stanislav Malyshev2016-04-261-0/+17
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-5.5: Fix memory leak Fix bug #72099: xml_parse_into_struct segmentation fault 5.5.36 now Fix bug #72094 - Out of bounds heap read access in exif header processing Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definition Fix bug #72061 - Out-of-bounds reads in zif_grapheme_stripos with negative offset Fix for bug #71912 (libgd: signedness vulnerability) Typo in NEWS Conflicts: configure.in main/php_version.h
| | * Fix bug #72099: xml_parse_into_struct segmentation faultStanislav Malyshev2016-04-261-0/+17
| | |
* | | Merge branch 'PHP-5.6'Christoph M. Becker2015-09-091-0/+2
|\ \ \ | |/ / | | | | | | | | | * PHP-5.6: Skip test for old glibc iconv
| * | Skip test for old glibc iconvChristoph M. Becker2015-09-091-0/+2
| |/ | | | | | | | | | | | | bug32001.phpt has a high failure rate for the submitted reports. According to several samples it seems the iconv implementation of glibc 2.12 (released 2010-05) is the culprit. It seems appropriate to skip the test for such old versions.
* | Deprecate PHP 4 constructorsAndrea Faulds2015-03-311-1/+1
| |
* | Use "float" and "integer" in typehint and zpp errorsAndrea Faulds2014-12-2123-131/+131
| |
* | Skip buncha tests on 32-bitAndrea Faulds2014-11-293-2/+3
|/
* this test depends on the simplexml ext, not just on xmlFerenc Kovacs2014-08-241-21/+0
|
* Merge branch 'PHP-5.3' into PHP-5.4Johannes Schlüter2013-07-101-0/+15
|\
| * add test for bug #65236Johannes Schlüter2013-07-101-0/+15
| |
* | Merge branch 'PHP-5.3' into PHP-5.4Xinchen Hui2012-10-103-0/+0
|\ \ | |/
| * Remove executable permission on phptXinchen Hui2012-10-103-0/+0
| |
| * - Fixed bug #49687 (utf8_decode vulnerabilities and deficiencies in the numberGustavo André dos Santos Lopes2010-10-271-0/+24
| | | | | | | | | | | | | | | | of reported malformed sequences). (Gustavo) #Made a public interface for get_next_char/utf-8 in trunk to use in utf8_decode. #In PHP 5.3, trunk's get_next_char was copied to xml.c because 5.3's #get_next_char is different and is not prepared to recover appropriately from #errors.