Commit graph

38 commits

Author SHA1 Message Date
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
d7a3edd45d Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03: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
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
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
3d3f11ede4 Fixed the UTF-8 and long path support in the streams on Windows.
Since long the default PHP charset is UTF-8, however the Windows part is
out of step with this important point. The current implementation in PHP
doesn't technically permit to handle UTF-8 filepath and several other
things. Till now, only the ANSI compatible APIs are being used. Here is more
about it

dd317752%28v=vs.85%29.aspx

The patch fixes not only issues with multibyte filenames under
incompatible codepages, but indirectly also issues with some other multibyte
encodings like BIG5, Shift-JIS, etc. by providing a clean way to access
filenames in UTF-8. Below is a small list of issues from the bug tracker,
that are getting fixed:

https://bugs.php.net/63401
https://bugs.php.net/41199
https://bugs.php.net/50203
https://bugs.php.net/71509
https://bugs.php.net/64699
https://bugs.php.net/64506
https://bugs.php.net/30195
https://bugs.php.net/65358
https://bugs.php.net/61315
https://bugs.php.net/70943
https://bugs.php.net/70903
https://bugs.php.net/63593
https://bugs.php.net/54977
https://bugs.php.net/54028
https://bugs.php.net/43148
https://bugs.php.net/30730
https://bugs.php.net/33350
https://bugs.php.net/35300
https://bugs.php.net/46990
https://bugs.php.net/61309
https://bugs.php.net/69333
https://bugs.php.net/45517
https://bugs.php.net/70551
https://bugs.php.net/50197
https://bugs.php.net/72200
https://bugs.php.net/37672

Yet more related tickets can for sure be found - on bugs.php.net, Stackoverflow
and Github. Some of the bugs are pretty recent, some descend to early
2000th, but  the user comments in there last even till today. Just for example,
bug #30195 was opened in 2004, the latest comment in there was made in 2014. It
is certain, that these bugs descend not only to pure PHP use cases, but get also
redirected from the popular PHP based projects. Given the modern systems (and
those supported by PHP) are always based on NTFS, there is no excuse to keep
these issues unresolved.

The internalization approach on Windows is in many ways different from
UNIX and Linux, while it supports and is based on Unicode. It depends on the
current system code page, APIs used and exact kind how the binary was compiled
The locale doesn't affect the way Unicode or ANSI API work. PHP in particular
is being compiled without _UNICODE defined and this is conditioned by the
way we handle strings. Here is more about it

https://msdn.microsoft.com/en-us/library/tsbaswba.aspx

However, with any system code page ANSI functions automatically convert
paths to UTF-16. Paths in some encodings incompatible with the
current system code page, won't work correctly with ANSI APIs. PHP
till now only uses the ANSI Windows APIs.

For example, on a system with the current code page 1252, the paths
in cp1252 are supported and transparently converted to UTF-16 by the
ANSI functions. Once one wants to handle a filepath encoded with cp932 on
that particular system, an ANSI or a POSIX compatible function used in
PHP will produce an erroneous result. When trying to convert that cp932 path
to UTF-8 and passing to the ANSI functions, an ANSI function would
likely interpret the UTF-8 string as some string in the current code page and
create a filepath that represents every single byte of the UTF-8 string.
These behaviors are not only broken but also disregard the documented
INI settings.

This patch solves the issies with the multibyte paths on Windows by
intelligently enforcing the usage of the Unicode aware APIs. For
functions expect Unicode (fe CreateFileW, FindFirstFileW, etc.), arguments
will be converted to UTF-16 wide chars. For functions returning Unicode
aware data (fe GetCurrentDirectoryW, etc.), resulting wide string is
converted back to char's depending on the current PHP charset settings,
either to the current ANSI codepage (this is the behavior prior to this patch)
or to UTF-8 (the default behavior).

In a particular case, users might have to explicitly set
internal_encoding or default_charset, if filenames in ANSI codepage are
necessary. Current tests show no regressions and witness that this will be an
exotic case, the current default UTF-8 encoding is compatible with any
supported system. The dependency libraries are long switching to Unicode APIs,
so some tests were also added for extensions not directly related to streams.
At large, the patch brings over 150 related tests into the core. Those target
and was run on various environments with European, Asian, etc. codepages.
General PHP frameworks was tested and showed no regressions.

The impact on the current C code base is low, the most places affected
are the Windows only places in the three files tsrm_win32.c, zend_virtual_cwd.c
and plain_wrapper.c. The actual implementation of the most of the wide
char supporting functionality is in win32/ioutil.* and win32/codepage.*,
several  low level functionsare extended in place to avoid reimplementation for
now. No performance impact was sighted. As previously mentioned, the ANSI APIs
used prior the patch perform Unicode conversions internally. Using the
Unicode  APIs directly while doing custom conversions just retains the status
quo. The ways to optimize it are open (fe. by implementing caching for the
strings converted to wide variants).

