Commit graph

59 commits

Author SHA1 Message Date
Nikita Popov
162aa1a5fc Deprecate __autoload() 2017-02-03 18:52:57 +01:00
Nikita Popov
5af586bec5 Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +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
Anatol Belski
ab7764d99b Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix test
2016-03-14 15:58:05 +01:00
Anatol Belski
beda05269c fix test
Many warnings won't appear with libxml2 >= 2.9.3 because in many
cases libxml2 2.9.3 will just abort processing.
2016-03-14 15:53:02 +01:00
Stanislav Malyshev
c1355152db More fixing for bug #71540 2016-02-15 01:53:02 -08:00
Stanislav Malyshev
cf0cf5b507 Fix bug #71540 - NULL pointer dereference in xsl_ext_function_php() 2016-02-15 00:09:09 -08:00
Stanislav Malyshev
c11b23c465 Fix bug #71540 - NULL pointer dereference in xsl_ext_function_php() 2016-02-15 00:08:18 -08:00
Xinchen Hui
4febfc25a6 Use die 2015-09-20 09:34:28 -07:00
Xinchen Hui
3fc5f5cdb5 Fixed bug #70535 (XSLT: free(): invalid pointer) 2015-09-20 09:30:50 -07:00
Nikita Popov
3ae995f03c Tweak uncaught exception message display
This implements a reduced variant of #1226 with just the following
change:

-Fatal error: Uncaught exception 'EngineException' with message 'Call to private method foo::bar() from context ''' in %s:%d
+Fatal error: Uncaught EngineException: Call to private method foo::bar() from context '' in %s:%d

The '' wrapper around messages is very weird if the exception
message itself contains ''. Futhermore having the message wrapped
in '' doesn't work for the "and defined" suffix of
TypeExceptions.
2015-05-17 18:47:06 +02:00
Nikita Popov
6ef9216269 Finish PHP 4 constructor deprecation 2015-03-31 17:55:27 +02:00
Nikita Popov
a81e65a501 Remove xsl.security_prefs ini option
Conflicts:
	ext/xsl/php_xsl.c
	ext/xsl/xsltprocessor.c
2015-03-09 11:06:18 +01:00
Rodrigo Prado de Jesus
813830e763 added various tests for XSLTProcessor and one test for iconv extension 2014-09-28 20:29:29 -03:00
Anatol Belski
fca1501ed6 added test for bug #53965 2014-04-01 10:08:08 +02:00
Michael Wallner
6408a1a59e fix bug #49634x 2013-12-02 12:10:00 +01:00
Xinchen Hui
e081c55fb5 Merge branch 'PHP-5.3' into PHP-5.4 2012-10-10 10:31:31 +08:00
Xinchen Hui
610c7fbe7b Remove executable permission on phpt 2012-10-10 10:27:49 +08:00
Christian Stocker
777a29fce2 Added the xsl.security_prefs option to 5_4 and trunk and
mark it as deprecated for BC-reasons
Added tests for ini option and combination of both
2011-10-10 07:59:19 +00:00
Christian Stocker
eb039d5783 Added the xsl.security_prefs option to 5_4 and trunk and
mark it as deprecated for BC-reasons
Added tests for ini option and combination of both
2011-10-10 07:59:19 +00:00
Christian Stocker
192511f75d Added test for Bug 54446
Init a variable to a default value to avoid issues
2011-10-05 18:11:29 +00:00
Christian Stocker
cc2fd64121 Added test for XSL bug 54446 2011-09-12 12:44:49 +00:00
Christian Stocker
2e2eb5e137 Revert r316043, the tests are different on purpose 2011-09-05 08:27:47 +00:00
Shein Alexey
2d52a6934a Synchronized fixed tests from 5.3 branch. 2011-09-02 18:01:20 +00:00
Christian Stocker
bbecdf57d3 fix xsl tests 2011-08-31 09:16:04 +00:00
Christian Stocker
6873ef7055 - Set an empty string and avoid warnings and stopping of the transformation process
when a php function can't be called.
- Fixed tests.
2011-08-31 09:14:08 +00:00
Christian Stocker
4297b67aee fix xsl date tests 2011-08-29 11:44:30 +00:00
Christian Stocker
5250f01d15 fix xsl date tests 2011-08-29 11:44:30 +00:00
Ilia Alshanetsky
62557f1d81 Fixed tests 2009-09-07 14:18:46 +00:00
Matt Wilmas
1fa3b21c15 MFH: Fixed error message grammar:
- "cannot" instead of "can not" (meaning "also can")
 - "than" instead of "then" (Hint: "then" should hardly be needed;
     you're not telling the order in which to do something)

... plus removed a couple ending. dots
2009-06-06 02:40:49 +00:00
Felipe Pena
1504c700be - Fixed tests 2009-06-04 01:15:12 +00:00
Felipe Pena
be7d45b0dc - New xsl files 2009-05-23 14:49:55 +00:00
Felipe Pena
5dfcef7ab4 - New tests (testfest BerlinUG) 2009-05-23 14:45:07 +00:00
Felipe Pena
a8209c5157 - Simplify test (cweiske) 2009-05-10 15:48:39 +00:00
Felipe Pena
680bc45ba5 - MFH: Fixed bug #48221 (memory leak when passing invalid xslt parameter) 2009-05-10 15:13:05 +00:00
Hannes Magnusson
a327a6f737 fix test 2006-09-28 12:01:52 +00:00
Marcus Boerger
e8ea32a789 - Add new test 2005-07-25 20:21:43 +00:00
Antony Dovgal
e63a7d893b change xsl_xsltprocessor_set_parameter() to support parameter->value arrays
add test for it
@Change xsl_xsltprocessor_set_parameter() to support parameter->value arrays (Tony)
2004-08-05 13:31:17 +00:00
Rob Richards
42ade33fa6 MFB: enable exslt support for win32 builds
WS fixes for exslt tests
2004-07-18 13:23:33 +00:00
Ilia Alshanetsky
738aa1099f Added missing skip condition. 2004-04-28 15:14:47 +00:00
Christian Stocker
65bc57a81f - make static methods calls work from within xslt
- extended tests
2004-04-20 09:24:24 +00:00
Rob Richards
fb39035e77 Fix class name 2004-04-07 16:48:11 +00:00
Christian Stocker
ab26ac118d really fix this test... 2004-01-19 17:38:47 +00:00
Christian Stocker
efed27ae1b fix test 2004-01-19 17:35:38 +00:00
Christian Stocker
d4488ccf2d Cosmetics and NEWS entry 2004-01-19 17:27:22 +00:00
Christian Stocker
c0a1f294e9 adjust test 2004-01-19 15:00:59 +00:00
Christian Stocker
c9bd0195a3 -test for more than one argument (this segfaulted before) 2004-01-18 12:30:52 +00:00
Rob Richards
840979858c Update tests 2004-01-10 11:50:49 +00:00
Rob Richards
44f59d6d7f fix warning for shared debug
fix test bug26384 - WS issue
2003-12-07 11:11:47 +00:00
Christian Stocker
e969b7897e fix test to the changes made regarding __toString() 2003-12-03 22:18:49 +00:00