mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-14 04:30:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2610d63a48 | ||
|
|
f75d2139cd | ||
|
|
a7f97b6fb7 | ||
|
|
cc65e0cdfb | ||
|
|
e629e4ba20 | ||
|
|
d004c1d5ff | ||
|
|
775d0707ca | ||
|
|
ce9b6e5ee8 | ||
|
|
6a5798d990 | ||
|
|
7d6d8a3369 | ||
|
|
df49ce3d5a | ||
|
|
a1fef89abe | ||
|
|
912e42fc23 | ||
|
|
43c69443bb | ||
|
|
cdd2b8a79f | ||
|
|
c4739897e7 | ||
|
|
4af9ca544e | ||
|
|
3cd3881574 | ||
|
|
5cfb81d5b0 | ||
|
|
b78f8220e7 | ||
|
|
1c7a902d8a | ||
|
|
f505d11207 | ||
|
|
7ccafe40c2 | ||
|
|
768bbedf82 | ||
|
|
9c5c3ff022 | ||
|
|
e645837ba1 | ||
|
|
4cabbf9781 | ||
|
|
4131f6bf39 | ||
|
|
97fcbf041a | ||
|
|
c1e84a3bde | ||
|
|
194e64982e | ||
|
|
ba41b340c2 | ||
|
|
c39e777722 | ||
|
|
df490dcf0c | ||
|
|
b5e5098c50 | ||
|
|
19ad1389aa | ||
|
|
13c32a102c | ||
|
|
23917b451b | ||
|
|
1e18ffd2f8 | ||
|
|
957aa220aa | ||
|
|
ad9aaf8093 | ||
|
|
73a07522ef | ||
|
|
53c49994f2 | ||
|
|
02ff308e27 | ||
|
|
4c711200b4 | ||
|
|
4fd3c8aebb | ||
|
|
b35c02e2df | ||
|
|
bfa7e11c9c | ||
|
|
e48305cdb5 | ||
|
|
59f6d7cd4f | ||
|
|
9db4e25927 | ||
|
|
29c449ce98 | ||
|
|
a508693874 | ||
|
|
ceb992501b | ||
|
|
9d9ba493a2 | ||
|
|
c667c26f61 | ||
|
|
160bf9c072 | ||
|
|
0ec5477fbd | ||
|
|
35baf71466 | ||
|
|
a0accfa59f | ||
|
|
d66cb721d4 | ||
|
|
1302eb7f72 | ||
|
|
3bbfb96e1a | ||
|
|
3c81e945a3 | ||
|
|
984f4b09e0 | ||
|
|
cd93b120c3 | ||
|
|
ffb788800f | ||
|
|
b5b8cd5074 | ||
|
|
983f155e1c | ||
|
|
042fa25896 | ||
|
|
e09febb286 | ||
|
|
db1596c8b1 | ||
|
|
342acbe1c6 | ||
|
|
25e45a9350 | ||
|
|
7e049b0427 | ||
|
|
8e167a2a00 | ||
|
|
60830f49c0 | ||
|
|
4ddb92be45 | ||
|
|
ef5f4ef81f | ||
|
|
b75e30c667 | ||
|
|
272805c898 | ||
|
|
ad5723acf2 | ||
|
|
a07f3ed2a6 | ||
|
|
7abb318beb | ||
|
|
60b3526bfb | ||
|
|
d3d5e3db2c | ||
|
|
8827a56cb4 | ||
|
|
e53947609a | ||
|
|
8947c7aa0d | ||
|
|
0d562a8f44 | ||
|
|
caf4beab2d | ||
|
|
82ec0d5fc5 | ||
|
|
be504995c3 | ||
|
|
9d7b5e30eb | ||
|
|
df33731812 | ||
|
|
cee9722028 | ||
|
|
b9940ab1bd | ||
|
|
81f356b4ae | ||
|
|
601d60a978 | ||
|
|
ed7e6d4758 | ||
|
|
95650d0942 | ||
|
|
e8fb5201ba | ||
|
|
dc024f0bdc | ||
|
|
bc63491da8 | ||
|
|
3803bbde24 | ||
|
|
e1821090ef | ||
|
|
dfffa0ba5b | ||
|
|
5fc635548e | ||
|
|
4b27569dc3 | ||
|
|
d887ef5a04 | ||
|
|
8f384473b4 | ||
|
|
043f8ac51e | ||
|
|
5776fceb16 | ||
|
|
4782ceea80 | ||
|
|
9af582bbe0 | ||
|
|
7b3cce0ba0 | ||
|
|
e21f87e957 | ||
|
|
100614da27 | ||
|
|
e10272c628 | ||
|
|
d3aeb8a204 | ||
|
|
ae46d1ce19 | ||
|
|
d734e75599 | ||
|
|
aa2eca2e48 | ||
|
|
f59b67ae50 | ||
|
|
be34c82bfd | ||
|
|
ff70b40dc9 | ||
|
|
dc0f2a5bad | ||
|
|
c61ceef779 | ||
|
|
ba15e8dfd0 | ||
|
|
45facd15fb | ||
|
|
a643ccfb90 | ||
|
|
9bed19a1e0 | ||
|
|
ed7d4977bb | ||
|
|
9bbd995679 | ||
|
|
d82d68742c | ||
|
|
1defbb25ed | ||
|
|
dd50ec1538 | ||
|
|
0cb9d75cb6 | ||
|
|
12d3bdee3d | ||
|
|
a894a8155f | ||
|
|
4435b9142f | ||
|
|
9faaee66fa | ||
|
|
0ea75af9be | ||
|
|
809610f5ea | ||
|
|
f938112c49 | ||
|
|
920a0afbf8 | ||
|
|
8ebc443120 | ||
|
|
fa0608077b | ||
|
|
429f411eb3 | ||
|
|
1f5f78d4aa | ||
|
|
741c5e4c0c | ||
|
|
174b9ee634 | ||
|
|
f5c8a79fa5 | ||
|
|
923102230b | ||
|
|
ec0b888a82 | ||
|
|
1955403ed5 | ||
|
|
7e9a1c1e3f | ||
|
|
cc70a46525 | ||
|
|
d819b45597 | ||
|
|
160dbe91a9 | ||
|
|
812106d0c6 | ||
|
|
21bb33cc72 | ||
|
|
6a7a03644a | ||
|
|
890195f85c | ||
|
|
9a404df382 | ||
|
|
2a81733c87 | ||
|
|
66b853d426 | ||
|
|
5ae20c6247 | ||
|
|
c167029eb6 | ||
|
|
96f5be53f6 | ||
|
|
bd31cb7563 | ||
|
|
afbf725e73 | ||
|
|
e78552f3aa | ||
|
|
829ea23d34 | ||
|
|
d19842f613 | ||
|
|
cb0d325066 | ||
|
|
af1cd45d17 | ||
|
|
80e2632776 | ||
|
|
c585b4845c | ||
|
|
b1997278fd | ||
|
|
8751e0fe71 | ||
|
|
7eda18514d | ||
|
|
0ae0d0bc53 | ||
|
|
d27d9158c9 | ||
|
|
5c2aa71e0c | ||
|
|
a5bb37117c | ||
|
|
baf5fdf598 | ||
|
|
f29c98c128 | ||
|
|
caecd88237 | ||
|
|
97123042a2 | ||
|
|
3645a80b38 | ||
|
|
9806a37a79 | ||
|
|
9991b8ecee | ||
|
|
e70e2d8310 | ||
|
|
7c1a1189be | ||
|
|
faab430141 | ||
|
|
0a41af216e | ||
|
|
2d9399af35 | ||
|
|
978128b446 | ||
|
|
9ec3e7d98c | ||
|
|
9433b33ac1 | ||
|
|
2533fde199 | ||
|
|
86f983bd3e | ||
|
|
3409d87eab | ||
|
|
2fd74c7f03 | ||
|
|
87cc7caa10 | ||
|
|
59c2a55ec7 | ||
|
|
8de838dc26 | ||
|
|
b56f8022c8 | ||
|
|
30123005ff | ||
|
|
8e3e034469 | ||
|
|
75f40ae1f3 | ||
|
|
fe0ca2745f | ||
|
|
ef2db26c60 | ||
|
|
7e43b4f908 | ||
|
|
aee6344e24 |
No files matched your search
@@ -3,6 +3,11 @@ language: c
|
||||
notifications:
|
||||
email:
|
||||
on_failure: change
|
||||
irc:
|
||||
channels:
|
||||
- "irc.efnet.org#php.pecl"
|
||||
on_success: change
|
||||
on_failure: always
|
||||
|
||||
cache:
|
||||
- apt
|
||||
|
||||
@@ -1,8 +1,53 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? May 2015, PHP 5.6.9
|
||||
14 May 2015, PHP 5.6.9
|
||||
|
||||
02 Apr 2015, PHP 5.6.8
|
||||
- Core:
|
||||
. Fixed bug #69467 (Wrong checked for the interface by using Trait).
|
||||
(Laruence)
|
||||
. Fixed bug #69420 (Invalid read in zend_std_get_method). (Laruence)
|
||||
. Fixed bug #60022 ("use statement [...] has no effect" depends on leading
|
||||
backslash). (Nikita)
|
||||
. Fixed bug #67314 (Segmentation fault in gc_remove_zval_from_buffer).
|
||||
(Dmitry)
|
||||
. Fixed bug #68652 (segmentation fault in destructor). (Dmitry)
|
||||
. Fixed bug #69419 (Returning compatible sub generator produces a warning).
|
||||
(Nikita)
|
||||
. Fixed bug #69472 (php_sys_readlink ignores misc errors from
|
||||
GetFinalPathNameByHandleA). (Jan Starke)
|
||||
. Fixed bug #69364 (PHP Multipart/form-data remote dos Vulnerability). (Stas)
|
||||
. Fixed bug #69403 (str_repeat() sign mismatch based memory corruption).
|
||||
(Stas)
|
||||
. Fixed bug #69418 (CVE-2006-7243 fix regressions in 5.4+). (Stas)
|
||||
. Fixed bug #69522 (heap buffer overflow in unpack()). (Stas)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #69545 (Integer overflow in ftp_genlist() resulting in heap
|
||||
overflow). (Stas)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #69354 (Incorrect use of SQLColAttributes with ODBC 3.0).
|
||||
(Anatol)
|
||||
. Fixed bug #69474 (ODBC: Query with same field name from two tables returns
|
||||
incorrect result). (Anatol)
|
||||
. Fixed bug #69381 (out of memory with sage odbc driver). (Frederic Marchall,
|
||||
Anatol Belski)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #69402 (Reading empty SSL stream hangs until timeout).
|
||||
(Daniel Lowrey)
|
||||
|
||||
- PCNTL:
|
||||
. Fixed bug #68598 (pcntl_exec() should not allow null char). (Stas)
|
||||
|
||||
- PCRE
|
||||
. Upgraded pcrelib to 8.37.
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69453 (Memory Corruption in phar_parse_tarfile when entry
|
||||
filename starts with null). (Stas)
|
||||
|
||||
16 Apr 2015, PHP 5.6.8
|
||||
|
||||
- Core:
|
||||
. Fixed bug #66609 (php crashes with __get() and ++ operator in some cases).
|
||||
@@ -12,19 +57,31 @@ PHP NEWS
|
||||
. Fixed bug #68917 (parse_url fails on some partial urls). (Wei Dai)
|
||||
. Fixed bug #69134 (Per Directory Values overrides PHP_INI_SYSTEM
|
||||
configuration options). (Anatol Belski)
|
||||
. Additional fix for bug #69152 (Type confusion vulnerability in
|
||||
exception::getTraceAsString). (Stas)
|
||||
. Fixed bug #69210 (serialize function return corrupted data when sleep has
|
||||
non-string values). (Juan Basso)
|
||||
. Fixed bug #69212 (Leaking VIA_HANDLER func when exception thrown in
|
||||
__call/... arg passing). (Nikita)
|
||||
. Fixed bug #69221 (Segmentation fault when using a generator in combination
|
||||
with an Iterator). (Nikita)
|
||||
. Fixed bug #69337 (php_stream_url_wrap_http_ex() type-confusion
|
||||
vulnerability). (Stas)
|
||||
. Fixed bug #69353 (Missing null byte checks for paths in various PHP
|
||||
extensions). (Stas)
|
||||
|
||||
- Apache2handler:
|
||||
. Fixed bug #69218 (potential remote code execution with apache 2.4
|
||||
apache2handler). (Gerrit Venema)
|
||||
|
||||
- cURL:
|
||||
. Implemented FR#69278 (HTTP2 support). (Masaki Kagaya)
|
||||
. Fixed bug #68739 (Missing break / control flow). (Laruence)
|
||||
. Fixed bug #69316 (Use-after-free in php_curl related to
|
||||
CURLOPT_FILE/_INFILE/_WRITEHEADER). (Laruence)
|
||||
|
||||
- Date:
|
||||
. Added DateTime::createFromImmutable(). (Trevor Suarez)
|
||||
. Fixed bug #69336 (Issues with "last day of <monthname>"). (Derick Rethans)
|
||||
|
||||
- Enchant:
|
||||
. Fixed bug #65406 (Enchant broker plugins are in the wrong place in windows
|
||||
@@ -33,18 +90,27 @@ PHP NEWS
|
||||
- Ereg:
|
||||
. Fixed bug #68740 (NULL Pointer Dereference). (Laruence)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #68819 (Fileinfo on specific file causes spurious OOM and/or
|
||||
segfault). (Anatol Belski)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #69202: (FILTER_FLAG_STRIP_BACKTICK ignored unless other
|
||||
. Fixed bug #69202 (FILTER_FLAG_STRIP_BACKTICK ignored unless other
|
||||
flags are used). (Jeff Welch)
|
||||
. Fixed bug #69203 (FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127). (Jeff
|
||||
Welch)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #68846 (False detection of CJK Unified Ideographs Extension E).
|
||||
(Masaki Kagaya)
|
||||
|
||||
- OPCache:
|
||||
. Fixed bug #69297 (function_exists strange behavior with OPCache on
|
||||
disabled function). (Laruence)
|
||||
. Fixed bug #69281 (opcache_is_script_cached no longer works). (danack)
|
||||
. Fixed bug #68677 (Use After Free). (CVE-2015-1351) (Laruence)
|
||||
|
||||
- OpenSSL
|
||||
- OpenSSL:
|
||||
. Fixed bugs #68853, #65137 (Buffered crypto stream data breaks IO polling
|
||||
in stream_select() contexts) (Chris Wright)
|
||||
. Fixed bug #69197 (openssl_pkcs7_sign handles default value incorrectly)
|
||||
@@ -60,22 +126,28 @@ PHP NEWS
|
||||
. Fixed bug #65467 (Call to undefined method cli_arg_typ_string). (Mike)
|
||||
. Fixed bug #67761 (Phar::mapPhar fails for Phars inside a path containing
|
||||
".tar"). (Mike)
|
||||
. Fixed bug #69324 (Buffer Over-read in unserialize when parsing Phar). (Stas)
|
||||
. Fixed bug #69441 (Buffer Overflow when parsing tar/zip/phar in
|
||||
phar_set_inode). (Stas)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #68741 (Null pointer dereference). (CVE-2015-1352) (Laruence)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #69152 (Type Confusion Infoleak Vulnerability in unserialize()
|
||||
with SoapFault). (Dmitry)
|
||||
. Fixed bug #69293 (NEW segfault when using SoapClient::__setSoapHeader
|
||||
(bisected, regression)). (Laruence)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #69227 (Use after free in zval_scan caused by
|
||||
spl_object_storage_get_gc). (adam dot scarr at 99designs dot com)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #69293 (NEW segfault when using SoapClient::__setSoapHeader
|
||||
(bisected, regression)). (Laruence)
|
||||
|
||||
- SQLITE:
|
||||
- Sqlite3:
|
||||
. Fixed bug #68760 (SQLITE segfaults if custom collator throws an exception).
|
||||
(Dan Ackroyd)
|
||||
. Fixed bug #69287 (Upgrade bundled libsqlite to 3.8.8.3). (Anatol)
|
||||
. Fixed bug #66550 (SQLite prepared statement use-after-free). (Sean Heelan)
|
||||
|
||||
19 Mar 2015, PHP 5.6.7
|
||||
|
||||
@@ -281,7 +353,7 @@ PHP NEWS
|
||||
interval). (Marc Bennewitz)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #68799: Free called on unitialized pointer. (CVE-2015-0232)
|
||||
. Fixed bug #68799: Free called on uninitialized pointer. (CVE-2015-0232)
|
||||
(Stas)
|
||||
|
||||
- Fileinfo:
|
||||
|
||||
+14
-4
@@ -213,12 +213,14 @@ Getting the stable release announced
|
||||
|
||||
c. ``$PHP_X_MD5`` array and update all the md5 sums
|
||||
|
||||
d. set ``$PHP_X_RC`` to false!
|
||||
d. ``$PHP_X_SHA256`` array and update all the SHA256 sums
|
||||
|
||||
e. Make sure there are no outdated "notes" or edited "date" keys in the
|
||||
e. set ``$PHP_X_RC`` to false!
|
||||
|
||||
f. Make sure there are no outdated "notes" or edited "date" keys in the
|
||||
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
|
||||
|
||||
f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
|
||||
g. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
|
||||
|
||||
3. Create the release file (releases/x_y_z.php)
|
||||
Usually we use the same content as for point 6, but included in php template
|
||||
@@ -267,6 +269,9 @@ to upgrade.
|
||||
9. Wait an hour or two, then send a mail to php-announce@lists.php.net,
|
||||
php-general@lists.php.net and internals@lists.php.net with a text similar to
|
||||
http://news.php.net/php.internals/17222.
|
||||
Please make sure that the mail to php-announce@ is its own completely seperate email.
|
||||
This is to make sure that repiles to the announcement on php-general@ or internals@
|
||||
will not accidentally hit the php-announce@ mailinglist.
|
||||
|
||||
Re-releasing the same version (or -pl)
|
||||
--------------------------------------
|
||||
@@ -283,7 +288,9 @@ Re-releasing the same version (or -pl)
|
||||
|
||||
d. ``$PHP_X_MD5`` array and update all the md5 sums
|
||||
|
||||
e. Make sure there are no outdated "notes" or edited "date" keys in the
|
||||
e. ``$PHP_X_SHA256`` array and update all the SHA256 sums
|
||||
|
||||
f. Make sure there are no outdated "notes" or edited "date" keys in the
|
||||
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
|
||||
|
||||
3. Add a short notice to phpweb stating that there is a new release, and
|
||||
@@ -300,3 +307,6 @@ to upgrade.
|
||||
5. Wait an hour or two, then send a mail to php-announce@lists.php.net,
|
||||
php-general@lists.php.net and internals@lists.php.net with a text similar to
|
||||
the news entry.
|
||||
Please make sure that the mail to php-announce@ is its own completely seperate email.
|
||||
This is to make sure that repiles to the announcement on php-general@ or internals@
|
||||
will not accidentally hit the php-announce@ mailinglist.
|
||||
@@ -271,7 +271,6 @@ PHP 5.6 UPGRADE NOTES
|
||||
|
||||
- Datetime:
|
||||
Added DatePeriod::getStartDate(), DatePeriod::getEndDate(), DatePeriod::getDateInterval() in 5.6.5.
|
||||
Added DateTime::createFromImmutable() in 5.6.8.
|
||||
|
||||
- GMP:
|
||||
Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #43201 (Crash on using unitialized vals and __get/__set)
|
||||
Bug #43201 (Crash on using uninitialized vals and __get/__set)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
--TEST--
|
||||
Bug #63336 (invalid E_NOTICE error occur)
|
||||
--XFAIL--
|
||||
Bug is not fixed yet
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL | E_NOTICE );
|
||||
@@ -18,7 +16,7 @@ class Child extends Base {
|
||||
public function bar($var, $more=self::DUMMY) { return true; }
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Strict Standards: Declaration of Child::foo() should be compatible with Base::foo($var = '123', $more = NULL) in %sbug63336.php on line %d
|
||||
--EXPECTF--
|
||||
Strict Standards: Declaration of Child::foo() should be compatible with Base::foo($var = TEST, $more = NULL) in %sbug63336.php on line %d
|
||||
|
||||
Strict Standards: Declaration of Child::bar() should be compatible with Base::bar($var, $more = 'XXX') in %sbug63336.php on line %d
|
||||
Strict Standards: Declaration of Child::bar() should be compatible with Base::bar($more = self::DUMMY) in %sbug63336.php on line %d
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #67314 (Segmentation fault in gc_remove_zval_from_buffer)
|
||||
--FILE--
|
||||
<?php
|
||||
function crash()
|
||||
{
|
||||
$notDefined[$i] = 'test';
|
||||
}
|
||||
|
||||
function error_handler() { return false; }
|
||||
|
||||
set_error_handler('error_handler');
|
||||
crash();
|
||||
echo "made it once\n";
|
||||
crash();
|
||||
echo "ok\n";
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: i in %sbug67314.php on line 4
|
||||
made it once
|
||||
|
||||
Notice: Undefined variable: i in %sbug67314.php on line 4
|
||||
ok
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #68652 (segmentation fault in destructor)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
|
||||
private static $instance;
|
||||
public static function getInstance() {
|
||||
if (isset(self::$instance)) {
|
||||
return self::$instance;
|
||||
}
|
||||
return self::$instance = new self();
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
Bar::getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
|
||||
private static $instance;
|
||||
public static function getInstance() {
|
||||
if (isset(self::$instance)) {
|
||||
return self::$instance;
|
||||
}
|
||||
return self::$instance = new self();
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
Foo::getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$foo = new Foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Access to undeclared static property: Bar::$instance in %sbug68652.php on line %d
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #69420 (Invalid read in zend_std_get_method)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait T {
|
||||
protected function test() {
|
||||
echo "okey";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class A {
|
||||
protected function test() {
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
use T;
|
||||
public function foo() {
|
||||
$this->test();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$b = new B();
|
||||
$b->foo();
|
||||
?>
|
||||
--EXPECT--
|
||||
okey
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #69467 (Wrong checked for the interface by using Trait)
|
||||
--FILE--
|
||||
<?php
|
||||
interface Baz {
|
||||
public function bad();
|
||||
}
|
||||
|
||||
trait Bar{
|
||||
protected function bad(){}
|
||||
}
|
||||
|
||||
class Foo implements Baz{
|
||||
use Bar;
|
||||
}
|
||||
|
||||
$test = new Foo();
|
||||
var_dump($test instanceof Baz);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Access level to Bar::bad() must be public (as in class Baz) in %sbug69467.php on line %d
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #69419: Returning compatible sub generator produces a warning
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function & genRefInner() {
|
||||
$var = 1;
|
||||
yield $var;
|
||||
}
|
||||
|
||||
function & genRefOuter() {
|
||||
return genRefInner();
|
||||
}
|
||||
|
||||
foreach(genRefOuter() as $i) {
|
||||
var_dump($i);
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Only variable references should be returned by reference in %s on line %d
|
||||
int(1)
|
||||
@@ -3,6 +3,8 @@
|
||||
--FILE--
|
||||
<?php
|
||||
use A;
|
||||
use \B;
|
||||
--EXPECTF--
|
||||
Warning: The use statement with non-compound name 'A' has no effect in %sns_033.php on line 2
|
||||
|
||||
Warning: The use statement with non-compound name 'B' has no effect in %sns_033.php on line 3
|
||||
+11
-11
@@ -984,7 +984,7 @@ static void zend_mm_random(unsigned char *buf, size_t size) /* {{{ */
|
||||
int has_context = 0;
|
||||
|
||||
if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) {
|
||||
/* Could mean that the key container does not exist, let try
|
||||
/* Could mean that the key container does not exist, let try
|
||||
again by asking for a new one */
|
||||
if (GetLastError() == NTE_BAD_KEYSET) {
|
||||
if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
|
||||
@@ -1348,7 +1348,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE
|
||||
}
|
||||
if (!silent) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
|
||||
zend_debug_alloc_output("---------------------------------------\n");
|
||||
zend_debug_alloc_output("%s(%d) : Block "PTR_FMT" status:\n" ZEND_FILE_LINE_RELAY_CC, ptr);
|
||||
@@ -2175,7 +2175,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
#if ZEND_MM_CACHE
|
||||
if (ZEND_MM_SMALL_SIZE(true_size)) {
|
||||
size_t index = ZEND_MM_BUCKET_INDEX(true_size);
|
||||
|
||||
|
||||
if (heap->cache[index] != NULL) {
|
||||
zend_mm_free_block *best_fit;
|
||||
zend_mm_free_block **cache;
|
||||
@@ -2188,7 +2188,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
heap->cache[index] = best_fit->prev_free_block;
|
||||
ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
|
||||
ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
|
||||
|
||||
|
||||
ptr = ZEND_MM_DATA_OF(best_fit);
|
||||
|
||||
#if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
|
||||
@@ -2470,7 +2470,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
|
||||
: "%0"(res),
|
||||
"rm"(size),
|
||||
"rm"(offset));
|
||||
|
||||
|
||||
if (UNEXPECTED(overflow)) {
|
||||
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
|
||||
return 0;
|
||||
@@ -2619,7 +2619,7 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
|
||||
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
int length;
|
||||
size_t length;
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
@@ -2627,13 +2627,13 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
length = strlen(s)+1;
|
||||
p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
length = strlen(s);
|
||||
p = (char *) _emalloc(safe_address(length, 1, 1) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
memcpy(p, s, length);
|
||||
memcpy(p, s, length+1);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
@@ -2647,7 +2647,7 @@ ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
p = (char *) _emalloc(safe_address(length, 1, 1) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
@@ -2668,7 +2668,7 @@ ZEND_API char *zend_strndup(const char *s, uint length)
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
p = (char *) malloc(length+1);
|
||||
p = (char *) malloc(safe_address(length, 1, 1));
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
|
||||
+11
-9
@@ -4051,7 +4051,8 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const
|
||||
}
|
||||
zend_hash_quick_update(*overriden, arKey, nKeyLength, h, fn, sizeof(zend_function), (void**)&fn);
|
||||
return;
|
||||
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT &&
|
||||
(existing_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0) {
|
||||
/* Make sure the trait method is compatible with previosly declared abstract method */
|
||||
if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
|
||||
@@ -4081,6 +4082,7 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const
|
||||
/* inherited members are overridden by members inserted by traits */
|
||||
/* check whether the trait method fulfills the inheritance requirements */
|
||||
do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
|
||||
fn->common.prototype = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7141,7 +7143,7 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
|
||||
void zend_do_use(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char *lcname;
|
||||
zval *name, *ns, tmp;
|
||||
@@ -7168,7 +7170,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
|
||||
ZVAL_STRING(name, p+1, 1);
|
||||
} else {
|
||||
ZVAL_ZVAL(name, ns, 1, 0);
|
||||
warn = !is_global && !CG(current_namespace);
|
||||
warn = !CG(current_namespace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7224,7 +7226,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */
|
||||
void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char *lookup_name;
|
||||
zval *name, *ns, tmp;
|
||||
@@ -7245,7 +7247,7 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i
|
||||
ZVAL_STRING(name, p+1, 1);
|
||||
} else {
|
||||
ZVAL_ZVAL(name, ns, 1, 0);
|
||||
warn = !is_global && !CG(current_namespace);
|
||||
warn = !CG(current_namespace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7309,25 +7311,25 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_use_function(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
|
||||
void zend_do_use_function(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (!CG(current_import_function)) {
|
||||
CG(current_import_function) = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(CG(current_import_function), 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
}
|
||||
|
||||
zend_do_use_non_class(ns_name, new_name, is_global, 1, 0, CG(current_import_function), CG(function_table) TSRMLS_CC);
|
||||
zend_do_use_non_class(ns_name, new_name, 1, 0, CG(current_import_function), CG(function_table) TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_do_use_const(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
|
||||
void zend_do_use_const(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (!CG(current_import_const)) {
|
||||
CG(current_import_const) = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(CG(current_import_const), 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
}
|
||||
|
||||
zend_do_use_non_class(ns_name, new_name, is_global, 0, 1, CG(current_import_const), &CG(const_filenames) TSRMLS_CC);
|
||||
zend_do_use_non_class(ns_name, new_name, 0, 1, CG(current_import_const), &CG(const_filenames) TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+4
-4
@@ -651,10 +651,10 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
|
||||
void zend_do_begin_namespace(const znode *name, zend_bool with_brackets TSRMLS_DC);
|
||||
void zend_do_end_namespace(TSRMLS_D);
|
||||
void zend_verify_namespace(TSRMLS_D);
|
||||
void zend_do_use(znode *name, znode *new_name, int is_global TSRMLS_DC);
|
||||
void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC);
|
||||
void zend_do_use_function(znode *name, znode *new_name, int is_global TSRMLS_DC);
|
||||
void zend_do_use_const(znode *name, znode *new_name, int is_global TSRMLS_DC);
|
||||
void zend_do_use(znode *name, znode *new_name TSRMLS_DC);
|
||||
void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC);
|
||||
void zend_do_use_function(znode *name, znode *new_name TSRMLS_DC);
|
||||
void zend_do_use_const(znode *name, znode *new_name TSRMLS_DC);
|
||||
void zend_do_end_compilation(TSRMLS_D);
|
||||
void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC);
|
||||
|
||||
|
||||
@@ -587,10 +587,14 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(trace) != IS_ARRAY) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
res = estrdup("");
|
||||
str = &res;
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num);
|
||||
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
|
||||
|
||||
@@ -1585,6 +1585,10 @@ ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
|
||||
ex->symbol_table = EG(active_symbol_table);
|
||||
for (i = 0; i < ex->op_array->last_var; i++) {
|
||||
if (*EX_CV_NUM(ex, i)) {
|
||||
if (UNEXPECTED(**EX_CV_NUM(ex, i) == &EG(uninitialized_zval))) {
|
||||
Z_DELREF(EG(uninitialized_zval));
|
||||
ALLOC_INIT_ZVAL(**EX_CV_NUM(ex, i));
|
||||
}
|
||||
zend_hash_quick_update(EG(active_symbol_table),
|
||||
ex->op_array->vars[i].name,
|
||||
ex->op_array->vars[i].name_len + 1,
|
||||
|
||||
+2
-7
@@ -147,8 +147,6 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
|
||||
GC_BENCH_INC(zval_possible_root);
|
||||
|
||||
if (GC_ZVAL_GET_COLOR(zv) != GC_PURPLE) {
|
||||
GC_ZVAL_SET_PURPLE(zv);
|
||||
|
||||
if (!GC_ZVAL_ADDRESS(zv)) {
|
||||
gc_root_buffer *newRoot = GC_G(unused);
|
||||
|
||||
@@ -159,7 +157,6 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
|
||||
GC_G(first_unused)++;
|
||||
} else {
|
||||
if (!GC_G(gc_enabled)) {
|
||||
GC_ZVAL_SET_BLACK(zv);
|
||||
return;
|
||||
}
|
||||
zv->refcount__gc++;
|
||||
@@ -169,10 +166,10 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
|
||||
if (!newRoot) {
|
||||
return;
|
||||
}
|
||||
GC_ZVAL_SET_PURPLE(zv);
|
||||
GC_G(unused) = newRoot->prev;
|
||||
}
|
||||
|
||||
GC_ZVAL_SET_PURPLE(zv);
|
||||
newRoot->next = GC_G(roots).next;
|
||||
newRoot->prev = &GC_G(roots);
|
||||
GC_G(roots).next->prev = newRoot;
|
||||
@@ -203,7 +200,6 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC)
|
||||
|
||||
obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zv)].bucket.obj;
|
||||
if (GC_GET_COLOR(obj->buffered) != GC_PURPLE) {
|
||||
GC_SET_PURPLE(obj->buffered);
|
||||
if (!GC_ADDRESS(obj->buffered)) {
|
||||
gc_root_buffer *newRoot = GC_G(unused);
|
||||
|
||||
@@ -214,7 +210,6 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC)
|
||||
GC_G(first_unused)++;
|
||||
} else {
|
||||
if (!GC_G(gc_enabled)) {
|
||||
GC_ZVAL_SET_BLACK(zv);
|
||||
return;
|
||||
}
|
||||
zv->refcount__gc++;
|
||||
@@ -225,10 +220,10 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC)
|
||||
return;
|
||||
}
|
||||
obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zv)].bucket.obj;
|
||||
GC_SET_PURPLE(obj->buffered);
|
||||
GC_G(unused) = newRoot->prev;
|
||||
}
|
||||
|
||||
GC_SET_PURPLE(obj->buffered);
|
||||
newRoot->next = GC_G(roots).next;
|
||||
newRoot->prev = &GC_G(roots);
|
||||
GC_G(roots).next->prev = newRoot;
|
||||
|
||||
+12
-12
@@ -255,10 +255,10 @@ use_declarations:
|
||||
;
|
||||
|
||||
use_declaration:
|
||||
namespace_name { zend_do_use(&$1, NULL, 0 TSRMLS_CC); }
|
||||
| namespace_name T_AS T_STRING { zend_do_use(&$1, &$3, 0 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL, 1 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4, 1 TSRMLS_CC); }
|
||||
namespace_name { zend_do_use(&$1, NULL TSRMLS_CC); }
|
||||
| namespace_name T_AS T_STRING { zend_do_use(&$1, &$3 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
use_function_declarations:
|
||||
@@ -267,10 +267,10 @@ use_function_declarations:
|
||||
;
|
||||
|
||||
use_function_declaration:
|
||||
namespace_name { zend_do_use_function(&$1, NULL, 0 TSRMLS_CC); }
|
||||
| namespace_name T_AS T_STRING { zend_do_use_function(&$1, &$3, 0 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zend_do_use_function(&$2, NULL, 1 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_function(&$2, &$4, 1 TSRMLS_CC); }
|
||||
namespace_name { zend_do_use_function(&$1, NULL TSRMLS_CC); }
|
||||
| namespace_name T_AS T_STRING { zend_do_use_function(&$1, &$3 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zend_do_use_function(&$2, NULL TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_function(&$2, &$4 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
use_const_declarations:
|
||||
@@ -279,10 +279,10 @@ use_const_declarations:
|
||||
;
|
||||
|
||||
use_const_declaration:
|
||||
namespace_name { zend_do_use_const(&$1, NULL, 0 TSRMLS_CC); }
|
||||
| namespace_name T_AS T_STRING { zend_do_use_const(&$1, &$3, 0 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zend_do_use_const(&$2, NULL, 1 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_const(&$2, &$4, 1 TSRMLS_CC); }
|
||||
namespace_name { zend_do_use_const(&$1, NULL TSRMLS_CC); }
|
||||
| namespace_name T_AS T_STRING { zend_do_use_const(&$1, &$3 TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name { zend_do_use_const(&$2, NULL TSRMLS_CC); }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_const(&$2, &$4 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
constant_declaration:
|
||||
|
||||
+7
-7
@@ -162,16 +162,16 @@ static inline void cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
|
||||
zend_hash_apply(&ce->function_table, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
}
|
||||
if (ce->static_members_table) {
|
||||
zval **static_members = ce->static_members_table;
|
||||
int count = ce->default_static_members_count;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ce->default_static_members_count; i++) {
|
||||
if (ce->static_members_table[i]) {
|
||||
zval *p = ce->static_members_table[i];
|
||||
ce->static_members_table[i] = NULL;
|
||||
zval_ptr_dtor(&p);
|
||||
}
|
||||
ce->default_static_members_count = 0;
|
||||
ce->default_static_members_table = ce->static_members_table = NULL;
|
||||
for (i = 0; i < count; i++) {
|
||||
zval_ptr_dtor(&static_members[i]);
|
||||
}
|
||||
ce->static_members_table = NULL;
|
||||
efree(static_members);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1456,14 +1456,19 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{
|
||||
zend_error(E_ERROR, "String size overflow");
|
||||
}
|
||||
|
||||
Z_STRVAL_P(result) = erealloc(Z_STRVAL_P(result), res_len+1);
|
||||
Z_STRVAL_P(result) = safe_erealloc(Z_STRVAL_P(result), res_len, 1, 1);
|
||||
|
||||
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(result), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
Z_STRVAL_P(result)[res_len]=0;
|
||||
Z_STRLEN_P(result) = res_len;
|
||||
} else {
|
||||
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
char *buf = (char *) emalloc(length + 1);
|
||||
char *buf;
|
||||
|
||||
if (Z_STRLEN_P(op1) < 0 || Z_STRLEN_P(op2) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) {
|
||||
zend_error(E_ERROR, "String size overflow");
|
||||
}
|
||||
buf = (char *) safe_emalloc(length, 1, 1);
|
||||
|
||||
memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
|
||||
memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
|
||||
@@ -261,7 +261,7 @@ CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){
|
||||
}
|
||||
|
||||
dwRet = pGetFinalPathNameByHandle(hFile, target, MAXPATHLEN, VOLUME_NAME_DOS);
|
||||
if(dwRet >= MAXPATHLEN) {
|
||||
if(dwRet >= MAXPATHLEN || dwRet == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1995,13 +1995,12 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
EX_T(opline->result.var).var.ptr = NULL;
|
||||
}
|
||||
} else if (fbc->type == ZEND_USER_FUNCTION) {
|
||||
temp_variable *ret = &EX_T(opline->result.var);
|
||||
EX(original_return_value) = EG(return_value_ptr_ptr);
|
||||
EG(active_symbol_table) = NULL;
|
||||
EG(active_op_array) = &fbc->op_array;
|
||||
EG(return_value_ptr_ptr) = NULL;
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
temp_variable *ret = &EX_T(opline->result.var);
|
||||
|
||||
ret->var.ptr = NULL;
|
||||
EG(return_value_ptr_ptr) = &ret->var.ptr;
|
||||
ret->var.ptr_ptr = &ret->var.ptr;
|
||||
@@ -2010,7 +2009,8 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
|
||||
if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
|
||||
ret->var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
|
||||
ret->var.fcall_returned_reference = 0;
|
||||
}
|
||||
} else if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
|
||||
@@ -567,13 +567,12 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
|
||||
EX_T(opline->result.var).var.ptr = NULL;
|
||||
}
|
||||
} else if (fbc->type == ZEND_USER_FUNCTION) {
|
||||
temp_variable *ret = &EX_T(opline->result.var);
|
||||
EX(original_return_value) = EG(return_value_ptr_ptr);
|
||||
EG(active_symbol_table) = NULL;
|
||||
EG(active_op_array) = &fbc->op_array;
|
||||
EG(return_value_ptr_ptr) = NULL;
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
temp_variable *ret = &EX_T(opline->result.var);
|
||||
|
||||
ret->var.ptr = NULL;
|
||||
EG(return_value_ptr_ptr) = &ret->var.ptr;
|
||||
ret->var.ptr_ptr = &ret->var.ptr;
|
||||
@@ -582,7 +581,8 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
|
||||
|
||||
if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
|
||||
ret->var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
|
||||
ret->var.fcall_returned_reference = 0;
|
||||
}
|
||||
} else if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -1346,6 +1346,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION");
|
||||
length = -1;
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
@@ -1411,6 +1412,7 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION");
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
@@ -1489,6 +1491,7 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
@@ -1566,6 +1569,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
length = CURL_READFUNC_ABORT;
|
||||
#endif
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) == IS_STRING) {
|
||||
length = MIN((int) (size * nmemb), Z_STRLEN_P(retval_ptr));
|
||||
memcpy(data, Z_STRVAL_P(retval_ptr), length);
|
||||
@@ -1640,6 +1644,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION");
|
||||
length = -1;
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
Bug #69316: Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEADER
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function hdr_callback($ch, $data) {
|
||||
// close the stream, causing the FILE structure to be free()'d
|
||||
if($GLOBALS['f_file']) {
|
||||
fclose($GLOBALS['f_file']); $GLOBALS['f_file'] = 0;
|
||||
|
||||
// cause an allocation of approx the same size as a FILE structure, size varies a bit depending on platform/libc
|
||||
$FILE_size = (PHP_INT_SIZE == 4 ? 0x160 : 0x238);
|
||||
curl_setopt($ch, CURLOPT_COOKIE, str_repeat("a", $FILE_size - 1));
|
||||
}
|
||||
return strlen($data);
|
||||
}
|
||||
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$temp_file = dirname(__FILE__) . '/body.tmp';
|
||||
$url = "{$host}/get.php?test=getpost";
|
||||
$ch = curl_init();
|
||||
$f_file = fopen($temp_file, "w") or die("failed to open file\n");
|
||||
curl_setopt($ch, CURLOPT_BUFFERSIZE, 10);
|
||||
curl_setopt($ch, CURLOPT_HEADERFUNCTION, "hdr_callback");
|
||||
curl_setopt($ch, CURLOPT_FILE, $f_file);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/body.tmp');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
array(1) {
|
||||
["test"]=>
|
||||
string(7) "getpost"
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
===DONE===
|
||||
+27
-27
@@ -115,7 +115,7 @@ static double astro_GMST0(double d)
|
||||
/* time, imposing no runtime or code overhead. */
|
||||
sidtim0 = astro_revolution((180.0 + 356.0470 + 282.9404) + (0.9856002585 + 4.70935E-5) * d);
|
||||
return sidtim0;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function computes the Sun's position at any instant */
|
||||
|
||||
@@ -177,32 +177,32 @@ static void astro_sun_RA_dec(double d, double *RA, double *dec, double *r)
|
||||
|
||||
/**
|
||||
* Note: timestamp = unixtimestamp (NEEDS to be 00:00:00 UT)
|
||||
* Eastern longitude positive, Western longitude negative
|
||||
* Northern latitude positive, Southern latitude negative
|
||||
* The longitude value IS critical in this function!
|
||||
* altit = the altitude which the Sun should cross
|
||||
* Set to -35/60 degrees for rise/set, -6 degrees
|
||||
* for civil, -12 degrees for nautical and -18
|
||||
* degrees for astronomical twilight.
|
||||
* upper_limb: non-zero -> upper limb, zero -> center
|
||||
* Set to non-zero (e.g. 1) when computing rise/set
|
||||
* times, and to zero when computing start/end of
|
||||
* twilight.
|
||||
* *rise = where to store the rise time
|
||||
* *set = where to store the set time
|
||||
* Both times are relative to the specified altitude,
|
||||
* and thus this function can be used to compute
|
||||
* various twilight times, as well as rise/set times
|
||||
* Return value: 0 = sun rises/sets this day, times stored at
|
||||
* *trise and *tset.
|
||||
* +1 = sun above the specified "horizon" 24 hours.
|
||||
* *trise set to time when the sun is at south,
|
||||
* minus 12 hours while *tset is set to the south
|
||||
* time plus 12 hours. "Day" length = 24 hours
|
||||
* -1 = sun is below the specified "horizon" 24 hours
|
||||
* "Day" length = 0 hours, *trise and *tset are
|
||||
* both set to the time when the sun is at south.
|
||||
*
|
||||
* Eastern longitude positive, Western longitude negative
|
||||
* Northern latitude positive, Southern latitude negative
|
||||
* The longitude value IS critical in this function!
|
||||
* altit = the altitude which the Sun should cross
|
||||
* Set to -35/60 degrees for rise/set, -6 degrees
|
||||
* for civil, -12 degrees for nautical and -18
|
||||
* degrees for astronomical twilight.
|
||||
* upper_limb: non-zero -> upper limb, zero -> center
|
||||
* Set to non-zero (e.g. 1) when computing rise/set
|
||||
* times, and to zero when computing start/end of
|
||||
* twilight.
|
||||
* *rise = where to store the rise time
|
||||
* *set = where to store the set time
|
||||
* Both times are relative to the specified altitude,
|
||||
* and thus this function can be used to compute
|
||||
* various twilight times, as well as rise/set times
|
||||
* Return value: 0 = sun rises/sets this day, times stored at
|
||||
* *trise and *tset.
|
||||
* +1 = sun above the specified "horizon" 24 hours.
|
||||
* *trise set to time when the sun is at south,
|
||||
* minus 12 hours while *tset is set to the south
|
||||
* time plus 12 hours. "Day" length = 24 hours
|
||||
* -1 = sun is below the specified "horizon" 24 hours
|
||||
* "Day" length = 0 hours, *trise and *tset are
|
||||
* both set to the time when the sun is at south.
|
||||
*
|
||||
*/
|
||||
int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set, timelib_sll *ts_transit)
|
||||
{
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
|
||||
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d)
|
||||
{
|
||||
timelib_sll dow, day;
|
||||
|
||||
|
||||
/* Figure out the dayofweek for y-1-1 */
|
||||
dow = timelib_day_of_week(y, 1, 1);
|
||||
/* then use that to figure out the offset for day 1 of week 1 */
|
||||
|
||||
+10
-10
@@ -677,7 +677,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
|
||||
if (strcasecmp("utc", word) == 0 || strcasecmp("gmt", word) == 0) {
|
||||
return timelib_timezone_utc;
|
||||
}
|
||||
|
||||
|
||||
for (tp = timelib_timezone_lookup; tp->name; tp++) {
|
||||
if (strcasecmp(word, tp->name) == 0) {
|
||||
if (!first_found) {
|
||||
@@ -808,7 +808,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
{
|
||||
uchar *cursor = s->cur;
|
||||
char *str, *ptr = NULL;
|
||||
|
||||
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
@@ -1437,7 +1437,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
w = timelib_get_nr((char **) &ptr, 2);
|
||||
d = timelib_get_nr((char **) &ptr, 1);
|
||||
@@ -1456,7 +1456,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
w = timelib_get_nr((char **) &ptr, 2);
|
||||
d = 1;
|
||||
@@ -1560,7 +1560,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
if (s->time->relative.weekday_behavior != 2) {
|
||||
s->time->relative.weekday_behavior = 1;
|
||||
}
|
||||
|
||||
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEKDAY;
|
||||
}
|
||||
@@ -1877,7 +1877,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
add_pbf_error(s, "A textual day could not be found", string, begin);
|
||||
break;
|
||||
} else {
|
||||
in.time->have_relative = 1;
|
||||
in.time->have_relative = 1;
|
||||
in.time->relative.have_weekday_relative = 1;
|
||||
in.time->relative.weekday = tmprel->multiplier;
|
||||
in.time->relative.weekday_behavior = 1;
|
||||
@@ -2148,13 +2148,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
|
||||
/* do funky checking whether the parsed time was valid time */
|
||||
if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
|
||||
s->time->s != TIMELIB_UNSET &&
|
||||
s->time->s != TIMELIB_UNSET &&
|
||||
!timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
|
||||
add_pbf_warning(s, "The parsed time was invalid", string, ptr);
|
||||
}
|
||||
/* do funky checking whether the parsed date was valid date */
|
||||
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
|
||||
s->time->d != TIMELIB_UNSET &&
|
||||
s->time->d != TIMELIB_UNSET &&
|
||||
!timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
|
||||
add_pbf_warning(s, "The parsed date was invalid", string, ptr);
|
||||
}
|
||||
@@ -2227,7 +2227,7 @@ int main(void)
|
||||
printf ("%04d-%02d-%02d %02d:%02d:%02d.%-5d %+04d %1d",
|
||||
time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
|
||||
if (time.have_relative) {
|
||||
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
|
||||
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
|
||||
time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s);
|
||||
}
|
||||
if (time.have_weekday_relative) {
|
||||
@@ -2236,7 +2236,7 @@ int main(void)
|
||||
if (time.have_weeknr_day) {
|
||||
printf(" / %dW%d", time.relative.weeknr_day.weeknr, time.relative.weeknr_day.dayofweek);
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ static int scan(Scanner *s)
|
||||
{
|
||||
uchar *cursor = s->cur;
|
||||
char *str, *ptr = NULL;
|
||||
|
||||
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
@@ -336,11 +336,11 @@ isoweek = year4 "-"? "W" weekofyear;
|
||||
case 'D': s->period->d = nr; break;
|
||||
case 'H': s->period->h = nr; break;
|
||||
case 'S': s->period->s = nr; break;
|
||||
case 'M':
|
||||
case 'M':
|
||||
if (in_time) {
|
||||
s->period->i = nr;
|
||||
} else {
|
||||
s->period->m = nr;
|
||||
s->period->m = nr;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -398,9 +398,9 @@ isoweek = year4 "-"? "W" weekofyear;
|
||||
|
||||
/*!max:re2c */
|
||||
|
||||
void timelib_strtointerval(char *s, int len,
|
||||
timelib_time **begin, timelib_time **end,
|
||||
timelib_rel_time **period, int *recurrences,
|
||||
void timelib_strtointerval(char *s, int len,
|
||||
timelib_time **begin, timelib_time **end,
|
||||
timelib_rel_time **period, int *recurrences,
|
||||
struct timelib_error_container **errors)
|
||||
{
|
||||
Scanner in;
|
||||
|
||||
+135
-68
@@ -36,7 +36,7 @@
|
||||
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
|
||||
# if defined(__LITTLE_ENDIAN__)
|
||||
# undef WORDS_BIGENDIAN
|
||||
# else
|
||||
# else
|
||||
# if defined(__BIG_ENDIAN__)
|
||||
# define WORDS_BIGENDIAN
|
||||
# endif
|
||||
@@ -49,11 +49,14 @@
|
||||
#define timelib_conv_int(l) ((l & 0x000000ff) << 24) + ((l & 0x0000ff00) << 8) + ((l & 0x00ff0000) >> 8) + ((l & 0xff000000) >> 24)
|
||||
#endif
|
||||
|
||||
static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
/* skip ID */
|
||||
uint32_t version;
|
||||
|
||||
/* read ID */
|
||||
version = (*tzf)[3] - '0';
|
||||
*tzf += 4;
|
||||
|
||||
|
||||
/* read BC flag */
|
||||
tz->bc = (**tzf == '\1');
|
||||
*tzf += 1;
|
||||
@@ -63,8 +66,10 @@ static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
tz->location.country_code[2] = '\0';
|
||||
*tzf += 2;
|
||||
|
||||
/* skip read of preamble */
|
||||
/* skip rest of preamble */
|
||||
*tzf += 13;
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
static void read_header(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
@@ -72,65 +77,88 @@ static void read_header(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
uint32_t buffer[6];
|
||||
|
||||
memcpy(&buffer, *tzf, sizeof(buffer));
|
||||
tz->ttisgmtcnt = timelib_conv_int(buffer[0]);
|
||||
tz->ttisstdcnt = timelib_conv_int(buffer[1]);
|
||||
tz->leapcnt = timelib_conv_int(buffer[2]);
|
||||
tz->timecnt = timelib_conv_int(buffer[3]);
|
||||
tz->typecnt = timelib_conv_int(buffer[4]);
|
||||
tz->charcnt = timelib_conv_int(buffer[5]);
|
||||
tz->bit32.ttisgmtcnt = timelib_conv_int(buffer[0]);
|
||||
tz->bit32.ttisstdcnt = timelib_conv_int(buffer[1]);
|
||||
tz->bit32.leapcnt = timelib_conv_int(buffer[2]);
|
||||
tz->bit32.timecnt = timelib_conv_int(buffer[3]);
|
||||
tz->bit32.typecnt = timelib_conv_int(buffer[4]);
|
||||
tz->bit32.charcnt = timelib_conv_int(buffer[5]);
|
||||
*tzf += sizeof(buffer);
|
||||
}
|
||||
|
||||
static void skip_64bit_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
if (tz->bit64.timecnt) {
|
||||
*tzf += (sizeof(int64_t) * tz->bit64.timecnt);
|
||||
*tzf += (sizeof(unsigned char) * tz->bit64.timecnt);
|
||||
}
|
||||
}
|
||||
|
||||
static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
int32_t *buffer = NULL;
|
||||
uint32_t i;
|
||||
unsigned char *cbuffer = NULL;
|
||||
|
||||
if (tz->timecnt) {
|
||||
buffer = (int32_t*) malloc(tz->timecnt * sizeof(int32_t));
|
||||
if (tz->bit32.timecnt) {
|
||||
buffer = (int32_t*) malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(int32_t) * tz->timecnt);
|
||||
*tzf += (sizeof(int32_t) * tz->timecnt);
|
||||
for (i = 0; i < tz->timecnt; i++) {
|
||||
memcpy(buffer, *tzf, sizeof(int32_t) * tz->bit32.timecnt);
|
||||
*tzf += (sizeof(int32_t) * tz->bit32.timecnt);
|
||||
for (i = 0; i < tz->bit32.timecnt; i++) {
|
||||
buffer[i] = timelib_conv_int(buffer[i]);
|
||||
}
|
||||
|
||||
cbuffer = (unsigned char*) malloc(tz->timecnt * sizeof(unsigned char));
|
||||
cbuffer = (unsigned char*) malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
if (!cbuffer) {
|
||||
free(buffer);
|
||||
return;
|
||||
}
|
||||
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->timecnt);
|
||||
*tzf += sizeof(unsigned char) * tz->timecnt;
|
||||
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit32.timecnt);
|
||||
*tzf += sizeof(unsigned char) * tz->bit32.timecnt;
|
||||
}
|
||||
|
||||
|
||||
tz->trans = buffer;
|
||||
tz->trans_idx = cbuffer;
|
||||
}
|
||||
|
||||
static void skip_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
*tzf += sizeof(unsigned char) * 6 * tz->bit64.typecnt;
|
||||
*tzf += sizeof(char) * tz->bit64.charcnt;
|
||||
if (tz->bit64.leapcnt) {
|
||||
*tzf += sizeof(int64_t) * tz->bit64.leapcnt * 2;
|
||||
}
|
||||
if (tz->bit64.ttisstdcnt) {
|
||||
*tzf += sizeof(unsigned char) * tz->bit64.ttisstdcnt;
|
||||
}
|
||||
if (tz->bit64.ttisgmtcnt) {
|
||||
*tzf += sizeof(unsigned char) * tz->bit64.ttisgmtcnt;
|
||||
}
|
||||
}
|
||||
|
||||
static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
unsigned char *buffer;
|
||||
int32_t *leap_buffer;
|
||||
unsigned int i, j;
|
||||
|
||||
buffer = (unsigned char*) malloc(tz->typecnt * sizeof(unsigned char) * 6);
|
||||
buffer = (unsigned char*) malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->typecnt);
|
||||
*tzf += sizeof(unsigned char) * 6 * tz->typecnt;
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit32.typecnt);
|
||||
*tzf += sizeof(unsigned char) * 6 * tz->bit32.typecnt;
|
||||
|
||||
tz->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
|
||||
tz->type = (ttinfo*) malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
if (!tz->type) {
|
||||
free(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < tz->typecnt; i++) {
|
||||
for (i = 0; i < tz->bit32.typecnt; i++) {
|
||||
j = i * 6;
|
||||
tz->type[i].offset = (buffer[j] * 16777216) + (buffer[j + 1] * 65536) + (buffer[j + 2] * 256) + buffer[j + 3];
|
||||
tz->type[i].isdst = buffer[j + 4];
|
||||
@@ -138,62 +166,74 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
}
|
||||
free(buffer);
|
||||
|
||||
tz->timezone_abbr = (char*) malloc(tz->charcnt);
|
||||
tz->timezone_abbr = (char*) malloc(tz->bit32.charcnt);
|
||||
if (!tz->timezone_abbr) {
|
||||
return;
|
||||
}
|
||||
memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->charcnt);
|
||||
*tzf += sizeof(char) * tz->charcnt;
|
||||
memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit32.charcnt);
|
||||
*tzf += sizeof(char) * tz->bit32.charcnt;
|
||||
|
||||
if (tz->leapcnt) {
|
||||
leap_buffer = (int32_t *) malloc(tz->leapcnt * 2 * sizeof(int32_t));
|
||||
if (tz->bit32.leapcnt) {
|
||||
leap_buffer = (int32_t *) malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
|
||||
if (!leap_buffer) {
|
||||
return;
|
||||
}
|
||||
memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->leapcnt * 2);
|
||||
*tzf += sizeof(int32_t) * tz->leapcnt * 2;
|
||||
memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->bit32.leapcnt * 2);
|
||||
*tzf += sizeof(int32_t) * tz->bit32.leapcnt * 2;
|
||||
|
||||
tz->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
|
||||
tz->leap_times = (tlinfo*) malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
if (!tz->leap_times) {
|
||||
free(leap_buffer);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < tz->leapcnt; i++) {
|
||||
for (i = 0; i < tz->bit32.leapcnt; i++) {
|
||||
tz->leap_times[i].trans = timelib_conv_int(leap_buffer[i * 2]);
|
||||
tz->leap_times[i].offset = timelib_conv_int(leap_buffer[i * 2 + 1]);
|
||||
}
|
||||
free(leap_buffer);
|
||||
}
|
||||
|
||||
if (tz->ttisstdcnt) {
|
||||
buffer = (unsigned char*) malloc(tz->ttisstdcnt * sizeof(unsigned char));
|
||||
if (tz->bit32.ttisstdcnt) {
|
||||
buffer = (unsigned char*) malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->ttisstdcnt);
|
||||
*tzf += sizeof(unsigned char) * tz->ttisstdcnt;
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisstdcnt);
|
||||
*tzf += sizeof(unsigned char) * tz->bit32.ttisstdcnt;
|
||||
|
||||
for (i = 0; i < tz->ttisstdcnt; i++) {
|
||||
for (i = 0; i < tz->bit32.ttisstdcnt; i++) {
|
||||
tz->type[i].isstdcnt = buffer[i];
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
if (tz->ttisgmtcnt) {
|
||||
buffer = (unsigned char*) malloc(tz->ttisgmtcnt * sizeof(unsigned char));
|
||||
if (tz->bit32.ttisgmtcnt) {
|
||||
buffer = (unsigned char*) malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->ttisgmtcnt);
|
||||
*tzf += sizeof(unsigned char) * tz->ttisgmtcnt;
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisgmtcnt);
|
||||
*tzf += sizeof(unsigned char) * tz->bit32.ttisgmtcnt;
|
||||
|
||||
for (i = 0; i < tz->ttisgmtcnt; i++) {
|
||||
for (i = 0; i < tz->bit32.ttisgmtcnt; i++) {
|
||||
tz->type[i].isgmtcnt = buffer[i];
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
static void skip_posix_string(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
int n_count = 0;
|
||||
|
||||
do {
|
||||
if (*tzf[0] == '\n') {
|
||||
n_count++;
|
||||
}
|
||||
(*tzf)++;
|
||||
} while (n_count < 2);
|
||||
}
|
||||
|
||||
static void read_location(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
uint32_t buffer[3];
|
||||
@@ -221,12 +261,12 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
||||
printf("Geo Location: %f,%f\n", tz->location.latitude, tz->location.longitude);
|
||||
printf("Comments:\n%s\n", tz->location.comments);
|
||||
printf("BC: %s\n", tz->bc ? "" : "yes");
|
||||
printf("UTC/Local count: %lu\n", (unsigned long) tz->ttisgmtcnt);
|
||||
printf("Std/Wall count: %lu\n", (unsigned long) tz->ttisstdcnt);
|
||||
printf("Leap.sec. count: %lu\n", (unsigned long) tz->leapcnt);
|
||||
printf("Trans. count: %lu\n", (unsigned long) tz->timecnt);
|
||||
printf("Local types count: %lu\n", (unsigned long) tz->typecnt);
|
||||
printf("Zone Abbr. count: %lu\n", (unsigned long) tz->charcnt);
|
||||
printf("UTC/Local count: %lu\n", (unsigned long) tz->bit32.ttisgmtcnt);
|
||||
printf("Std/Wall count: %lu\n", (unsigned long) tz->bit32.ttisstdcnt);
|
||||
printf("Leap.sec. count: %lu\n", (unsigned long) tz->bit32.leapcnt);
|
||||
printf("Trans. count: %lu\n", (unsigned long) tz->bit32.timecnt);
|
||||
printf("Local types count: %lu\n", (unsigned long) tz->bit32.typecnt);
|
||||
printf("Zone Abbr. count: %lu\n", (unsigned long) tz->bit32.charcnt);
|
||||
|
||||
printf ("%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
|
||||
"", "", 0,
|
||||
@@ -237,7 +277,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
||||
tz->type[0].isstdcnt,
|
||||
tz->type[0].isgmtcnt
|
||||
);
|
||||
for (i = 0; i < tz->timecnt; i++) {
|
||||
for (i = 0; i < tz->bit32.timecnt; i++) {
|
||||
printf ("%08X (%12d) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
|
||||
tz->trans[i], tz->trans[i], tz->trans_idx[i],
|
||||
(long int) tz->type[tz->trans_idx[i]].offset,
|
||||
@@ -248,7 +288,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
||||
tz->type[tz->trans_idx[i]].isgmtcnt
|
||||
);
|
||||
}
|
||||
for (i = 0; i < tz->leapcnt; i++) {
|
||||
for (i = 0; i < tz->bit32.leapcnt; i++) {
|
||||
printf ("%08X (%12ld) = %d\n",
|
||||
tz->leap_times[i].trans,
|
||||
(long) tz->leap_times[i].trans,
|
||||
@@ -267,7 +307,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
cur_locale = strdup(tmp);
|
||||
}
|
||||
setlocale(LC_CTYPE, "C");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
do {
|
||||
int mid = ((unsigned)left + right) >> 1;
|
||||
@@ -282,7 +322,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale(LC_CTYPE, cur_locale);
|
||||
if (cur_locale) free(cur_locale);
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -291,7 +331,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale(LC_CTYPE, cur_locale);
|
||||
if (cur_locale) free(cur_locale);
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -312,18 +352,45 @@ int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
|
||||
return (seek_to_tz_position(&tzf, timezone, tzdb));
|
||||
}
|
||||
|
||||
static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
*tzf += 20;
|
||||
}
|
||||
|
||||
static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
uint32_t buffer[6];
|
||||
|
||||
memcpy(&buffer, *tzf, sizeof(buffer));
|
||||
tz->bit64.ttisgmtcnt = timelib_conv_int(buffer[0]);
|
||||
tz->bit64.ttisstdcnt = timelib_conv_int(buffer[1]);
|
||||
tz->bit64.leapcnt = timelib_conv_int(buffer[2]);
|
||||
tz->bit64.timecnt = timelib_conv_int(buffer[3]);
|
||||
tz->bit64.typecnt = timelib_conv_int(buffer[4]);
|
||||
tz->bit64.charcnt = timelib_conv_int(buffer[5]);
|
||||
*tzf += sizeof(buffer);
|
||||
}
|
||||
|
||||
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
|
||||
{
|
||||
const unsigned char *tzf;
|
||||
timelib_tzinfo *tmp;
|
||||
int version;
|
||||
|
||||
if (seek_to_tz_position(&tzf, timezone, tzdb)) {
|
||||
tmp = timelib_tzinfo_ctor(timezone);
|
||||
|
||||
read_preamble(&tzf, tmp);
|
||||
version = read_preamble(&tzf, tmp);
|
||||
read_header(&tzf, tmp);
|
||||
read_transistions(&tzf, tmp);
|
||||
read_types(&tzf, tmp);
|
||||
if (version == 2) {
|
||||
skip_64bit_preamble(&tzf, tmp);
|
||||
read_64bit_header(&tzf, tmp);
|
||||
skip_64bit_transistions(&tzf, tmp);
|
||||
skip_64bit_types(&tzf, tmp);
|
||||
skip_posix_string(&tzf, tmp);
|
||||
}
|
||||
read_location(&tzf, tmp);
|
||||
} else {
|
||||
tmp = NULL;
|
||||
@@ -338,9 +405,9 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
|
||||
|
||||
/* If there is no transition time, we pick the first one, if that doesn't
|
||||
* exist we return NULL */
|
||||
if (!tz->timecnt || !tz->trans) {
|
||||
if (!tz->bit32.timecnt || !tz->trans) {
|
||||
*transition_time = 0;
|
||||
if (tz->typecnt == 1) {
|
||||
if (tz->bit32.typecnt == 1) {
|
||||
return &(tz->type[0]);
|
||||
}
|
||||
return NULL;
|
||||
@@ -355,10 +422,10 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
|
||||
|
||||
*transition_time = 0;
|
||||
j = 0;
|
||||
while (j < tz->timecnt && tz->type[j].isdst) {
|
||||
while (j < tz->bit32.timecnt && tz->type[j].isdst) {
|
||||
++j;
|
||||
}
|
||||
if (j == tz->timecnt) {
|
||||
if (j == tz->bit32.timecnt) {
|
||||
j = 0;
|
||||
}
|
||||
return &(tz->type[j]);
|
||||
@@ -366,25 +433,25 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
|
||||
|
||||
/* In all other cases we loop through the available transtion times to find
|
||||
* the correct entry */
|
||||
for (i = 0; i < tz->timecnt; i++) {
|
||||
for (i = 0; i < tz->bit32.timecnt; i++) {
|
||||
if (ts < tz->trans[i]) {
|
||||
*transition_time = tz->trans[i - 1];
|
||||
return &(tz->type[tz->trans_idx[i - 1]]);
|
||||
}
|
||||
}
|
||||
*transition_time = tz->trans[tz->timecnt - 1];
|
||||
return &(tz->type[tz->trans_idx[tz->timecnt - 1]]);
|
||||
*transition_time = tz->trans[tz->bit32.timecnt - 1];
|
||||
return &(tz->type[tz->trans_idx[tz->bit32.timecnt - 1]]);
|
||||
}
|
||||
|
||||
static tlinfo* fetch_leaptime_offset(timelib_tzinfo *tz, timelib_sll ts)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!tz->leapcnt || !tz->leap_times) {
|
||||
if (!tz->bit32.leapcnt || !tz->leap_times) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = tz->leapcnt - 1; i > 0; i--) {
|
||||
for (i = tz->bit32.leapcnt - 1; i > 0; i--) {
|
||||
if (ts > tz->leap_times[i].trans) {
|
||||
return &(tz->leap_times[i]);
|
||||
}
|
||||
@@ -396,7 +463,7 @@ int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz)
|
||||
{
|
||||
ttinfo *to;
|
||||
timelib_sll dummy;
|
||||
|
||||
|
||||
if ((to = fetch_timezone_offset(tz, ts, &dummy))) {
|
||||
return to->isdst;
|
||||
}
|
||||
@@ -439,12 +506,12 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
|
||||
{
|
||||
timelib_time_offset *gmt_offset;
|
||||
timelib_sll retval;
|
||||
|
||||
|
||||
switch (t->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
return (t->z + t->dst) * -60;
|
||||
|
||||
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
|
||||
retval = gmt_offset->offset;
|
||||
|
||||
+19
-19
@@ -116,26 +116,26 @@ timelib_tzinfo* timelib_tzinfo_ctor(char *name)
|
||||
timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
|
||||
{
|
||||
timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
|
||||
tmp->ttisgmtcnt = tz->ttisgmtcnt;
|
||||
tmp->ttisstdcnt = tz->ttisstdcnt;
|
||||
tmp->leapcnt = tz->leapcnt;
|
||||
tmp->timecnt = tz->timecnt;
|
||||
tmp->typecnt = tz->typecnt;
|
||||
tmp->charcnt = tz->charcnt;
|
||||
|
||||
tmp->trans = (int32_t *) malloc(tz->timecnt * sizeof(int32_t));
|
||||
tmp->trans_idx = (unsigned char*) malloc(tz->timecnt * sizeof(unsigned char));
|
||||
memcpy(tmp->trans, tz->trans, tz->timecnt * sizeof(int32_t));
|
||||
memcpy(tmp->trans_idx, tz->trans_idx, tz->timecnt * sizeof(unsigned char));
|
||||
tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
|
||||
tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
|
||||
tmp->bit32.leapcnt = tz->bit32.leapcnt;
|
||||
tmp->bit32.timecnt = tz->bit32.timecnt;
|
||||
tmp->bit32.typecnt = tz->bit32.typecnt;
|
||||
tmp->bit32.charcnt = tz->bit32.charcnt;
|
||||
|
||||
tmp->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
|
||||
memcpy(tmp->type, tz->type, tz->typecnt * sizeof(struct ttinfo));
|
||||
tmp->trans = (int32_t *) malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
tmp->trans_idx = (unsigned char*) malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
memcpy(tmp->trans, tz->trans, tz->bit32.timecnt * sizeof(int32_t));
|
||||
memcpy(tmp->trans_idx, tz->trans_idx, tz->bit32.timecnt * sizeof(unsigned char));
|
||||
|
||||
tmp->timezone_abbr = (char*) malloc(tz->charcnt);
|
||||
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->charcnt);
|
||||
tmp->type = (ttinfo*) malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
|
||||
tmp->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
|
||||
memcpy(tmp->leap_times, tz->leap_times, tz->leapcnt * sizeof(tlinfo));
|
||||
tmp->timezone_abbr = (char*) malloc(tz->bit32.charcnt);
|
||||
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
|
||||
|
||||
tmp->leap_times = (tlinfo*) malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
@@ -236,7 +236,7 @@ void timelib_dump_date(timelib_time *d, int options)
|
||||
|
||||
if ((options & 1) == 1) {
|
||||
if (d->have_relative) {
|
||||
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
|
||||
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
|
||||
d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
|
||||
if (d->relative.first_last_day_of != 0) {
|
||||
switch (d->relative.first_last_day_of) {
|
||||
@@ -271,7 +271,7 @@ void timelib_dump_date(timelib_time *d, int options)
|
||||
|
||||
void timelib_dump_rel_time(timelib_rel_time *d)
|
||||
{
|
||||
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS (days: %lld)%s",
|
||||
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS (days: %lld)%s",
|
||||
d->y, d->m, d->d, d->h, d->i, d->s, d->days, d->invert ? " inverted" : "");
|
||||
if (d->first_last_day_of != 0) {
|
||||
switch (d->first_last_day_of) {
|
||||
|
||||
@@ -80,8 +80,8 @@ long timelib_parse_tz_cor(char**);
|
||||
|
||||
/* From parse_iso_intervals.re */
|
||||
void timelib_strtointerval(char *s, int len,
|
||||
timelib_time **begin, timelib_time **end,
|
||||
timelib_rel_time **period, int *recurrences,
|
||||
timelib_time **begin, timelib_time **end,
|
||||
timelib_rel_time **period, int *recurrences,
|
||||
struct timelib_error_container **errors);
|
||||
|
||||
|
||||
|
||||
@@ -158,12 +158,22 @@ typedef struct tlocinfo
|
||||
typedef struct timelib_tzinfo
|
||||
{
|
||||
char *name;
|
||||
uint32_t ttisgmtcnt;
|
||||
uint32_t ttisstdcnt;
|
||||
uint32_t leapcnt;
|
||||
uint32_t timecnt;
|
||||
uint32_t typecnt;
|
||||
uint32_t charcnt;
|
||||
struct {
|
||||
uint32_t ttisgmtcnt;
|
||||
uint32_t ttisstdcnt;
|
||||
uint32_t leapcnt;
|
||||
uint32_t timecnt;
|
||||
uint32_t typecnt;
|
||||
uint32_t charcnt;
|
||||
} bit32;
|
||||
struct {
|
||||
uint64_t ttisgmtcnt;
|
||||
uint64_t ttisstdcnt;
|
||||
uint64_t leapcnt;
|
||||
uint64_t timecnt;
|
||||
uint64_t typecnt;
|
||||
uint64_t charcnt;
|
||||
} bit64;
|
||||
|
||||
int32_t *trans;
|
||||
unsigned char *trans_idx;
|
||||
|
||||
+43568
-16523
File diff suppressed because it is too large.
Load diff
@@ -106,7 +106,7 @@ static int do_range_limit_days(timelib_sll *y, timelib_sll *m, timelib_sll *d)
|
||||
timelib_sll days_this_month;
|
||||
timelib_sll last_month, last_year;
|
||||
timelib_sll days_last_month;
|
||||
|
||||
|
||||
/* can jump an entire leap year period quickly */
|
||||
if (*d >= DAYS_PER_LYEAR_PERIOD || *d <= -DAYS_PER_LYEAR_PERIOD) {
|
||||
*y += YEARS_PER_LYEAR_PERIOD * (*d / DAYS_PER_LYEAR_PERIOD);
|
||||
@@ -396,7 +396,7 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
|
||||
timelib_time_offset *before, *after;
|
||||
timelib_sll tmp;
|
||||
int in_transistion;
|
||||
|
||||
|
||||
tz->is_localtime = 1;
|
||||
before = timelib_get_time_zone_info(tz->sse, tzi);
|
||||
after = timelib_get_time_zone_info(tz->sse - before->offset, tzi);
|
||||
@@ -406,7 +406,7 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
|
||||
((tz->sse - after->offset) >= (after->transistion_time + (before->offset - after->offset))) &&
|
||||
((tz->sse - after->offset) < after->transistion_time)
|
||||
);
|
||||
|
||||
|
||||
if ((before->offset != after->offset) && !in_transistion) {
|
||||
tmp = -after->offset;
|
||||
} else {
|
||||
@@ -464,7 +464,7 @@ int main(void)
|
||||
printf ("%04d-%02d-%02d %02d:%02d:%02d.%-5d %+04d %1d",
|
||||
time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
|
||||
if (time.have_relative) {
|
||||
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
|
||||
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
|
||||
time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s);
|
||||
}
|
||||
if (time.have_weekday_relative) {
|
||||
|
||||
@@ -141,7 +141,7 @@ void timelib_update_from_sse(timelib_time *tm)
|
||||
signed int dst = tm->dst;
|
||||
|
||||
sse = tm->sse;
|
||||
|
||||
|
||||
switch (tm->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
case TIMELIB_ZONETYPE_OFFSET: {
|
||||
@@ -152,11 +152,11 @@ void timelib_update_from_sse(timelib_time *tm)
|
||||
|
||||
case TIMELIB_ZONETYPE_ID: {
|
||||
timelib_time_offset *gmt_offset;
|
||||
|
||||
|
||||
gmt_offset = timelib_get_time_zone_info(tm->sse, tm->tz_info);
|
||||
timelib_unixtime2gmt(tm, tm->sse + gmt_offset->offset);
|
||||
timelib_time_offset_dtor(gmt_offset);
|
||||
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
|
||||
case TIMELIB_ZONETYPE_OFFSET: {
|
||||
int z = tm->z;
|
||||
signed int dst = tm->dst;
|
||||
|
||||
|
||||
timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
|
||||
|
||||
tm->z = z;
|
||||
@@ -195,7 +195,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
|
||||
timelib_unixtime2gmt(tm, ts + gmt_offset->offset);
|
||||
|
||||
/* we need to reset the sse here as unixtime2gmt modifies it */
|
||||
tm->sse = ts;
|
||||
tm->sse = ts;
|
||||
tm->dst = gmt_offset->is_dst;
|
||||
tm->z = gmt_offset->offset;
|
||||
tm->tz_info = tz;
|
||||
|
||||
+6
-39
@@ -185,10 +185,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_date_format, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, format)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_immutable, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, DateTimeImmutable)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_format, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, format)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -472,7 +468,6 @@ const zend_function_entry date_funcs_date[] = {
|
||||
PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DateTime, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME(DateTime, createFromImmutable, arginfo_date_method_create_from_immutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
|
||||
@@ -2786,7 +2781,7 @@ PHP_METHOD(DateTimeImmutable, createFromMutable)
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime_object, date_ce_date) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O!", &datetime_object, date_ce_date) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2917,34 +2912,6 @@ PHP_METHOD(DateTime, __wakeup)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DateTime::createFromImmutable(DateTimeImmutable object)
|
||||
Creates new DateTime object from an existing DateTimeImmutable object.
|
||||
*/
|
||||
PHP_METHOD(DateTime, createFromImmutable)
|
||||
{
|
||||
zval *datetimeimmutable_object = NULL;
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetimeimmutable_object, date_ce_immutable) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
old_obj = (php_date_obj *) zend_object_store_get_object(datetimeimmutable_object TSRMLS_CC);
|
||||
new_obj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
|
||||
new_obj->time = timelib_time_ctor();
|
||||
*new_obj->time = *old_obj->time;
|
||||
if (old_obj->time->tz_abbr) {
|
||||
new_obj->time->tz_abbr = strdup(old_obj->time->tz_abbr);
|
||||
}
|
||||
if (old_obj->time->tz_info) {
|
||||
new_obj->time->tz_info = old_obj->time->tz_info;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Helper function used to add an associative array of warnings and errors to a zval */
|
||||
static void zval_from_error_container(zval *z, timelib_error_container *error)
|
||||
{
|
||||
@@ -3959,7 +3926,7 @@ PHP_FUNCTION(timezone_transitions_get)
|
||||
add_assoc_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); \
|
||||
add_next_index_zval(return_value, element);
|
||||
|
||||
#define add_last() add(tzobj->tzi.tz->timecnt - 1, timestamp_begin)
|
||||
#define add_last() add(tzobj->tzi.tz->bit32.timecnt - 1, timestamp_begin)
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
@@ -3970,7 +3937,7 @@ PHP_FUNCTION(timezone_transitions_get)
|
||||
} else {
|
||||
begin = 0;
|
||||
found = 0;
|
||||
if (tzobj->tzi.tz->timecnt > 0) {
|
||||
if (tzobj->tzi.tz->bit32.timecnt > 0) {
|
||||
do {
|
||||
if (tzobj->tzi.tz->trans[begin] > timestamp_begin) {
|
||||
if (begin > 0) {
|
||||
@@ -3982,18 +3949,18 @@ PHP_FUNCTION(timezone_transitions_get)
|
||||
break;
|
||||
}
|
||||
begin++;
|
||||
} while (begin < tzobj->tzi.tz->timecnt);
|
||||
} while (begin < tzobj->tzi.tz->bit32.timecnt);
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (tzobj->tzi.tz->timecnt > 0) {
|
||||
if (tzobj->tzi.tz->bit32.timecnt > 0) {
|
||||
add_last();
|
||||
} else {
|
||||
add_nominal();
|
||||
}
|
||||
} else {
|
||||
for (i = begin; i < tzobj->tzi.tz->timecnt; ++i) {
|
||||
for (i = begin; i < tzobj->tzi.tz->bit32.timecnt; ++i) {
|
||||
if (tzobj->tzi.tz->trans[i] < timestamp_end) {
|
||||
add(i, tzobj->tzi.tz->trans[i]);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ PHP_FUNCTION(getdate);
|
||||
PHP_METHOD(DateTime, __construct);
|
||||
PHP_METHOD(DateTime, __wakeup);
|
||||
PHP_METHOD(DateTime, __set_state);
|
||||
PHP_METHOD(DateTime, createFromImmutable);
|
||||
PHP_FUNCTION(date_create);
|
||||
PHP_FUNCTION(date_create_immutable);
|
||||
PHP_FUNCTION(date_create_from_format);
|
||||
|
||||
@@ -16,7 +16,7 @@ date_default_timezone_set("Europe/London");
|
||||
// Create a DateTimeZone object
|
||||
$tz = new DateTimeZone("Europe/London");
|
||||
|
||||
$tran = $tz->getTransitions();
|
||||
$tran = $tz->getTransitions(-306972000, -37241999);
|
||||
|
||||
if (!is_array($tran)) {
|
||||
echo "TEST FAILED: Expected an array\n";
|
||||
@@ -25,14 +25,14 @@ if (!is_array($tran)) {
|
||||
echo "\n-- Total number of transitions: " . count($tran). " --\n";
|
||||
|
||||
echo "\n-- Format a sample entry for Spring 1963 --\n";
|
||||
var_dump( $tran[97] );
|
||||
var_dump( $tran[6] );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
*** Testing DateTimeZone::getTransitions() : basic functionality ***
|
||||
|
||||
-- Total number of transitions: 243 --
|
||||
-- Total number of transitions: 18 --
|
||||
|
||||
-- Format a sample entry for Spring 1963 --
|
||||
array(5) {
|
||||
|
||||
@@ -10,6 +10,6 @@ define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
|
||||
require 'DateTime_data-massive.inc';
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
test_massive_positive: ADD: -333333-01-01 16:18:02 EST + P+666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 EST**
|
||||
test_massive_negative: ADD: 333333-01-01 16:18:02 EST + P-666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 EST**
|
||||
--EXPECTF--
|
||||
test_massive_positive: ADD: -333333-01-01 16:18:02 %s + P+666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 %s**
|
||||
test_massive_negative: ADD: 333333-01-01 16:18:02 %s + P-666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 %s**
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Tests for DateTime::createFromImmutable.
|
||||
--INI--
|
||||
date.timezone=America/New_York
|
||||
--FILE--
|
||||
<?php
|
||||
$current = "2015-03-05 07:00:16";
|
||||
|
||||
$i = DateTime::createFromImmutable(date_create_immutable($current));
|
||||
var_dump($i);
|
||||
|
||||
$i = DateTime::createFromImmutable(date_create($current));
|
||||
var_dump($i);
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2015-03-05 07:00:16.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(16) "America/New_York"
|
||||
}
|
||||
|
||||
Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d
|
||||
NULL
|
||||
@@ -10,6 +10,6 @@ define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
|
||||
require 'DateTime_data-massive.inc';
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
test_massive_positive: DIFF: 333333-01-01 16:18:02 EST - -333333-01-01 16:18:02 EST = **P+666666Y0M0DT0H0M0S**
|
||||
test_massive_negative: DIFF: -333333-01-01 16:18:02 EST - 333333-01-01 16:18:02 EST = **P-666666Y0M0DT0H0M0S**
|
||||
--EXPECTF--
|
||||
test_massive_positive: DIFF: 333333-01-01 16:18:02 %s - -333333-01-01 16:18:02 %s = **P+666666Y0M0DT0H%s**
|
||||
test_massive_negative: DIFF: -333333-01-01 16:18:02 %s - 333333-01-01 16:18:02 %s = **P-666666Y0M0DT0H%s**
|
||||
@@ -10,6 +10,6 @@ define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
|
||||
require 'DateTime_data-massive.inc';
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
test_massive_positive: SUB: 333333-01-01 16:18:02 EST - P+666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 EST**
|
||||
test_massive_negative: SUB: -333333-01-01 16:18:02 EST - P-666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 EST**
|
||||
--EXPECTF--
|
||||
test_massive_positive: SUB: 333333-01-01 16:18:02 %s - P+666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 %s**
|
||||
test_massive_negative: SUB: -333333-01-01 16:18:02 %s - P-666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 %s**
|
||||
@@ -27,7 +27,7 @@ object(ReflectionClass)#%d (1) {
|
||||
string(8) "DateTime"
|
||||
}
|
||||
..and get names of all its methods
|
||||
array(19) {
|
||||
array(18) {
|
||||
[0]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
@@ -52,109 +52,102 @@ array(19) {
|
||||
[3]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(19) "createFromImmutable"
|
||||
string(16) "createFromFormat"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[4]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(16) "createFromFormat"
|
||||
string(13) "getLastErrors"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[5]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(13) "getLastErrors"
|
||||
string(6) "format"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[6]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(6) "format"
|
||||
string(6) "modify"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[7]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(6) "modify"
|
||||
string(3) "add"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[8]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(3) "add"
|
||||
string(3) "sub"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[9]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(3) "sub"
|
||||
string(11) "getTimezone"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[10]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(11) "getTimezone"
|
||||
string(11) "setTimezone"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[11]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(11) "setTimezone"
|
||||
string(9) "getOffset"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[12]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(9) "getOffset"
|
||||
string(7) "setTime"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[13]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(7) "setTime"
|
||||
string(7) "setDate"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[14]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(7) "setDate"
|
||||
string(10) "setISODate"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[15]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(10) "setISODate"
|
||||
string(12) "setTimestamp"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[16]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(12) "setTimestamp"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[17]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(12) "getTimestamp"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[18]=>
|
||||
[17]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(4) "diff"
|
||||
|
||||
@@ -20,10 +20,10 @@ array(5) {
|
||||
["time"]=>
|
||||
string(%d) "%s"
|
||||
["offset"]=>
|
||||
int(3600)
|
||||
int(%s)
|
||||
["isdst"]=>
|
||||
bool(true)
|
||||
bool(%s)
|
||||
["abbr"]=>
|
||||
string(3) "BST"
|
||||
string(%d) "%s"
|
||||
}
|
||||
10000002008-02-28T12:00:00+0000
|
||||
@@ -27,7 +27,7 @@ var_dump( getdate($timestamp) );
|
||||
-- Testing getdate\(\) function by passing float 12.3456789000e10 value to timestamp --
|
||||
array\(11\) {
|
||||
\["seconds"\]=>
|
||||
int\((36|0)\)
|
||||
int\((.+)\)
|
||||
\["minutes"\]=>
|
||||
int\((43|0)\)
|
||||
\["hours"\]=>
|
||||
@@ -53,7 +53,7 @@ array\(11\) {
|
||||
-- Testing getdate\(\) function by passing float -12.3456789000e10 value to timestamp --
|
||||
array\(11\) {
|
||||
\["seconds"\]=>
|
||||
int\((44|12|20)\)
|
||||
int\((.+)\)
|
||||
\["minutes"\]=>
|
||||
int\((39|23)\)
|
||||
\["hours"\]=>
|
||||
|
||||
@@ -24,7 +24,7 @@ foreach ($tzs as $tz) {
|
||||
echo "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
America/Toronto
|
||||
Y: 0 - January 2000-01-01T01:01:01-0500
|
||||
Y: 69 - January 2069-01-01T01:01:01-0500
|
||||
@@ -32,11 +32,11 @@ Y: 70 - January 1970-01-01T01:01:01-0500
|
||||
Y: 71 - January 1971-01-01T01:01:01-0500
|
||||
Y: 99 - January 1999-01-01T01:01:01-0500
|
||||
Y: 100 - January 2000-01-01T01:01:01-0500
|
||||
Y: 101 - January 0101-01-01T01:01:01-0500
|
||||
Y: 105 - January 0105-01-01T01:01:01-0500
|
||||
Y: 110 - January 0110-01-01T01:01:01-0500
|
||||
Y: 1900 - January 1900-01-01T01:01:01-0500
|
||||
Y: 1901 - January 1901-01-01T01:01:01-0500
|
||||
Y: 101 - January 0101-01-01T01:01:01-0%d
|
||||
Y: 105 - January 0105-01-01T01:01:01-0%d
|
||||
Y: 110 - January 0110-01-01T01:01:01-0%d
|
||||
Y: 1900 - January 1900-01-01T01:01:01-0%d
|
||||
Y: 1901 - January 1901-01-01T01:01:01-0%d
|
||||
Y: 1902 - January 1902-01-01T01:01:01-0500
|
||||
Y: 1999 - January 1999-01-01T01:01:01-0500
|
||||
Y: 2000 - January 2000-01-01T01:01:01-0500
|
||||
@@ -49,11 +49,11 @@ Y: 70 - January 1970-01-01T01:01:01+0100
|
||||
Y: 71 - January 1971-01-01T01:01:01+0100
|
||||
Y: 99 - January 1999-01-01T01:01:01+0100
|
||||
Y: 100 - January 2000-01-01T01:01:01+0100
|
||||
Y: 101 - January 0101-01-01T01:01:01+0100
|
||||
Y: 105 - January 0105-01-01T01:01:01+0100
|
||||
Y: 110 - January 0110-01-01T01:01:01+0100
|
||||
Y: 1900 - January 1900-01-01T01:01:01+0100
|
||||
Y: 1901 - January 1901-01-01T01:01:01+0100
|
||||
Y: 101 - January 0101-01-01T01:01:01+0%d
|
||||
Y: 105 - January 0105-01-01T01:01:01+0%d
|
||||
Y: 110 - January 0110-01-01T01:01:01+0%d
|
||||
Y: 1900 - January 1900-01-01T01:01:01+0%d
|
||||
Y: 1901 - January 1901-01-01T01:01:01+0%d
|
||||
Y: 1902 - January 1902-01-01T01:01:01+0100
|
||||
Y: 1999 - January 1999-01-01T01:01:01+0100
|
||||
Y: 2000 - January 2000-01-01T01:01:01+0100
|
||||
|
||||
@@ -18,24 +18,24 @@ $tz = timezone_open("Europe/London");
|
||||
|
||||
$tran = timezone_transitions_get($tz);
|
||||
|
||||
echo "\n-- Get all transitions --\n";
|
||||
$tran = timezone_transitions_get($tz);
|
||||
echo "\n-- Get all 60s transitions --\n";
|
||||
$tran = timezone_transitions_get($tz, -306972000, -37241999);
|
||||
var_dump( gettype($tran) );
|
||||
|
||||
echo "\n-- Total number of transitions: " . count($tran). " --\n";
|
||||
|
||||
echo "\n-- Format a sample entry pfor Spring 1963 --\n";
|
||||
var_dump( $tran[97] );
|
||||
var_dump( $tran[6] );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
*** Testing timezone_transitions_get() : basic functionality ***
|
||||
|
||||
-- Get all transitions --
|
||||
-- Get all 60s transitions --
|
||||
string(5) "array"
|
||||
|
||||
-- Total number of transitions: 243 --
|
||||
-- Total number of transitions: 18 --
|
||||
|
||||
-- Format a sample entry pfor Spring 1963 --
|
||||
array(5) {
|
||||
|
||||
+1
-1
@@ -914,7 +914,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
RETURN_FALSE;
|
||||
#ifdef F_SETFL
|
||||
} else if (modenr == DBA_CREAT) {
|
||||
int flags = fcntl(info->fd, F_SETFL);
|
||||
int flags = fcntl(info->fd, F_GETFL);
|
||||
fcntl(info->fd, F_SETFL, flags & ~O_APPEND);
|
||||
#endif
|
||||
}
|
||||
|
||||
+59
-55
@@ -187,10 +187,10 @@ ZEND_END_ARG_INFO();
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* class DOMDocument extends DOMNode
|
||||
* class DOMDocument extends DOMNode
|
||||
*
|
||||
* URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-i-Document
|
||||
* Since:
|
||||
* Since:
|
||||
*/
|
||||
|
||||
const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
|
||||
@@ -235,10 +235,10 @@ const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ docType DOMDocumentType
|
||||
readonly=yes
|
||||
/* {{{ docType DOMDocumentType
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-B63ED1A31
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -266,15 +266,15 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ implementation DOMImplementation
|
||||
readonly=yes
|
||||
/* {{{ implementation DOMImplementation
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1B793EBA
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -285,10 +285,10 @@ int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ documentElement DOMElement
|
||||
readonly=yes
|
||||
/* {{{ documentElement DOMElement
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-87CD092
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -384,8 +384,8 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ standalone boolean
|
||||
readonly=no
|
||||
/* {{{ standalone boolean
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-standalone
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -443,7 +443,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ version string
|
||||
/* {{{ version string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-version
|
||||
Since: DOM Level 3
|
||||
@@ -501,8 +501,8 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ strictErrorChecking boolean
|
||||
readonly=no
|
||||
/* {{{ strictErrorChecking boolean
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-strictErrorChecking
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -541,7 +541,7 @@ int dom_document_strict_error_checking_write(dom_object *obj, zval *newval TSRML
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ formatOutput boolean
|
||||
/* {{{ formatOutput boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_format_output_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -578,7 +578,7 @@ int dom_document_format_output_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ validateOnParse boolean
|
||||
/* {{{ validateOnParse boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_validate_on_parse_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -615,7 +615,7 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ resolveExternals boolean
|
||||
/* {{{ resolveExternals boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_resolve_externals_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -652,7 +652,7 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ preserveWhiteSpace boolean
|
||||
/* {{{ preserveWhiteSpace boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_preserve_whitespace_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -689,7 +689,7 @@ int dom_document_preserve_whitespace_write(dom_object *obj, zval *newval TSRMLS_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ recover boolean
|
||||
/* {{{ recover boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_recover_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -726,7 +726,7 @@ int dom_document_recover_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ substituteEntities boolean
|
||||
/* {{{ substituteEntities boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_substitue_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -763,8 +763,8 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ documentURI string
|
||||
readonly=no
|
||||
/* {{{ documentURI string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-documentURI
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -820,8 +820,8 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ config DOMConfiguration
|
||||
readonly=yes
|
||||
/* {{{ config DOMConfiguration
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-config
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -836,7 +836,7 @@ int dom_document_config_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_element)
|
||||
{
|
||||
@@ -869,7 +869,7 @@ PHP_FUNCTION(dom_document_create_element)
|
||||
|
||||
/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment();
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_document_fragment)
|
||||
{
|
||||
@@ -896,7 +896,7 @@ PHP_FUNCTION(dom_document_create_document_fragment)
|
||||
|
||||
/* {{{ proto DOMText dom_document_create_text_node(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_text_node)
|
||||
{
|
||||
@@ -924,7 +924,7 @@ PHP_FUNCTION(dom_document_create_text_node)
|
||||
|
||||
/* {{{ proto DOMComment dom_document_create_comment(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_comment)
|
||||
{
|
||||
@@ -952,7 +952,7 @@ PHP_FUNCTION(dom_document_create_comment)
|
||||
|
||||
/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_cdatasection)
|
||||
{
|
||||
@@ -980,7 +980,7 @@ PHP_FUNCTION(dom_document_create_cdatasection)
|
||||
|
||||
/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_processing_instruction)
|
||||
{
|
||||
@@ -1015,7 +1015,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
|
||||
|
||||
/* {{{ proto DOMAttr dom_document_create_attribute(string name);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_attribute)
|
||||
{
|
||||
@@ -1049,7 +1049,7 @@ PHP_FUNCTION(dom_document_create_attribute)
|
||||
|
||||
/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_entity_reference)
|
||||
{
|
||||
@@ -1082,7 +1082,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
|
||||
|
||||
/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_get_elements_by_tag_name)
|
||||
{
|
||||
@@ -1116,7 +1116,7 @@ PHP_FUNCTION(dom_document_import_node)
|
||||
xmlDocPtr docp;
|
||||
xmlNodePtr nodep, retnodep;
|
||||
dom_object *intern, *nodeobj;
|
||||
int ret;
|
||||
int ret;
|
||||
long recursive = 0;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) {
|
||||
@@ -1127,7 +1127,7 @@ PHP_FUNCTION(dom_document_import_node)
|
||||
|
||||
DOM_GET_OBJ(nodep, node, xmlNodePtr, nodeobj);
|
||||
|
||||
if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE
|
||||
if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE
|
||||
|| nodep->type == XML_DOCUMENT_TYPE_NODE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot import: Node Type Not Supported");
|
||||
RETURN_FALSE;
|
||||
@@ -1217,7 +1217,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nodep->ns = nsptr;
|
||||
|
||||
DOM_RET_OBJ(nodep, &ret, intern);
|
||||
@@ -1519,11 +1519,15 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int sourc
|
||||
xmlInitParser();
|
||||
|
||||
if (mode == DOM_LOAD_FILE) {
|
||||
char *file_dest = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
char *file_dest;
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
return NULL;
|
||||
}
|
||||
file_dest = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (file_dest) {
|
||||
ctxt = xmlCreateFileParserCtxt(file_dest);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
ctxt = xmlCreateMemoryParserCtxt(source, source_len);
|
||||
}
|
||||
@@ -1845,7 +1849,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
zval *id;
|
||||
xmlDoc *docp;
|
||||
xmlNodePtr root;
|
||||
long flags = 0;
|
||||
long flags = 0;
|
||||
int err;
|
||||
dom_object *intern;
|
||||
|
||||
@@ -1858,7 +1862,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
err = xmlXIncludeProcessFlags(docp, flags);
|
||||
|
||||
/* XML_XINCLUDE_START and XML_XINCLUDE_END nodes need to be removed as these
|
||||
are added via xmlXIncludeProcess to mark beginning and ending of xincluded document
|
||||
are added via xmlXIncludeProcess to mark beginning and ending of xincluded document
|
||||
but are not wanted in resulting document - must be done even if err as it could fail after
|
||||
having processed some xincludes */
|
||||
root = (xmlNodePtr) docp->children;
|
||||
@@ -1874,7 +1878,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1895,19 +1899,19 @@ PHP_FUNCTION(dom_document_validate)
|
||||
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
|
||||
|
||||
cvp = xmlNewValidCtxt();
|
||||
|
||||
|
||||
cvp->userData = NULL;
|
||||
cvp->error = (xmlValidityErrorFunc) php_libxml_error_handler;
|
||||
cvp->warning = (xmlValidityErrorFunc) php_libxml_error_handler;
|
||||
|
||||
|
||||
if (xmlValidateDocument(cvp, docp)) {
|
||||
RETVAL_TRUE;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
xmlFreeValidCtxt(cvp);
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1948,7 +1952,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
break;
|
||||
case DOM_LOAD_STRING:
|
||||
parser = xmlSchemaNewMemParserCtxt(source, source_len);
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
but it is not apparent how to do that for schema's */
|
||||
break;
|
||||
default:
|
||||
@@ -2044,7 +2048,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
break;
|
||||
case DOM_LOAD_STRING:
|
||||
parser = xmlRelaxNGNewMemParserCtxt(source, source_len);
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
but it is not apparent how to do that for schema's */
|
||||
break;
|
||||
default:
|
||||
@@ -2112,10 +2116,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
int source_len, refcount, ret;
|
||||
long options = 0;
|
||||
htmlParserCtxtPtr ctxt;
|
||||
|
||||
|
||||
id = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &source, &source_len, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2148,7 +2152,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
htmlParseDocument(ctxt);
|
||||
newdoc = ctxt->myDoc;
|
||||
htmlFreeParserCtxt(ctxt);
|
||||
|
||||
|
||||
if (!newdoc)
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -2270,13 +2274,13 @@ PHP_FUNCTION(dom_document_save_html)
|
||||
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
buf = xmlBufferCreate();
|
||||
if (!buf) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch buffer");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (node->type == XML_DOCUMENT_FRAG_NODE) {
|
||||
int one_size;
|
||||
|
||||
|
||||
@@ -13,6 +13,11 @@ assert.bail=true
|
||||
$doc = new DOMDocument();
|
||||
$result = $doc->loadHTMLFile("");
|
||||
assert('$result === false');
|
||||
$doc = new DOMDocument();
|
||||
$result = $doc->loadHTMLFile("text.html\0something");
|
||||
assert('$result === null');
|
||||
?>
|
||||
--EXPECTF--
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Empty string supplied as input %s
|
||||
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile() expects parameter 1 to be a valid path, string given %s
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #68799 (Free called on unitialized pointer)
|
||||
Bug #68799 (Free called on uninitialized pointer)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
|
||||
@@ -508,6 +508,11 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
|
||||
RETVAL_FALSE;
|
||||
goto clean;
|
||||
}
|
||||
if (CHECK_NULL_PATH(buffer, buffer_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETVAL_FALSE;
|
||||
goto clean;
|
||||
}
|
||||
|
||||
wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -1072,6 +1072,9 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
if (bytecnt > nbytes) {
|
||||
bytecnt = nbytes;
|
||||
}
|
||||
if (offset > bytecnt) {
|
||||
offset = bytecnt;
|
||||
}
|
||||
if (s == NULL) {
|
||||
ms->search.s_len = 0;
|
||||
ms->search.s = NULL;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #68819 Fileinfo on specific file causes spurious OOM and/or segfault, var 1
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$string = <<<HERE
|
||||
----a-----'''---------a---------------a--------a-----a-----a---------a-----as-------a----a--a-------------a--as-----s---------------a---------a---a--s-a-----a-----------asy---------a-----a-----------a----s--------a-------------a-------a--------a----s------------a-----a----------------a----s-----------------\r\n-------------------a-------a-a-------a-----a----a----s----s--------a-----------------------a----a----s-------------a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a----s----s--------a----------a----------------------a----a----s-------------a----------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n------a-------a-a-------a-----a----a---a-----a-----------------------a----a---a-----a------------------s-------a----a---a-----a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s------\r\n-------------------a-------a-a-------a-----a----a---a-------a------------------------a----a---a-----''--a-------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a-------s-----a---a-------------------------a----a-------------a---a-------------------s-------a----a-------------a---a-----as-a--------------a-----a--s----s---------y------------a-----a-s---a-------''----a---s--a-''------''----s------------a-y----------------s------a-----y--a-s--a-s------s--a-s----------''----------------------------a---s--a----a---------a-s---a-s--------s--------a---------s--a-y-------------as----a----a-------------a------a---s--a-s------a--------a----s----y--as--a----a-s---------------a-----a--------------------------------------\r\n-------------------a-------a-a-------a-----a----a-----------s--------a-----------------------a----a--------------------a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a-----------s--------a----------a----------------------a----a--------------------a------------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a---a-----------------------a----a---a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a---a----------a----------------------a----a---a------------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-----a-a-----------a-------a-a-------a-----a----a----a---s-----a-----------------------a----a----a---------a-----------------s-------a----a----a---------a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a--------a----a-----------------------a----a----------a----a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-----a-------------a-------a-a-------a-----a----a--------s-----a---a-------------------------a----a--------------a---a-------------------s-------------a---------------a----a---a---a-----as-a--------------a-----a--s----s---------y------------a-----a-s---a-------''----a---s--a-''------''----s------------a-y----------------s------a-----y--a-s--a-s------s--a-s----------''----------------------------a---s--a----a---------a-s---a-s--------s--------a---------s--a-y-------------as----a----a-------------a------a---s--a-s------a--------a----s----y--as--a----a-s---------------a-----a-----------Line truncated
|
||||
HERE;
|
||||
|
||||
$finfo = new finfo();
|
||||
$type = $finfo->buffer($string);
|
||||
|
||||
var_dump($type);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(60) "ASCII text, with very long lines, with CRLF line terminators"
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #68819 Fileinfo on specific file causes spurious OOM and/or segfault, var 2
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$string = '';
|
||||
|
||||
// These two in any order
|
||||
$string .= "\r\n";
|
||||
$string .= "''''";
|
||||
|
||||
// Total string length > 8192
|
||||
$string .= str_repeat(chr(rand(32, 127)), 8184);
|
||||
|
||||
// Ending in this string
|
||||
$string .= "say";
|
||||
|
||||
$finfo = new finfo();
|
||||
$type = $finfo->buffer($string);
|
||||
var_dump($type);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(60) "ASCII text, with very long lines, with CRLF line terminators"
|
||||
@@ -19,6 +19,7 @@ echo "*** Testing finfo_file() : basic functionality ***\n";
|
||||
var_dump( finfo_file( $finfo, __FILE__) );
|
||||
var_dump( finfo_file( $finfo, __FILE__, FILEINFO_CONTINUE ) );
|
||||
var_dump( finfo_file( $finfo, $magicFile ) );
|
||||
var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
@@ -27,4 +28,7 @@ var_dump( finfo_file( $finfo, $magicFile ) );
|
||||
string(28) "text/x-php; charset=us-ascii"
|
||||
string(22) "PHP script, ASCII text"
|
||||
string(25) "text/plain; charset=utf-8"
|
||||
|
||||
Warning: finfo_file(): Invalid path in %s%efinfo_file_basic.php on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
+41
-41
@@ -188,9 +188,9 @@ ftp_close(ftpbuf_t *ftp)
|
||||
SSL_shutdown(ftp->ssl_handle);
|
||||
SSL_free(ftp->ssl_handle);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
closesocket(ftp->fd);
|
||||
}
|
||||
}
|
||||
ftp_gc(ftp);
|
||||
efree(ftp);
|
||||
return NULL;
|
||||
@@ -262,7 +262,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
|
||||
if (!ftp_getresp(ftp)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (ftp->resp != 234) {
|
||||
if (!ftp_putcmd(ftp, "AUTH", "SSL")) {
|
||||
return 0;
|
||||
@@ -270,7 +270,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
|
||||
if (!ftp_getresp(ftp)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (ftp->resp != 334) {
|
||||
return 0;
|
||||
} else {
|
||||
@@ -278,7 +278,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
|
||||
ftp->use_ssl_for_data = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ctx = SSL_CTX_new(SSLv23_client_method());
|
||||
if (ctx == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create the SSL context");
|
||||
@@ -325,8 +325,8 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
|
||||
if (!ftp_getresp(ftp)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ftp->use_ssl_for_data = (ftp->resp >= 200 && ftp->resp <=299);
|
||||
|
||||
ftp->use_ssl_for_data = (ftp->resp >= 200 && ftp->resp <=299);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -360,7 +360,7 @@ ftp_reinit(ftpbuf_t *ftp)
|
||||
{
|
||||
if (ftp == NULL) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ftp_gc(ftp);
|
||||
|
||||
@@ -395,7 +395,7 @@ ftp_syst(ftpbuf_t *ftp)
|
||||
if (!ftp_putcmd(ftp, "SYST", NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 215) {
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 215) {
|
||||
return NULL;
|
||||
}
|
||||
syst = ftp->inbuf;
|
||||
@@ -431,14 +431,14 @@ ftp_pwd(ftpbuf_t *ftp)
|
||||
if (!ftp_putcmd(ftp, "PWD", NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 257) {
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 257) {
|
||||
return NULL;
|
||||
}
|
||||
/* copy out the pwd from response */
|
||||
if ((pwd = strchr(ftp->inbuf, '"')) == NULL) {
|
||||
if ((pwd = strchr(ftp->inbuf, '"')) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if ((end = strrchr(++pwd, '"')) == NULL) {
|
||||
if ((end = strrchr(++pwd, '"')) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ftp->pwd = estrndup(pwd, end - pwd);
|
||||
@@ -608,7 +608,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 200) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -625,7 +625,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
|
||||
}
|
||||
|
||||
snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
|
||||
|
||||
|
||||
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -642,7 +642,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -674,7 +674,7 @@ ftp_type(ftpbuf_t *ftp, ftptype_t type)
|
||||
if (ftp == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (type == ftp->type) {
|
||||
if (type == ftp->type) {
|
||||
return 1;
|
||||
}
|
||||
if (type == FTPTYPE_ASCII) {
|
||||
@@ -765,7 +765,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
|
||||
if (!ftp_putcmd(ftp, "PASV", NULL)) {
|
||||
return 0;
|
||||
}
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 227) {
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 227) {
|
||||
return 0;
|
||||
}
|
||||
/* parse out the IP and port */
|
||||
@@ -807,7 +807,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
||||
ftp->data = data;
|
||||
|
||||
if (resumepos > 0) {
|
||||
@@ -900,7 +900,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, l
|
||||
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data;
|
||||
ftp->data = data;
|
||||
|
||||
if (startpos > 0) {
|
||||
snprintf(arg, sizeof(arg), "%ld", startpos);
|
||||
@@ -1101,7 +1101,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
|
||||
|
||||
if (strpbrk(cmd, "\r\n")) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* build the output buffer */
|
||||
if (args && args[0]) {
|
||||
/* "cmd args\r\n\0" */
|
||||
@@ -1247,7 +1247,7 @@ my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
|
||||
sent = SSL_write(ftp->ssl_handle, buf, size);
|
||||
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
|
||||
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
|
||||
sent = SSL_write(ftp->data->ssl_handle, buf, size);
|
||||
} else {
|
||||
#endif
|
||||
@@ -1287,14 +1287,14 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
|
||||
nr_bytes = SSL_read(ftp->ssl_handle, buf, len);
|
||||
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
|
||||
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
|
||||
nr_bytes = SSL_read(ftp->data->ssl_handle, buf, len);
|
||||
} else {
|
||||
#endif
|
||||
nr_bytes = recv(s, buf, len, 0);
|
||||
#if HAVE_OPENSSL_EXT
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return (nr_bytes);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1511,7 +1511,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC)
|
||||
|
||||
data_accepted:
|
||||
#if HAVE_OPENSSL_EXT
|
||||
|
||||
|
||||
/* now enable ssl if we need to */
|
||||
if (ftp->use_ssl && ftp->use_ssl_for_data) {
|
||||
ctx = SSL_CTX_new(SSLv23_client_method());
|
||||
@@ -1531,23 +1531,23 @@ data_accepted:
|
||||
SSL_CTX_free(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SSL_set_fd(data->ssl_handle, data->fd);
|
||||
|
||||
if (ftp->old_ssl) {
|
||||
SSL_copy_session_id(data->ssl_handle, ftp->ssl_handle);
|
||||
}
|
||||
|
||||
|
||||
if (SSL_connect(data->ssl_handle) <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: SSL/TLS handshake failed");
|
||||
SSL_shutdown(data->ssl_handle);
|
||||
SSL_free(data->ssl_handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
data->ssl_active = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1562,14 +1562,14 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
|
||||
{
|
||||
#if HAVE_OPENSSL_EXT
|
||||
SSL_CTX *ctx;
|
||||
#endif
|
||||
#endif
|
||||
if (data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (data->listener != -1) {
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (data->ssl_active) {
|
||||
|
||||
|
||||
ctx = SSL_get_SSL_CTX(data->ssl_handle);
|
||||
SSL_CTX_free(ctx);
|
||||
|
||||
@@ -1577,9 +1577,9 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
|
||||
SSL_free(data->ssl_handle);
|
||||
data->ssl_active = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
closesocket(data->listener);
|
||||
}
|
||||
}
|
||||
if (data->fd != -1) {
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (data->ssl_active) {
|
||||
@@ -1590,9 +1590,9 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
|
||||
SSL_free(data->ssl_handle);
|
||||
data->ssl_active = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
closesocket(data->fd);
|
||||
}
|
||||
}
|
||||
if (ftp) {
|
||||
ftp->data = NULL;
|
||||
}
|
||||
@@ -1610,8 +1610,8 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
databuf_t *data = NULL;
|
||||
char *ptr;
|
||||
int ch, lastch;
|
||||
int size, rcvd;
|
||||
int lines;
|
||||
size_t size, rcvd;
|
||||
size_t lines;
|
||||
char **ret = NULL;
|
||||
char **entry;
|
||||
char *text;
|
||||
@@ -1629,7 +1629,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data;
|
||||
ftp->data = data;
|
||||
|
||||
if (!ftp_putcmd(ftp, cmd, path)) {
|
||||
goto bail;
|
||||
@@ -1653,7 +1653,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
lines = 0;
|
||||
lastch = 0;
|
||||
while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
|
||||
if (rcvd == -1) {
|
||||
if (rcvd == -1 || rcvd > ((size_t)(-1))-size) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@@ -1858,7 +1858,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
|
||||
goto bail;
|
||||
}
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data;
|
||||
@@ -1914,7 +1914,7 @@ ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC)
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data_close(ftp, ftp->data);
|
||||
|
||||
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
+4
-4
@@ -1432,7 +1432,7 @@ PHP_FUNCTION(imageloadfont)
|
||||
gdFontPtr font;
|
||||
php_stream *stream;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_name) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_name) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2369,7 +2369,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
long ignore_warning;
|
||||
|
||||
if (image_type == PHP_GDIMG_TYPE_GD2PART) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (width < 1 || height < 1) {
|
||||
@@ -2377,7 +2377,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4046,7 +4046,7 @@ PHP_FUNCTION(imagepsencodefont)
|
||||
char *enc, **enc_vector;
|
||||
int enc_len, *f_ind;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &fnt, &enc, &enc_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &fnt, &enc, &enc_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Testing that imageloadfont() breaks on non-string first parameter
|
||||
--CREDITS--
|
||||
Neveo Harrison <neveoo [at] gmail [dot] com> #testfest #tek11
|
||||
--SKIPIF--
|
||||
<?php
|
||||
<?php
|
||||
if (!extension_loaded("gd")) die("skip GD not present");
|
||||
?>
|
||||
--FILE--
|
||||
@@ -11,5 +11,5 @@ Neveo Harrison <neveoo [at] gmail [dot] com> #testfest #tek11
|
||||
var_dump( imageloadfont(array()) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imageloadfont() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
Warning: imageloadfont() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
+8
-3
@@ -238,6 +238,9 @@ typedef struct _gmp_temp {
|
||||
#define GMP_42_OR_NEWER \
|
||||
((__GNU_MP_VERSION >= 5) || (__GNU_MP_VERSION >= 4 && __GNU_MP_VERSION_MINOR >= 2))
|
||||
|
||||
#define GMP_51_OR_NEWER \
|
||||
((__GNU_MP_VERSION >= 6) || (__GNU_MP_VERSION >= 5 && __GNU_MP_VERSION_MINOR >= 1))
|
||||
|
||||
/* The maximum base for input and output conversions is 62 from GMP 4.2
|
||||
* onwards. */
|
||||
#if GMP_42_OR_NEWER
|
||||
@@ -1428,11 +1431,12 @@ ZEND_FUNCTION(gmp_pow)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INIT_GMP_RETVAL(gmpnum_result);
|
||||
if (Z_TYPE_P(base_arg) == IS_LONG && Z_LVAL_P(base_arg) >= 0) {
|
||||
INIT_GMP_RETVAL(gmpnum_result);
|
||||
mpz_ui_pow_ui(gmpnum_result, Z_LVAL_P(base_arg), exp);
|
||||
} else {
|
||||
FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base);
|
||||
INIT_GMP_RETVAL(gmpnum_result);
|
||||
mpz_pow_ui(gmpnum_result, gmpnum_base, exp);
|
||||
FREE_GMP_TEMP(temp_base);
|
||||
}
|
||||
@@ -1606,13 +1610,14 @@ ZEND_FUNCTION(gmp_rootrem)
|
||||
add_index_zval(return_value, 0, gmp_create(&gmpnum_result1 TSRMLS_CC));
|
||||
add_index_zval(return_value, 1, gmp_create(&gmpnum_result2 TSRMLS_CC));
|
||||
|
||||
#if GMP_42_OR_NEWER
|
||||
#if GMP_51_OR_NEWER
|
||||
/* mpz_rootrem() is supported since GMP 4.2, but buggy wrt odd roots
|
||||
* of negative numbers */
|
||||
mpz_rootrem(gmpnum_result1, gmpnum_result2, gmpnum_a, (unsigned long) nth);
|
||||
#else
|
||||
mpz_root(gmpnum_result1, gmpnum_a, (unsigned long) nth);
|
||||
mpz_pow_ui(gmpnum_result2, gmpnum_result1, (unsigned long) nth);
|
||||
mpz_sub(gmpnum_result2, gmpnum_a, gmpnum_result2);
|
||||
mpz_abs(gmpnum_result2, gmpnum_result2);
|
||||
#endif
|
||||
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
|
||||
@@ -13,7 +13,7 @@ var_dump(gmp_random_bits(-1));
|
||||
gmp_random_bits(1);
|
||||
gmp_random_bits(1024);
|
||||
|
||||
// 2 seconds to make sure the numbers stay in range
|
||||
// 0.5 seconds to make sure the numbers stay in range
|
||||
$start = microtime(true);
|
||||
$limit = (2 ** 30) - 1;
|
||||
while (1) {
|
||||
@@ -26,7 +26,7 @@ while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
if (microtime(true) - $start > 2) {
|
||||
if (microtime(true) - $start > 0.5) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ gmp_random_range(-1, $plusTen);
|
||||
gmp_random_range($zero, $plusTen);
|
||||
gmp_random_range($minusTen, $plusTen);
|
||||
|
||||
// 2 seconds to make sure the numbers stay in range
|
||||
// 0.5 seconds to make sure the numbers stay in range
|
||||
$start = microtime(true);
|
||||
while (1) {
|
||||
for ($i = 0; $i < 5000; $i++) {
|
||||
@@ -56,7 +56,7 @@ while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
if (microtime(true) - $start > 2) {
|
||||
if (microtime(true) - $start > 0.5) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ array(2) {
|
||||
[1]=>
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(2) "36"
|
||||
string(3) "-36"
|
||||
}
|
||||
}
|
||||
array(2) {
|
||||
|
||||
+6
-1
@@ -143,6 +143,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
|
||||
}
|
||||
if (isfilename) {
|
||||
if (CHECK_NULL_PATH(data, data_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
|
||||
@@ -258,6 +259,10 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (isfilename) {
|
||||
if (CHECK_NULL_PATH(data, data_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
|
||||
if (!stream) {
|
||||
/* Stream will report errors opening file */
|
||||
@@ -462,7 +467,7 @@ PHP_FUNCTION(hash_update_file)
|
||||
char *filename, buf[1024];
|
||||
int filename_len, n;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ hash_hmac_file('crc32', $file, $key, TRUE, $extra_arg);
|
||||
echo "\n-- Testing hash_hmac_file() function with invalid hash algorithm --\n";
|
||||
hash_hmac_file('foo', $file, $key, TRUE);
|
||||
|
||||
echo "\n-- Testing hash_hmac_file() function with bad path --\n";
|
||||
hash_hmac_file('crc32', $file.chr(0).$file, $key, TRUE);
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
@@ -51,4 +54,8 @@ Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d
|
||||
-- Testing hash_hmac_file() function with invalid hash algorithm --
|
||||
|
||||
Warning: hash_hmac_file(): Unknown hashing algorithm: foo in %s on line %d
|
||||
|
||||
-- Testing hash_hmac_file() function with bad path --
|
||||
|
||||
Warning: hash_hmac_file(): Invalid path in %s on line %d
|
||||
===Done===
|
||||
+1
-1
@@ -9,7 +9,7 @@ if test "$PHP_JSON" != "no"; then
|
||||
AC_DEFINE([HAVE_JSON],1 ,[whether to enable JavaScript Object Serialization support])
|
||||
AC_HEADER_STDC
|
||||
|
||||
PHP_NEW_EXTENSION(json, json.c utf8_decode.c JSON_parser.c, $ext_shared)
|
||||
PHP_NEW_EXTENSION(json, json.c JSON_parser.c, $ext_shared)
|
||||
PHP_INSTALL_HEADERS([ext/json], [php_json.h])
|
||||
PHP_SUBST(JSON_SHARED_LIBADD)
|
||||
fi
|
||||
+1
-1
@@ -5,7 +5,7 @@ ARG_ENABLE("json", "JavaScript Object Serialization support", "yes");
|
||||
|
||||
if (PHP_JSON != "no") {
|
||||
EXTENSION('json', 'json.c', PHP_JSON_SHARED, "");
|
||||
ADD_SOURCES(configure_module_dirname, "JSON_parser.c utf8_decode.c", "json");
|
||||
ADD_SOURCES(configure_module_dirname, "JSON_parser.c", "json");
|
||||
PHP_INSTALL_HEADERS("ext/json/", "php_json.h");
|
||||
}
|
||||
|
||||
@@ -102,22 +102,6 @@ SOURCE=.\JSON_parser.c
|
||||
|
||||
SOURCE=.\JSON_parser.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\utf8_decode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\utf8_decode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\utf8_to_utf16.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\utf8_to_utf16.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
<file role="src" name="JSON_parser.c" />
|
||||
<file role="src" name="JSON_parser.h" />
|
||||
<file role="src" name="php_json.h" />
|
||||
<file role="src" name="utf8_decode.c" />
|
||||
<file role="src" name="utf8_decode.h" />
|
||||
<file role="src" name="utf8_to_utf16.c" />
|
||||
<file role="src" name="utf8_to_utf16.h" />
|
||||
<dir role="test" name="tests">
|
||||
<file role="test" name="fail001.phpt" />
|
||||
<file role="test" name="pass001.phpt" />
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
/* utf8_decode.c */
|
||||
|
||||
/* 2005-12-25 */
|
||||
|
||||
/*
|
||||
Copyright (c) 2005 JSON.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
The Software shall be used for Good, not Evil.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "utf8_decode.h"
|
||||
|
||||
/*
|
||||
Very Strict UTF-8 Decoder
|
||||
|
||||
UTF-8 is a multibyte character encoding of Unicode. A character can be
|
||||
represented by 1-4 bytes. The bit pattern of the first byte indicates the
|
||||
number of continuation bytes.
|
||||
|
||||
Most UTF-8 decoders tend to be lenient, attempting to recover as much
|
||||
information as possible, even from badly encoded input. This UTF-8
|
||||
decoder is not lenient. It will reject input which does not include
|
||||
proper continuation bytes. It will reject aliases (or suboptimal
|
||||
codings). It will reject surrogates. (Surrogate encoding should only be
|
||||
used with UTF-16.)
|
||||
|
||||
Code Contination Minimum Maximum
|
||||
0xxxxxxx 0 0 127
|
||||
10xxxxxx error
|
||||
110xxxxx 1 128 2047
|
||||
1110xxxx 2 2048 65535 excluding 55296 - 57343
|
||||
11110xxx 3 65536 1114111
|
||||
11111xxx error
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Get the next byte. It returns UTF8_END if there are no more bytes.
|
||||
*/
|
||||
static int
|
||||
get(json_utf8_decode *utf8)
|
||||
{
|
||||
int c;
|
||||
if (utf8->the_index >= utf8->the_length) {
|
||||
return UTF8_END;
|
||||
}
|
||||
c = utf8->the_input[utf8->the_index] & 0xFF;
|
||||
utf8->the_index += 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get the 6-bit payload of the next continuation byte.
|
||||
Return UTF8_ERROR if it is not a contination byte.
|
||||
*/
|
||||
static int
|
||||
cont(json_utf8_decode *utf8)
|
||||
{
|
||||
int c = get(utf8);
|
||||
return ((c & 0xC0) == 0x80) ? (c & 0x3F) : UTF8_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Initialize the UTF-8 decoder. The decoder is not reentrant,
|
||||
*/
|
||||
void
|
||||
utf8_decode_init(json_utf8_decode *utf8, char p[], int length)
|
||||
{
|
||||
utf8->the_index = 0;
|
||||
utf8->the_input = p;
|
||||
utf8->the_length = length;
|
||||
utf8->the_char = 0;
|
||||
utf8->the_byte = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get the current byte offset. This is generally used in error reporting.
|
||||
*/
|
||||
int
|
||||
utf8_decode_at_byte(json_utf8_decode *utf8)
|
||||
{
|
||||
return utf8->the_byte;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get the current character offset. This is generally used in error reporting.
|
||||
The character offset matches the byte offset if the text is strictly ASCII.
|
||||
*/
|
||||
int
|
||||
utf8_decode_at_character(json_utf8_decode *utf8)
|
||||
{
|
||||
return utf8->the_char > 0 ? utf8->the_char - 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Extract the next character.
|
||||
Returns: the character (between 0 and 1114111)
|
||||
or UTF8_END (the end)
|
||||
or UTF8_ERROR (error)
|
||||
*/
|
||||
int
|
||||
utf8_decode_next(json_utf8_decode *utf8)
|
||||
{
|
||||
int c; /* the first byte of the character */
|
||||
int r; /* the result */
|
||||
|
||||
if (utf8->the_index >= utf8->the_length) {
|
||||
return utf8->the_index == utf8->the_length ? UTF8_END : UTF8_ERROR;
|
||||
}
|
||||
utf8->the_byte = utf8->the_index;
|
||||
utf8->the_char += 1;
|
||||
c = get(utf8);
|
||||
/*
|
||||
Zero continuation (0 to 127)
|
||||
*/
|
||||
if ((c & 0x80) == 0) {
|
||||
return c;
|
||||
}
|
||||
/*
|
||||
One contination (128 to 2047)
|
||||
*/
|
||||
if ((c & 0xE0) == 0xC0) {
|
||||
int c1 = cont(utf8);
|
||||
if (c1 < 0) {
|
||||
return UTF8_ERROR;
|
||||
}
|
||||
r = ((c & 0x1F) << 6) | c1;
|
||||
return r >= 128 ? r : UTF8_ERROR;
|
||||
}
|
||||
/*
|
||||
Two continuation (2048 to 55295 and 57344 to 65535)
|
||||
*/
|
||||
if ((c & 0xF0) == 0xE0) {
|
||||
int c1 = cont(utf8);
|
||||
int c2 = cont(utf8);
|
||||
if (c1 < 0 || c2 < 0) {
|
||||
return UTF8_ERROR;
|
||||
}
|
||||
r = ((c & 0x0F) << 12) | (c1 << 6) | c2;
|
||||
return r >= 2048 && (r < 55296 || r > 57343) ? r : UTF8_ERROR;
|
||||
}
|
||||
/*
|
||||
Three continuation (65536 to 1114111)
|
||||
*/
|
||||
if ((c & 0xF8) == 0xF0) {
|
||||
int c1 = cont(utf8);
|
||||
int c2 = cont(utf8);
|
||||
int c3 = cont(utf8);
|
||||
if (c1 < 0 || c2 < 0 || c3 < 0) {
|
||||
return UTF8_ERROR;
|
||||
}
|
||||
r = ((c & 0x0F) << 18) | (c1 << 12) | (c2 << 6) | c3;
|
||||
return r >= 65536 && r <= 1114111 ? r : UTF8_ERROR;
|
||||
}
|
||||
return UTF8_ERROR;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/* utf8_decode.h */
|
||||
|
||||
#define UTF8_END -1
|
||||
#define UTF8_ERROR -2
|
||||
|
||||
typedef struct json_utf8_decode
|
||||
{
|
||||
int the_index;
|
||||
char *the_input;
|
||||
int the_length;
|
||||
int the_char;
|
||||
int the_byte;
|
||||
} json_utf8_decode;
|
||||
|
||||
extern int utf8_decode_at_byte(json_utf8_decode *utf8);
|
||||
extern int utf8_decode_at_character(json_utf8_decode *utf8);
|
||||
extern void utf8_decode_init(json_utf8_decode *utf8, char p[], int length);
|
||||
extern int utf8_decode_next(json_utf8_decode *utf8);
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
RFC 2144 test vectors for CAST-128 in ECB mode (bug #62102)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mcrypt') OR print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$plaintext = "\x01\x23\x45\x67\x89\xAB\xCD\xEF";
|
||||
|
||||
echo
|
||||
|
||||
"128-bit: ",
|
||||
bin2hex(mcrypt_encrypt('cast-128', "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9A", $plaintext, 'ecb')),
|
||||
"\n",
|
||||
"80-bit: ",
|
||||
bin2hex(mcrypt_encrypt('cast-128', "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45", $plaintext, 'ecb')),
|
||||
"\n",
|
||||
"40-bit: ",
|
||||
bin2hex(mcrypt_encrypt('cast-128', "\x01\x23\x45\x67\x12", $plaintext, 'ecb')),
|
||||
"\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
128-bit: 238b4fe5847e44b2
|
||||
80-bit: eb6a711a2c02271b
|
||||
40-bit: 7ac816d16e9b302e
|
||||
@@ -199,7 +199,6 @@ mysqli_close($link);
|
||||
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
|
||||
printf("[008] %s [%d] %s\n", $column_def,
|
||||
mysqli_errno($link), mysqli_error($link));
|
||||
continue;
|
||||
}
|
||||
|
||||
$column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)');
|
||||
@@ -220,7 +219,6 @@ mysqli_close($link);
|
||||
while ($field = mysqli_fetch_field($res)) {
|
||||
if (!isset($expected_flags[$field->name])) {
|
||||
printf("[010] Found unexpected field '%s'\n", $field->name);
|
||||
continue;
|
||||
}
|
||||
list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags[$field->name], $flags);
|
||||
if ($unexpected_flags)
|
||||
|
||||
+28
-19
@@ -960,9 +960,9 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
|
||||
charextraalloc = 0;
|
||||
colfieldid = SQL_COLUMN_DISPLAY_SIZE;
|
||||
|
||||
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME,
|
||||
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME,
|
||||
result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
|
||||
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
|
||||
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
|
||||
NULL, 0, NULL, &result->values[i].coltype);
|
||||
|
||||
/* Don't bind LONG / BINARY columns, so that fetch behaviour can
|
||||
@@ -997,8 +997,17 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
|
||||
charextraalloc = 1;
|
||||
#endif
|
||||
default:
|
||||
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
|
||||
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
|
||||
NULL, 0, NULL, &displaysize);
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO && colfieldid == SQL_DESC_OCTET_LENGTH) {
|
||||
/* This is a quirk for ODBC 2.0 compatibility for broken driver implementations.
|
||||
*/
|
||||
charextraalloc = 1;
|
||||
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE,
|
||||
NULL, 0, NULL, &displaysize);
|
||||
}
|
||||
#endif
|
||||
/* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */
|
||||
if (result->values[i].coltype == SQL_TIMESTAMP) {
|
||||
displaysize += 3;
|
||||
@@ -1091,7 +1100,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len);
|
||||
PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len);
|
||||
|
||||
RETURN_LONG(len);
|
||||
}
|
||||
@@ -1181,7 +1190,7 @@ PHP_FUNCTION(odbc_prepare)
|
||||
|
||||
result->numparams = 0;
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -1609,7 +1618,7 @@ PHP_FUNCTION(odbc_exec)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
efree(result);
|
||||
@@ -2135,7 +2144,7 @@ PHP_FUNCTION(odbc_result)
|
||||
fieldsize = result->longreadlen;
|
||||
}
|
||||
} else {
|
||||
SQLColAttributes(result->stmt, (SQLUSMALLINT)(field_ind + 1),
|
||||
PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1),
|
||||
(SQLUSMALLINT)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH :
|
||||
SQL_COLUMN_DISPLAY_SIZE),
|
||||
NULL, 0, NULL, &fieldsize);
|
||||
@@ -2871,7 +2880,7 @@ PHP_FUNCTION(odbc_field_type)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
|
||||
PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
|
||||
RETURN_STRING(tmp,1)
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3110,7 +3119,7 @@ PHP_FUNCTION(odbc_tables)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3177,7 +3186,7 @@ PHP_FUNCTION(odbc_columns)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3247,7 +3256,7 @@ PHP_FUNCTION(odbc_columnprivileges)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3323,7 +3332,7 @@ PHP_FUNCTION(odbc_foreignkeys)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3389,7 +3398,7 @@ PHP_FUNCTION(odbc_gettypeinfo)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3446,7 +3455,7 @@ PHP_FUNCTION(odbc_primarykeys)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3512,7 +3521,7 @@ PHP_FUNCTION(odbc_procedurecolumns)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3579,7 +3588,7 @@ PHP_FUNCTION(odbc_procedures)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3647,7 +3656,7 @@ PHP_FUNCTION(odbc_specialcolumns)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3716,7 +3725,7 @@ PHP_FUNCTION(odbc_statistics)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
@@ -3779,7 +3788,7 @@ PHP_FUNCTION(odbc_tableprivileges)
|
||||
|
||||
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
|
||||
|
||||
rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
|
||||
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
|
||||
if (rc == SQL_INVALID_HANDLE) {
|
||||
efree(result);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
|
||||
|
||||
@@ -281,8 +281,18 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
|
||||
|
||||
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
|
||||
#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WLONGVARCHAR)
|
||||
|
||||
#define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttribute
|
||||
#define PHP_ODBC_SQLALLOCSTMT(hdbc, phstmt) SQLAllocHandle(SQL_HANDLE_STMT, hdbc, phstmt)
|
||||
|
||||
#define PHP_ODBC_SQL_DESC_NAME SQL_DESC_NAME
|
||||
#else
|
||||
#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR)
|
||||
|
||||
#define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttributes
|
||||
#define PHP_ODBC_SQLALLOCSTMT SQLAllocStmt
|
||||
|
||||
#define PHP_ODBC_SQL_DESC_NAME SQL_COLUMN_NAME
|
||||
#endif
|
||||
#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
odbc_exec(): Getting accurate unicode data from query
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
<?php
|
||||
if ("unixODBC" != ODBC_TYPE) {
|
||||
die("skip ODBC_TYPE != unixODBC");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Bug #69354 Incorrect use of SQLColAttributes with ODBC 3.0
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100))');
|
||||
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a", 100) . "')");
|
||||
|
||||
$res = odbc_exec($conn,"select VARCHAR_COL from FOO");
|
||||
if ($res) {
|
||||
if (odbc_fetch_row($res)) {
|
||||
$ret = odbc_result($res,'varchar_col');
|
||||
echo strlen($ret), "\n";
|
||||
echo $ret[0], "\n";
|
||||
echo $ret[strlen($ret)-1], "\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
100
|
||||
a
|
||||
a
|
||||
==DONE==
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
|
||||
?>
|
||||
@@ -2,6 +2,11 @@
|
||||
odbc_exec(): Basic test
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
<?php
|
||||
if ("unixODBC" != ODBC_TYPE) {
|
||||
die("skip ODBC_TYPE != unixODBC");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ $conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (TEST INT)');
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (TEST INT NOT NULL)');
|
||||
odbc_exec($conn, 'ALTER TABLE FOO ADD PRIMARY KEY (TEST)');
|
||||
|
||||
odbc_exec($conn, 'INSERT INTO FOO VALUES (1)');
|
||||
|
||||
@@ -1707,17 +1707,23 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
|
||||
static char *accel_tsrm_realpath(const char *path, int path_len TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_6_X_API_NO
|
||||
char *real_path;
|
||||
#endif
|
||||
char *cwd;
|
||||
int cwd_len;
|
||||
|
||||
/* realpath("") returns CWD */
|
||||
if (!*path) {
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
|
||||
new_state.cwd = (char*)emalloc(1);
|
||||
#else
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (!new_state.cwd) {
|
||||
zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
new_state.cwd[0] = '\0';
|
||||
new_state.cwd_length = 0;
|
||||
if ((cwd = accel_getcwd(&cwd_len TSRMLS_CC)) != NULL) {
|
||||
@@ -1725,18 +1731,26 @@ static char *accel_tsrm_realpath(const char *path, int path_len TSRMLS_DC)
|
||||
}
|
||||
} else if (!IS_ABSOLUTE_PATH(path, path_len) &&
|
||||
(cwd = accel_getcwd(&cwd_len TSRMLS_CC)) != NULL) {
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
|
||||
new_state.cwd = estrndup(cwd, cwd_len);
|
||||
#else
|
||||
new_state.cwd = zend_strndup(cwd, cwd_len);
|
||||
if (!new_state.cwd) {
|
||||
zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
new_state.cwd_length = cwd_len;
|
||||
} else {
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
|
||||
new_state.cwd = (char*)emalloc(1);
|
||||
#else
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (!new_state.cwd) {
|
||||
zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
new_state.cwd[0] = '\0';
|
||||
new_state.cwd_length = 0;
|
||||
}
|
||||
@@ -1745,14 +1759,22 @@ static char *accel_tsrm_realpath(const char *path, int path_len TSRMLS_DC)
|
||||
# define CWD_REALPATH 2
|
||||
#endif
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) {
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
|
||||
efree(new_state.cwd);
|
||||
#else
|
||||
free(new_state.cwd);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
|
||||
return new_state.cwd;
|
||||
#else
|
||||
real_path = emalloc(new_state.cwd_length + 1);
|
||||
memcpy(real_path, new_state.cwd, new_state.cwd_length + 1);
|
||||
free(new_state.cwd);
|
||||
return real_path;
|
||||
#endif
|
||||
}
|
||||
|
||||
static char *accel_php_resolve_path(const char *filename, int filename_length, const char *path TSRMLS_DC)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Test that script cached info is correct with validate_timestamps disabled
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.validate_timestamps=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(opcache_is_script_cached(__FILE__));
|
||||
var_dump(opcache_is_script_cached("nonexistent.php"));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
@@ -4,6 +4,7 @@ Test that script cached info is correct
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.validate_timestamps=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
|
||||
@@ -324,14 +324,16 @@ static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC)
|
||||
persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len + 1);
|
||||
if (persistent_script) {
|
||||
return !persistent_script->corrupted &&
|
||||
validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS;
|
||||
(!ZCG(accel_directives).validate_timestamps ||
|
||||
validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
if ((key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC)) != NULL) {
|
||||
persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length + 1);
|
||||
return persistent_script && !persistent_script->corrupted &&
|
||||
validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS;
|
||||
(!ZCG(accel_directives).validate_timestamps ||
|
||||
validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -3,6 +3,7 @@ Bug #68912 (Segmentation fault at openssl_spki_new)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!extension_loaded("xml")) die("skip xml extension not loaded");
|
||||
if (!@openssl_pkey_new()) die("skip cannot create private key");
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
@@ -1826,7 +1826,7 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz
|
||||
{
|
||||
php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
|
||||
int nr_bytes = 0;
|
||||
|
||||
|
||||
/* Only do this if SSL is active. */
|
||||
if (sslsock->ssl_active) {
|
||||
int retry = 1;
|
||||
@@ -1910,13 +1910,18 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz
|
||||
|
||||
/* Also, on reads, we may get this condition on an EOF. We should check properly. */
|
||||
if (read) {
|
||||
stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle));
|
||||
stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle));
|
||||
}
|
||||
|
||||
|
||||
/* Don't loop indefinitely in non-blocking mode if no data is available */
|
||||
if (began_blocked == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now, if we have to wait some time, and we're supposed to be blocking, wait for the socket to become
|
||||
* available. Now, php_pollfd_for uses select to wait up to our time_left value only...
|
||||
*/
|
||||
if (retry && began_blocked) {
|
||||
if (retry) {
|
||||
if (read) {
|
||||
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ?
|
||||
(POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL);
|
||||
|
||||
+36
-36
@@ -198,7 +198,7 @@ ZEND_GET_MODULE(pcntl)
|
||||
|
||||
static void pcntl_signal_handler(int);
|
||||
static void pcntl_signal_dispatch();
|
||||
|
||||
|
||||
void php_register_signal_constants(INIT_FUNC_ARGS)
|
||||
{
|
||||
|
||||
@@ -234,7 +234,7 @@ void php_register_signal_constants(INIT_FUNC_ARGS)
|
||||
REGISTER_LONG_CONSTANT("SIGTERM", (long) SIGTERM, CONST_CS | CONST_PERSISTENT);
|
||||
#ifdef SIGSTKFLT
|
||||
REGISTER_LONG_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SIGCLD
|
||||
REGISTER_LONG_CONSTANT("SIGCLD", (long) SIGCLD, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
@@ -484,7 +484,7 @@ static void php_pcntl_register_errno_constants(INIT_FUNC_ARGS)
|
||||
}
|
||||
|
||||
static PHP_GINIT_FUNCTION(pcntl)
|
||||
{
|
||||
{
|
||||
memset(pcntl_globals, 0, sizeof(*pcntl_globals));
|
||||
}
|
||||
|
||||
@@ -547,7 +547,7 @@ PHP_FUNCTION(pcntl_fork)
|
||||
PCNTL_G(last_error) = errno;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno);
|
||||
}
|
||||
|
||||
|
||||
RETURN_LONG((long) id);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -560,7 +560,7 @@ PHP_FUNCTION(pcntl_alarm)
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
|
||||
return;
|
||||
|
||||
|
||||
RETURN_LONG ((long) alarm(seconds));
|
||||
}
|
||||
/* }}} */
|
||||
@@ -576,7 +576,7 @@ PHP_FUNCTION(pcntl_waitpid)
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &pid, &z_status, &options) == FAILURE)
|
||||
return;
|
||||
|
||||
|
||||
convert_to_long_ex(&z_status);
|
||||
|
||||
status = Z_LVAL_P(z_status);
|
||||
@@ -604,7 +604,7 @@ PHP_FUNCTION(pcntl_wait)
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &z_status, &options) == FAILURE)
|
||||
return;
|
||||
|
||||
|
||||
convert_to_long_ex(&z_status);
|
||||
|
||||
status = Z_LVAL_P(z_status);
|
||||
@@ -628,7 +628,7 @@ PHP_FUNCTION(pcntl_wait)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool pcntl_wifexited(int status)
|
||||
/* {{{ proto bool pcntl_wifexited(int status)
|
||||
Returns true if the child status code represents a successful exit */
|
||||
PHP_FUNCTION(pcntl_wifexited)
|
||||
{
|
||||
@@ -646,7 +646,7 @@ PHP_FUNCTION(pcntl_wifexited)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool pcntl_wifstopped(int status)
|
||||
/* {{{ proto bool pcntl_wifstopped(int status)
|
||||
Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid) */
|
||||
PHP_FUNCTION(pcntl_wifstopped)
|
||||
{
|
||||
@@ -664,7 +664,7 @@ PHP_FUNCTION(pcntl_wifstopped)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool pcntl_wifsignaled(int status)
|
||||
/* {{{ proto bool pcntl_wifsignaled(int status)
|
||||
Returns true if the child status code represents a process that was terminated due to a signal */
|
||||
PHP_FUNCTION(pcntl_wifsignaled)
|
||||
{
|
||||
@@ -682,7 +682,7 @@ PHP_FUNCTION(pcntl_wifsignaled)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int pcntl_wexitstatus(int status)
|
||||
/* {{{ proto int pcntl_wexitstatus(int status)
|
||||
Returns the status code of a child's exit */
|
||||
PHP_FUNCTION(pcntl_wexitstatus)
|
||||
{
|
||||
@@ -700,7 +700,7 @@ PHP_FUNCTION(pcntl_wexitstatus)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int pcntl_wtermsig(int status)
|
||||
/* {{{ proto int pcntl_wtermsig(int status)
|
||||
Returns the number of the signal that terminated the process who's status code is passed */
|
||||
PHP_FUNCTION(pcntl_wtermsig)
|
||||
{
|
||||
@@ -718,7 +718,7 @@ PHP_FUNCTION(pcntl_wtermsig)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int pcntl_wstopsig(int status)
|
||||
/* {{{ proto int pcntl_wstopsig(int status)
|
||||
Returns the number of the signal that caused the process to stop who's status code is passed */
|
||||
PHP_FUNCTION(pcntl_wstopsig)
|
||||
{
|
||||
@@ -754,19 +754,19 @@ PHP_FUNCTION(pcntl_exec)
|
||||
char *path;
|
||||
int path_len;
|
||||
ulong key_num;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|aa", &path, &path_len, &args, &envs) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ZEND_NUM_ARGS() > 1) {
|
||||
/* Build argument list */
|
||||
args_hash = HASH_OF(args);
|
||||
argc = zend_hash_num_elements(args_hash);
|
||||
|
||||
|
||||
argv = safe_emalloc((argc + 2), sizeof(char *), 0);
|
||||
*argv = path;
|
||||
for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1;
|
||||
for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1;
|
||||
(argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS));
|
||||
(argi++, current_arg++, zend_hash_move_forward(args_hash)) ) {
|
||||
|
||||
@@ -784,9 +784,9 @@ PHP_FUNCTION(pcntl_exec)
|
||||
/* Build environment pair list */
|
||||
envs_hash = HASH_OF(envs);
|
||||
envc = zend_hash_num_elements(envs_hash);
|
||||
|
||||
|
||||
envp = safe_emalloc((envc + 1), sizeof(char *), 0);
|
||||
for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp;
|
||||
for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp;
|
||||
(envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS));
|
||||
(envi++, pair++, zend_hash_move_forward(envs_hash)) ) {
|
||||
switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) {
|
||||
@@ -802,13 +802,13 @@ PHP_FUNCTION(pcntl_exec)
|
||||
|
||||
convert_to_string_ex(element);
|
||||
|
||||
/* Length of element + equal sign + length of key + null */
|
||||
/* Length of element + equal sign + length of key + null */
|
||||
pair_length = Z_STRLEN_PP(element) + key_length + 2;
|
||||
*pair = emalloc(pair_length);
|
||||
strlcpy(*pair, key, key_length);
|
||||
strlcpy(*pair, key, key_length);
|
||||
strlcat(*pair, "=", pair_length);
|
||||
strlcat(*pair, Z_STRVAL_PP(element), pair_length);
|
||||
|
||||
|
||||
/* Cleanup */
|
||||
if (return_val == HASH_KEY_IS_LONG) efree(key);
|
||||
}
|
||||
@@ -818,7 +818,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
PCNTL_G(last_error) = errno;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno));
|
||||
}
|
||||
|
||||
|
||||
/* Cleanup */
|
||||
for (pair = envp; *pair != NULL; pair++) efree(*pair);
|
||||
efree(envp);
|
||||
@@ -831,7 +831,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
}
|
||||
|
||||
efree(argv);
|
||||
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -881,7 +881,7 @@ PHP_FUNCTION(pcntl_signal)
|
||||
zend_hash_index_del(&PCNTL_G(php_signal_table), signo);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (!zend_is_callable(handle, 0, &func_name TSRMLS_CC)) {
|
||||
PCNTL_G(last_error) = EINVAL;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name);
|
||||
@@ -889,11 +889,11 @@ PHP_FUNCTION(pcntl_signal)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(func_name);
|
||||
|
||||
|
||||
/* Add the function name to our signal table */
|
||||
zend_hash_index_update(&PCNTL_G(php_signal_table), signo, (void **) &handle, sizeof(zval *), (void **) &dest_handle);
|
||||
if (dest_handle) zval_add_ref(dest_handle);
|
||||
|
||||
|
||||
if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) == SIG_ERR) {
|
||||
PCNTL_G(last_error) = errno;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal");
|
||||
@@ -1030,7 +1030,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
|
||||
}
|
||||
|
||||
/*
|
||||
* sigtimedwait and sigwaitinfo can return 0 on success on some
|
||||
* sigtimedwait and sigwaitinfo can return 0 on success on some
|
||||
* platforms, e.g. NetBSD
|
||||
*/
|
||||
if (!signo && siginfo.si_signo) {
|
||||
@@ -1078,7 +1078,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
|
||||
EMPTY_SWITCH_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RETURN_LONG(signo);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1108,12 +1108,12 @@ PHP_FUNCTION(pcntl_getpriority)
|
||||
long who = PRIO_PROCESS;
|
||||
long pid = getpid();
|
||||
int pri;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &pid, &who) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* needs to be cleared, since any returned value is valid */
|
||||
/* needs to be cleared, since any returned value is valid */
|
||||
errno = 0;
|
||||
|
||||
pri = getpriority(who, pid);
|
||||
@@ -1173,7 +1173,7 @@ PHP_FUNCTION(pcntl_setpriority)
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1206,7 +1206,7 @@ static void pcntl_signal_handler(int signo)
|
||||
{
|
||||
struct php_pcntl_pending_signal *psig;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
psig = PCNTL_G(spares);
|
||||
if (!psig) {
|
||||
/* oops, too many signals for us to track, so we'll forget about this one */
|
||||
@@ -1255,7 +1255,7 @@ void pcntl_signal_dispatch()
|
||||
|
||||
queue = PCNTL_G(head);
|
||||
PCNTL_G(head) = NULL; /* simple stores are atomic */
|
||||
|
||||
|
||||
/* Allocate */
|
||||
|
||||
while (queue) {
|
||||
@@ -1282,7 +1282,7 @@ void pcntl_signal_dispatch()
|
||||
|
||||
/* Re-enable queue */
|
||||
PCNTL_G(processing_signal_queue) = 0;
|
||||
|
||||
|
||||
/* return signal mask to previous state */
|
||||
sigprocmask(SIG_SETMASK, &old_mask, NULL);
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
EXTENSION("pcre", "php_pcre.c", false /* never shared */,
|
||||
"-Iext/pcre/pcrelib");
|
||||
ADD_SOURCES("ext/pcre/pcrelib", "pcre_chartables.c pcre_ucd.c pcre_compile.c pcre_config.c pcre_exec.c pcre_fullinfo.c pcre_get.c pcre_globals.c pcre_maketables.c pcre_newline.c pcre_ord2utf8.c pcre_refcount.c pcre_study.c pcre_tables.c pcre_valid_utf8.c pcre_version.c pcre_xclass.c", "pcre");
|
||||
ADD_SOURCES("ext/pcre/pcrelib", "pcre_chartables.c pcre_ucd.c pcre_compile.c pcre_config.c pcre_exec.c pcre_fullinfo.c pcre_get.c pcre_globals.c pcre_maketables.c pcre_newline.c pcre_ord2utf8.c pcre_refcount.c pcre_study.c pcre_tables.c pcre_valid_utf8.c pcre_version.c pcre_xclass.c pcre_jit_compile.c", "pcre");
|
||||
ADD_DEF_FILE("ext\\pcre\\php_pcre.def");
|
||||
|
||||
AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Using bundled PCRE library');
|
||||
|
||||
+2
-1
@@ -58,7 +58,8 @@ PHP_ARG_WITH(pcre-regex,,
|
||||
pcrelib/pcre_maketables.c pcrelib/pcre_newline.c \
|
||||
pcrelib/pcre_ord2utf8.c pcrelib/pcre_refcount.c pcrelib/pcre_study.c \
|
||||
pcrelib/pcre_tables.c pcrelib/pcre_valid_utf8.c \
|
||||
pcrelib/pcre_version.c pcrelib/pcre_xclass.c"
|
||||
pcrelib/pcre_version.c pcrelib/pcre_xclass.c \
|
||||
pcrelib/pcre_jit_compile.c"
|
||||
PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcrelib"
|
||||
PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
|
||||
|
||||
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
|
||||
University of Cambridge Computing Service,
|
||||
Cambridge, England.
|
||||
|
||||
Copyright (c) 1997-2013 University of Cambridge
|
||||
Copyright (c) 1997-2015 University of Cambridge
|
||||
All rights reserved
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
|
||||
Email local part: hzmester
|
||||
Emain domain: freemail.hu
|
||||
|
||||
Copyright(c) 2010-2013 Zoltan Herczeg
|
||||
Copyright(c) 2010-2015 Zoltan Herczeg
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
|
||||
Email local part: hzmester
|
||||
Emain domain: freemail.hu
|
||||
|
||||
Copyright(c) 2009-2013 Zoltan Herczeg
|
||||
Copyright(c) 2009-2015 Zoltan Herczeg
|
||||
All rights reserved.
|
||||
|
||||
|
||||
|
||||
+386
-1
@@ -1,6 +1,391 @@
|
||||
ChangeLog for PCRE
|
||||
------------------
|
||||
|
||||
Version 8.37 28-April-2015
|
||||
--------------------------
|
||||
|
||||
1. When an (*ACCEPT) is triggered inside capturing parentheses, it arranges
|
||||
for those parentheses to be closed with whatever has been captured so far.
|
||||
However, it was failing to mark any other groups between the hightest
|
||||
capture so far and the currrent group as "unset". Thus, the ovector for
|
||||
those groups contained whatever was previously there. An example is the
|
||||
pattern /(x)|((*ACCEPT))/ when matched against "abcd".
|
||||
|
||||
2. If an assertion condition was quantified with a minimum of zero (an odd
|
||||
thing to do, but it happened), SIGSEGV or other misbehaviour could occur.
|
||||
|
||||
3. If a pattern in pcretest input had the P (POSIX) modifier followed by an
|
||||
unrecognized modifier, a crash could occur.
|
||||
|
||||
4. An attempt to do global matching in pcretest with a zero-length ovector
|
||||
caused a crash.
|
||||
|
||||
5. Fixed a memory leak during matching that could occur for a subpattern
|
||||
subroutine call (recursive or otherwise) if the number of captured groups
|
||||
that had to be saved was greater than ten.
|
||||
|
||||
6. Catch a bad opcode during auto-possessification after compiling a bad UTF
|
||||
string with NO_UTF_CHECK. This is a tidyup, not a bug fix, as passing bad
|
||||
UTF with NO_UTF_CHECK is documented as having an undefined outcome.
|
||||
|
||||
7. A UTF pattern containing a "not" match of a non-ASCII character and a
|
||||
subroutine reference could loop at compile time. Example: /[^\xff]((?1))/.
|
||||
|
||||
8. When a pattern is compiled, it remembers the highest back reference so that
|
||||
when matching, if the ovector is too small, extra memory can be obtained to
|
||||
use instead. A conditional subpattern whose condition is a check on a
|
||||
capture having happened, such as, for example in the pattern
|
||||
/^(?:(a)|b)(?(1)A|B)/, is another kind of back reference, but it was not
|
||||
setting the highest backreference number. This mattered only if pcre_exec()
|
||||
was called with an ovector that was too small to hold the capture, and there
|
||||
was no other kind of back reference (a situation which is probably quite
|
||||
rare). The effect of the bug was that the condition was always treated as
|
||||
FALSE when the capture could not be consulted, leading to a incorrect
|
||||
behaviour by pcre_exec(). This bug has been fixed.
|
||||
|
||||
9. A reference to a duplicated named group (either a back reference or a test
|
||||
for being set in a conditional) that occurred in a part of the pattern where
|
||||
PCRE_DUPNAMES was not set caused the amount of memory needed for the pattern
|
||||
to be incorrectly calculated, leading to overwriting.
|
||||
|
||||
10. A mutually recursive set of back references such as (\2)(\1) caused a
|
||||
segfault at study time (while trying to find the minimum matching length).
|
||||
The infinite loop is now broken (with the minimum length unset, that is,
|
||||
zero).
|
||||
|
||||
11. If an assertion that was used as a condition was quantified with a minimum
|
||||
of zero, matching went wrong. In particular, if the whole group had
|
||||
unlimited repetition and could match an empty string, a segfault was
|
||||
likely. The pattern (?(?=0)?)+ is an example that caused this. Perl allows
|
||||
assertions to be quantified, but not if they are being used as conditions,
|
||||
so the above pattern is faulted by Perl. PCRE has now been changed so that
|
||||
it also rejects such patterns.
|
||||
|
||||
12. A possessive capturing group such as (a)*+ with a minimum repeat of zero
|
||||
failed to allow the zero-repeat case if pcre2_exec() was called with an
|
||||
ovector too small to capture the group.
|
||||
|
||||
13. Fixed two bugs in pcretest that were discovered by fuzzing and reported by
|
||||
Red Hat Product Security:
|
||||
|
||||
(a) A crash if /K and /F were both set with the option to save the compiled
|
||||
pattern.
|
||||
|
||||
(b) Another crash if the option to print captured substrings in a callout
|
||||
was combined with setting a null ovector, for example \O\C+ as a subject
|
||||
string.
|
||||
|
||||
14. A pattern such as "((?2){0,1999}())?", which has a group containing a
|
||||
forward reference repeated a large (but limited) number of times within a
|
||||
repeated outer group that has a zero minimum quantifier, caused incorrect
|
||||
code to be compiled, leading to the error "internal error:
|
||||
previously-checked referenced subpattern not found" when an incorrect
|
||||
memory address was read. This bug was reported as "heap overflow",
|
||||
discovered by Kai Lu of Fortinet's FortiGuard Labs and given the CVE number
|
||||
CVE-2015-2325.
|
||||
|
||||
23. A pattern such as "((?+1)(\1))/" containing a forward reference subroutine
|
||||
call within a group that also contained a recursive back reference caused
|
||||
incorrect code to be compiled. This bug was reported as "heap overflow",
|
||||
discovered by Kai Lu of Fortinet's FortiGuard Labs, and given the CVE
|
||||
number CVE-2015-2326.
|
||||
|
||||
24. Computing the size of the JIT read-only data in advance has been a source
|
||||
of various issues, and new ones are still appear unfortunately. To fix
|
||||
existing and future issues, size computation is eliminated from the code,
|
||||
and replaced by on-demand memory allocation.
|
||||
|
||||
25. A pattern such as /(?i)[A-`]/, where characters in the other case are
|
||||
adjacent to the end of the range, and the range contained characters with
|
||||
more than one other case, caused incorrect behaviour when compiled in UTF
|
||||
mode. In that example, the range a-j was left out of the class.
|
||||
|
||||
26. Fix JIT compilation of conditional blocks, which assertion
|
||||
is converted to (*FAIL). E.g: /(?(?!))/.
|
||||
|
||||
27. The pattern /(?(?!)^)/ caused references to random memory. This bug was
|
||||
discovered by the LLVM fuzzer.
|
||||
|
||||
28. The assertion (?!) is optimized to (*FAIL). This was not handled correctly
|
||||
when this assertion was used as a condition, for example (?(?!)a|b). In
|
||||
pcre2_match() it worked by luck; in pcre2_dfa_match() it gave an incorrect
|
||||
error about an unsupported item.
|
||||
|
||||
29. For some types of pattern, for example /Z*(|d*){216}/, the auto-
|
||||
possessification code could take exponential time to complete. A recursion
|
||||
depth limit of 1000 has been imposed to limit the resources used by this
|
||||
optimization.
|
||||
|
||||
30. A pattern such as /(*UTF)[\S\V\H]/, which contains a negated special class
|
||||
such as \S in non-UCP mode, explicit wide characters (> 255) can be ignored
|
||||
because \S ensures they are all in the class. The code for doing this was
|
||||
interacting badly with the code for computing the amount of space needed to
|
||||
compile the pattern, leading to a buffer overflow. This bug was discovered
|
||||
by the LLVM fuzzer.
|
||||
|
||||
31. A pattern such as /((?2)+)((?1))/ which has mutual recursion nested inside
|
||||
other kinds of group caused stack overflow at compile time. This bug was
|
||||
discovered by the LLVM fuzzer.
|
||||
|
||||
32. A pattern such as /(?1)(?#?'){8}(a)/ which had a parenthesized comment
|
||||
between a subroutine call and its quantifier was incorrectly compiled,
|
||||
leading to buffer overflow or other errors. This bug was discovered by the
|
||||
LLVM fuzzer.
|
||||
|
||||
33. The illegal pattern /(?(?<E>.*!.*)?)/ was not being diagnosed as missing an
|
||||
assertion after (?(. The code was failing to check the character after
|
||||
(?(?< for the ! or = that would indicate a lookbehind assertion. This bug
|
||||
was discovered by the LLVM fuzzer.
|
||||
|
||||
34. A pattern such as /X((?2)()*+){2}+/ which has a possessive quantifier with
|
||||
a fixed maximum following a group that contains a subroutine reference was
|
||||
incorrectly compiled and could trigger buffer overflow. This bug was
|
||||
discovered by the LLVM fuzzer.
|
||||
|
||||
35. A mutual recursion within a lookbehind assertion such as (?<=((?2))((?1)))
|
||||
caused a stack overflow instead of the diagnosis of a non-fixed length
|
||||
lookbehind assertion. This bug was discovered by the LLVM fuzzer.
|
||||
|
||||
36. The use of \K in a positive lookbehind assertion in a non-anchored pattern
|
||||
(e.g. /(?<=\Ka)/) could make pcregrep loop.
|
||||
|
||||
37. There was a similar problem to 36 in pcretest for global matches.
|
||||
|
||||
38. If a greedy quantified \X was preceded by \C in UTF mode (e.g. \C\X*),
|
||||
and a subsequent item in the pattern caused a non-match, backtracking over
|
||||
the repeated \X did not stop, but carried on past the start of the subject,
|
||||
causing reference to random memory and/or a segfault. There were also some
|
||||
other cases where backtracking after \C could crash. This set of bugs was
|
||||
discovered by the LLVM fuzzer.
|
||||
|
||||
39. The function for finding the minimum length of a matching string could take
|
||||
a very long time if mutual recursion was present many times in a pattern,
|
||||
for example, /((?2){73}(?2))((?1))/. A better mutual recursion detection
|
||||
method has been implemented. This infelicity was discovered by the LLVM
|
||||
fuzzer.
|
||||
|
||||
40. Static linking against the PCRE library using the pkg-config module was
|
||||
failing on missing pthread symbols.
|
||||
|
||||
|
||||
Version 8.36 26-September-2014
|
||||
------------------------------
|
||||
|
||||
1. Got rid of some compiler warnings in the C++ modules that were shown up by
|
||||
-Wmissing-field-initializers and -Wunused-parameter.
|
||||
|
||||
2. The tests for quantifiers being too big (greater than 65535) were being
|
||||
applied after reading the number, and stupidly assuming that integer
|
||||
overflow would give a negative number. The tests are now applied as the
|
||||
numbers are read.
|
||||
|
||||
3. Tidy code in pcre_exec.c where two branches that used to be different are
|
||||
now the same.
|
||||
|
||||
4. The JIT compiler did not generate match limit checks for certain
|
||||
bracketed expressions with quantifiers. This may lead to exponential
|
||||
backtracking, instead of returning with PCRE_ERROR_MATCHLIMIT. This
|
||||
issue should be resolved now.
|
||||
|
||||
5. Fixed an issue, which occures when nested alternatives are optimized
|
||||
with table jumps.
|
||||
|
||||
6. Inserted two casts and changed some ints to size_t in the light of some
|
||||
reported 64-bit compiler warnings (Bugzilla 1477).
|
||||
|
||||
7. Fixed a bug concerned with zero-minimum possessive groups that could match
|
||||
an empty string, which sometimes were behaving incorrectly in the
|
||||
interpreter (though correctly in the JIT matcher). This pcretest input is
|
||||
an example:
|
||||
|
||||
'\A(?:[^"]++|"(?:[^"]*+|"")*+")++'
|
||||
NON QUOTED "QUOT""ED" AFTER "NOT MATCHED
|
||||
|
||||
the interpreter was reporting a match of 'NON QUOTED ' only, whereas the
|
||||
JIT matcher and Perl both matched 'NON QUOTED "QUOT""ED" AFTER '. The test
|
||||
for an empty string was breaking the inner loop and carrying on at a lower
|
||||
level, when possessive repeated groups should always return to a higher
|
||||
level as they have no backtrack points in them. The empty string test now
|
||||
occurs at the outer level.
|
||||
|
||||
8. Fixed a bug that was incorrectly auto-possessifying \w+ in the pattern
|
||||
^\w+(?>\s*)(?<=\w) which caused it not to match "test test".
|
||||
|
||||
9. Give a compile-time error for \o{} (as Perl does) and for \x{} (which Perl
|
||||
doesn't).
|
||||
|
||||
10. Change 8.34/15 introduced a bug that caused the amount of memory needed
|
||||
to hold a pattern to be incorrectly computed (too small) when there were
|
||||
named back references to duplicated names. This could cause "internal
|
||||
error: code overflow" or "double free or corruption" or other memory
|
||||
handling errors.
|
||||
|
||||
11. When named subpatterns had the same prefixes, back references could be
|
||||
confused. For example, in this pattern:
|
||||
|
||||
/(?P<Name>a)?(?P<Name2>b)?(?(<Name>)c|d)*l/
|
||||
|
||||
the reference to 'Name' was incorrectly treated as a reference to a
|
||||
duplicate name.
|
||||
|
||||
12. A pattern such as /^s?c/mi8 where the optional character has more than
|
||||
one "other case" was incorrectly compiled such that it would only try to
|
||||
match starting at "c".
|
||||
|
||||
13. When a pattern starting with \s was studied, VT was not included in the
|
||||
list of possible starting characters; this should have been part of the
|
||||
8.34/18 patch.
|
||||
|
||||
14. If a character class started [\Qx]... where x is any character, the class
|
||||
was incorrectly terminated at the ].
|
||||
|
||||
15. If a pattern that started with a caseless match for a character with more
|
||||
than one "other case" was studied, PCRE did not set up the starting code
|
||||
unit bit map for the list of possible characters. Now it does. This is an
|
||||
optimization improvement, not a bug fix.
|
||||
|
||||
16. The Unicode data tables have been updated to Unicode 7.0.0.
|
||||
|
||||
17. Fixed a number of memory leaks in pcregrep.
|
||||
|
||||
18. Avoid a compiler warning (from some compilers) for a function call with
|
||||
a cast that removes "const" from an lvalue by using an intermediate
|
||||
variable (to which the compiler does not object).
|
||||
|
||||
19. Incorrect code was compiled if a group that contained an internal recursive
|
||||
back reference was optional (had quantifier with a minimum of zero). This
|
||||
example compiled incorrect code: /(((a\2)|(a*)\g<-1>))*/ and other examples
|
||||
caused segmentation faults because of stack overflows at compile time.
|
||||
|
||||
20. A pattern such as /((?(R)a|(?1)))+/, which contains a recursion within a
|
||||
group that is quantified with an indefinite repeat, caused a compile-time
|
||||
loop which used up all the system stack and provoked a segmentation fault.
|
||||
This was not the same bug as 19 above.
|
||||
|
||||
21. Add PCRECPP_EXP_DECL declaration to operator<< in pcre_stringpiece.h.
|
||||
Patch by Mike Frysinger.
|
||||
|
||||
|
||||
Version 8.35 04-April-2014
|
||||
--------------------------
|
||||
|
||||
1. A new flag is set, when property checks are present in an XCLASS.
|
||||
When this flag is not set, PCRE can perform certain optimizations
|
||||
such as studying these XCLASS-es.
|
||||
|
||||
2. The auto-possessification of character sets were improved: a normal
|
||||
and an extended character set can be compared now. Furthermore
|
||||
the JIT compiler optimizes more character set checks.
|
||||
|
||||
3. Got rid of some compiler warnings for potentially uninitialized variables
|
||||
that show up only when compiled with -O2.
|
||||
|
||||
4. A pattern such as (?=ab\K) that uses \K in an assertion can set the start
|
||||
of a match later then the end of the match. The pcretest program was not
|
||||
handling the case sensibly - it was outputting from the start to the next
|
||||
binary zero. It now reports this situation in a message, and outputs the
|
||||
text from the end to the start.
|
||||
|
||||
5. Fast forward search is improved in JIT. Instead of the first three
|
||||
characters, any three characters with fixed position can be searched.
|
||||
Search order: first, last, middle.
|
||||
|
||||
6. Improve character range checks in JIT. Characters are read by an inprecise
|
||||
function now, which returns with an unknown value if the character code is
|
||||
above a certain threshold (e.g: 256). The only limitation is that the value
|
||||
must be bigger than the threshold as well. This function is useful when
|
||||
the characters above the threshold are handled in the same way.
|
||||
|
||||
7. The macros whose names start with RAWUCHAR are placeholders for a future
|
||||
mode in which only the bottom 21 bits of 32-bit data items are used. To
|
||||
make this more memorable for those maintaining the code, the names have
|
||||
been changed to start with UCHAR21, and an extensive comment has been added
|
||||
to their definition.
|
||||
|
||||
8. Add missing (new) files sljitNativeTILEGX.c and sljitNativeTILEGX-encoder.c
|
||||
to the export list in Makefile.am (they were accidentally omitted from the
|
||||
8.34 tarball).
|
||||
|
||||
9. The informational output from pcretest used the phrase "starting byte set"
|
||||
which is inappropriate for the 16-bit and 32-bit libraries. As the output
|
||||
for "first char" and "need char" really means "non-UTF-char", I've changed
|
||||
"byte" to "char", and slightly reworded the output. The documentation about
|
||||
these values has also been (I hope) clarified.
|
||||
|
||||
10. Another JIT related optimization: use table jumps for selecting the correct
|
||||
backtracking path, when more than four alternatives are present inside a
|
||||
bracket.
|
||||
|
||||
11. Empty match is not possible, when the minimum length is greater than zero,
|
||||
and there is no \K in the pattern. JIT should avoid empty match checks in
|
||||
such cases.
|
||||
|
||||
12. In a caseless character class with UCP support, when a character with more
|
||||
than one alternative case was not the first character of a range, not all
|
||||
the alternative cases were added to the class. For example, s and \x{17f}
|
||||
are both alternative cases for S: the class [RST] was handled correctly,
|
||||
but [R-T] was not.
|
||||
|
||||
13. The configure.ac file always checked for pthread support when JIT was
|
||||
enabled. This is not used in Windows, so I have put this test inside a
|
||||
check for the presence of windows.h (which was already tested for).
|
||||
|
||||
14. Improve pattern prefix search by a simplified Boyer-Moore algorithm in JIT.
|
||||
The algorithm provides a way to skip certain starting offsets, and usually
|
||||
faster than linear prefix searches.
|
||||
|
||||
15. Change 13 for 8.20 updated RunTest to check for the 'fr' locale as well
|
||||
as for 'fr_FR' and 'french'. For some reason, however, it then used the
|
||||
Windows-specific input and output files, which have 'french' screwed in.
|
||||
So this could never have worked. One of the problems with locales is that
|
||||
they aren't always the same. I have now updated RunTest so that it checks
|
||||
the output of the locale test (test 3) against three different output
|
||||
files, and it allows the test to pass if any one of them matches. With luck
|
||||
this should make the test pass on some versions of Solaris where it was
|
||||
failing. Because of the uncertainty, the script did not used to stop if
|
||||
test 3 failed; it now does. If further versions of a French locale ever
|
||||
come to light, they can now easily be added.
|
||||
|
||||
16. If --with-pcregrep-bufsize was given a non-integer value such as "50K",
|
||||
there was a message during ./configure, but it did not stop. This now
|
||||
provokes an error. The invalid example in README has been corrected.
|
||||
If a value less than the minimum is given, the minimum value has always
|
||||
been used, but now a warning is given.
|
||||
|
||||
17. If --enable-bsr-anycrlf was set, the special 16/32-bit test failed. This
|
||||
was a bug in the test system, which is now fixed. Also, the list of various
|
||||
configurations that are tested for each release did not have one with both
|
||||
16/32 bits and --enable-bar-anycrlf. It now does.
|
||||
|
||||
18. pcretest was missing "-C bsr" for displaying the \R default setting.
|
||||
|
||||
19. Little endian PowerPC systems are supported now by the JIT compiler.
|
||||
|
||||
20. The fast forward newline mechanism could enter to an infinite loop on
|
||||
certain invalid UTF-8 input. Although we don't support these cases
|
||||
this issue can be fixed by a performance optimization.
|
||||
|
||||
21. Change 33 of 8.34 is not sufficient to ensure stack safety because it does
|
||||
not take account if existing stack usage. There is now a new global
|
||||
variable called pcre_stack_guard that can be set to point to an external
|
||||
function to check stack availability. It is called at the start of
|
||||
processing every parenthesized group.
|
||||
|
||||
22. A typo in the code meant that in ungreedy mode the max/min qualifier
|
||||
behaved like a min-possessive qualifier, and, for example, /a{1,3}b/U did
|
||||
not match "ab".
|
||||
|
||||
23. When UTF was disabled, the JIT program reported some incorrect compile
|
||||
errors. These messages are silenced now.
|
||||
|
||||
24. Experimental support for ARM-64 and MIPS-64 has been added to the JIT
|
||||
compiler.
|
||||
|
||||
25. Change all the temporary files used in RunGrepTest to be different to those
|
||||
used by RunTest so that the tests can be run simultaneously, for example by
|
||||
"make -j check".
|
||||
|
||||
|
||||
Version 8.34 15-December-2013
|
||||
-----------------------------
|
||||
|
||||
@@ -5311,7 +5696,7 @@ by an auxiliary program - but can then be edited by hand if required. There are
|
||||
now no calls to isalnum(), isspace(), isdigit(), isxdigit(), tolower() or
|
||||
toupper() in the code.
|
||||
|
||||
7. Turn the malloc/free functions variables into pcre_malloc and pcre_free and
|
||||
7. Turn the malloc/free funtions variables into pcre_malloc and pcre_free and
|
||||
make them global. Abolish the function for setting them, as the caller can now
|
||||
set them directly.
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ and semantics are as close as possible to those of the Perl 5 language.
|
||||
|
||||
Release 8 of PCRE is distributed under the terms of the "BSD" licence, as
|
||||
specified below. The documentation for PCRE, supplied in the "doc"
|
||||
directory, is distributed under the same terms as the software itself.
|
||||
directory, is distributed under the same terms as the software itself. The data
|
||||
in the testdata directory is not copyrighted and is in the public domain.
|
||||
|
||||
The basic library functions are written in C and are freestanding. Also
|
||||
included in the distribution is a set of C++ wrapper functions, and a
|
||||
@@ -24,7 +25,7 @@ Email domain: cam.ac.uk
|
||||
University of Cambridge Computing Service,
|
||||
Cambridge, England.
|
||||
|
||||
Copyright (c) 1997-2013 University of Cambridge
|
||||
Copyright (c) 1997-2015 University of Cambridge
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -35,7 +36,7 @@ Written by: Zoltan Herczeg
|
||||
Email local part: hzmester
|
||||
Emain domain: freemail.hu
|
||||
|
||||
Copyright(c) 2010-2013 Zoltan Herczeg
|
||||
Copyright(c) 2010-2015 Zoltan Herczeg
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -46,7 +47,7 @@ Written by: Zoltan Herczeg
|
||||
Email local part: hzmester
|
||||
Emain domain: freemail.hu
|
||||
|
||||
Copyright(c) 2009-2013 Zoltan Herczeg
|
||||
Copyright(c) 2009-2015 Zoltan Herczeg
|
||||
All rights reserved.
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,32 @@
|
||||
News about PCRE releases
|
||||
------------------------
|
||||
|
||||
Release 8.37 28-April-2015
|
||||
--------------------------
|
||||
|
||||
This is bug-fix release. Note that this library (now called PCRE1) is now being
|
||||
maintained for bug fixes only. New projects are advised to use the new PCRE2
|
||||
libraries.
|
||||
|
||||
|
||||
Release 8.36 26-September-2014
|
||||
------------------------------
|
||||
|
||||
This is primarily a bug-fix release. However, in addition, the Unicode data
|
||||
tables have been updated to Unicode 7.0.0.
|
||||
|
||||
|
||||
Release 8.35 04-April-2014
|
||||
--------------------------
|
||||
|
||||
There have been performance improvements for classes containing non-ASCII
|
||||
characters and the "auto-possessification" feature has been extended. Other
|
||||
minor improvements have been implemented and bugs fixed. There is a new callout
|
||||
feature to enable applications to do detailed stack checks at compile time, to
|
||||
avoid running out of stack for deeply nested parentheses. The JIT compiler has
|
||||
been extended with experimental support for ARM-64, MIPS-64, and PPC-LE.
|
||||
|
||||
|
||||
Release 8.34 15-December-2013
|
||||
-----------------------------
|
||||
|
||||
|
||||
+30
-18
@@ -1,7 +1,16 @@
|
||||
README file for PCRE (Perl-compatible regular expression library)
|
||||
-----------------------------------------------------------------
|
||||
|
||||
The latest release of PCRE is always available in three alternative formats
|
||||
NOTE: This set of files relates to PCRE releases that use the original API,
|
||||
with library names libpcre, libpcre16, and libpcre32. January 2015 saw the
|
||||
first release of a new API, known as PCRE2, with release numbers starting at
|
||||
10.00 and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old
|
||||
libraries (now called PCRE1) are still being maintained for bug fixes, but
|
||||
there will be no new development. New projects are advised to use the new PCRE2
|
||||
libraries.
|
||||
|
||||
|
||||
The latest release of PCRE1 is always available in three alternative formats
|
||||
from:
|
||||
|
||||
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
|
||||
@@ -45,14 +54,16 @@ the 16-bit library, which processes strings of 16-bit values, and one for the
|
||||
32-bit library, which processes strings of 32-bit values. The distribution also
|
||||
includes a set of C++ wrapper functions (see the pcrecpp man page for details),
|
||||
courtesy of Google Inc., which can be used to call the 8-bit PCRE library from
|
||||
C++.
|
||||
C++. Other C++ wrappers have been created from time to time. See, for example:
|
||||
https://github.com/YasserAsmi/regexp, which aims to be simple and similar in
|
||||
style to the C API.
|
||||
|
||||
In addition, there is a set of C wrapper functions (again, just for the 8-bit
|
||||
library) that are based on the POSIX regular expression API (see the pcreposix
|
||||
man page). These end up in the library called libpcreposix. Note that this just
|
||||
provides a POSIX calling interface to PCRE; the regular expressions themselves
|
||||
still follow Perl syntax and semantics. The POSIX API is restricted, and does
|
||||
not give full access to all of PCRE's facilities.
|
||||
The distribution also contains a set of C wrapper functions (again, just for
|
||||
the 8-bit library) that are based on the POSIX regular expression API (see the
|
||||
pcreposix man page). These end up in the library called libpcreposix. Note that
|
||||
this just provides a POSIX calling interface to PCRE; the regular expressions
|
||||
themselves still follow Perl syntax and semantics. The POSIX API is restricted,
|
||||
and does not give full access to all of PCRE's facilities.
|
||||
|
||||
The header file for the POSIX-style functions is called pcreposix.h. The
|
||||
official POSIX name is regex.h, but I did not want to risk possible problems
|
||||
@@ -85,11 +96,12 @@ documentation is supplied in two other forms:
|
||||
1. There are files called doc/pcre.txt, doc/pcregrep.txt, and
|
||||
doc/pcretest.txt in the source distribution. The first of these is a
|
||||
concatenation of the text forms of all the section 3 man pages except
|
||||
those that summarize individual functions. The other two are the text
|
||||
forms of the section 1 man pages for the pcregrep and pcretest commands.
|
||||
These text forms are provided for ease of scanning with text editors or
|
||||
similar tools. They are installed in <prefix>/share/doc/pcre, where
|
||||
<prefix> is the installation prefix (defaulting to /usr/local).
|
||||
the listing of pcredemo.c and those that summarize individual functions.
|
||||
The other two are the text forms of the section 1 man pages for the
|
||||
pcregrep and pcretest commands. These text forms are provided for ease of
|
||||
scanning with text editors or similar tools. They are installed in
|
||||
<prefix>/share/doc/pcre, where <prefix> is the installation prefix
|
||||
(defaulting to /usr/local).
|
||||
|
||||
2. A set of files containing all the documentation in HTML form, hyperlinked
|
||||
in various ways, and rooted in a file called index.html, is distributed in
|
||||
@@ -372,12 +384,12 @@ library. They are also documented in the pcrebuild man page.
|
||||
|
||||
Of course, the relevant libraries must be installed on your system.
|
||||
|
||||
. The default size of internal buffer used by pcregrep can be set by, for
|
||||
example:
|
||||
. The default size (in bytes) of the internal buffer used by pcregrep can be
|
||||
set by, for example:
|
||||
|
||||
--with-pcregrep-bufsize=50K
|
||||
--with-pcregrep-bufsize=51200
|
||||
|
||||
The default value is 20K.
|
||||
The value must be a plain integer. The default is 20480.
|
||||
|
||||
. It is possible to compile pcretest so that it links with the libreadline
|
||||
or libedit libraries, by specifying, respectively,
|
||||
@@ -987,4 +999,4 @@ pcre_xxx, one with the name pcre16_xx, and a third with the name pcre32_xxx.
|
||||
Philip Hazel
|
||||
Email local part: ph10
|
||||
Email domain: cam.ac.uk
|
||||
Last updated: 05 November 2013
|
||||
Last updated: 10 February 2015
|
||||
@@ -314,7 +314,7 @@ them both to 0; an emulation function will be used. */
|
||||
#define PACKAGE_NAME "PCRE"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "PCRE 8.32"
|
||||
#define PACKAGE_STRING "PCRE 8.36"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "pcre"
|
||||
@@ -323,7 +323,7 @@ them both to 0; an emulation function will be used. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "8.32"
|
||||
#define PACKAGE_VERSION "8.36"
|
||||
|
||||
/* to make a symbol visible */
|
||||
/* #undef PCRECPP_EXP_DECL */
|
||||
@@ -331,6 +331,13 @@ them both to 0; an emulation function will be used. */
|
||||
/* to make a symbol visible */
|
||||
/* #undef PCRECPP_EXP_DEFN */
|
||||
|
||||
/* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
|
||||
parentheses (of any kind) in a pattern. This limits the amount of system
|
||||
stack that is used while compiling a pattern. */
|
||||
#ifndef PARENS_NEST_LIMIT
|
||||
#define PARENS_NEST_LIMIT 250
|
||||
#endif
|
||||
|
||||
/* The value of PCREGREP_BUFSIZE determines the size of buffer used by
|
||||
pcregrep to hold parts of the file it is searching. This is also the
|
||||
minimum value. The actual amount of memory used by pcregrep is three times
|
||||
@@ -390,7 +397,7 @@ them both to 0; an emulation function will be used. */
|
||||
#undef SUPPORT_GCOV
|
||||
|
||||
/* Define to any value to enable support for Just-In-Time compiling. */
|
||||
#undef SUPPORT_JIT
|
||||
#define SUPPORT_JIT
|
||||
|
||||
/* Define to any value to allow pcregrep to be linked with libbz2, so that it
|
||||
is able to handle .bz2 files. */
|
||||
@@ -432,7 +439,7 @@ them both to 0; an emulation function will be used. */
|
||||
|
||||
/* Version number of package */
|
||||
#ifndef VERSION
|
||||
#define VERSION "8.34"
|
||||
#define VERSION "8.36"
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
@@ -444,3 +451,4 @@ them both to 0; an emulation function will be used. */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
+713
-678
File diff suppressed because it is too large.
Load diff
@@ -5,7 +5,7 @@
|
||||
/* This is the public header file for the PCRE library, to be #included by
|
||||
applications that call the PCRE functions.
|
||||
|
||||
Copyright (c) 1997-2013 University of Cambridge
|
||||
Copyright (c) 1997-2014 University of Cambridge
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
/* The current PCRE version information. */
|
||||
|
||||
#define PCRE_MAJOR 8
|
||||
#define PCRE_MINOR 34
|
||||
#define PCRE_MINOR 36
|
||||
#define PCRE_PRERELEASE
|
||||
#define PCRE_DATE 2013-12-15
|
||||
#define PCRE_DATE 2014-09-26
|
||||
|
||||
/* When an application links to a PCRE DLL in Windows, the symbols that are
|
||||
imported have to be identified as such. When building PCRE, the appropriate
|
||||
@@ -491,36 +491,42 @@ PCRE_EXP_DECL void (*pcre_free)(void *);
|
||||
PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t);
|
||||
PCRE_EXP_DECL void (*pcre_stack_free)(void *);
|
||||
PCRE_EXP_DECL int (*pcre_callout)(pcre_callout_block *);
|
||||
PCRE_EXP_DECL int (*pcre_stack_guard)(void);
|
||||
|
||||
PCRE_EXP_DECL void *(*pcre16_malloc)(size_t);
|
||||
PCRE_EXP_DECL void (*pcre16_free)(void *);
|
||||
PCRE_EXP_DECL void *(*pcre16_stack_malloc)(size_t);
|
||||
PCRE_EXP_DECL void (*pcre16_stack_free)(void *);
|
||||
PCRE_EXP_DECL int (*pcre16_callout)(pcre16_callout_block *);
|
||||
PCRE_EXP_DECL int (*pcre16_stack_guard)(void);
|
||||
|
||||
PCRE_EXP_DECL void *(*pcre32_malloc)(size_t);
|
||||
PCRE_EXP_DECL void (*pcre32_free)(void *);
|
||||
PCRE_EXP_DECL void *(*pcre32_stack_malloc)(size_t);
|
||||
PCRE_EXP_DECL void (*pcre32_stack_free)(void *);
|
||||
PCRE_EXP_DECL int (*pcre32_callout)(pcre32_callout_block *);
|
||||
PCRE_EXP_DECL int (*pcre32_stack_guard)(void);
|
||||
#else /* VPCOMPAT */
|
||||
PCRE_EXP_DECL void *pcre_malloc(size_t);
|
||||
PCRE_EXP_DECL void pcre_free(void *);
|
||||
PCRE_EXP_DECL void *pcre_stack_malloc(size_t);
|
||||
PCRE_EXP_DECL void pcre_stack_free(void *);
|
||||
PCRE_EXP_DECL int pcre_callout(pcre_callout_block *);
|
||||
PCRE_EXP_DECL int pcre_stack_guard(void);
|
||||
|
||||
PCRE_EXP_DECL void *pcre16_malloc(size_t);
|
||||
PCRE_EXP_DECL void pcre16_free(void *);
|
||||
PCRE_EXP_DECL void *pcre16_stack_malloc(size_t);
|
||||
PCRE_EXP_DECL void pcre16_stack_free(void *);
|
||||
PCRE_EXP_DECL int pcre16_callout(pcre16_callout_block *);
|
||||
PCRE_EXP_DECL int pcre16_stack_guard(void);
|
||||
|
||||
PCRE_EXP_DECL void *pcre32_malloc(size_t);
|
||||
PCRE_EXP_DECL void pcre32_free(void *);
|
||||
PCRE_EXP_DECL void *pcre32_stack_malloc(size_t);
|
||||
PCRE_EXP_DECL void pcre32_stack_free(void *);
|
||||
PCRE_EXP_DECL int pcre32_callout(pcre32_callout_block *);
|
||||
PCRE_EXP_DECL int pcre32_stack_guard(void);
|
||||
#endif /* VPCOMPAT */
|
||||
|
||||
/* User defined callback which provides a stack just before the match starts. */
|
||||
|
||||
+308
-142
File diff suppressed because it is too large.
Load diff
Loaded 100 of 221 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user