The long path implementation is user transparent. If a path exceeds the
length of _MAX_PATH, it'll be automatically prefixed with \\?\. The MAXPATHLEN
is set to 2048 bytes.

Appreciation to Pierre Joye, Matt Ficken, @algo13 and others for tips, ideas
and testing.

Thanks.
2016-06-20 12:45:39 +02:00
Xinchen Hui
97956a5d08 Fixed tests 2015-03-30 16:25:41 +08:00
Mauricio Vieira
8afe869cab xmlwriter_full_end_element tests 2014-08-02 22:39:12 -03:00
Mauricio Vieira
51be35cf38 Tests for writeAttributeNS and xmlwriter_write_attribute_ns 2014-08-02 22:39:11 -03:00
Veres Lajos
72085b0e5f typo fixes 2013-07-15 00:18:57 -07:00
Felipe Pena
785791c0e3 - Fix the fix :P 2010-02-15 21:37:46 +00:00
Felipe Pena
c6b34452ef - Fix test (bug #51040) 2010-02-15 21:16:34 +00:00
Zoe Slattery
f018b09af8 fix tests 2009-07-17 09:03:04 +00:00
Pierre Joye
51b6f4a0d5 - MFB: #48202, Out of memory error when passing non-existing filename, enable related tests (marked as XFAIL now) 2009-05-25 16:16:54 +00:00
Felipe Pena
7ff4b251f3 - New tests (testfest DutchUG) 2009-05-16 15:11:21 +00:00
Felipe Pena
f395d9bf3e Fix test 2008-03-05 13:15:03 +00:00
Antony Dovgal
b0ecc20ac7 that endElement() call was required 2007-10-25 13:00:58 +00:00
Antony Dovgal
305e55b794 fix test 2007-10-25 11:54:10 +00:00
Antony Dovgal
8300bed9f9 add missing skipif sections 2007-07-16 13:29:41 +00:00
Antony Dovgal
7b6d4abf1f MFB 2007-06-26 12:14:01 +00:00
Dmitry Stogov
6d93257d0e Fixed tests 2007-06-25 06:46:15 +00:00
Pierre Joye
614bc87eff - [@DOC]#41326, better fix. It restores BC and allows both canonical and short
form:
  - when $content is given, the closing tag will be generated (even for empty
  string)
  - when $content is ignored or NULL is given, the short form will be used
2007-05-14 09:22:44 +00:00
Pierre Joye
bfb6f7001f - #41326, writing empty tags with Xmlwriter::WriteElement[ns] 2007-05-08 21:40:25 +00:00
Rob Richards
bb12eaa1e9 MFB: Fix bug #41287 (Namespace functions don't allow xmlns to be optional)
add test
2007-05-04 20:17:40 +00:00
Rob Richards
05a532c07a parameter entity argument (pe) should be bool
update test
2007-01-06 18:03:15 +00:00
Antony Dovgal
024d8f4376 cosmetic improvements 2006-12-05 23:03:42 +00:00
Rob Richards
2888ebde73 Fixed bug #39504 (xmlwriter_write_dtd_entity() creates Attlist tag,
not enity). (Hannes Magnusson)
add test
2006-11-13 20:47:52 +00:00
Hannes Magnusson
3cd6518f39 Enable xmlwriter_start_dtd_entity(), xmlwriter_end_dtd_entity() & xmlwriter_write_dtd_entity() 2006-11-09 20:02:23 +00:00
Antony Dovgal
051248b021 wrong directory 2006-08-09 18:37:39 +00:00
Pierre Joye
93d4de150e - MFH: fix tests, libxml 2.6.24 and up adds a new line after a processing
instruction (PI)
2006-07-19 18:58:06 +00:00
Antony Dovgal
762842ee30 MF51: fix tests and their skip conditions 2005-12-12 21:21:36 +00:00
Rob Richards
37d1633ff4 allow NULL prefix to create default namespace
fix tests
2005-12-09 20:51:23 +00:00
Rob Richards
944dc57ef5 - enable a few additional functions
- add tests
2005-12-09 04:56:21 +00:00
Rob Richards
d8427c5efa - fix remaining parameter typo
- add test
2005-12-07 04:59:41 +00:00
Rob Richards
c47f0cc73b fix tests 2005-08-06 18:23:40 +00:00
Marcus Boerger
d3c337e59d - Tweak tests a bit 2005-07-03 09:10:41 +00:00
Pierre Joye
58cb6bb07f - initial tests 2005-06-23 11:29:03 +00:00