Compare commits

...
214 Commits
Author SHA1 Message Date
Ferenc Kovacs d3d42b9550 5.6.17RC1 2015-12-10 01:36:02 +01:00
Ferenc Kovacs 7d5dbaed76 5.6.18 will be next 2015-12-10 01:30:27 +01:00
Anatol Belski e4238f4bf5 update NEWS 2015-12-09 13:37:37 +01:00
Michael Orlitzky 24f21a3012 ext/imap/config.m4: fix conftest segfault in utf8_to_mutf7 check, bug #66909.
The test program for utf8_to_mutf7 attempts to call it without
arguments. The function expects one argument, however, and this leads
to a segfault as reported in PHP bug #66909.

The test program is using the PHP_IMAP_TEST_BUILD macro which
complicates things a little. To keep this diff small, the
PHP_IMAP_TEST_BUILD macro was modified to pass a fifth argument
"extra-source" to the PHP_TEST_BUILD macro. The check for
utf8_to_mutf7 was then modified to check for a dummy function,
utf8_to_mutf7_php, which passes the correct number of arguments to
utf8_to_mutf7.

PHP-Bug: https://bugs.php.net/bug.php?id=66909
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=376735
2015-12-09 12:04:16 +01:00
Michael Orlitzky 38b68fc042 ext/dba/config.m4: Autodetect Berkeley DB v5.3.
When the user passes --with-db4=DIR to ./configure, the directory DIR
is searched for a number of paths in order of preference. These paths
contain possible locations for Berkeley DB (BDB) to be installed, and
since PHP only supports BDB-4.x and BDB-5.x, it's important that (for
example) version 5.1 be autodetected before falling back to
/usr/include/db.h which can point to BDB-6.x.

The newer BDB-5.3 works with PHP, and if only BDB-5.3 is installed on
the user's system, the current ./configure script is fine. However, if
both BDB-5.3 and BDB-6.0 are installed, version 5.3 is not
autodetected, causing BDB-6.0 to be used. The ./configure step then fails.

This commit adds autodetection for BDB-5.3, and fixes a bug reported
on Gentoo at https://bugs.gentoo.org/show_bug.cgi?id=564824.
2015-12-09 11:20:36 +01:00
Anatol Belski 56e7903131 fix path separator in test 2015-12-09 11:18:25 +01:00
George Wang 00ed55005a Bumped SAPI version to 6.9 2015-12-09 00:28:08 -05:00
George Wang 0d84097d44 Added "mod_auth_basic" to apache module list. 2015-12-09 00:27:55 -05:00
George Wang 08080c18f5 Add sanitizing checks for request data. 2015-12-09 00:26:41 -05:00
George Wang c60d4b9770 Clear secret after use. 2015-12-09 00:26:24 -05:00
George Wang 84fd8ffa2a Fixed __DIR__ in CLI mode. 2015-12-09 00:25:48 -05:00
Popa Adrian Marius a90ce6de31 Add PDO_Firebird fix in NEWS 2015-12-03 17:23:56 +02:00
Popa Adrian Marius 8da5752311 Use LL_MASK for SQL_INT64 data formatting 2015-12-03 17:12:02 +02:00
Popa Adrian Marius 4173a667fa Fix Bug #60052 Integer returned as a 64bit integer on X64_86 for pdo_firebird 2015-12-03 16:14:17 +02:00
Xinchen Hui e6b46dc2ff Fixed bug #70960 (ReflectionFunction for array_unique returns wrong number of parameters) 2015-11-24 13:45:16 +08:00
Lior Kaplan 1c72e5b299 Align NEWS entries format 2015-11-23 18:46:19 +02:00
Lior Kaplan 532912d8ab Add NEWS entry for #61751 2015-11-23 18:42:21 +02:00
Lior Kaplan d6b78a3511 Fixed bug #61751 (SAPI build problem on AIX: Undefined symbol: php_register_internal_extensions) 2015-11-23 18:40:47 +02:00
Xinchen Hui b9845e5006 Add bug #70957 and #70958 releated test in refection 2015-11-23 18:48:21 +08:00
Xinchen Hui a2b85ddecf Fixed bug #70958 (Invalid opcode while using ::class as trait method paramater default value) 2015-11-23 18:29:59 +08:00
Xinchen Hui ab17840d33 Fixed bug #70957 (self::class can not be resolved with reflection for abstract class) 2015-11-23 12:20:44 +08:00
Xinchen Hui 205e0ba81d Update test script 2015-11-21 05:01:51 -08:00
Xinchen Hui cbc71995a8 Unused var 2015-11-21 04:54:48 -08:00
Xinchen Hui 7b195c9875 Improved fix for bug #70944 2015-11-21 00:27:56 -08:00
Xinchen Hui a1c887964e Fixed bug #70944 (try{ } finally{} can create infinite chains of exceptions) 2015-11-20 16:24:53 +08:00
Xinchen Hui b42eb16cf4 This seems better 2015-11-20 15:36:13 +08:00
Xinchen Hui c8d6673b59 Fixed build error "undefined symbol gdJpegGetVersionString" 2015-11-20 15:22:05 +08:00
Xinchen Hui 66c1f966f0 Merge branch 'PHP-5.6' of git.php.net:/php-src into PHP-5.6 2015-11-17 20:13:22 +08:00
Xinchen Hui fba3985f23 Improve the test 2015-11-17 20:12:50 +08:00
Andrey Hristov 822400ef3b News for fixed bug #68344 2015-11-16 12:38:25 +01:00
Xinchen Hui 25439e939e Merge branch 'PHP-5.6' of git.php.net:/php-src into PHP-5.6 2015-11-16 17:00:16 +08:00
Xinchen Hui be6fd4ba89 Fixed bug #68077 (LOAD DATA LOCAL INFILE / open_basedir restriction)
Actually, this only be fixed if php uses mysqlnd
2015-11-16 16:59:55 +08:00
Côme Bernigaud 15876e85e5 Added back support for undocummented host:port syntax 2015-11-16 04:50:12 +01:00
Jakub Zelenka e5abc53701 Use the same CS for all json tests 2015-11-15 19:06:09 +00:00
Dmitry Stogov f8bf9bd86b Fixed bug #70900 (SoapClient systematic out of memory error) 2015-11-12 20:31:52 +03:00
Côme Bernigaud 391087ed28 Using default port in ldap_connect when NULL is passed (this was the behavior prior to 5.6.11)
Note that passing 0 will also result in default port.
2015-11-12 07:06:05 +01:00
Xinchen Hui f72c7edfa4 Ensure the test fails 2015-11-11 14:55:33 +01:00
Ferenc Kovacs b22636c838 propare for 5.6.16RC1 2015-11-11 09:20:16 +01:00
Jakub Zelenka 1a12403002 Remove SNI test that trigger request to sni.velox.ch
This has been requested by Kaspar Brand who provides
sni.velox.ch. That site is only for interactive
testing and not for unit/integration/regression testing.
Although this test is run only in special cases (when
SNI_TESTS is defined) it should still be removed.

Also this test is not reliable as it depends on external
resources.
2015-11-09 18:11:18 +00:00
Matteo Beccati fd61666d96 Fix bug #70875 Segmentation fault if wsdl has no targetNamespace attribute 2015-11-07 11:00:33 +01:00
Christopher Jones 089ca134fb Always remember NEWS.... 2015-11-07 02:15:24 +11:00
Christopher Jones a57b205383 Fix compile warnings about comparison of unsigned expression always being true 2015-11-07 02:14:18 +11:00
Christopher Jones f88a9a9643 Bump OCI8 version 2015-11-07 02:10:57 +11:00
Christopher Jones 3060dfd92e Fix bug 68298 (PHP OCI8 OCI int overflow) (Senthil) 2015-11-07 01:56:50 +11:00
Reeze Xia 1c0622a472 Make test for bug #70852 to cover all cases 2015-11-05 14:09:24 +08:00
Reeze Xia 51218b3b9d Fixed bug #70852 Segfault getting NULL offset of an ArrayObject. 2015-11-05 13:46:03 +08:00
Xinchen Hui 227c898cd9 Fixed test 2015-11-02 10:58:55 +08:00
Xinchen Hui a23a88b3e7 Merge branch 'PHP-5.6' of git.php.net:/php-src into PHP-5.6 2015-11-02 10:47:32 +08:00
Xinchen Hui 37ed0dafe4 Fixed bug #70828 (php-fpm 5.6 with opcache crashes when referencing a non-existent constant) 2015-11-02 10:47:02 +08:00
Jakub Zelenka e62db72111 Use standard title for new openssl tests 2015-10-29 19:11:57 +00:00
root 06c6b51e7d new tests to openssl module, don't covered yet. 2015-10-29 19:06:40 +00:00
Andrey Hristov 6d51b7b2e3 Another Fix for Bug #68344 MySQLi does not provide way to disable peer certificate validation
Added the possibility to explicitly state that the peer certificate should not be checked.
Back to the default - checking the certificate.
Exported MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT
Usage : mysqli_real_connect( , , , , , MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT)

If mysqli_ssl_set() is not called, but only MYSQLI_CLIENT_SSL is passed, without the (don't) very flag,
then no verification takes place.
2015-10-27 12:59:09 +01:00
Anatol Belski 2f7a8515ca update NEWS 2015-10-26 15:56:34 +01:00
Anatol Belski 83bfefeccb Fixed bug #70718 stream_select() when OpenSSL extension is loaded on PHP Win64 2015-10-26 15:54:29 +01:00
Nuno Lopes 36311ee4fd unbreak coverage data: fix #line directives in phpdbg parser 2015-10-24 18:12:24 -04:00
Nuno Lopes 0e069fa57d exclude datelib from coverage report as asked by Derick 2015-10-24 17:38:20 -04:00
Anatol Belski 22af88274b Fix globals initialization in sapi/cgi
Basically backport 8430ec17
2015-10-23 13:56:40 +02:00
Andrey Hristov afd31489d0 Improve fix for Bug #68344 MySQLi does not provide way to disable peer certificate validation 2015-10-22 11:48:53 +02:00
Andrey Hristov 8292260515 Fix for Bug #68344 MySQLi does not provide way to disable peer certificate validation 2015-10-21 15:10:24 +02:00
Andrey Hristov efd2b3f5f2 Update the certificates needed for the mysqli tests 2015-10-21 10:42:51 +02:00
Anatol Belski ccc95bf9df backport 262160e and 2d55e8c into 5.6 2015-10-20 20:05:44 +02:00
Xinchen Hui d5f76caf6c Fixed bug #70748 (Segfault in ini_lex () at Zend/zend_ini_scanner.l) 2015-10-20 13:20:56 +08:00
Ferenc Kovacs 395ef4efb7 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  fixup, both catched by nikic
  use another character device in this test as /dev/console seems that it is different for lxc containers
  the de_DE(iso-8859-1) locale is not available on ubuntu by default, but there is no reason to require that over the utf-8 one
  let's try running our testsuite without sudo
2015-10-19 22:47:23 +02:00
Ferenc Kovacs f3838a9c35 Merge branch 'pr-1483' into PHP-5.5
* pr-1483:
  fixup, both catched by nikic
  use another character device in this test as /dev/console seems that it is different for lxc containers
  the de_DE(iso-8859-1) locale is not available on ubuntu by default, but there is no reason to require that over the utf-8 one
  let's try running our testsuite without sudo
2015-10-19 22:44:19 +02:00
Stanislav Malyshev 0b35e0c5a1 Merge branch 'pull-request/1535' into PHP-5.6
* pull-request/1535:
  Bug #70561: Fix DirectoryIterator to throw OutOfBoundsException
2015-10-18 17:17:55 -07:00
Daniel Persson 73384728ca Fix bug #64172
Check if the SQLSTATE error code is equal to PDO_ERR_NONE before we ask the driver.
And if no error is reported skip the extra call to the driver.
2015-10-18 17:06:54 -07:00
Fábio Perez c76fd640e6 Skip some tests for platforms different than x86
These tests are verifying undefined behaviour such as shifting by more than 63
bits and by negative numbers.
2015-10-18 15:45:25 -07:00
Stanislav Malyshev b94f67885c Skip serialize test if ext/session is not loaded 2015-10-18 15:43:03 -07:00
jubianchi 718445b096 Remove wrong argument $session from SNMP::setSecurity() 2015-10-18 14:48:39 -07:00
jubianchi 39a2514643 Fix SNMP::setSecurity() arginfo (Fixes bug #70476) 2015-10-18 14:48:25 -07:00
Anatol Belski 9501293de7 update NEWS 2015-10-18 11:34:42 +02:00
Anatol Belski 7f33ab834d C89 compat 2015-10-18 11:14:30 +02:00
MiRacLe.RPZ 2b5af600e3 use spprintf instead (no need to estrdup afterwards). 2015-10-18 11:10:50 +02:00
MiRacLe.RPZ 5c19355095 dblib's dbcolname can return null in some cases 2015-10-18 11:10:45 +02:00
MiRacLe.RPZ 4c8f064d7d testcase fot bug #69757 2015-10-18 11:10:39 +02:00
MiRacLe.RPZ acb2368976 Segmentation fault on pdo_dblib::nextRowset (bug #69757) 2015-10-18 11:10:34 +02:00
Ferenc Kovacs 22cbf68344 prepare for 5.6.15RC1 2015-10-15 00:22:12 +02:00
Anatol Belski d160e98feb fix test 2015-10-12 09:46:52 +02:00
Nikita Popov d7d01fc9a3 Fixed bug #70685
Doing a less intrusive variant of the PHP 7.0 fix for 5.6.
2015-10-10 14:59:21 +02:00
Nikita Popov e19423f3cb Improve previous fix
Don't forbid null binding on plain functions.
2015-10-09 23:28:24 +02:00
Nikita Popov bbae7ddf29 Fixed bug #70681 2015-10-09 23:01:23 +02:00
Anatol Belski 505c9c3742 update NEWS 2015-10-09 12:35:06 +02:00
Nuno Lopes 052dd3005b fix coverage report for datelib 2015-10-04 05:45:05 -04:00
Xinchen Hui 2fb8bb1157 Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer) 2015-10-03 20:33:24 -07:00
Xinchen Hui 6876112c89 Fixed the third one of (segfault in gc_remove_from_buffer())
This one maybe only used in debug mode, so no bug report and no test
script provided
2015-10-03 20:15:35 -07:00
Xinchen Hui 4744eec753 Fixed bug #70631 (Another Segfault in gc_remove_from_buffer()) 2015-10-03 20:08:21 -07:00
Xinchen Hui 925412ee1c Do not edit the zval cause it might be in shared memory 2015-10-03 19:50:38 -07:00
Xinchen Hui c147d90dbf Fixed bug #70601 (Segfault in gc_remove_from_buffer()) 2015-10-03 19:38:56 -07:00
Anatol Belski 83bef0ef83 fix win10 support
dwMajorVersion == 10 there, and generally this check is obsolete
as we don't support dwMajorVersion < 6 since 5.5
2015-10-03 10:44:43 +02:00
Nikita Popov fe1933aae2 Fixed bug #70625 2015-10-03 10:12:11 +02:00
Ferenc Kovacs 6f895a29c9 Merge branch 'pr-1544' into PHP-5.6
* pr-1544:
  Update NEWS file with LDAP fixes
2015-10-02 21:48:33 +02:00
Derick Rethans c08824fd72 Updated to version 2015.7 (2015g) 2015-10-02 18:12:16 +01:00
Xinchen Hui c98ea8465b Fixed bug #70619 (DateTimeImmutable segfault) 2015-10-02 07:19:21 -07:00
Julien Pauli 0fd71d1184 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fixed test
  5.5.31 now

Conflicts:
	configure.in
	main/php_version.h
2015-09-30 13:19:18 +02:00
Julien Pauli d7fb43e30d Fixed test 2015-09-30 13:18:16 +02:00
Julien Pauli 3f08fc0466 5.5.31 now 2015-09-30 13:01:11 +02:00
Andrey Hristov 07a8e5ce37 Add JSON as exported type, if available. mysqlnd has it, libmysql doesn't export it (for now). 2015-09-30 09:03:35 +02:00
Ferenc Kovacs 0c10e10ee8 update NEWS, these missed 5.6.14RC1 as I was not asked to include them so delaying for the next release 2015-09-30 01:28:39 +02:00
Ferenc Kovacs 264f33a23f add NEWS entries 2015-09-30 01:16:43 +02:00
Ferenc Kovacs 62ff2d0bfe Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  add NEWS entries
2015-09-30 01:15:54 +02:00
Ferenc Kovacs 932f707177 add NEWS entries 2015-09-30 01:15:24 +02:00
Stanislav Malyshev 2e267bd3c7 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Better fix for bug #70433

Conflicts:
	ext/phar/dirstream.c
2015-09-28 21:42:08 -07:00
Stanislav Malyshev 1ddf72180a Better fix for bug #70433 2015-09-28 21:41:02 -07:00
Stanislav Malyshev 51b23cd0f0 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  fix memory leak
  FIx bug #70433 - Uninitialized pointer in phar_make_dirstream when zip entry filename is "/"

Conflicts:
	ext/phar/dirstream.c
2015-09-28 20:44:28 -07:00
Stanislav Malyshev f98ab19dc0 fix memory leak 2015-09-28 20:43:18 -07:00
Stanislav Malyshev e78ac461db FIx bug #70433 - Uninitialized pointer in phar_make_dirstream when zip entry filename is "/" 2015-09-28 17:12:35 -07:00
Stanislav Malyshev f39a4ee0c9 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix bug #69720: Null pointer dereference in phar_get_fp_offset()
2015-09-28 16:59:46 -07:00
Stanislav Malyshev d698f0ae51 Fix bug #69720: Null pointer dereference in phar_get_fp_offset() 2015-09-28 15:56:51 -07:00
Misha Nasledov 84452dba8e Update NEWS file with LDAP fixes 2015-09-28 12:59:16 -07:00
Stanislav Malyshev 629e4da7cc Fix bug #70480 (php_url_parse_ex() buffer overflow read) 2015-09-28 11:31:14 -07:00
Andrey Hristov 59de2c037c Fixed bug #70572 segfault in mysqlnd_connect 2015-09-25 14:06:28 +02:00
Andrey Hristov 85be6fe96b Spread the news about 70384 2015-09-25 13:54:10 +02:00
Anatol Belski f451b023d1 update NEWS 2015-09-23 20:00:38 +02:00
Anatol Belski 257693614e add test 2015-09-23 19:48:38 +02:00
Anatol Belski ca89d9a797 expose openssl config path so it can be tested 2015-09-23 19:48:20 +02:00
Andrey Hristov f79cd18789 Fix for Bug #70384 mysqli_real_query(): Unknown type 245 sent by the server 2015-09-23 18:25:12 +02:00
Bishop Bettini 368d3ff0d9 Bug #70561: Fix DirectoryIterator to throw OutOfBoundsException
-------------------------------------------------------------------------------
DirectoryIterator implements SeekableIterator, which "should throw an
OutOfBoundsException if the position is not seekable". As is, seek just returns
and one must call valid(). This approach is different than most (all?) other
SeekableIterator implementations and leads to developer confusion. See the
bug report for a specific example.
2015-09-23 11:14:52 -04:00
Anatol Belski 8317e0fa46 add missing header
For PRIu32 and maybe more, that fixes build
2015-09-23 14:01:59 +02:00
Anatol Belski c505d55158 silence mkdir to fix fails after unclean test run 2015-09-23 13:55:28 +02:00
Derick Rethans 96d1d13d87 Update timelib to 2015.02 2015-09-22 08:59:45 +01:00
Derick Rethans e4f3fb976b Fixed test cases due to changes in rules 2015-09-22 08:42:12 +01:00
Derick Rethans fab5cbab1a Bumb timelib version to 2015.01 2015-09-22 08:41:56 +01:00
Jakub Zelenka dcd569aad6 Use tabs for arg info indent in openssl.c 2015-09-20 12:34:35 +01:00
Ferenc Kovacs 11cddaf6f4 prepare for PHP-5.6.14RC1 2015-09-17 01:48:02 +02:00
Xinchen Hui 37d814b84c Add test XFAIL for bug #70470 2015-09-11 13:45:18 +08:00
Côme Bernigaud 059dd18c37 Added support of LDAP_OPT_TIMEOUT, fixes #69574 2015-09-09 18:02:10 +02:00
Lior Kaplan 43f6099ce4 Add entry for #70284 in 5.6.13 2015-09-09 14:20:04 +03:00
Côme Bernigaud a483a79c85 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix bug in LDAP extensions' saving TIMELIMIT and DEREF
2015-09-09 10:34:46 +02:00
Côme Bernigaud cc7140e8d9 Merge branch 'pull-request/1512' into PHP-5.5
* pull-request/1512:
  Fix bug in LDAP extensions' saving TIMELIMIT and DEREF
2015-09-09 10:30:17 +02:00
Christoph M. Becker 71da4f1f7f Skip test for old glibc iconv
bug32001.phpt has a high failure rate for the submitted reports. According to
several samples it seems the iconv implementation of glibc 2.12 (released
2010-05) is the culprit. It seems appropriate to skip the test for such old
versions.
2015-09-09 04:27:28 +02:00
Tyson Andre c3fc65eb7c Fix bug in LDAP extensions' saving TIMELIMIT and DEREF
LDAP_OPT_TIMELIMIT and LDAP_OPT_DEREF's original values weren't
saved properly because of a bug introduced when copy and pasting.

This lead to the original timeout being changed
when specifying a temporary override (e.g. for ldap_search(..., $timeout))
2015-09-08 18:42:02 -07:00
Christoph M. Becker b89f128480 updated NEWS 2015-09-09 03:12:59 +02:00
Sergei Turchanov 7b3616db77 Fix #70456: mysqlnd doesn't activate TCP keep-alive when connecting to a server
libmysqlclient activates TCP keep-alive when connecting to a server. PHP
mysqlnd extension must do the same to maintain compatibility.
2015-09-09 01:43:29 +02:00
Remi Collet debfc866d2 Fix build
php_zip.c:1647:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
php_zip.c:1648:3: error: format not a string literal and no format arguments [-Werror=format-security]
2015-09-07 13:52:28 +02:00
Jakub Zelenka d47029167d Fix bug #60632: openssl_seal fails with AES 2015-09-06 16:39:59 +01:00
Christoph M. Becker aed225b7e4 updated NEWS 2015-09-05 14:39:24 +02:00
Christoph M. Becker fd94c92171 Fix #68291: 404 on urls with '+'
URI paths have to be treated according to RFC 3986 by the CLI web server, not
as application/x-www-form-urlencoded.
2015-09-05 14:34:08 +02:00
Christoph M. Becker f9ece83994 updated NEWS 2015-09-05 03:14:56 +02:00
Christoph M. Becker 43b26c7b21 Fix #70395: Missing ARG_INFO for openssl_seal()
This patch adds the missing ARG_INFO for the optional 5th parameter $method.
2015-09-05 03:08:02 +02:00
Christoph M. Becker dc1a8dd7f0 updated NEWS 2015-09-05 01:27:59 +02:00
Christoph M. Becker b2954c64ab Fix #70001: Assigning to DOMNode::textContent does additional entity encoding
Assigning to DOMNode::textContent encodes entities, what does not match the
behavior of DOMText::__construct() and DOMDocument::createTextNode. This patch
changes the behavior of DOMNode::textContent in this regard.
2015-09-05 01:17:50 +02:00
Christoph M. Becker b59ea797f5 updated NEWS 2015-09-05 00:37:08 +02:00
Christoph M. Becker c77f783777 Fix #70322: ZipArchive::close() doesn't indicate errors
If an archive can't be written, ZipArchive::close() nonetheless returns TRUE.
We fix the return value to properly return success, and additionally raise a
warning on failure.
2015-09-05 00:34:10 +02:00
Niklas Keller 4b1dff6f43 Fix #70361: HTTP stream wrapper doesn't close keep-alive connections 2015-09-04 16:29:35 +02:00
Ferenc Kovacs 52b2a3ff25 move the phpdbg NEWS entry to the correct version 2015-09-03 01:58:13 +02:00
Ferenc Kovacs 3759de241f add missing news entries 2015-09-03 01:46:38 +02:00
Julien Pauli c65350cd4d Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Merge branch 'PHP-5.6'
  bump version
2015-09-02 17:55:57 +02:00
Julien Pauli bb98ed600a Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Merge branch 'PHP-5.6'
  bump version

Conflicts:
	configure.in
	main/php_version.h
2015-09-02 17:55:20 +02:00
Matteo Beccati a12cef979d Merge branch 'PHP-5.6'
* PHP-5.6:
  Added missing skipif for phar+zlib test
2015-09-02 17:53:36 +02:00
Julien Pauli c07150cd1a Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  5.5.30 next

Conflicts:
	configure.in
	main/php_version.h
2015-09-02 17:42:00 +02:00
Julien Pauli ea807f9c07 5.5.30 next 2015-09-02 17:40:56 +02:00
Stanislav Malyshev 51fca4b77d bump version 2015-09-01 13:12:16 -07:00
Stanislav Malyshev a6c063d663 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  More fixes for bug #70219
2015-09-01 12:51:48 -07:00
Stanislav Malyshev 3fe509443c Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  fix unit tests
2015-09-01 12:24:14 -07:00
Stanislav Malyshev 43c2dfa7b3 Merge branch 'PHP-5.5' into PHP-5.5.29
* PHP-5.5:
  fix unit tests
2015-09-01 12:24:06 -07:00
Stanislav Malyshev 4aeff30337 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  fix unit tests
2015-09-01 12:23:55 -07:00
Stanislav Malyshev 1922c650ba fix unit tests 2015-09-01 12:23:22 -07:00
Stanislav Malyshev c19d59c550 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  add NEWS for fixes
  Improve fix for #70172
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
  fix test
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix for bug #69782
  Add CVE IDs asigned (post release) to PHP 5.4.43
  Add CVE IDs asigned to #69085 (PHP 5.4.39)
  5.4.45 next

Conflicts:
	ext/pcre/php_pcre.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	ext/zip/php_zip.c
2015-09-01 12:06:41 -07:00
Stanislav Malyshev 45e7e79485 Merge branch '70284' into PHP-5.6
* 70284:
  Fix bug ##70284 (Use after free vulnerability in unserialize() with GMP)
2015-09-01 12:05:02 -07:00
Stanislav Malyshev 32fe02c27d Merge branch 'PHP-5.5' into PHP-5.5.29
* PHP-5.5:
  update NEWS
  add NEWS for fixes
2015-09-01 12:04:04 -07:00
Stanislav Malyshev 31b634bf7c update NEWS 2015-09-01 12:03:48 -07:00
Stanislav Malyshev 0fac73a3bf Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  add NEWS for fixes
2015-09-01 12:00:30 -07:00
Stanislav Malyshev 7ceb0e3a18 add NEWS for fixes 2015-09-01 11:53:59 -07:00
Stanislav Malyshev 53d274beb0 Merge branch 'PHP-5.5' into PHP-5.5.29
* PHP-5.5:
  Improve fix for #70172
  Add CVE IDs asigned (post release) to PHP 5.4.43
  Add CVE IDs asigned to #69085 (PHP 5.4.39)

Conflicts:
	ext/pcre/php_pcre.c
2015-09-01 11:43:27 -07:00
Stanislav Malyshev 33d3acaae7 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Improve fix for #70172
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
  fix test
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix for bug #69782
  Add CVE IDs asigned (post release) to PHP 5.4.43
  Add CVE IDs asigned to #69085 (PHP 5.4.39)
  5.4.45 next

Conflicts:
	configure.in
	ext/pcre/php_pcre.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	main/php_version.h
2015-09-01 11:42:19 -07:00
Stanislav Malyshev 48cfd1160b Merge branch 'PHP-5.4.45' into PHP-5.4
* PHP-5.4.45:
  Improve fix for #70172
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
  fix test
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix for bug #69782
2015-09-01 11:40:15 -07:00
Stanislav Malyshev 7c31203935 Improve fix for #70172 2015-09-01 11:38:39 -07:00
Stanislav Malyshev e2291e4b1a Merge branch 'PHP-5.4.45' into PHP-5.5.29
* PHP-5.4.45:
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
2015-09-01 01:17:12 -07:00
Stanislav Malyshev 1390a5812b Fix bug #70312 - HAVAL gives wrong hashes in specific cases 2015-09-01 01:16:30 -07:00
Stanislav Malyshev 3605d1baf5 Merge branch 'PHP-5.4.45' into PHP-5.5.29
* PHP-5.4.45:
  fix test
2015-09-01 00:59:55 -07:00
Stanislav Malyshev 906f19f136 fix test 2015-09-01 00:59:31 -07:00
Stanislav Malyshev 6935058a98 Merge branch 'PHP-5.4.45' into PHP-5.5.29
* PHP-5.4.45:
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)

Conflicts:
	ext/pcre/php_pcre.c
	ext/standard/var_unserializer.c
2015-09-01 00:28:39 -07:00
Stanislav Malyshev c8f07ad477 add test 2015-09-01 00:26:12 -07:00
Stanislav Malyshev 259057b2a4 Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList 2015-09-01 00:20:45 -07:00
Stanislav Malyshev f06a069c46 Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage 2015-09-01 00:14:15 -07:00
Stanislav Malyshev e8429400d4 Fix bug #70172 - Use After Free Vulnerability in unserialize() 2015-08-31 23:26:14 -07:00
Stanislav Malyshev e201f01ac1 Fix bug #70388 - SOAP serialize_function_call() type confusion 2015-08-31 21:06:03 -07:00
Xinchen Hui 9da99d8c5f Merge branch 'PHP-5.6' of git.php.net:/php-src into PHP-5.6 2015-08-30 05:34:15 -07:00
Xinchen Hui ef1bd8f0e6 Fixed bug #70389 (PDO constructor changes unrelated variables) 2015-08-30 05:02:38 -07:00
Stanislav Malyshev f9c2bf73ad Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories 2015-08-30 00:38:08 -07:00
Stanislav Malyshev ce2c67c8e8 Improve fix for #70385 2015-08-29 23:01:36 -07:00
Matteo Beccati 9d816f1bcf Added missing skipif for phar+zlib test 2015-08-29 10:47:02 +02:00
Stanislav Malyshev 03964892c0 Fix bug #70345 (Multiple vulnerabilities related to PCRE functions) 2015-08-28 22:52:50 -07:00
Stanislav Malyshev 64043cb9e5 Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes) 2015-08-28 22:25:41 -07:00
Stanislav Malyshev fc8eff897b More fixes for bug #70219 2015-08-28 21:50:21 -07:00
Anatol Belski 00eebd7a47 fix dir separator in test 2015-08-28 11:39:26 +02:00
Anatol Belski 5d2294e8b8 fix path separator in test 2015-08-28 11:38:16 +02:00
Anatol Belski ebdd9cf6e8 fix test 2015-08-28 11:29:38 +02:00
Adam Harvey 4ddc4af87c Fix NEWS indentation. 2015-08-27 16:00:36 -07:00
Adam Harvey e872f4d9c1 Don't detect FreeBSD 10 as FreeBSD 1 in libtool.m4.
Fixes bug #70370 (Bundled libtool.m4 doesn't handle FreeBSD 10 when building
extensions).
2015-08-27 15:59:59 -07:00
Jakub Zelenka a5864d9917 Update NEWS with info about bug #55259 2015-08-27 21:37:59 +01:00
Stanislav Malyshev 24dda816d0 Merge branch 'PHP-5.4.45' into PHP-5.5.29
* PHP-5.4.45:
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix for bug #69782
  5.4.45 next

Conflicts:
	configure.in
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	main/php_version.h
2015-08-25 23:08:49 -07:00
Jakub Zelenka c39336d1d8 Fix bug #55259 (openssl extension does not get the DH parameters from DH key resource) 2015-08-25 20:26:11 +01:00
Christoph M. Becker e5adf2b427 updated NEWS 2015-08-24 23:05:18 +02:00
Christoph M. Becker fc203fa37e Fix #67131: setcookie() conditional for empty values not met
PHP applies a workaround for old MSIE where setting an empty cookie value would
not delete the cookie. This workaround is only triggered if an empty string (or
a value that converts to an empty string) is actually given as $value parameter
of setcookie. If the $value parameter is omitted, an empty cookie value is
sent. This commit fixes the inconsistent behavior.
2015-08-24 23:03:50 +02:00
Ferenc Kovacs 95a0b11d0a fixup, both catched by nikic 2015-08-24 17:02:25 +02:00
Ferenc Kovacs e93d7953df use another character device in this test as /dev/console seems that it is different for lxc containers 2015-08-24 14:40:21 +02:00
Ferenc Kovacs 941bbf2067 the de_DE(iso-8859-1) locale is not available on ubuntu by default, but there is no reason to require that over the utf-8 one 2015-08-24 14:40:06 +02:00
Stanislav Malyshev df4bf28f9f Fix bug #70219 (Use after free vulnerability in session deserializer) 2015-08-23 19:56:12 -07:00
Stanislav Malyshev d735957cb5 Fix bug ##70284 (Use after free vulnerability in unserialize() with GMP) 2015-08-23 16:08:07 -07:00
Ferenc Kovacs 85d34c3264 let's try running our testsuite without sudo 2015-08-23 22:47:51 +02:00
Anatol Belski 78b2b1d6f7 fix test
backport from master
2015-08-23 17:27:55 +02:00
Anatol Belski b460b530d6 fix test
backport from master
2015-08-23 17:27:53 +02:00
Anatol Belski 24e78ec1d8 fix test 2015-08-23 17:27:51 +02:00
Anatol Belski 5786f86656 fix test
backported from master
2015-08-23 17:27:50 +02:00
Bob Weinand 272cccd175 Fix phpdbg_break_next() 2015-08-23 12:07:14 +01:00
Anatol Belski 2b9c7f881a fix tests 2015-08-21 15:13:39 +02:00
Anatol Belski aa23bc6d1d fix dir separator 2015-08-21 14:08:33 +02:00
Anatol Belski 9e69ef4ce2 fix dir separator in test 2015-08-21 14:05:58 +02:00
Anatol Belski e8f37fe3dc fix dir separator in test 2015-08-21 14:04:08 +02:00
Stanislav Malyshev 1744be2d17 Fix for bug #69782 2015-08-16 17:16:15 -07:00
Lior Kaplan 9ff3334397 Add CVE IDs asigned (post release) to PHP 5.4.43 2015-08-10 11:19:18 +03:00
Lior Kaplan dc72378ff0 Add CVE IDs asigned to #69085 (PHP 5.4.39) 2015-08-10 11:18:33 +03:00
Stanislav Malyshev b221df5549 5.4.45 next 2015-08-04 23:56:15 -07:00
234 changed files with 7628 additions and 5221 deletions

No files matched your search

+15 -7
View File
@@ -1,4 +1,19 @@
language: c
sudo: false
addons:
apt:
packages:
- locales
- language-pack-de
- re2c
- libgmp-dev
- libicu-dev
- libmcrypt-dev
- libtidy-dev
- libenchant-dev
- libaspell-dev
- libpspell-dev
- librecode-dev
notifications:
email:
@@ -27,13 +42,6 @@ env:
- ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y libenchant-dev libaspell-dev libpspell-dev librecode-dev
- sudo cp ./travis/de /var/lib/locales/supported.d/de
- sudo dpkg-reconfigure locales
- ./travis/install.sh
before_script:
# Compile PHP
- ./travis/compile.sh
+1 -1
View File
@@ -57,7 +57,7 @@ php_lcov.info: lcov-test
cp $$x.bbg lcov_data/$$y.bbg ; \
fi; \
done; \
for dir in ext/bcmath/libbcmath ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
for dir in ext/bcmath/libbcmath ext/date/lib ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
if test -d lcov_data/$$dir; then \
rm -rf lcov_data/$$dir ; \
fi; \
+162 -1
View File
@@ -1,6 +1,135 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2015, PHP 5.6.14
10 Dec 2015, PHP 5.6.17RC1
- Core:
. Fixed bug #66909 (configure fails utf8_to_mutf7 test). (Michael Orlitzky)
. Fixed bug #70958 (Invalid opcode while using ::class as trait method
paramater default value). (Laruence)
. Fixed bug #70957 (self::class can not be resolved with reflection for
abstract class). (Laruence)
. Fixed bug #70944 (try{ } finally{} can create infinite chains of
exceptions). (Laruence)
. Fixed bug #61751 (SAPI build problem on AIX: Undefined symbol:
php_register_internal_extensions). (Lior Kaplan)
- Mysqlnd:
. Fixed bug #68077 (LOAD DATA LOCAL INFILE / open_basedir restriction).
(Laruence)
- SOAP:
. Fixed bug #70900 (SoapClient systematic out of memory error). (Dmitry)
- Standard:
. Fixed bug #70960 (ReflectionFunction for array_unique returns wrong number
of parameters). (Laruence)
- PDO_Firebird:
. Fixed bug #60052 (Integer returned as a 64bit integer on X64_86). (Mariuz)
26 Nov 2015, PHP 5.6.16
- Core:
. Fixed bug #70828 (php-fpm 5.6 with opcache crashes when referencing a
non-existent constant). (Laruence)
. Fixed bug #70748 (Segfault in ini_lex () at Zend/zend_ini_scanner.l).
(Laruence)
- Mysqlnd:
. Fixed bug #68344 (MySQLi does not provide way to disable peer certificate
validation) by introducing MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT
connection flag. (Andrey)
- OCI8:
. Fixed bug #68298 (OCI int overflow). (Senthil)
- PDO_DBlib:
. Fixed bug #69757 (Segmentation fault on nextRowset).
(miracle at rpz dot name)
- SOAP:
. Fixed bug #70875 (Segmentation fault if wsdl has no targetNamespace
attribute). (Matteo)
- SPL:
. Fixed bug #70852 (Segfault getting NULL offset of an ArrayObject).
(Reeze Xia)
29 Oct 2015, PHP 5.6.15
- Core:
. Fixed bug #70681 (Segfault when binding $this of internal instance method
to null). (Nikita)
. Fixed bug #70685 (Segfault for getClosure() internal method rebind with
invalid $this). (Nikita)
- Date:
. Fixed bug #70619 (DateTimeImmutable segfault). (Laruence)
- Mcrypt:
. Fixed bug #70625 (mcrypt_encrypt() won't return data when no IV was
specified under RC4). (Nikita)
- Mysqlnd:
. Fixed bug #70384 (mysqli_real_query():Unknown type 245 sent by the server).
(Andrey)
. Fixed bug #70572 segfault in mysqlnd_connect. (Andrey, Remi)
- Opcache:
. Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer).
(Laruence)
. Fixed bug #70631 (Another Segfault in gc_remove_from_buffer()). (Laruence)
. Fixed bug #70601 (Segfault in gc_remove_from_buffer()). (Laruence)
. Fixed compatibility with Windows 10 (see also bug #70652). (Anatol)
01 Oct 2015, PHP 5.6.14
- Core:
. Fixed bug #70370 (Bundled libtool.m4 doesn't handle FreeBSD 10 when
building extensions). (Adam)
- CLI server:
. Fixed bug #68291 (404 on urls with '+'). (cmb)
- DOM:
. Fixed bug #70001 (Assigning to DOMNode::textContent does additional entity
encoding). (cmb)
- ldap:
. Fixed bug #70465 (Bug in ldap_search() modifies LDAP_OPT_TIMELIMIT/DEREF's values). (Tyson Andre)
. Fixed bug #69574 (ldap timeouts not enforced). (Côme Bernigaud)
- Mysqlnd:
. Fixed bug #70456 (mysqlnd doesn't activate TCP keep-alive when connecting to
a server). (Sergei Turchanov)
- OpenSSL:
. Fixed bug #55259 (openssl extension does not get the DH parameters from
DH key resource). (Jakub Zelenka)
. Fixed bug #70395 (Missing ARG_INFO for openssl_seal()). (cmb)
. Fixed bug #60632 (openssl_seal fails with AES). (Jakub Zelenka)
. Fixed bug #68312 (Lookup for openssl.cnf causes a message box). (Anatol)
- PDO:
. Fixed bug #70389 (PDO constructor changes unrelated variables). (Laruence)
- Phar:
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()). (Stas)
. FIxed bug #70433 (Uninitialized pointer in phar_make_dirstream when zip
entry filename is "/"). (Stas)
- Phpdbg:
. Fix phpdbg_break_next() sometimes not breaking. (Bob)
- Standard:
. Fixed bug #67131 (setcookie() conditional for empty values not met). (cmb)
- Streams:
. Fixed bug #70361 (HTTP stream wrapper doesn't close keep-alive connections).
(Niklas Keller)
- Zip:
. Fixed bug #70322 (ZipArchive::close() doesn't indicate errors). (cmb)
03 Sep 2015, PHP 5.6.13
@@ -9,6 +138,9 @@ PHP NEWS
. Fixed bug #69487 (SAPI may truncate POST data). (cmb)
. Fixed bug #70198 (Checking liveness does not work as expected).
(Shafreeck Sea, Anatol Belski)
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()). (Stas)
. Fixed bug #70219 (Use after free vulnerability in session deserializer).
(taoguangchen at icloud dot com)
- CLI server:
. Fixed bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE).
@@ -21,6 +153,18 @@ PHP NEWS
. Fixed bug #70277 (new DateTimeZone($foo) is ignoring text after null byte).
(cmb)
- EXIF:
. Fixed bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte
value of 32 bytes). (Stas)
- GMP:
. Fixed bug #70284 (Use after free vulnerability in unserialize() with GMP).
(stas)
- hash:
. Fixed bug #70312 (HAVAL gives wrong hashes in specific cases). (letsgolee
at naver dot com)
- MCrypt:
. Fixed bug #69833 (mcrypt fd caching not working). (Anatol)
@@ -31,11 +175,21 @@ PHP NEWS
- PCRE:
. Fixed bug #70232 (Incorrect bump-along behavior with \K and empty string
match). (cmb)
. Fixed bug #70345 (Multiple vulnerabilities related to PCRE functions).
(Anatol Belski)
- SOAP:
. Fixed bug #70388 (SOAP serialize_function_call() type confusion / RCE).
(Stas)
- SPL:
. Fixed bug #70290 (Null pointer deref (segfault) in spl_autoload via
ob_start). (hugh at allthethings dot co dot nz)
. Fixed bug #70303 (Incorrect constructor reflection for ArrayObject). (cmb)
. Fixed bug #70365 (Use-after-free vulnerability in unserialize() with
SplObjectStorage). (taoguangchen at icloud dot com)
. Fixed bug #70366 (Use-after-free vulnerability in unserialize() with
SplDoublyLinkedList). (taoguangchen at icloud dot com)
- Standard:
. Fixed bug #70052 (getimagesize() fails for very large and very small WBMP).
@@ -43,6 +197,13 @@ PHP NEWS
. Fixed bug #70157 (parse_ini_string() segmentation fault with
INI_SCANNER_TYPED). (Tjerk)
- XSLT:
. Fixed bug #69782 (NULL pointer dereference). (Stas)
- ZIP:
. Fixed bug #70350 (ZipArchive::extractTo allows for directory traversal when
creating directories). (neal at fb dot com)
06 Aug 2015, PHP 5.6.12
- Core:
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #70681: Segfault when binding $this of internal instance method to null
--FILE--
<?php
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
$c = $c->bindTo(null);
$c = (new ReflectionFunction('strlen'))->getClosure();
$c = $c->bindTo(null);
var_dump($c("foo"));
?>
--EXPECTF--
Warning: Cannot unbind $this of internal method in %s on line %d
int(3)
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #70685: Segfault for getClosure() internal method rebind with invalid $this
--FILE--
<?php
class cls {}
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
$c = $c->bindTo(new cls);
var_dump($c);
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
$c = $c->bindTo(new SplStack, 'cls');
var_dump($c);
?>
--EXPECTF--
Warning: Cannot bind internal method SplDoublyLinkedList::count() to object of class cls in %s on line %d
NULL
Warning: Cannot bind function SplDoublyLinkedList::count to scope class cls in %s on line %d
NULL
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #70748 (Segfault in ini_lex () at Zend/zend_ini_scanner.l)
--FILE--
<?php
$ini = '[${ ';
$ini_file = __DIR__ . "/bug70748.ini";
file_put_contents($ini_file, $ini);
var_dump(parse_ini_file($ini_file));
?>
--CLEAN--
<?php
unlink(__DIR__ . "bug70748.ini");
?>
--EXPECTF--
Warning: syntax error, unexpected $end, expecting '}' in %sbug70748.ini on line %d
in %sbug70748.php on line %d
bool(false)
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #70828 (php-fpm 5.6 with opcache crashes when referencing a non-existent constant)
--FILE--
<?php
namespace test {
use const nonexistent;
class test {
static function run(){
var_dump(nonexistent);
existent;
}
}
}
namespace {
define("test\\existent", "bug!", 1);
test\test::run();
}
?>
--EXPECTF--
Notice: Use of undefined constant nonexistent - assumed 'nonexistent' in %sbug70828.php on line %d
string(11) "nonexistent"
+37
View File
@@ -0,0 +1,37 @@
--TEST--
Bug #70944 (try{ } finally{} can create infinite chains of exceptions)
--FILE--
<?php
try {
$e = new Exception("Foo");
try {
throw new Exception("Bar", 0, $e);
} finally {
throw $e;
}
} catch (Exception $e) {
var_dump((string)$e);
}
try {
$e = new Exception("Foo");
try {
throw new Exception("Bar", 0, $e);
} finally {
throw new Exception("Dummy", 0, $e);
}
} catch (Exception $e) {
var_dump((string)$e);
}
?>
--EXPECTF--
string(%d) "exception 'Exception' with message 'Foo' in %sbug70944.php:%d
Stack trace:
#0 {main}"
string(%d) "exception 'Exception' with message 'Foo' in %sbug70944.php:%d
Stack trace:
#0 {main}
Next exception 'Exception' with message 'Dummy' in %sbug70944.php:%d
Stack trace:
#0 {main}"
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #70957 (self::class can not be resolved with reflection for abstract class)
--FILE--
<?php
abstract class Foo
{
function bar($a = self::class) {}
}
trait T {
public function bar() {
}
}
class Bar extends Foo
{
use T;
}
?>
--EXPECTF--
Strict Standards: Declaration of T::bar() should be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #70958 (Invalid opcode while using ::class as trait method paramater default value)
--FILE--
<?php
trait Foo
{
function bar($a = self::class) {
var_dump($a);
}
}
class B {
use Foo;
}
$b = new B;
$b->bar();
?>
--EXPECT--
string(1) "B"
+20 -13
View File
@@ -88,6 +88,12 @@ ZEND_METHOD(Closure, bind)
zend_error(E_WARNING, "Cannot bind an instance to a static closure");
}
if (newthis == NULL && !(closure->func.common.fn_flags & ZEND_ACC_STATIC)
&& closure->func.common.scope && closure->func.type == ZEND_INTERNAL_FUNCTION) {
zend_error(E_WARNING, "Cannot unbind $this of internal method");
return;
}
if (scope_arg != NULL) { /* scope argument was given */
if (IS_ZEND_STD_OBJECT(*scope_arg)) {
ce = Z_OBJCE_P(scope_arg);
@@ -127,6 +133,19 @@ ZEND_METHOD(Closure, bind)
ce = closure->func.common.scope;
}
/* verify that we aren't binding internal function to a wrong scope */
if (closure->func.type == ZEND_INTERNAL_FUNCTION && closure->func.common.scope != NULL) {
if (ce && !instanceof_function(ce, closure->func.common.scope TSRMLS_CC)) {
zend_error(E_WARNING, "Cannot bind function %s::%s to scope class %s", closure->func.common.scope->name, closure->func.common.function_name, ce->name);
return;
}
if (ce && newthis && (closure->func.common.fn_flags & ZEND_ACC_STATIC) == 0 &&
!instanceof_function(Z_OBJCE_P(newthis), closure->func.common.scope TSRMLS_CC)) {
zend_error(E_WARNING, "Cannot bind internal method %s::%s() to object of class %s", closure->func.common.scope->name, closure->func.common.function_name, Z_OBJCE_P(newthis)->name);
return;
}
}
zend_create_closure(return_value, &closure->func, ce, newthis TSRMLS_CC);
}
/* }}} */
@@ -464,19 +483,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
closure->func.op_array.run_time_cache = NULL;
(*closure->func.op_array.refcount)++;
} else {
/* verify that we aren't binding internal function to a wrong scope */
if(func->common.scope != NULL) {
if(scope && !instanceof_function(scope, func->common.scope TSRMLS_CC)) {
zend_error(E_WARNING, "Cannot bind function %s::%s to scope class %s", func->common.scope->name, func->common.function_name, scope->name);
scope = NULL;
}
if(scope && this_ptr && (func->common.fn_flags & ZEND_ACC_STATIC) == 0 &&
!instanceof_function(Z_OBJCE_P(this_ptr), closure->func.common.scope TSRMLS_CC)) {
zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", func->common.scope->name, func->common.function_name, Z_OBJCE_P(this_ptr)->name);
scope = NULL;
this_ptr = NULL;
}
} else {
if (!func->common.scope) {
/* if it's a free function, we won't set scope & this since they're meaningless */
this_ptr = NULL;
scope = NULL;
+11 -9
View File
@@ -2214,10 +2214,16 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
if (!CG(active_class_entry)) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot access self::class when no class scope is active");
}
if (CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) {
if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
zval_dtor(&class_name->u.constant);
constant_name.op_type = IS_CONST;
ZVAL_STRINGL(&constant_name.u.constant, "class", sizeof("class")-1, 1);
zend_do_fetch_constant(result, class_name, &constant_name, ZEND_RT, 1 TSRMLS_CC);
ZVAL_STRINGL(&constant_name.u.constant, "__CLASS__", sizeof("__CLASS__")-1, 1);
if (is_static) {
*result = constant_name;
result->u.constant.type = IS_CONSTANT;
} else {
zend_do_fetch_constant(result, NULL, &constant_name, ZEND_RT, 1 TSRMLS_CC);
}
break;
}
zval_dtor(&class_name->u.constant);
@@ -3472,10 +3478,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
zval *zv, zv_copy;
int use_copy;
ALLOC_ZVAL(zv);
*zv = *precv->op2.zv;
zval_copy_ctor(zv);
INIT_PZVAL(zv);
zv = precv->op2.zv;
if ((Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN_P(zv));
memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
@@ -3517,7 +3520,6 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
zval_dtor(&zv_copy);
}
}
zval_ptr_dtor(&zv);
}
} else {
memcpy(offset, "NULL", 4);
@@ -5808,7 +5810,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
opline->op2.constant = zend_add_const_name_literal(CG(active_op_array), &constant_name->u.constant, 0 TSRMLS_CC);
} else {
opline->extended_value = IS_CONSTANT_UNQUALIFIED;
if (CG(current_namespace)) {
if (check_namespace && CG(current_namespace)) {
opline->extended_value |= IS_CONSTANT_IN_NAMESPACE;
opline->op2.constant = zend_add_const_name_literal(CG(active_op_array), &constant_name->u.constant, 1 TSRMLS_CC);
} else {
+10 -2
View File
@@ -36,7 +36,7 @@ ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
{
zval *previous;
zval *previous, *ancestor;
if (exception == add_previous || !add_previous || !exception) {
return;
@@ -46,6 +46,14 @@ void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
return;
}
while (exception && exception != add_previous && Z_OBJ_HANDLE_P(exception) != Z_OBJ_HANDLE_P(add_previous)) {
ancestor = zend_read_property(default_exception_ce, add_previous, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
while (Z_TYPE_P(ancestor) == IS_OBJECT) {
if (Z_OBJ_HANDLE_P(ancestor) == Z_OBJ_HANDLE_P(exception)) {
zval_ptr_dtor(&add_previous);
return;
}
ancestor = zend_read_property(default_exception_ce, ancestor, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
}
previous = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
if (Z_TYPE_P(previous) == IS_NULL) {
zend_update_property(default_exception_ce, exception, "previous", sizeof("previous")-1, add_previous TSRMLS_CC);
@@ -234,7 +242,6 @@ ZEND_METHOD(exception, __wakeup)
{
zval *value;
zval *object = getThis();
HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
CHECK_EXC_TYPE("message", IS_STRING);
CHECK_EXC_TYPE("string", IS_STRING);
CHECK_EXC_TYPE("code", IS_LONG);
@@ -645,6 +652,7 @@ ZEND_METHOD(exception, getPrevious)
previous = zend_read_property(default_exception_ce, getThis(), "previous", sizeof("previous")-1, 1 TSRMLS_CC);
RETURN_ZVAL(previous, 1, 0);
}
/* }}} */
int zend_spprintf(char **message, int max_len, const char *format, ...) /* {{{ */
{
+2093 -2092
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -108,7 +108,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
/* Eat leading whitespace */
#define EAT_LEADING_WHITESPACE() \
while (yytext[0]) { \
while (yyleng) { \
if (yytext[0] == ' ' || yytext[0] == '\t') { \
SCNG(yy_text)++; \
yyleng--; \
@@ -119,7 +119,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
/* Eat trailing whitespace + extra char */
#define EAT_TRAILING_WHITESPACE_EX(ch) \
while (yyleng > 0 && ( \
while (yyleng && ( \
(ch != 'X' && yytext[yyleng - 1] == ch) || \
yytext[yyleng - 1] == '\n' || \
yytext[yyleng - 1] == '\r' || \
+13 -13
View File
@@ -1,13 +1,13 @@
/* Generated by re2c 0.13.5 */
#line 3 "Zend/zend_ini_scanner_defs.h"
enum YYCONDTYPE {
yycINITIAL,
yycST_OFFSET,
yycST_SECTION_VALUE,
yycST_VALUE,
yycST_SECTION_RAW,
yycST_DOUBLE_QUOTES,
yycST_VARNAME,
yycST_RAW,
};
/* Generated by re2c 0.13.5 */
#line 3 "Zend/zend_ini_scanner_defs.h"
enum YYCONDTYPE {
yycINITIAL,
yycST_OFFSET,
yycST_SECTION_VALUE,
yycST_VALUE,
yycST_SECTION_RAW,
yycST_DOUBLE_QUOTES,
yycST_VARNAME,
yycST_RAW,
};
+2 -2
View File
@@ -1545,7 +1545,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
freebsd[[123]]*) objformat=aout ;;
freebsd[[123]].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -3162,7 +3162,7 @@ case $host_os in
;;
esac
;;
freebsd[[12]]*)
freebsd[[12]].*)
# C++ shared libraries reported to be fairly broken before switch to ELF
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
+2 -2
View File
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=6
PHP_RELEASE_VERSION=14
PHP_EXTRA_VERSION="-dev"
PHP_RELEASE_VERSION=17
PHP_EXTRA_VERSION="RC1"
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`
+1
View File
@@ -10,6 +10,7 @@ ADD_FLAG('CFLAGS_DATE', "/wd4244");
var tl_config = FSO.CreateTextFile("ext/date/lib/timelib_config.h", true);
tl_config.WriteLine("#include \"config.w32.h\"");
tl_config.WriteLine("#include <php_stdint.h>");
tl_config.WriteLine("#include \"win32/php_inttypes.h\"");
tl_config.WriteLine("#define TIMELIB_OMIT_STDINT 1");
tl_config.Close();
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Derick Rethans
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 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.
-7
View File
@@ -1,7 +0,0 @@
Regenerating Parser
===================
Make sure you use re2c 0.9.10 or higher:
re2c -d -b -o ext/date/lib/parse_date.c ext/date/lib/parse_date.re
re2c -d -b -o ext/date/lib/parse_iso_intervals.c ext/date/lib/parse_iso_intervals.re
+8
View File
@@ -0,0 +1,8 @@
timelib
=======
Timelib is a timezone and date/time library that can calculate local time,
convert between timezones and parse textual descriptions of date/time
information.
It is the library supporting PHP's Date/Time extension.
+23 -18
View File
@@ -1,26 +1,31 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/*
| Algorithms are taken from a public domain source by Paul |
| Schlyter, who wrote this in December 1992 |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include <stdio.h>
#include <math.h>
#include "timelib.h"
+24
View File
@@ -1,3 +1,27 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* This macro computes the length of the day, from sunrise to sunset. */
/* Sunrise/set is considered to occur when the Sun's upper limb is */
/* 35 arc minutes below the horizon (this accounts for the refraction */
+21 -17
View File
@@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
#include "timelib.h"
static int m_table_common[13] = { -1, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
+21 -17
View File
@@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
#include "timelib.h"
#include <math.h>
+173 -167
View File
File diff suppressed because it is too large. Load diff
+66 -60
View File
@@ -1,19 +1,25 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
@@ -104,7 +110,7 @@ typedef unsigned char uchar;
#define RET(i) {s->cur = cursor; return i;}
#define timelib_string_free free
#define timelib_string_free timelib_free
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { add_error(s, "Double time specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_time = 1; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; } }
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
@@ -316,7 +322,7 @@ uchar *fill(Scanner *s, uchar *cursor){
s->lim -= cnt;
}
if((s->top - s->lim) < BSIZE){
uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));
uchar *buf = (uchar*) timelib_malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));
memcpy(buf, s->tok, s->lim - s->tok);
s->tok = buf;
s->ptr = &buf[s->ptr - s->bot];
@@ -324,7 +330,7 @@ uchar *fill(Scanner *s, uchar *cursor){
s->pos = &buf[s->pos - s->bot];
s->lim = &buf[s->lim - s->bot];
s->top = &s->lim[BSIZE];
free(s->bot);
timelib_free(s->bot);
s->bot = buf;
}
if((cnt = read(s->fd, (char*) s->lim, BSIZE)) != BSIZE){
@@ -339,37 +345,37 @@ uchar *fill(Scanner *s, uchar *cursor){
static void add_warning(Scanner *s, char *error)
{
s->errors->warning_count++;
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
}
static void add_error(Scanner *s, char *error)
{
s->errors->error_count++;
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
}
static void add_pbf_warning(Scanner *s, char *error, char *sptr, char *cptr)
{
s->errors->warning_count++;
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages[s->errors->warning_count - 1].position = cptr - sptr;
s->errors->warning_messages[s->errors->warning_count - 1].character = *cptr;
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
}
static void add_pbf_error(Scanner *s, char *error, char *sptr, char *cptr)
{
s->errors->error_count++;
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages[s->errors->error_count - 1].position = cptr - sptr;
s->errors->error_messages[s->errors->error_count - 1].character = *cptr;
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
}
static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
@@ -433,7 +439,7 @@ static timelib_sll timelib_meridian_with_check(char **ptr, timelib_sll h)
static char *timelib_string(Scanner *s)
{
char *tmp = calloc(1, s->cur - s->tok + 1);
char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
memcpy(tmp, s->tok, s->cur - s->tok);
return tmp;
@@ -460,10 +466,10 @@ static timelib_sll timelib_get_nr_ex(char **ptr, int max_length, int *scanned_le
if (scanned_length) {
*scanned_length = end - begin;
}
str = calloc(1, end - begin + 1);
str = timelib_calloc(1, end - begin + 1);
memcpy(str, begin, end - begin);
tmp_nr = strtoll(str, NULL, 10);
free(str);
timelib_free(str);
return tmp_nr;
}
@@ -500,13 +506,13 @@ static double timelib_get_frac_nr(char **ptr, int max_length)
++len;
}
end = *ptr;
str = calloc(1, end - begin + 1);
str = timelib_calloc(1, end - begin + 1);
memcpy(str, begin, end - begin);
if (str[0] == ':') {
str[0] = '.';
}
tmp_nr = strtod(str, NULL);
free(str);
timelib_free(str);
return tmp_nr;
}
@@ -542,7 +548,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
++*ptr;
}
end = *ptr;
word = calloc(1, end - begin + 1);
word = timelib_calloc(1, end - begin + 1);
memcpy(word, begin, end - begin);
for (tp = timelib_reltext_lookup; tp->name; tp++) {
@@ -552,7 +558,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
}
}
free(word);
timelib_free(word);
return value;
}
@@ -564,18 +570,18 @@ static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
return timelib_lookup_relative_text(ptr, behavior);
}
static long timelib_lookup_month(char **ptr)
static timelib_long timelib_lookup_month(char **ptr)
{
char *word;
char *begin = *ptr, *end;
long value = 0;
timelib_long value = 0;
const timelib_lookup_table *tp;
while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
++*ptr;
}
end = *ptr;
word = calloc(1, end - begin + 1);
word = timelib_calloc(1, end - begin + 1);
memcpy(word, begin, end - begin);
for (tp = timelib_month_lookup; tp->name; tp++) {
@@ -584,11 +590,11 @@ static long timelib_lookup_month(char **ptr)
}
}
free(word);
timelib_free(word);
return value;
}
static long timelib_get_month(char **ptr)
static timelib_long timelib_get_month(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
++*ptr;
@@ -622,7 +628,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
++*ptr;
}
end = *ptr;
word = calloc(1, end - begin + 1);
word = timelib_calloc(1, end - begin + 1);
memcpy(word, begin, end - begin);
for (tp = timelib_relunit_lookup; tp->name; tp++) {
@@ -632,7 +638,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
}
}
free(word);
timelib_free(word);
return value;
}
@@ -668,7 +674,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
}
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst)
{
int first_found = 0;
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
@@ -706,18 +712,18 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return NULL;
}
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
{
char *word;
char *begin = *ptr, *end;
long value = 0;
timelib_long value = 0;
const timelib_tz_lookup_table *tp;
while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
++*ptr;
}
end = *ptr;
word = calloc(1, end - begin + 1);
word = timelib_calloc(1, end - begin + 1);
memcpy(word, begin, end - begin);
if ((tp = abbr_search(word, -1, 0))) {
@@ -733,10 +739,10 @@ static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found
return value;
}
long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
{
timelib_tzinfo *res;
long retval = 0;
timelib_long retval = 0;
*tz_not_found = 0;
@@ -764,7 +770,7 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
retval = timelib_parse_tz_cor(ptr);
} else {
int found = 0;
long offset = 0;
timelib_long offset = 0;
char *tz_abbr;
t->is_localtime = 1;
@@ -784,7 +790,7 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
found++;
}
}
free(tz_abbr);
timelib_free(tz_abbr);
*tz_not_found = (found == 0);
retval = offset;
}
@@ -797,10 +803,10 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
#define timelib_split_free(arg) { \
int i; \
for (i = 0; i < arg.c; i++) { \
free(arg.v[i]); \
timelib_free(arg.v[i]); \
} \
if (arg.v) { \
free(arg.v); \
timelib_free(arg.v); \
} \
}
@@ -871,7 +877,7 @@ iso8601normtz = 't'? hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz
gnunocolon = 't'? hour24lz minutelz;
/* gnunocolontz = hour24lz minutelz space? (tzcorrection | tz); */
iso8601nocolon = 't'? hour24lz minutelz secondlz;
iso8601nocolon = 't'? hour24lz minutelz secondlz;
/* iso8601nocolontz = hour24lz minutelz secondlz space? (tzcorrection | tz); */
/* Date formats */
@@ -1721,14 +1727,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
/*!max:re2c */
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
{
Scanner in;
int t;
char *e = s + len - 1;
memset(&in, 0, sizeof(in));
in.errors = malloc(sizeof(struct timelib_error_container));
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
@@ -1756,7 +1762,7 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container
}
e++;
in.str = malloc((e - s) + YYMAXFILL);
in.str = timelib_malloc((e - s) + YYMAXFILL);
memset(in.str, 0, (e - s) + YYMAXFILL);
memcpy(in.str, s, (e - s));
in.lim = in.str + (e - s) + YYMAXFILL;
@@ -1792,7 +1798,7 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container
add_warning(&in, "The parsed date was invalid");
}
free(in.str);
timelib_free(in.str);
if (errors) {
*errors = in.errors;
} else {
@@ -1832,7 +1838,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time)
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
}
timelib_time *timelib_parse_from_format(char *format, char *string, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
timelib_time *timelib_parse_from_format(char *format, char *string, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
{
char *fptr = format;
char *ptr = string;
@@ -1843,7 +1849,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
int allow_extra = 0;
memset(&in, 0, sizeof(in));
in.errors = malloc(sizeof(struct timelib_error_container));
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
@@ -2186,14 +2192,14 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
if (parsed->dst == TIMELIB_UNSET) parsed->dst = now->dst != TIMELIB_UNSET ? now->dst : 0;
if (!parsed->tz_abbr) {
parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
}
if (!parsed->tz_info) {
parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
}
if (parsed->zone_type == 0 && now->zone_type != 0) {
parsed->zone_type = now->zone_type;
/* parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
/* parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
*/ parsed->is_localtime = 1;
}
@@ -2202,7 +2208,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;
+59 -153
View File
@@ -1,21 +1,27 @@
/* Generated by re2c 0.13.5 on Wed Nov 27 11:14:23 2013 */
/* Generated by re2c 0.13.5 on Thu Aug 13 10:30:12 2015 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
@@ -71,7 +77,7 @@ typedef unsigned char uchar;
#define RET(i) {s->cur = cursor; return i;}
#define timelib_string_free free
#define timelib_string_free timelib_free
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
#define TIMELIB_DEINIT timelib_string_free(str)
@@ -107,24 +113,24 @@ typedef struct Scanner {
static void add_warning(Scanner *s, char *error)
{
s->errors->warning_count++;
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
}
static void add_error(Scanner *s, char *error)
{
s->errors->error_count++;
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
}
static char *timelib_string(Scanner *s)
{
char *tmp = calloc(1, s->cur - s->tok + 1);
char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
memcpy(tmp, s->tok, s->cur - s->tok);
return tmp;
@@ -148,10 +154,10 @@ static timelib_sll timelib_get_nr(char **ptr, int max_length)
++len;
}
end = *ptr;
str = calloc(1, end - begin + 1);
str = timelib_calloc(1, end - begin + 1);
memcpy(str, begin, end - begin);
tmp_nr = strtoll(str, NULL, 10);
free(str);
timelib_free(str);
return tmp_nr;
}
@@ -190,9 +196,9 @@ static void timelib_eat_until_separator(char **ptr)
}
}
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
{
long retval = 0;
timelib_long retval = 0;
*tz_not_found = 0;
@@ -228,10 +234,10 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
#define timelib_split_free(arg) { \
int i; \
for (i = 0; i < arg.c; i++) { \
free(arg.v[i]); \
timelib_free(arg.v[i]); \
} \
if (arg.v) { \
free(arg.v); \
timelib_free(arg.v); \
} \
}
@@ -244,15 +250,15 @@ static int scan(Scanner *s)
{
uchar *cursor = s->cur;
char *str, *ptr = NULL;
std:
s->tok = cursor;
s->len = 0;
#line 276 "ext/date/lib/parse_iso_intervals.re"
#line 282 "ext/date/lib/parse_iso_intervals.re"
#line 256 "ext/date/lib/parse_iso_intervals.c"
#line 262 "ext/date/lib/parse_iso_intervals.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -291,7 +297,6 @@ std:
0, 0, 0, 0, 0, 0, 0, 0,
};
YYDEBUG(0, *YYCURSOR);
if ((YYLIMIT - YYCURSOR) < 20) YYFILL(20);
yych = *YYCURSOR;
if (yych <= ',') {
@@ -316,35 +321,30 @@ std:
if (yych != 'R') goto yy11;
}
}
YYDEBUG(2, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '/') goto yy3;
if (yych <= '9') goto yy98;
yy3:
YYDEBUG(3, *YYCURSOR);
#line 389 "ext/date/lib/parse_iso_intervals.re"
#line 395 "ext/date/lib/parse_iso_intervals.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 331 "ext/date/lib/parse_iso_intervals.c"
#line 334 "ext/date/lib/parse_iso_intervals.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy3;
if (yych <= '9') goto yy59;
goto yy3;
yy5:
YYDEBUG(5, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
if (yych <= '9') goto yy12;
if (yych == 'T') goto yy14;
yy6:
YYDEBUG(6, *YYCURSOR);
#line 316 "ext/date/lib/parse_iso_intervals.re"
#line 322 "ext/date/lib/parse_iso_intervals.re"
{
timelib_sll nr;
int in_time = 0;
@@ -368,11 +368,11 @@ yy6:
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:
@@ -387,30 +387,24 @@ yy6:
}
#line 389 "ext/date/lib/parse_iso_intervals.c"
yy7:
YYDEBUG(7, *YYCURSOR);
++YYCURSOR;
YYDEBUG(8, *YYCURSOR);
#line 378 "ext/date/lib/parse_iso_intervals.re"
#line 384 "ext/date/lib/parse_iso_intervals.re"
{
goto std;
}
#line 398 "ext/date/lib/parse_iso_intervals.c"
#line 396 "ext/date/lib/parse_iso_intervals.c"
yy9:
YYDEBUG(9, *YYCURSOR);
++YYCURSOR;
YYDEBUG(10, *YYCURSOR);
#line 383 "ext/date/lib/parse_iso_intervals.re"
#line 389 "ext/date/lib/parse_iso_intervals.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 408 "ext/date/lib/parse_iso_intervals.c"
#line 404 "ext/date/lib/parse_iso_intervals.c"
yy11:
YYDEBUG(11, *YYCURSOR);
yych = *++YYCURSOR;
goto yy3;
yy12:
YYDEBUG(12, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'L') {
if (yych <= '9') {
@@ -427,7 +421,6 @@ yy12:
}
}
yy13:
YYDEBUG(13, *YYCURSOR);
YYCURSOR = YYMARKER;
if (yyaccept <= 0) {
goto yy3;
@@ -435,7 +428,6 @@ yy13:
goto yy6;
}
yy14:
YYDEBUG(14, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 128) {
@@ -443,11 +435,9 @@ yy14:
}
goto yy6;
yy15:
YYDEBUG(15, *YYCURSOR);
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
YYDEBUG(16, *YYCURSOR);
if (yybm[0+yych] & 128) {
goto yy15;
}
@@ -459,28 +449,23 @@ yy15:
if (yych != 'S') goto yy13;
}
yy17:
YYDEBUG(17, *YYCURSOR);
yych = *++YYCURSOR;
goto yy6;
yy18:
YYDEBUG(18, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
if (yych <= '9') goto yy22;
goto yy6;
yy19:
YYDEBUG(19, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
if (yych >= ':') goto yy6;
yy20:
YYDEBUG(20, *YYCURSOR);
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
YYDEBUG(21, *YYCURSOR);
if (yych <= 'L') {
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy20;
@@ -491,22 +476,18 @@ yy20:
goto yy13;
}
yy22:
YYDEBUG(22, *YYCURSOR);
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
YYDEBUG(23, *YYCURSOR);
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy22;
if (yych == 'S') goto yy17;
goto yy13;
yy24:
YYDEBUG(24, *YYCURSOR);
yych = *++YYCURSOR;
if (yych == 'T') goto yy14;
goto yy6;
yy25:
YYDEBUG(25, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'L') {
if (yych <= '9') {
@@ -526,7 +507,6 @@ yy25:
}
}
yy26:
YYDEBUG(26, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
@@ -534,7 +514,6 @@ yy26:
if (yych == 'T') goto yy14;
goto yy6;
yy27:
YYDEBUG(27, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
@@ -542,7 +521,6 @@ yy27:
if (yych == 'T') goto yy14;
goto yy6;
yy28:
YYDEBUG(28, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
@@ -550,11 +528,9 @@ yy28:
if (yych == 'T') goto yy14;
goto yy6;
yy29:
YYDEBUG(29, *YYCURSOR);
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
YYDEBUG(30, *YYCURSOR);
if (yych <= 'D') {
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy29;
@@ -570,11 +546,9 @@ yy29:
}
}
yy31:
YYDEBUG(31, *YYCURSOR);
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
YYDEBUG(32, *YYCURSOR);
if (yych <= 'C') {
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy31;
@@ -585,17 +559,14 @@ yy31:
goto yy13;
}
yy33:
YYDEBUG(33, *YYCURSOR);
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
YYDEBUG(34, *YYCURSOR);
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy33;
if (yych == 'D') goto yy24;
goto yy13;
yy35:
YYDEBUG(35, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'L') {
if (yych <= '9') {
@@ -614,22 +585,18 @@ yy35:
goto yy13;
}
}
YYDEBUG(36, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != '-') goto yy39;
YYDEBUG(37, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '0') goto yy40;
if (yych <= '1') goto yy41;
goto yy13;
yy38:
YYDEBUG(38, *YYCURSOR);
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
yy39:
YYDEBUG(39, *YYCURSOR);
if (yych <= 'L') {
if (yych <= '9') {
if (yych <= '/') goto yy13;
@@ -649,21 +616,17 @@ yy39:
}
}
yy40:
YYDEBUG(40, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy42;
goto yy13;
yy41:
YYDEBUG(41, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '3') goto yy13;
yy42:
YYDEBUG(42, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != '-') goto yy13;
YYDEBUG(43, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '0') goto yy44;
@@ -671,70 +634,55 @@ yy42:
if (yych <= '3') goto yy46;
goto yy13;
yy44:
YYDEBUG(44, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy47;
goto yy13;
yy45:
YYDEBUG(45, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy47;
goto yy13;
yy46:
YYDEBUG(46, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '2') goto yy13;
yy47:
YYDEBUG(47, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != 'T') goto yy13;
YYDEBUG(48, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '1') goto yy49;
if (yych <= '2') goto yy50;
goto yy13;
yy49:
YYDEBUG(49, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy51;
goto yy13;
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '5') goto yy13;
yy51:
YYDEBUG(51, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != ':') goto yy13;
YYDEBUG(52, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '6') goto yy13;
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= ':') goto yy13;
YYDEBUG(54, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != ':') goto yy13;
YYDEBUG(55, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '6') goto yy13;
YYDEBUG(56, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= ':') goto yy13;
YYDEBUG(57, *YYCURSOR);
++YYCURSOR;
YYDEBUG(58, *YYCURSOR);
#line 358 "ext/date/lib/parse_iso_intervals.re"
#line 364 "ext/date/lib/parse_iso_intervals.re"
{
DEBUG_OUTPUT("combinedrep");
TIMELIB_INIT;
@@ -753,17 +701,14 @@ yy51:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
#line 757 "ext/date/lib/parse_iso_intervals.c"
#line 705 "ext/date/lib/parse_iso_intervals.c"
yy59:
YYDEBUG(59, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= ':') goto yy13;
YYDEBUG(60, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= ':') goto yy13;
YYDEBUG(61, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') {
if (yych == '-') goto yy64;
@@ -774,40 +719,33 @@ yy59:
goto yy13;
}
yy62:
YYDEBUG(62, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '0') goto yy13;
if (yych <= '9') goto yy85;
goto yy13;
yy63:
YYDEBUG(63, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '2') goto yy85;
goto yy13;
yy64:
YYDEBUG(64, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '0') goto yy65;
if (yych <= '1') goto yy66;
goto yy13;
yy65:
YYDEBUG(65, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '0') goto yy13;
if (yych <= '9') goto yy67;
goto yy13;
yy66:
YYDEBUG(66, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '3') goto yy13;
yy67:
YYDEBUG(67, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != '-') goto yy13;
YYDEBUG(68, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '0') goto yy69;
@@ -815,74 +753,58 @@ yy67:
if (yych <= '3') goto yy71;
goto yy13;
yy69:
YYDEBUG(69, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '0') goto yy13;
if (yych <= '9') goto yy72;
goto yy13;
yy70:
YYDEBUG(70, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy72;
goto yy13;
yy71:
YYDEBUG(71, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '2') goto yy13;
yy72:
YYDEBUG(72, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != 'T') goto yy13;
YYDEBUG(73, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '1') goto yy74;
if (yych <= '2') goto yy75;
goto yy13;
yy74:
YYDEBUG(74, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy76;
goto yy13;
yy75:
YYDEBUG(75, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '5') goto yy13;
yy76:
YYDEBUG(76, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != ':') goto yy13;
YYDEBUG(77, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '6') goto yy13;
YYDEBUG(78, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= ':') goto yy13;
YYDEBUG(79, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != ':') goto yy13;
YYDEBUG(80, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '6') goto yy13;
YYDEBUG(81, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= ':') goto yy13;
YYDEBUG(82, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != 'Z') goto yy13;
yy83:
YYDEBUG(83, *YYCURSOR);
++YYCURSOR;
YYDEBUG(84, *YYCURSOR);
#line 292 "ext/date/lib/parse_iso_intervals.re"
#line 298 "ext/date/lib/parse_iso_intervals.re"
{
timelib_time *current;
@@ -905,9 +827,8 @@ yy83:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 909 "ext/date/lib/parse_iso_intervals.c"
#line 831 "ext/date/lib/parse_iso_intervals.c"
yy85:
YYDEBUG(85, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '0') goto yy86;
@@ -915,75 +836,60 @@ yy85:
if (yych <= '3') goto yy88;
goto yy13;
yy86:
YYDEBUG(86, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '0') goto yy13;
if (yych <= '9') goto yy89;
goto yy13;
yy87:
YYDEBUG(87, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy89;
goto yy13;
yy88:
YYDEBUG(88, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '2') goto yy13;
yy89:
YYDEBUG(89, *YYCURSOR);
yych = *++YYCURSOR;
if (yych != 'T') goto yy13;
YYDEBUG(90, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '1') goto yy91;
if (yych <= '2') goto yy92;
goto yy13;
yy91:
YYDEBUG(91, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '9') goto yy93;
goto yy13;
yy92:
YYDEBUG(92, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '5') goto yy13;
yy93:
YYDEBUG(93, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '6') goto yy13;
YYDEBUG(94, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= ':') goto yy13;
YYDEBUG(95, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= '6') goto yy13;
YYDEBUG(96, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych >= ':') goto yy13;
YYDEBUG(97, *YYCURSOR);
yych = *++YYCURSOR;
if (yych == 'Z') goto yy83;
goto yy13;
yy98:
YYDEBUG(98, *YYCURSOR);
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
YYDEBUG(99, *YYCURSOR);
if (yych <= '/') goto yy100;
if (yych <= '9') goto yy98;
yy100:
YYDEBUG(100, *YYCURSOR);
#line 281 "ext/date/lib/parse_iso_intervals.re"
#line 287 "ext/date/lib/parse_iso_intervals.re"
{
DEBUG_OUTPUT("recurrences");
TIMELIB_INIT;
@@ -993,9 +899,9 @@ yy100:
s->have_recurrences = 1;
return TIMELIB_PERIOD;
}
#line 997 "ext/date/lib/parse_iso_intervals.c"
#line 903 "ext/date/lib/parse_iso_intervals.c"
}
#line 393 "ext/date/lib/parse_iso_intervals.re"
#line 399 "ext/date/lib/parse_iso_intervals.re"
}
#ifdef PHP_WIN32
@@ -1004,9 +910,9 @@ yy100:
#define YYMAXFILL 20
void timelib_strtointerval(char *s, int len,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
void timelib_strtointerval(char *s, size_t len,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
struct timelib_error_container **errors)
{
Scanner in;
@@ -1014,7 +920,7 @@ void timelib_strtointerval(char *s, int len,
char *e = s + len - 1;
memset(&in, 0, sizeof(in));
in.errors = malloc(sizeof(struct timelib_error_container));
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
@@ -1040,7 +946,7 @@ void timelib_strtointerval(char *s, int len,
e++;
/* init cursor */
in.str = malloc((e - s) + YYMAXFILL);
in.str = timelib_malloc((e - s) + YYMAXFILL);
memset(in.str, 0, (e - s) + YYMAXFILL);
memcpy(in.str, s, (e - s));
in.lim = in.str + (e - s) + YYMAXFILL;
@@ -1094,7 +1000,7 @@ void timelib_strtointerval(char *s, int len,
#endif
} while(t != EOI);
free(in.str);
timelib_free(in.str);
if (errors) {
*errors = in.errors;
} else {
+37 -31
View File
@@ -1,19 +1,25 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
@@ -69,7 +75,7 @@ typedef unsigned char uchar;
#define RET(i) {s->cur = cursor; return i;}
#define timelib_string_free free
#define timelib_string_free timelib_free
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
#define TIMELIB_DEINIT timelib_string_free(str)
@@ -105,24 +111,24 @@ typedef struct Scanner {
static void add_warning(Scanner *s, char *error)
{
s->errors->warning_count++;
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
}
static void add_error(Scanner *s, char *error)
{
s->errors->error_count++;
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
}
static char *timelib_string(Scanner *s)
{
char *tmp = calloc(1, s->cur - s->tok + 1);
char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
memcpy(tmp, s->tok, s->cur - s->tok);
return tmp;
@@ -146,10 +152,10 @@ static timelib_sll timelib_get_nr(char **ptr, int max_length)
++len;
}
end = *ptr;
str = calloc(1, end - begin + 1);
str = timelib_calloc(1, end - begin + 1);
memcpy(str, begin, end - begin);
tmp_nr = strtoll(str, NULL, 10);
free(str);
timelib_free(str);
return tmp_nr;
}
@@ -188,9 +194,9 @@ static void timelib_eat_until_separator(char **ptr)
}
}
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
{
long retval = 0;
timelib_long retval = 0;
*tz_not_found = 0;
@@ -226,10 +232,10 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
#define timelib_split_free(arg) { \
int i; \
for (i = 0; i < arg.c; i++) { \
free(arg.v[i]); \
timelib_free(arg.v[i]); \
} \
if (arg.v) { \
free(arg.v); \
timelib_free(arg.v); \
} \
}
@@ -398,7 +404,7 @@ isoweek = year4 "-"? "W" weekofyear;
/*!max:re2c */
void timelib_strtointerval(char *s, int len,
void timelib_strtointerval(char *s, size_t len,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
struct timelib_error_container **errors)
@@ -408,7 +414,7 @@ void timelib_strtointerval(char *s, int len,
char *e = s + len - 1;
memset(&in, 0, sizeof(in));
in.errors = malloc(sizeof(struct timelib_error_container));
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
@@ -434,7 +440,7 @@ void timelib_strtointerval(char *s, int len,
e++;
/* init cursor */
in.str = malloc((e - s) + YYMAXFILL);
in.str = timelib_malloc((e - s) + YYMAXFILL);
memset(in.str, 0, (e - s) + YYMAXFILL);
memcpy(in.str, s, (e - s));
in.lim = in.str + (e - s) + YYMAXFILL;
@@ -488,7 +494,7 @@ void timelib_strtointerval(char *s, int len,
#endif
} while(t != EOI);
free(in.str);
timelib_free(in.str);
if (errors) {
*errors = in.errors;
} else {
+50 -46
View File
@@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
#include "timelib.h"
#include <stdio.h>
@@ -103,7 +107,7 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
unsigned char *cbuffer = NULL;
if (tz->bit32.timecnt) {
buffer = (int32_t*) malloc(tz->bit32.timecnt * sizeof(int32_t));
buffer = (int32_t*) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
if (!buffer) {
return;
}
@@ -113,9 +117,9 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
buffer[i] = timelib_conv_int(buffer[i]);
}
cbuffer = (unsigned char*) malloc(tz->bit32.timecnt * sizeof(unsigned char));
cbuffer = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
if (!cbuffer) {
free(buffer);
timelib_free(buffer);
return;
}
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit32.timecnt);
@@ -147,16 +151,16 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
int32_t *leap_buffer;
unsigned int i, j;
buffer = (unsigned char*) malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
buffer = (unsigned char*) timelib_malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
if (!buffer) {
return;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit32.typecnt);
*tzf += sizeof(unsigned char) * 6 * tz->bit32.typecnt;
tz->type = (ttinfo*) malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
tz->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
if (!tz->type) {
free(buffer);
timelib_free(buffer);
return;
}
@@ -166,9 +170,9 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
tz->type[i].isdst = buffer[j + 4];
tz->type[i].abbr_idx = buffer[j + 5];
}
free(buffer);
timelib_free(buffer);
tz->timezone_abbr = (char*) malloc(tz->bit32.charcnt);
tz->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
if (!tz->timezone_abbr) {
return;
}
@@ -176,27 +180,27 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
*tzf += sizeof(char) * tz->bit32.charcnt;
if (tz->bit32.leapcnt) {
leap_buffer = (int32_t *) malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
leap_buffer = (int32_t *) timelib_malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
if (!leap_buffer) {
return;
}
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->bit32.leapcnt * sizeof(tlinfo));
tz->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
if (!tz->leap_times) {
free(leap_buffer);
timelib_free(leap_buffer);
return;
}
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);
timelib_free(leap_buffer);
}
if (tz->bit32.ttisstdcnt) {
buffer = (unsigned char*) malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
if (!buffer) {
return;
}
@@ -206,11 +210,11 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
for (i = 0; i < tz->bit32.ttisstdcnt; i++) {
tz->type[i].isstdcnt = buffer[i];
}
free(buffer);
timelib_free(buffer);
}
if (tz->bit32.ttisgmtcnt) {
buffer = (unsigned char*) malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
if (!buffer) {
return;
}
@@ -220,7 +224,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
for (i = 0; i < tz->bit32.ttisgmtcnt; i++) {
tz->type[i].isgmtcnt = buffer[i];
}
free(buffer);
timelib_free(buffer);
}
}
@@ -249,7 +253,7 @@ static void read_location(const unsigned char **tzf, timelib_tzinfo *tz)
comments_len = timelib_conv_int(buffer[2]);
*tzf += sizeof(buffer);
tz->location.comments = malloc(comments_len + 1);
tz->location.comments = timelib_malloc(comments_len + 1);
memcpy(tz->location.comments, *tzf, comments_len);
tz->location.comments[comments_len] = '\0';
*tzf += comments_len;
@@ -263,12 +267,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->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("UTC/Local count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.ttisgmtcnt);
printf("Std/Wall count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.ttisstdcnt);
printf("Leap.sec. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.leapcnt);
printf("Trans. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.timecnt);
printf("Local types count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.typecnt);
printf("Zone Abbr. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.charcnt);
printf ("%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
"", "", 0,
@@ -306,7 +310,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
tmp = setlocale(LC_CTYPE, NULL);
if (tmp) {
cur_locale = strdup(tmp);
cur_locale = timelib_strdup(tmp);
}
setlocale(LC_CTYPE, "C");
#endif
@@ -323,7 +327,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
(*tzf) = &(tzdb->data[tzdb->index[mid].pos]);
#ifdef HAVE_SETLOCALE
setlocale(LC_CTYPE, cur_locale);
if (cur_locale) free(cur_locale);
if (cur_locale) timelib_free(cur_locale);
#endif
return 1;
}
@@ -332,7 +336,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);
if (cur_locale) timelib_free(cur_locale);
#endif
return 0;
}
@@ -424,13 +428,13 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
*transition_time = 0;
j = 0;
while (j < tz->bit32.timecnt && tz->type[j].isdst) {
while (j < tz->bit32.timecnt && tz->type[tz->trans_idx[j]].isdst) {
++j;
}
if (j == tz->bit32.timecnt) {
j = 0;
}
return &(tz->type[j]);
return &(tz->type[tz->trans_idx[j]]);
}
/* In all other cases we loop through the available transtion times to find
@@ -499,7 +503,7 @@ timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *
tmp->offset = offset;
tmp->leap_secs = leap_secs;
tmp->abbr = abbr ? strdup(abbr) : strdup("GMT");
tmp->abbr = abbr ? timelib_strdup(abbr) : timelib_strdup("GMT");
return tmp;
}
+47 -42
View File
@@ -1,30 +1,34 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
#include "timelib.h"
#include <ctype.h>
#include <math.h>
#define TIMELIB_TIME_FREE(m) \
if (m) { \
free(m); \
timelib_free(m); \
m = NULL; \
} \
@@ -35,7 +39,7 @@
timelib_time* timelib_time_ctor(void)
{
timelib_time *t;
t = calloc(1, sizeof(timelib_time));
t = timelib_calloc(1, sizeof(timelib_time));
return t;
}
@@ -43,7 +47,7 @@ timelib_time* timelib_time_ctor(void)
timelib_rel_time* timelib_rel_time_ctor(void)
{
timelib_rel_time *t;
t = calloc(1, sizeof(timelib_rel_time));
t = timelib_calloc(1, sizeof(timelib_rel_time));
return t;
}
@@ -53,7 +57,7 @@ timelib_time* timelib_time_clone(timelib_time *orig)
timelib_time *tmp = timelib_time_ctor();
memcpy(tmp, orig, sizeof(timelib_time));
if (orig->tz_abbr) {
tmp->tz_abbr = strdup(orig->tz_abbr);
tmp->tz_abbr = timelib_strdup(orig->tz_abbr);
}
if (orig->tz_info) {
tmp->tz_info = orig->tz_info;
@@ -71,10 +75,11 @@ timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel)
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr)
{
unsigned int i;
size_t tz_abbr_len = strlen(tz_abbr);
TIMELIB_TIME_FREE(tm->tz_abbr);
tm->tz_abbr = strdup(tz_abbr);
for (i = 0; i < strlen(tz_abbr); i++) {
tm->tz_abbr = timelib_strdup(tz_abbr);
for (i = 0; i < tz_abbr_len; i++) {
tm->tz_abbr[i] = toupper(tz_abbr[i]);
}
}
@@ -93,7 +98,7 @@ void timelib_rel_time_dtor(timelib_rel_time* t)
timelib_time_offset* timelib_time_offset_ctor(void)
{
timelib_time_offset *t;
t = calloc(1, sizeof(timelib_time_offset));
t = timelib_calloc(1, sizeof(timelib_time_offset));
return t;
}
@@ -107,8 +112,8 @@ void timelib_time_offset_dtor(timelib_time_offset* t)
timelib_tzinfo* timelib_tzinfo_ctor(char *name)
{
timelib_tzinfo *t;
t = calloc(1, sizeof(timelib_tzinfo));
t->name = strdup(name);
t = timelib_calloc(1, sizeof(timelib_tzinfo));
t->name = timelib_strdup(name);
return t;
}
@@ -123,18 +128,18 @@ timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
tmp->bit32.typecnt = tz->bit32.typecnt;
tmp->bit32.charcnt = tz->bit32.charcnt;
tmp->trans = (int32_t *) malloc(tz->bit32.timecnt * sizeof(int32_t));
tmp->trans_idx = (unsigned char*) malloc(tz->bit32.timecnt * sizeof(unsigned char));
tmp->trans = (int32_t *) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
tmp->trans_idx = (unsigned char*) timelib_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->type = (ttinfo*) malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
tmp->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(struct ttinfo));
tmp->timezone_abbr = (char*) malloc(tz->bit32.charcnt);
tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
tmp->leap_times = (tlinfo*) malloc(tz->bit32.leapcnt * sizeof(tlinfo));
tmp->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
return tmp;
@@ -166,23 +171,23 @@ void timelib_error_container_dtor(timelib_error_container *errors)
int i;
for (i = 0; i < errors->warning_count; i++) {
free(errors->warning_messages[i].message);
timelib_free(errors->warning_messages[i].message);
}
free(errors->warning_messages);
timelib_free(errors->warning_messages);
for (i = 0; i < errors->error_count; i++) {
free(errors->error_messages[i].message);
timelib_free(errors->error_messages[i].message);
}
free(errors->error_messages);
free(errors);
timelib_free(errors->error_messages);
timelib_free(errors);
}
signed long timelib_date_to_int(timelib_time *d, int *error)
timelib_long timelib_date_to_int(timelib_time *d, int *error)
{
timelib_sll ts;
ts = d->sse;
if (ts < LONG_MIN || ts > LONG_MAX) {
if (ts < TIMELIB_LONG_MIN || ts > TIMELIB_LONG_MAX) {
if (error) {
*error = 1;
}
@@ -191,7 +196,7 @@ signed long timelib_date_to_int(timelib_time *d, int *error)
if (error) {
*error = 0;
}
return (signed long) d->sse;
return (timelib_long) d->sse;
}
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
@@ -286,10 +291,10 @@ void timelib_dump_rel_time(timelib_rel_time *d)
printf("\n");
}
long timelib_parse_tz_cor(char **ptr)
timelib_long timelib_parse_tz_cor(char **ptr)
{
char *begin = *ptr, *end;
long tmp;
timelib_long tmp;
while (isdigit(**ptr) || **ptr == ':') {
++*ptr;
+39 -26
View File
@@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
#ifndef __TIMELIB_H__
#define __TIMELIB_H__
@@ -26,7 +30,16 @@
#include <limits.h>
#endif
#define TIMELIB_VERSION 201102
#ifndef timelib_malloc
# define timelib_malloc malloc
# define timelib_realloc realloc
# define timelib_calloc calloc
# define timelib_strdup strdup
# define timelib_free free
#endif
#define TIMELIB_VERSION 201502
#define TIMELIB_ASCII_VERSION "2015.02"
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
@@ -71,15 +84,15 @@ int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
/* From parse_date.re */
timelib_time *timelib_strtotime(char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
timelib_time *timelib_parse_from_format(char *format, char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
timelib_time *timelib_strtotime(char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
timelib_time *timelib_parse_from_format(char *format, char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst);
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
long timelib_parse_tz_cor(char**);
timelib_long timelib_parse_tz_cor(char**);
/* From parse_iso_intervals.re */
void timelib_strtointerval(char *s, int len,
void timelib_strtointerval(char *s, size_t len,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
struct timelib_error_container **errors);
@@ -108,7 +121,7 @@ timelib_sll timelib_get_current_offset(timelib_time *t);
void timelib_dump_tzinfo(timelib_tzinfo *tz);
const timelib_tzdb *timelib_builtin_db(void);
const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count);
long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
/* From timelib.c */
timelib_tzinfo* timelib_tzinfo_ctor(char *name);
@@ -131,12 +144,12 @@ void timelib_time_offset_dtor(timelib_time_offset* t);
void timelib_error_container_dtor(timelib_error_container *errors);
signed long timelib_date_to_int(timelib_time *d, int *error);
timelib_long timelib_date_to_int(timelib_time *d, int *error);
void timelib_dump_date(timelib_time *d, int options);
void timelib_dump_rel_time(timelib_rel_time *d);
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
long timelib_parse_tz_cor(char **ptr);
timelib_long timelib_parse_tz_cor(char **ptr);
/* from astro.c */
double timelib_ts_to_juliandate(timelib_sll ts);
+41 -19
View File
@@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
#ifndef __TIMELIB_STRUCTS_H__
#define __TIMELIB_STRUCTS_H__
@@ -121,6 +125,24 @@ typedef unsigned __int64 uint64_t;
#include <strings.h>
#endif
#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
typedef int64_t timelib_long;
typedef uint64_t timelib_ulong;
# define TIMELIB_LONG_MAX INT64_MAX
# define TIMELIB_LONG_MIN INT64_MIN
# define TIMELIB_ULONG_MAX UINT64_MAX
# define TIMELIB_LONG_FMT "%" PRId64
# define TIMELIB_ULONG_FMT "%" PRIu64
#else
typedef int32_t timelib_long;
typedef uint32_t timelib_ulong;
# define TIMELIB_LONG_MAX INT32_MAX
# define TIMELIB_LONG_MIN INT32_MIN
# define TIMELIB_ULONG_MAX UINT32_MAX
# define TIMELIB_LONG_FMT "%" PRId32
# define TIMELIB_ULONG_FMT "%" PRIu32
#endif
#if defined(_MSC_VER)
typedef uint64_t timelib_ull;
typedef int64_t timelib_sll;
@@ -249,10 +271,10 @@ typedef struct timelib_error_message {
} timelib_error_message;
typedef struct timelib_error_container {
int warning_count;
struct timelib_error_message *error_messages;
struct timelib_error_message *warning_messages;
int error_count;
struct timelib_error_message *error_messages;
int warning_count;
} timelib_error_container;
typedef struct _timelib_tz_lookup_table {
+666 -510
View File
File diff suppressed because it is too large. Load diff
+47 -63
View File
@@ -23,9 +23,6 @@
{ "acwst", 0, 31500, "Australia/Eucla" },
{ "addt", 1, -7200, "America/Goose_Bay" },
{ "addt", 1, -7200, "America/Pangnirtung" },
{ "admt", 0, 9320, "Africa/Addis_Ababa" },
{ "admt", 0, 9320, "Africa/Asmara" },
{ "admt", 0, 9320, "Africa/Asmera" },
{ "adt", 1, -10800, "America/Halifax" },
{ "adt", 1, -10800, "America/Barbados" },
{ "adt", 1, -10800, "America/Blanc-Sablon" },
@@ -124,7 +121,6 @@
{ "ant", 0, -16200, "America/Aruba" },
{ "ant", 0, -16200, "America/Kralendijk" },
{ "ant", 0, -16200, "America/Lower_Princes" },
{ "aot", 0, 3124, "Africa/Luanda" },
{ "apt", 1, -10800, "America/Halifax" },
{ "apt", 1, -10800, "America/Blanc-Sablon" },
{ "apt", 1, -10800, "America/Glace_Bay" },
@@ -236,6 +232,7 @@
{ "ast", 0, -14400, "America/Dominica" },
{ "ast", 0, -14400, "America/Glace_Bay" },
{ "ast", 0, -14400, "America/Goose_Bay" },
{ "ast", 0, -14400, "America/Grand_Turk" },
{ "ast", 0, -14400, "America/Grenada" },
{ "ast", 0, -14400, "America/Guadeloupe" },
{ "ast", 0, -14400, "America/Halifax" },
@@ -305,16 +302,34 @@
{ "bdt", 1, -36000, "America/Nome" },
{ "bdt", 0, 21600, "Asia/Dhaka" },
{ "beat", 0, 9000, "Africa/Mogadishu" },
{ "beat", 0, 9000, "Africa/Addis_Ababa" },
{ "beat", 0, 9000, "Africa/Asmara" },
{ "beat", 0, 9000, "Africa/Asmera" },
{ "beat", 0, 9000, "Africa/Dar_es_Salaam" },
{ "beat", 0, 9000, "Africa/Djibouti" },
{ "beat", 0, 9000, "Africa/Kampala" },
{ "beat", 0, 9000, "Africa/Nairobi" },
{ "beat", 0, 9000, "Indian/Antananarivo" },
{ "beat", 0, 9000, "Indian/Comoro" },
{ "beat", 0, 9000, "Indian/Mayotte" },
{ "beaut", 0, 9900, "Africa/Nairobi" },
{ "beaut", 0, 9900, "Africa/Addis_Ababa" },
{ "beaut", 0, 9900, "Africa/Asmara" },
{ "beaut", 0, 9900, "Africa/Asmera" },
{ "beaut", 0, 9900, "Africa/Dar_es_Salaam" },
{ "beaut", 0, 9900, "Africa/Djibouti" },
{ "beaut", 0, 9900, "Africa/Kampala" },
{ "beaut", 0, 9900, "Africa/Mogadishu" },
{ "beaut", 0, 9900, "Indian/Antananarivo" },
{ "beaut", 0, 9900, "Indian/Comoro" },
{ "beaut", 0, 9900, "Indian/Mayotte" },
{ "bmt", 0, -14309, "America/Barbados" },
{ "bmt", 0, 6264, "Europe/Tiraspol" },
{ "bmt", 0, -17776, "America/Bogota" },
{ "bmt", 0, 10656, "Asia/Baghdad" },
{ "bmt", 0, 24124, "Asia/Bangkok" },
{ "bmt", 0, 24124, "Asia/Phnom_Penh" },
{ "bmt", 0, 24124, "Asia/Vientiane" },
{ "bmt", 0, 25632, "Asia/Jakarta" },
{ "bmt", 0, 6264, "Europe/Bucharest" },
{ "bmt", 0, 6264, "Europe/Chisinau" },
@@ -362,6 +377,7 @@
{ "bst", 1, 3600, "Europe/Isle_of_Man" },
{ "bst", 1, 3600, "Europe/Jersey" },
{ "bst", 1, 3600, "GB" },
{ "bst", 0, 39600, "Pacific/Bougainville" },
{ "btt", 0, 21600, "Asia/Thimbu" },
{ "btt", 0, 21600, "Asia/Thimphu" },
{ "burt", 0, 23400, "Asia/Kolkata" },
@@ -372,7 +388,6 @@
{ "cant", 0, -3600, "Atlantic/Canary" },
{ "capt", 1, -32400, "America/Anchorage" },
{ "cast", 0, 34200, "Australia/Adelaide" },
{ "cast", 1, 10800, "Africa/Gaborone" },
{ "cast", 1, 10800, "Africa/Juba" },
{ "cast", 1, 10800, "Africa/Khartoum" },
{ "cast", 0, 39600, "Antarctica/Casey" },
@@ -445,7 +460,6 @@
{ "cdt", 1, 32400, "PRC" },
{ "cdt", 1, 32400, "ROC" },
{ "cemt", 1, 10800, "Europe/Berlin" },
{ "cemt", 1, 10800, "CET" },
{ "cest", 1, 7200, "Europe/Berlin" },
{ "cest", 1, 10800, "Europe/Kaliningrad" },
{ "cest", 1, 7200, "Africa/Algiers" },
@@ -455,7 +469,6 @@
{ "cest", 1, 7200, "Antarctica/Troll" },
{ "cest", 1, 7200, "Arctic/Longyearbyen" },
{ "cest", 1, 7200, "Atlantic/Jan_Mayen" },
{ "cest", 1, 7200, "CET" },
{ "cest", 1, 7200, "Europe/Amsterdam" },
{ "cest", 1, 7200, "Europe/Andorra" },
{ "cest", 1, 7200, "Europe/Athens" },
@@ -500,7 +513,6 @@
{ "cest", 1, 7200, "Europe/Zagreb" },
{ "cest", 1, 7200, "Europe/Zaporozhye" },
{ "cest", 1, 7200, "Europe/Zurich" },
{ "cest", 1, 7200, "WET" },
{ "cet", 0, 3600, "Europe/Berlin" },
{ "cet", 0, 7200, "Europe/Kaliningrad" },
{ "cet", 0, 3600, "Africa/Algiers" },
@@ -510,7 +522,6 @@
{ "cet", 0, 3600, "Africa/Tunis" },
{ "cet", 0, 3600, "Arctic/Longyearbyen" },
{ "cet", 0, 3600, "Atlantic/Jan_Mayen" },
{ "cet", 0, 3600, "CET" },
{ "cet", 0, 3600, "Europe/Amsterdam" },
{ "cet", 0, 3600, "Europe/Andorra" },
{ "cet", 0, 3600, "Europe/Athens" },
@@ -555,7 +566,6 @@
{ "cet", 0, 3600, "Europe/Zagreb" },
{ "cet", 0, 3600, "Europe/Zaporozhye" },
{ "cet", 0, 3600, "Europe/Zurich" },
{ "cet", 0, 3600, "WET" },
{ "cgst", 1, -3600, "America/Scoresbysund" },
{ "cgt", 0, -7200, "America/Scoresbysund" },
{ "chadt", 1, 49500, "Pacific/Chatham" },
@@ -563,6 +573,7 @@
{ "chast", 0, 44100, "Pacific/Chatham" },
{ "chdt", 1, -19800, "America/Belize" },
{ "chost", 1, 36000, "Asia/Choibalsan" },
{ "chost", 1, 32400, "Asia/Choibalsan" },
{ "chot", 0, 32400, "Asia/Choibalsan" },
{ "chot", 0, 28800, "Asia/Choibalsan" },
{ "chut", 0, 36000, "Pacific/Chuuk" },
@@ -577,7 +588,10 @@
{ "clst", 1, -10800, "Chile/Continental" },
{ "clst", 1, -14400, "Chile/Continental" },
{ "clt", 0, -14400, "America/Santiago" },
{ "clt", 0, -10800, "America/Santiago" },
{ "clt", 0, -18000, "America/Santiago" },
{ "clt", 0, -10800, "Antarctica/Palmer" },
{ "clt", 0, -10800, "Chile/Continental" },
{ "clt", 0, -14400, "Antarctica/Palmer" },
{ "clt", 0, -14400, "Chile/Continental" },
{ "clt", 0, -18000, "Chile/Continental" },
@@ -602,6 +616,7 @@
{ "cmt", 0, -15408, "America/Rosario" },
{ "cmt", 0, -16060, "America/Caracas" },
{ "cmt", 0, -16356, "America/La_Paz" },
{ "cmt", 0, -19176, "America/Cayman" },
{ "cmt", 0, -19176, "America/Panama" },
{ "cmt", 0, 6900, "Europe/Chisinau" },
{ "cmt", 0, 6900, "Europe/Tiraspol" },
@@ -735,9 +750,10 @@
{ "easst", 1, -18000, "Chile/EasterIsland" },
{ "easst", 1, -18000, "Pacific/Easter" },
{ "easst", 1, -21600, "Pacific/Easter" },
{ "east", 0, -18000, "Chile/EasterIsland" },
{ "east", 0, -21600, "Chile/EasterIsland" },
{ "east", 0, -25200, "Chile/EasterIsland" },
{ "east", 1, 14400, "Indian/Antananarivo" },
{ "east", 0, -18000, "Pacific/Easter" },
{ "east", 0, -21600, "Pacific/Easter" },
{ "east", 0, -25200, "Pacific/Easter" },
{ "eat", 0, 10800, "Africa/Khartoum" },
@@ -783,7 +799,6 @@
{ "edt", 1, -14400, "America/Thunder_Bay" },
{ "edt", 1, -14400, "America/Toronto" },
{ "edt", 1, -14400, "Canada/Eastern" },
{ "edt", 1, -14400, "EST" },
{ "eest", 1, 10800, "Europe/Helsinki" },
{ "eest", 1, 10800, "Africa/Cairo" },
{ "eest", 1, 10800, "Asia/Amman" },
@@ -793,7 +808,6 @@
{ "eest", 1, 10800, "Asia/Hebron" },
{ "eest", 1, 10800, "Asia/Istanbul" },
{ "eest", 1, 10800, "Asia/Nicosia" },
{ "eest", 1, 10800, "EET" },
{ "eest", 1, 10800, "Europe/Athens" },
{ "eest", 1, 10800, "Europe/Bucharest" },
{ "eest", 1, 10800, "Europe/Chisinau" },
@@ -826,7 +840,6 @@
{ "eet", 0, 7200, "Asia/Hebron" },
{ "eet", 0, 7200, "Asia/Istanbul" },
{ "eet", 0, 7200, "Asia/Nicosia" },
{ "eet", 0, 7200, "EET" },
{ "eet", 0, 7200, "Europe/Athens" },
{ "eet", 0, 7200, "Europe/Bucharest" },
{ "eet", 0, 7200, "Europe/Chisinau" },
@@ -859,9 +872,7 @@
{ "ept", 1, -14400, "America/Thunder_Bay" },
{ "ept", 1, -14400, "America/Toronto" },
{ "ept", 1, -14400, "Canada/Eastern" },
{ "ept", 1, -14400, "EST" },
{ "est", 0, -18000, "America/New_York" },
{ "est", 0, -18000, "America/Antigua" },
{ "est", 0, -18000, "America/Atikokan" },
{ "est", 0, -18000, "America/Cambridge_Bay" },
{ "est", 0, -18000, "America/Cancun" },
@@ -902,7 +913,6 @@
{ "est", 0, -18000, "America/Thunder_Bay" },
{ "est", 0, -18000, "America/Toronto" },
{ "est", 0, -18000, "Canada/Eastern" },
{ "est", 0, -18000, "EST" },
{ "ewt", 1, -14400, "America/New_York" },
{ "ewt", 1, -14400, "America/Detroit" },
{ "ewt", 1, -14400, "America/Iqaluit" },
@@ -911,7 +921,6 @@
{ "ewt", 1, -14400, "America/Thunder_Bay" },
{ "ewt", 1, -14400, "America/Toronto" },
{ "ewt", 1, -14400, "Canada/Eastern" },
{ "ewt", 1, -14400, "EST" },
{ "fet", 0, 10800, "Europe/Kaliningrad" },
{ "fet", 0, 10800, "Europe/Minsk" },
{ "ffmt", 0, -14660, "America/Martinique" },
@@ -953,12 +962,9 @@
{ "gmt", 0, 0, "Africa/Dakar" },
{ "gmt", 0, 0, "Africa/Freetown" },
{ "gmt", 0, 0, "Africa/Lome" },
{ "gmt", 0, 0, "Africa/Malabo" },
{ "gmt", 0, 0, "Africa/Monrovia" },
{ "gmt", 0, 0, "Africa/Niamey" },
{ "gmt", 0, 0, "Africa/Nouakchott" },
{ "gmt", 0, 0, "Africa/Ouagadougou" },
{ "gmt", 0, 0, "Africa/Porto-Novo" },
{ "gmt", 0, 0, "Africa/Sao_Tome" },
{ "gmt", 0, 0, "Africa/Timbuktu" },
{ "gmt", 0, 0, "America/Danmarkshavn" },
@@ -980,6 +986,7 @@
{ "gst", 0, 14400, "Asia/Muscat" },
{ "gst", 0, 14400, "Asia/Qatar" },
{ "gst", 0, 36000, "Pacific/Guam" },
{ "gst", 0, 36000, "Pacific/Saipan" },
{ "gyt", 0, -14400, "America/Guyana" },
{ "gyt", 0, -10800, "America/Guyana" },
{ "gyt", 0, -13500, "America/Guyana" },
@@ -988,7 +995,6 @@
{ "hast", 0, -36000, "America/Adak" },
{ "hast", 0, -36000, "America/Atka" },
{ "hdt", 1, -34200, "Pacific/Honolulu" },
{ "hdt", 1, -34200, "HST" },
{ "hdt", 1, -34200, "Pacific/Johnston" },
{ "hkst", 1, 32400, "Asia/Hong_Kong" },
{ "hkt", 0, 28800, "Asia/Hong_Kong" },
@@ -998,7 +1004,6 @@
{ "hmt", 0, 21200, "Asia/Dacca" },
{ "hmt", 0, 21200, "Asia/Dhaka" },
{ "hmt", 0, 21200, "Asia/Kolkata" },
{ "hmt", 0, 5989, "EET" },
{ "hmt", 0, 5989, "Europe/Helsinki" },
{ "hmt", 0, 5989, "Europe/Mariehamn" },
{ "hovst", 1, 28800, "Asia/Hovd" },
@@ -1006,27 +1011,23 @@
{ "hovt", 0, 21600, "Asia/Hovd" },
{ "hst", 0, -36000, "Pacific/Honolulu" },
{ "hst", 0, -37800, "Pacific/Honolulu" },
{ "hst", 0, -36000, "HST" },
{ "hst", 0, -36000, "Pacific/Johnston" },
{ "hst", 0, -37800, "HST" },
{ "hst", 0, -37800, "Pacific/Johnston" },
{ "ict", 0, 25200, "Asia/Bangkok" },
{ "ict", 0, 25200, "Asia/Ho_Chi_Minh" },
{ "ict", 0, 25200, "Asia/Phnom_Penh" },
{ "ict", 0, 25200, "Asia/Saigon" },
{ "ict", 0, 25200, "Asia/Vientiane" },
{ "ict", 0, 28800, "Asia/Ho_Chi_Minh" },
{ "ict", 0, 28800, "Asia/Phnom_Penh" },
{ "ict", 0, 28800, "Asia/Saigon" },
{ "ict", 0, 28800, "Asia/Vientiane" },
{ "iddt", 1, 14400, "Asia/Jerusalem" },
{ "iddt", 1, 14400, "Asia/Tel_Aviv" },
{ "idt", 1, 10800, "Asia/Jerusalem" },
{ "idt", 1, 10800, "Asia/Gaza" },
{ "idt", 1, 10800, "Asia/Hebron" },
{ "idt", 1, 10800, "Asia/Tel_Aviv" },
{ "idt", 0, 28800, "Asia/Ho_Chi_Minh" },
{ "idt", 0, 28800, "Asia/Saigon" },
{ "ihst", 1, 21600, "Asia/Colombo" },
{ "imt", 0, 25035, "Asia/Irkutsk" },
{ "imt", 0, 25025, "Asia/Irkutsk" },
{ "imt", 0, 7016, "Asia/Istanbul" },
{ "imt", 0, 7016, "Europe/Istanbul" },
{ "iot", 0, 21600, "Indian/Chagos" },
@@ -1075,6 +1076,7 @@
{ "jmt", 0, 8440, "Asia/Tel_Aviv" },
{ "jst", 0, 32400, "Asia/Tokyo" },
{ "jst", 0, 32400, "Asia/Dili" },
{ "jst", 0, 32400, "Asia/Ho_Chi_Minh" },
{ "jst", 0, 32400, "Asia/Hong_Kong" },
{ "jst", 0, 32400, "Asia/Jakarta" },
{ "jst", 0, 32400, "Asia/Kuala_Lumpur" },
@@ -1084,11 +1086,13 @@
{ "jst", 0, 32400, "Asia/Pontianak" },
{ "jst", 0, 32400, "Asia/Pyongyang" },
{ "jst", 0, 32400, "Asia/Rangoon" },
{ "jst", 0, 32400, "Asia/Saigon" },
{ "jst", 0, 32400, "Asia/Sakhalin" },
{ "jst", 0, 32400, "Asia/Seoul" },
{ "jst", 0, 32400, "Asia/Singapore" },
{ "jst", 0, 32400, "Asia/Taipei" },
{ "jst", 0, 32400, "Asia/Ujung_Pandang" },
{ "jst", 0, 32400, "Pacific/Bougainville" },
{ "jst", 0, 32400, "Pacific/Nauru" },
{ "jst", 0, 32400, "ROC" },
{ "jst", 0, 32400, "ROK" },
@@ -1096,8 +1100,8 @@
{ "jwst", 0, 28800, "ROC" },
{ "kart", 0, 18000, "Asia/Karachi" },
{ "kdt", 1, 36000, "Asia/Seoul" },
{ "kdt", 1, 32400, "Asia/Seoul" },
{ "kdt", 1, 32400, "ROK" },
{ "kdt", 1, 34200, "Asia/Seoul" },
{ "kdt", 1, 34200, "ROK" },
{ "kdt", 1, 36000, "ROK" },
{ "kgst", 1, 21600, "Asia/Bishkek" },
{ "kgt", 0, 18000, "Asia/Bishkek" },
@@ -1107,7 +1111,6 @@
{ "kizt", 0, 14400, "Asia/Qyzylorda" },
{ "kizt", 0, 18000, "Asia/Qyzylorda" },
{ "kmt", 0, 5736, "Europe/Vilnius" },
{ "kmt", 0, -18431, "America/Cayman" },
{ "kmt", 0, -18431, "America/Grand_Turk" },
{ "kmt", 0, -18431, "America/Jamaica" },
{ "kmt", 0, 7324, "Europe/Kiev" },
@@ -1122,12 +1125,9 @@
{ "krat", 0, 28800, "Asia/Krasnoyarsk" },
{ "krat", 0, 21600, "Asia/Novokuznetsk" },
{ "krat", 0, 25200, "Asia/Novokuznetsk" },
{ "kst", 0, 28800, "Asia/Seoul" },
{ "kst", 0, 30600, "Asia/Seoul" },
{ "kst", 0, 32400, "Asia/Pyongyang" },
{ "kst", 0, 32400, "Asia/Seoul" },
{ "kst", 0, 28800, "Asia/Pyongyang" },
{ "kst", 0, 28800, "ROK" },
{ "kst", 0, 30600, "Asia/Pyongyang" },
{ "kst", 0, 30600, "ROK" },
{ "kst", 0, 32400, "ROK" },
@@ -1147,7 +1147,7 @@
{ "lkt", 0, 23400, "Asia/Colombo" },
{ "lkt", 0, 21600, "Asia/Colombo" },
{ "lrt", 0, -2670, "Africa/Monrovia" },
{ "lst", 1, 9388, "Europe/Riga" },
{ "lst", 1, 9394, "Europe/Riga" },
{ "madmt", 1, 3600, "Atlantic/Madeira" },
{ "madst", 1, 0, "Atlantic/Madeira" },
{ "madt", 0, -3600, "Atlantic/Madeira" },
@@ -1202,9 +1202,6 @@
{ "mdt", 1, -21600, "Canada/Mountain" },
{ "mdt", 1, -21600, "Canada/Saskatchewan" },
{ "mdt", 1, -21600, "Mexico/BajaSur" },
{ "mdt", 1, -21600, "MST" },
{ "mest", 1, 7200, "MET" },
{ "met", 0, 3600, "MET" },
{ "mht", 0, 43200, "Pacific/Kwajalein" },
{ "mht", 0, 39600, "Pacific/Kwajalein" },
{ "mht", 0, 39600, "Pacific/Majuro" },
@@ -1226,7 +1223,6 @@
{ "mot", 0, 28800, "Asia/Macao" },
{ "mot", 0, 28800, "Asia/Macau" },
{ "mpt", 1, -21600, "America/Denver" },
{ "mpt", 0, 36000, "Pacific/Saipan" },
{ "mpt", 1, -21600, "America/Boise" },
{ "mpt", 1, -21600, "America/Cambridge_Bay" },
{ "mpt", 1, -21600, "America/Edmonton" },
@@ -1240,8 +1236,6 @@
{ "mpt", 1, -21600, "Canada/East-Saskatchewan" },
{ "mpt", 1, -21600, "Canada/Mountain" },
{ "mpt", 1, -21600, "Canada/Saskatchewan" },
{ "mpt", 1, -21600, "MST" },
{ "mpt", 0, 32400, "Pacific/Saipan" },
{ "msd", 1, 14400, "Europe/Moscow" },
{ "msd", 1, 14400, "Europe/Chisinau" },
{ "msd", 1, 14400, "Europe/Kaliningrad" },
@@ -1254,6 +1248,7 @@
{ "msd", 1, 14400, "Europe/Tiraspol" },
{ "msd", 1, 14400, "Europe/Uzhgorod" },
{ "msd", 1, 14400, "Europe/Vilnius" },
{ "msd", 1, 14400, "Europe/Volgograd" },
{ "msd", 1, 14400, "Europe/Zaporozhye" },
{ "msk", 0, 10800, "Europe/Moscow" },
{ "msk", 0, 14400, "Europe/Moscow" },
@@ -1272,7 +1267,6 @@
{ "msk", 0, 10800, "Europe/Zaporozhye" },
{ "msk", 0, 14400, "Europe/Simferopol" },
{ "msk", 0, 14400, "Europe/Volgograd" },
{ "msk", 1, 14400, "Europe/Volgograd" },
{ "msm", 1, 18000, "Europe/Moscow" },
{ "mst", 0, -25200, "America/Denver" },
{ "mst", 0, -25200, "America/Bahia_Banderas" },
@@ -1304,7 +1298,6 @@
{ "mst", 0, -25200, "Mexico/BajaNorte" },
{ "mst", 0, -25200, "Mexico/BajaSur" },
{ "mst", 0, -25200, "Mexico/General" },
{ "mst", 0, -25200, "MST" },
{ "mst", 1, 12679, "Europe/Moscow" },
{ "must", 1, 18000, "Indian/Mauritius" },
{ "mut", 0, 14400, "Indian/Mauritius" },
@@ -1324,7 +1317,6 @@
{ "mwt", 1, -21600, "Canada/East-Saskatchewan" },
{ "mwt", 1, -21600, "Canada/Mountain" },
{ "mwt", 1, -21600, "Canada/Saskatchewan" },
{ "mwt", 1, -21600, "MST" },
{ "myt", 0, 28800, "Asia/Kuala_Lumpur" },
{ "myt", 0, 28800, "Asia/Kuching" },
{ "ncst", 1, 43200, "Pacific/Noumea" },
@@ -1333,7 +1325,6 @@
{ "nddt", 1, -5400, "Canada/Newfoundland" },
{ "ndt", 1, -9052, "America/St_Johns" },
{ "ndt", 1, -9000, "America/St_Johns" },
{ "ndt", 1, -36000, "Pacific/Midway" },
{ "ndt", 1, -9000, "America/Goose_Bay" },
{ "ndt", 1, -9000, "Canada/Newfoundland" },
{ "ndt", 1, -9052, "America/Goose_Bay" },
@@ -1342,7 +1333,6 @@
{ "nest", 1, 4800, "Europe/Amsterdam" },
{ "net", 0, 1200, "Europe/Amsterdam" },
{ "nft", 0, 41400, "Pacific/Norfolk" },
{ "nmt", 0, 20928, "Asia/Novokuznetsk" },
{ "nmt", 0, 40320, "Pacific/Norfolk" },
{ "novst", 1, 25200, "Asia/Novosibirsk" },
{ "novst", 1, 28800, "Asia/Novosibirsk" },
@@ -1433,6 +1423,7 @@
{ "pett", 0, 43200, "Asia/Kamchatka" },
{ "pett", 0, 39600, "Asia/Kamchatka" },
{ "pet", 0, -18000, "America/Lima" },
{ "pgt", 0, 36000, "Pacific/Bougainville" },
{ "pgt", 0, 36000, "Pacific/Port_Moresby" },
{ "phot", 0, 46800, "Pacific/Enderbury" },
{ "phot", 0, -39600, "Pacific/Enderbury" },
@@ -1441,17 +1432,19 @@
{ "pht", 0, 28800, "Asia/Manila" },
{ "pkst", 1, 21600, "Asia/Karachi" },
{ "pkt", 0, 18000, "Asia/Karachi" },
{ "plmt", 0, 25590, "Asia/Ho_Chi_Minh" },
{ "plmt", 0, 25590, "Asia/Saigon" },
{ "pmdt", 1, -7200, "America/Miquelon" },
{ "pmst", 0, -10800, "America/Miquelon" },
{ "pmt", 0, -13236, "America/Paramaribo" },
{ "pmt", 0, -13252, "America/Paramaribo" },
{ "pmt", 0, 36000, "Antarctica/DumontDUrville" },
{ "pmt", 0, 13505, "Asia/Yekaterinburg" },
{ "pmt", 0, 26240, "Asia/Pontianak" },
{ "pmt", 0, 561, "Africa/Algiers" },
{ "pmt", 0, 561, "Africa/Tunis" },
{ "pmt", 0, 561, "Europe/Monaco" },
{ "pmt", 0, 561, "Europe/Paris" },
{ "pmt", 0, 561, "WET" },
{ "pnt", 0, -30600, "Pacific/Pitcairn" },
{ "pont", 0, 39600, "Pacific/Pohnpei" },
{ "pont", 0, 39600, "Pacific/Ponape" },
@@ -1509,8 +1502,7 @@
{ "qyzt", 0, 21600, "Asia/Qyzylorda" },
{ "qyzt", 0, 18000, "Asia/Qyzylorda" },
{ "ret", 0, 14400, "Indian/Reunion" },
{ "rmt", 0, 5788, "Europe/Riga" },
{ "rmt", 0, -5268, "Atlantic/Reykjavik" },
{ "rmt", 0, 5794, "Europe/Riga" },
{ "rmt", 0, 23080, "Asia/Rangoon" },
{ "rott", 0, -10800, "Antarctica/Rothera" },
{ "sakst", 1, 39600, "Asia/Sakhalin" },
@@ -1528,8 +1520,10 @@
{ "sast", 1, 10800, "Africa/Johannesburg" },
{ "sast", 0, 5400, "Africa/Johannesburg" },
{ "sast", 1, 10800, "Africa/Maseru" },
{ "sast", 1, 10800, "Africa/Mbabane" },
{ "sast", 1, 10800, "Africa/Windhoek" },
{ "sast", 0, 5400, "Africa/Gaborone" },
{ "sast", 0, 5400, "Africa/Maseru" },
{ "sast", 0, 5400, "Africa/Mbabane" },
{ "sast", 0, 7200, "Africa/Maseru" },
{ "sast", 0, 7200, "Africa/Mbabane" },
{ "sast", 0, 7200, "Africa/Windhoek" },
@@ -1543,15 +1537,11 @@
{ "shet", 0, 21600, "Asia/Aqtau" },
{ "shet", 0, 18000, "Asia/Aqtau" },
{ "sjmt", 0, -20173, "America/Costa_Rica" },
{ "smt", 0, 25580, "Asia/Saigon" },
{ "smt", 0, -13884, "Atlantic/Stanley" },
{ "smt", 0, -16966, "America/Santiago" },
{ "smt", 0, -16966, "Chile/Continental" },
{ "smt", 0, 24925, "Asia/Kuala_Lumpur" },
{ "smt", 0, 24925, "Asia/Singapore" },
{ "smt", 0, 25580, "Asia/Ho_Chi_Minh" },
{ "smt", 0, 25580, "Asia/Phnom_Penh" },
{ "smt", 0, 25580, "Asia/Vientiane" },
{ "smt", 0, 8160, "Europe/Simferopol" },
{ "sret", 0, 39600, "Asia/Srednekolymsk" },
{ "srt", 0, -10800, "America/Paramaribo" },
@@ -1579,7 +1569,7 @@
{ "tbist", 1, 14400, "Asia/Tbilisi" },
{ "tbit", 0, 14400, "Asia/Tbilisi" },
{ "tbit", 0, 10800, "Asia/Tbilisi" },
{ "tbmt", 0, 10746, "Asia/Tbilisi" },
{ "tbmt", 0, 10751, "Asia/Tbilisi" },
{ "tft", 0, 18000, "Indian/Kerguelen" },
{ "tjt", 0, 18000, "Asia/Dushanbe" },
{ "tkt", 0, -39600, "Pacific/Fakaofo" },
@@ -1602,7 +1592,6 @@
{ "tsat", 0, 10800, "Europe/Volgograd" },
{ "tvt", 0, 43200, "Pacific/Funafuti" },
{ "uct", 0, 0, "Etc/UCT" },
{ "uct", 0, 0, "UCT" },
{ "ulast", 1, 32400, "Asia/Ulaanbaatar" },
{ "ulast", 1, 32400, "Asia/Ulan_Bator" },
{ "ulat", 0, 28800, "Asia/Ulaanbaatar" },
@@ -1620,7 +1609,6 @@
{ "utc", 0, 0, "Etc/Universal" },
{ "utc", 0, 0, "Etc/UTC" },
{ "utc", 0, 0, "Etc/Zulu" },
{ "utc", 0, 0, "GMT" },
{ "utc", 0, 0, "UTC" },
{ "utc", 0, 0, "UTC" },
{ "uyhst", 1, -9000, "America/Montevideo" },
@@ -1679,7 +1667,6 @@
{ "wat", 0, 3600, "Africa/Brazzaville" },
{ "wat", 0, -3600, "Africa/Bissau" },
{ "wat", 0, -3600, "Africa/El_Aaiun" },
{ "wat", 0, -3600, "Africa/Niamey" },
{ "wat", 0, 3600, "Africa/Bangui" },
{ "wat", 0, 3600, "Africa/Douala" },
{ "wat", 0, 3600, "Africa/Kinshasa" },
@@ -1695,7 +1682,6 @@
{ "wemt", 1, 7200, "Europe/Madrid" },
{ "wemt", 1, 7200, "Europe/Monaco" },
{ "wemt", 1, 7200, "Europe/Paris" },
{ "wemt", 1, 7200, "WET" },
{ "west", 1, 3600, "Europe/Paris" },
{ "west", 1, 7200, "Europe/Luxembourg" },
{ "west", 1, 3600, "Africa/Algiers" },
@@ -1711,7 +1697,6 @@
{ "west", 1, 3600, "Europe/Luxembourg" },
{ "west", 1, 3600, "Europe/Madrid" },
{ "west", 1, 3600, "Europe/Monaco" },
{ "west", 1, 3600, "WET" },
{ "wet", 0, 0, "Europe/Paris" },
{ "wet", 0, 3600, "Europe/Luxembourg" },
{ "wet", 0, 0, "Africa/Algiers" },
@@ -1729,7 +1714,6 @@
{ "wet", 0, 0, "Europe/Luxembourg" },
{ "wet", 0, 0, "Europe/Madrid" },
{ "wet", 0, 0, "Europe/Monaco" },
{ "wet", 0, 0, "WET" },
{ "wft", 0, 43200, "Pacific/Wallis" },
{ "wgst", 1, -7200, "America/Godthab" },
{ "wgst", 1, -7200, "America/Danmarkshavn" },
+23 -19
View File
@@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
#include "timelib.h"
/* jan feb mrt apr may jun jul aug sep oct nov dec */
@@ -423,9 +427,9 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
tz->dst = gmt_offset->is_dst;
if (tz->tz_abbr) {
free(tz->tz_abbr);
timelib_free(tz->tz_abbr);
}
tz->tz_abbr = strdup(gmt_offset->abbr);
tz->tz_abbr = timelib_strdup(gmt_offset->abbr);
timelib_time_offset_dtor(gmt_offset);
}
return tmp;
+26 -22
View File
@@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* The MIT License (MIT)
*
* Copyright (c) 2015 Derick Rethans
*
* 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 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.
*/
/* $Id$ */
#include "timelib.h"
#include <stdio.h>
@@ -217,7 +221,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset)
{
if (t->tz_abbr) {
free(t->tz_abbr);
timelib_free(t->tz_abbr);
}
t->tz_abbr = NULL;
@@ -231,9 +235,9 @@ void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset)
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info)
{
if (t->tz_abbr) {
free(t->tz_abbr);
timelib_free(t->tz_abbr);
}
t->tz_abbr = strdup(abbr_info.abbr);
t->tz_abbr = timelib_strdup(abbr_info.abbr);
t->z = abbr_info.utc_offset;
t->have_zone = 1;
@@ -257,9 +261,9 @@ void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz)
t->dst = gmt_offset->is_dst;
t->tz_info = tz;
if (t->tz_abbr) {
free(t->tz_abbr);
timelib_free(t->tz_abbr);
}
t->tz_abbr = strdup(gmt_offset->abbr);
t->tz_abbr = timelib_strdup(gmt_offset->abbr);
timelib_time_offset_dtor(gmt_offset);
t->have_zone = 1;
+1 -1
View File
@@ -2785,7 +2785,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;
}
+2 -11
View File
@@ -8,7 +8,7 @@ date_default_timezone_set('UTC');
echo "Done\n";
?>
--EXPECTF--
array(7) {
array(6) {
[0]=>
array(3) {
["dst"]=>
@@ -52,7 +52,7 @@ array(7) {
["offset"]=>
int(0)
["timezone_id"]=>
string(3) "GMT"
string(3) "UTC"
}
[5]=>
array(3) {
@@ -63,14 +63,5 @@ array(7) {
["timezone_id"]=>
string(3) "UTC"
}
[6]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(0)
["timezone_id"]=>
string(3) "UTC"
}
}
Done
-4
View File
@@ -6,8 +6,6 @@ date.timezone=GMT
<?php
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 GMT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MET"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MEST"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 EDT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-00"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+00"))."\n";
@@ -21,8 +19,6 @@ echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0330"))."\n";
--EXPECT--
2002-06-25 14:18:48
2002-06-25 14:18:48
2002-06-25 13:18:48
2002-06-25 12:18:48
2002-06-25 18:18:48
2002-06-25 14:18:48
2002-06-25 14:18:48
+1 -1
View File
@@ -6,4 +6,4 @@ $data = unserialize('a:2:{i:0;O:12:"DateTimeZone":2:{s:13:"timezone_type";a:2:{i
var_dump($data);
?>
--EXPECTF--
Fatal error: DateTimeZone::__wakeup(): Timezone initialization failed in %s/bug68942.php on line %d
Fatal error: DateTimeZone::__wakeup(): Timezone initialization failed in %s%ebug68942.php on line %d
+1 -1
View File
@@ -6,4 +6,4 @@ $data = unserialize('a:2:{i:0;O:8:"DateTime":3:{s:4:"date";s:26:"2000-01-01 00:0
var_dump($data);
?>
--EXPECTF--
Fatal error: Invalid serialization data for DateTime object in %s/bug68942_2.php on line %d
Fatal error: Invalid serialization data for DateTime object in %s%ebug68942_2.php on line %d
+5 -1
View File
@@ -320,6 +320,10 @@ if test "$PHP_DB4" != "no"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/db4/db.h
break
elif test -f "$i/include/db5.3/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db5.3/db.h
break
elif test -f "$i/include/db5.1/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db5.1/db.h
@@ -362,7 +366,7 @@ if test "$PHP_DB4" != "no"; then
break
fi
done
PHP_DBA_DB_CHECK(4, db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
PHP_DBA_DB_CHECK(4, db-5.3 db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
fi
PHP_DBA_STD_RESULT(db4,Berkeley DB4)
+3 -4
View File
@@ -930,7 +930,6 @@ int dom_node_text_content_write(dom_object *obj, zval *newval TSRMLS_DC)
{
xmlNode *nodep = dom_object_get_node(obj);
zval value_copy;
xmlChar *enc_str;
if (nodep == NULL) {
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
@@ -938,9 +937,9 @@ int dom_node_text_content_write(dom_object *obj, zval *newval TSRMLS_DC)
}
convert_to_string_copy(newval, value_copy);
enc_str = xmlEncodeEntitiesReentrant(nodep->doc, Z_STRVAL_P(newval));
xmlNodeSetContent(nodep, enc_str);
xmlFree(enc_str);
/* we have to use xmlNodeAddContent() to get the same behavior as with xmlNewText() */
xmlNodeSetContent(nodep, (xmlChar *) "");
xmlNodeAddContent(nodep, Z_STRVAL_P(newval));
if (newval == &value_copy) {
zval_dtor(newval);
}
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #70001 (Assigning to DOMNode::textContent does additional entity encoding)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$element = new DOMText('<p>foo & bar</p>');
var_dump($element->textContent);
$element = (new DOMDocument())->createTextNode('<p>foo & bar</p>');
var_dump($element->textContent);
$element->textContent = ('<p>foo & bar</p>');
var_dump($element->textContent);
?>
--EXPECT--
string(16) "<p>foo & bar</p>"
string(16) "<p>foo & bar</p>"
string(16) "<p>foo & bar</p>"
+106 -106
View File
@@ -64,7 +64,7 @@
#include "php_ini.h"
#include "ext/standard/php_string.h"
#include "ext/standard/php_image.h"
#include "ext/standard/info.h"
#include "ext/standard/info.h"
/* needed for ssize_t definition */
#include <sys/types.h>
@@ -151,7 +151,7 @@ ZEND_BEGIN_MODULE_GLOBALS(exif)
char * encode_jis;
char * decode_jis_be;
char * decode_jis_le;
ZEND_END_MODULE_GLOBALS(exif)
ZEND_END_MODULE_GLOBALS(exif)
ZEND_DECLARE_MODULE_GLOBALS(exif)
@@ -160,7 +160,7 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
#else
#define EXIF_G(v) (exif_globals.v)
#endif
/* {{{ PHP_INI
*/
@@ -203,7 +203,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("exif.decode_jis_intel", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_le, zend_exif_globals, exif_globals)
PHP_INI_END()
/* }}} */
/* {{{ PHP_GINIT_FUNCTION
*/
static PHP_GINIT_FUNCTION(exif)
@@ -223,9 +223,9 @@ PHP_MINIT_FUNCTION(exif)
{
REGISTER_INI_ENTRIES();
if (zend_hash_exists(&module_registry, "mbstring", sizeof("mbstring"))) {
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
} else {
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
}
return SUCCESS;
}
@@ -255,7 +255,7 @@ zend_module_entry exif_module_entry = {
exif_module_deps,
"exif",
exif_functions,
PHP_MINIT(exif),
PHP_MINIT(exif),
PHP_MSHUTDOWN(exif),
NULL, NULL,
PHP_MINFO(exif),
@@ -268,7 +268,7 @@ zend_module_entry exif_module_entry = {
NULL,
NULL,
STANDARD_MODULE_PROPERTIES_EX
#else
#else
STANDARD_MODULE_PROPERTIES
#endif
};
@@ -657,73 +657,73 @@ static tag_info_array tag_table_IFD = {
{ 0x0213, "YCbCrPositioning"},
{ 0x0214, "ReferenceBlackWhite"},
{ 0x02BC, "ExtensibleMetadataPlatform"}, /* XAP: Extensible Authoring Publishing, obsoleted by XMP: Extensible Metadata Platform */
{ 0x0301, "Gamma"},
{ 0x0302, "ICCProfileDescriptor"},
{ 0x0303, "SRGBRenderingIntent"},
{ 0x0320, "ImageTitle"},
{ 0x5001, "ResolutionXUnit"},
{ 0x5002, "ResolutionYUnit"},
{ 0x5003, "ResolutionXLengthUnit"},
{ 0x5004, "ResolutionYLengthUnit"},
{ 0x5005, "PrintFlags"},
{ 0x5006, "PrintFlagsVersion"},
{ 0x5007, "PrintFlagsCrop"},
{ 0x5008, "PrintFlagsBleedWidth"},
{ 0x5009, "PrintFlagsBleedWidthScale"},
{ 0x500A, "HalftoneLPI"},
{ 0x500B, "HalftoneLPIUnit"},
{ 0x500C, "HalftoneDegree"},
{ 0x500D, "HalftoneShape"},
{ 0x500E, "HalftoneMisc"},
{ 0x500F, "HalftoneScreen"},
{ 0x5010, "JPEGQuality"},
{ 0x5011, "GridSize"},
{ 0x5012, "ThumbnailFormat"},
{ 0x5013, "ThumbnailWidth"},
{ 0x5014, "ThumbnailHeight"},
{ 0x5015, "ThumbnailColorDepth"},
{ 0x5016, "ThumbnailPlanes"},
{ 0x5017, "ThumbnailRawBytes"},
{ 0x5018, "ThumbnailSize"},
{ 0x5019, "ThumbnailCompressedSize"},
{ 0x501A, "ColorTransferFunction"},
{ 0x501B, "ThumbnailData"},
{ 0x5020, "ThumbnailImageWidth"},
{ 0x5021, "ThumbnailImageHeight"},
{ 0x5022, "ThumbnailBitsPerSample"},
{ 0x5023, "ThumbnailCompression"},
{ 0x5024, "ThumbnailPhotometricInterp"},
{ 0x5025, "ThumbnailImageDescription"},
{ 0x5026, "ThumbnailEquipMake"},
{ 0x5027, "ThumbnailEquipModel"},
{ 0x5028, "ThumbnailStripOffsets"},
{ 0x5029, "ThumbnailOrientation"},
{ 0x502A, "ThumbnailSamplesPerPixel"},
{ 0x502B, "ThumbnailRowsPerStrip"},
{ 0x502C, "ThumbnailStripBytesCount"},
{ 0x502D, "ThumbnailResolutionX"},
{ 0x502E, "ThumbnailResolutionY"},
{ 0x502F, "ThumbnailPlanarConfig"},
{ 0x5030, "ThumbnailResolutionUnit"},
{ 0x5031, "ThumbnailTransferFunction"},
{ 0x5032, "ThumbnailSoftwareUsed"},
{ 0x5033, "ThumbnailDateTime"},
{ 0x5034, "ThumbnailArtist"},
{ 0x5035, "ThumbnailWhitePoint"},
{ 0x5036, "ThumbnailPrimaryChromaticities"},
{ 0x5037, "ThumbnailYCbCrCoefficients"},
{ 0x5038, "ThumbnailYCbCrSubsampling"},
{ 0x5039, "ThumbnailYCbCrPositioning"},
{ 0x503A, "ThumbnailRefBlackWhite"},
{ 0x503B, "ThumbnailCopyRight"},
{ 0x5090, "LuminanceTable"},
{ 0x5091, "ChrominanceTable"},
{ 0x5100, "FrameDelay"},
{ 0x5101, "LoopCount"},
{ 0x5110, "PixelUnit"},
{ 0x5111, "PixelPerUnitX"},
{ 0x5112, "PixelPerUnitY"},
{ 0x5113, "PaletteHistogram"},
{ 0x0301, "Gamma"},
{ 0x0302, "ICCProfileDescriptor"},
{ 0x0303, "SRGBRenderingIntent"},
{ 0x0320, "ImageTitle"},
{ 0x5001, "ResolutionXUnit"},
{ 0x5002, "ResolutionYUnit"},
{ 0x5003, "ResolutionXLengthUnit"},
{ 0x5004, "ResolutionYLengthUnit"},
{ 0x5005, "PrintFlags"},
{ 0x5006, "PrintFlagsVersion"},
{ 0x5007, "PrintFlagsCrop"},
{ 0x5008, "PrintFlagsBleedWidth"},
{ 0x5009, "PrintFlagsBleedWidthScale"},
{ 0x500A, "HalftoneLPI"},
{ 0x500B, "HalftoneLPIUnit"},
{ 0x500C, "HalftoneDegree"},
{ 0x500D, "HalftoneShape"},
{ 0x500E, "HalftoneMisc"},
{ 0x500F, "HalftoneScreen"},
{ 0x5010, "JPEGQuality"},
{ 0x5011, "GridSize"},
{ 0x5012, "ThumbnailFormat"},
{ 0x5013, "ThumbnailWidth"},
{ 0x5014, "ThumbnailHeight"},
{ 0x5015, "ThumbnailColorDepth"},
{ 0x5016, "ThumbnailPlanes"},
{ 0x5017, "ThumbnailRawBytes"},
{ 0x5018, "ThumbnailSize"},
{ 0x5019, "ThumbnailCompressedSize"},
{ 0x501A, "ColorTransferFunction"},
{ 0x501B, "ThumbnailData"},
{ 0x5020, "ThumbnailImageWidth"},
{ 0x5021, "ThumbnailImageHeight"},
{ 0x5022, "ThumbnailBitsPerSample"},
{ 0x5023, "ThumbnailCompression"},
{ 0x5024, "ThumbnailPhotometricInterp"},
{ 0x5025, "ThumbnailImageDescription"},
{ 0x5026, "ThumbnailEquipMake"},
{ 0x5027, "ThumbnailEquipModel"},
{ 0x5028, "ThumbnailStripOffsets"},
{ 0x5029, "ThumbnailOrientation"},
{ 0x502A, "ThumbnailSamplesPerPixel"},
{ 0x502B, "ThumbnailRowsPerStrip"},
{ 0x502C, "ThumbnailStripBytesCount"},
{ 0x502D, "ThumbnailResolutionX"},
{ 0x502E, "ThumbnailResolutionY"},
{ 0x502F, "ThumbnailPlanarConfig"},
{ 0x5030, "ThumbnailResolutionUnit"},
{ 0x5031, "ThumbnailTransferFunction"},
{ 0x5032, "ThumbnailSoftwareUsed"},
{ 0x5033, "ThumbnailDateTime"},
{ 0x5034, "ThumbnailArtist"},
{ 0x5035, "ThumbnailWhitePoint"},
{ 0x5036, "ThumbnailPrimaryChromaticities"},
{ 0x5037, "ThumbnailYCbCrCoefficients"},
{ 0x5038, "ThumbnailYCbCrSubsampling"},
{ 0x5039, "ThumbnailYCbCrPositioning"},
{ 0x503A, "ThumbnailRefBlackWhite"},
{ 0x503B, "ThumbnailCopyRight"},
{ 0x5090, "LuminanceTable"},
{ 0x5091, "ChrominanceTable"},
{ 0x5100, "FrameDelay"},
{ 0x5101, "LoopCount"},
{ 0x5110, "PixelUnit"},
{ 0x5111, "PixelPerUnitX"},
{ 0x5112, "PixelPerUnitY"},
{ 0x5113, "PaletteHistogram"},
{ 0x1000, "RelatedImageFileFormat"},
{ 0x800D, "ImageID"},
{ 0x80E3, "Matteing"}, /* obsoleted by ExtraSamples */
@@ -929,7 +929,7 @@ static tag_info_array tag_table_VND_NIKON = {
{ 0x000b, "Converter"},
TAG_TABLE_END
};
static tag_info_array tag_table_VND_NIKON_990 = {
{ 0x0001, "Version"},
{ 0x0002, "ISOSetting"},
@@ -948,7 +948,7 @@ static tag_info_array tag_table_VND_NIKON_990 = {
{ 0x0010, "DataDump"},
TAG_TABLE_END
};
static tag_info_array tag_table_VND_OLYMPUS = {
{ 0x0200, "SpecialMode"},
{ 0x0201, "JPEGQuality"},
@@ -1214,7 +1214,7 @@ char * exif_dump_data(int *dump_free, int format, int components, int length, in
if (components > 0) {
dump = erealloc(dump, len + 2 + 1);
snprintf(dump + len, 2 + 1, ", ");
len += 2;
len += 2;
components--;
} else{
break;
@@ -1564,7 +1564,7 @@ typedef struct {
static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type *ImageInfo, int type, const char *format, ...)
{
va_list args;
va_start(args, format);
#ifdef EXIF_DEBUG
{
@@ -2617,7 +2617,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
*pszEncoding = estrdup((const char*)szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
* since we have no encoding support for the BOM yet we skip that.
*/
if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
@@ -2635,8 +2635,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
}
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
(unsigned char**)pszInfoPtr,
&len,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
@@ -2656,8 +2656,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
ByteCount -= 8;
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
(unsigned char**)pszInfoPtr,
&len,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
@@ -2691,12 +2691,12 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
* Process unicode field in IFD. */
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
{
xp_field->tag = tag;
xp_field->tag = tag;
xp_field->value = NULL;
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)&xp_field->value,
&xp_field->size,
(unsigned char**)&xp_field->value,
&xp_field->size,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
@@ -2721,7 +2721,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
return FALSE;
maker_note = maker_note_array+i;
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
continue;
@@ -2842,9 +2842,9 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
/* If its bigger than 4 bytes, the dir entry contains an offset. */
value_ptr = offset_base+offset_val;
/*
/*
dir_entry is ImageInfo->file.list[sn].data+2+i*12
offset_base is ImageInfo->file.list[sn].data-dir_offset
offset_base is ImageInfo->file.list[sn].data-dir_offset
dir_entry - offset_base is dir_offset+2+i*12
*/
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
@@ -2915,18 +2915,18 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
case TAG_COMP_IMAGE_WIDTH:
ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
break;
case TAG_IMAGEHEIGHT:
case TAG_COMP_IMAGE_HEIGHT:
ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
break;
case TAG_STRIP_OFFSETS:
case TAG_JPEG_INTERCHANGE_FORMAT:
/* accept both formats */
ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
break;
case TAG_STRIP_BYTE_COUNTS:
if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) {
ImageInfo->Thumbnail.filetype = ImageInfo->FileType;
@@ -2936,7 +2936,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
}
ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
break;
case TAG_JPEG_INTERCHANGE_FORMAT_LEN:
if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) {
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG;
@@ -2954,16 +2954,16 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
if (length<byte_count-1) {
/* When there are any characters after the first NUL */
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1);
spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
/* but we are not supposed to change this */
/* keep in mind that image_info does not store editor value */
} else {
ImageInfo->Copyright = estrdup(value_ptr);
ImageInfo->Copyright = estrndup(value_ptr, byte_count);
}
}
break;
break;
case TAG_USERCOMMENT:
ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC);
@@ -3051,10 +3051,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
break;
case TAG_MAKE:
ImageInfo->make = estrdup(value_ptr);
ImageInfo->make = estrndup(value_ptr, byte_count);
break;
case TAG_MODEL:
ImageInfo->model = estrdup(value_ptr);
ImageInfo->model = estrndup(value_ptr, byte_count);
break;
case TAG_MAKER_NOTE:
@@ -3404,7 +3404,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
if ((itemlen - 2) < 6) {
return FALSE;
}
exif_process_SOFn(Data, marker, &sof_info);
ImageInfo->Width = sof_info.width;
ImageInfo->Height = sof_info.height;
@@ -3449,21 +3449,21 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC)
}
for (;;) {
pos += length;
if (pos>=ImageInfo->Thumbnail.size)
if (pos>=ImageInfo->Thumbnail.size)
return FALSE;
c = data[pos++];
if (pos>=ImageInfo->Thumbnail.size)
if (pos>=ImageInfo->Thumbnail.size)
return FALSE;
if (c != 0xFF) {
return FALSE;
}
n = 8;
while ((c = data[pos++]) == 0xFF && n--) {
if (pos+3>=ImageInfo->Thumbnail.size)
if (pos+3>=ImageInfo->Thumbnail.size)
return FALSE;
/* +3 = pos++ of next check when reaching marker + 2 bytes for length */
}
if (c == 0xFF)
if (c == 0xFF)
return FALSE;
marker = c;
length = php_jpg_get16(data+pos);
@@ -3777,7 +3777,7 @@ static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC)
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/II format");
#endif
ImageInfo->sections_found |= FOUND_IFD0;
if (exif_process_IFD_in_TIFF(ImageInfo,
if (exif_process_IFD_in_TIFF(ImageInfo,
php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
SECTION_IFD0 TSRMLS_CC)) {
ret = TRUE;
@@ -3957,7 +3957,7 @@ PHP_FUNCTION(exif_read_data)
sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC);
#ifdef EXIF_DEBUG
if (sections_str)
if (sections_str)
exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections found: %s", sections_str[0] ? sections_str : "None");
#endif
+4
View File
@@ -1,4 +1,8 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#include "php_config.h"
#endif
#ifdef HAVE_GD_PNG
/* needs to be first */
+5 -5
View File
@@ -630,7 +630,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
{
mpz_ptr gmpnum;
const unsigned char *p, *max;
zval zv, *zv_ptr = &zv;
zval *zv_ptr;
int retval = FAILURE;
php_unserialize_data_t unserialize_data = (php_unserialize_data_t) data;
@@ -640,7 +640,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
p = buf;
max = buf + buf_len;
INIT_ZVAL(zv);
ALLOC_INIT_ZVAL(zv_ptr);
if (!php_var_unserialize(&zv_ptr, &p, max, &unserialize_data TSRMLS_CC)
|| Z_TYPE_P(zv_ptr) != IS_STRING
|| convert_to_gmp(gmpnum, zv_ptr, 10 TSRMLS_CC) == FAILURE
@@ -648,9 +648,9 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
zend_throw_exception(NULL, "Could not unserialize number", 0 TSRMLS_CC);
goto exit;
}
zval_dtor(&zv);
var_push_dtor_no_addref(&unserialize_data, &zv_ptr);
INIT_ZVAL(zv);
ALLOC_INIT_ZVAL(zv_ptr);
if (!php_var_unserialize(&zv_ptr, &p, max, &unserialize_data TSRMLS_CC)
|| Z_TYPE_P(zv_ptr) != IS_ARRAY
) {
@@ -667,7 +667,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
retval = SUCCESS;
exit:
zval_dtor(&zv);
var_push_dtor_no_addref(&unserialize_data, &zv_ptr);
PHP_VAR_UNSERIALIZE_DESTROY(unserialize_data);
return retval;
}
+50
View File
@@ -0,0 +1,50 @@
--TEST--
Bug #70284 (Use after free vulnerability in unserialize() with GMP)
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
$inner = 'r:2;a:1:{i:0;a:1:{i:0;r:4;}}';
$exploit = 'a:2:{i:0;s:1:"1";i:1;C:3:"GMP":'.strlen($inner).':{'.$inner.'}}';
$data = unserialize($exploit);
$fakezval = ptr2str(1122334455);
$fakezval .= ptr2str(0);
$fakezval .= "\x00\x00\x00\x00";
$fakezval .= "\x01";
$fakezval .= "\x00";
$fakezval .= "\x00\x00";
for ($i = 0; $i < 5; $i++) {
$v[$i] = $fakezval.$i;
}
var_dump($data);
function ptr2str($ptr)
{
$out = '';
for ($i = 0; $i < 8; $i++) {
$out .= chr($ptr & 0xff);
$ptr >>= 8;
}
return $out;
}
?>
--EXPECTF--
array(2) {
[0]=>
string(1) "1"
[1]=>
object(GMP)#%d (2) {
[0]=>
array(1) {
[0]=>
NULL
}
["num"]=>
string(1) "1"
}
}
+5 -5
View File
@@ -336,7 +336,7 @@ PHP_HASH_API void PHP_HAVAL128Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
@@ -390,7 +390,7 @@ PHP_HASH_API void PHP_HAVAL160Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
@@ -444,7 +444,7 @@ PHP_HASH_API void PHP_HAVAL192Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
@@ -484,7 +484,7 @@ PHP_HASH_API void PHP_HAVAL224Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
@@ -525,7 +525,7 @@ PHP_HASH_API void PHP_HAVAL256Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #70312 HAVAL gives wrong hashes in specific cases
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
var_dump(hash('haval128,5', '1234567890123456789012345678901234567890123456789012345678901234'));
var_dump(hash('haval160,5', '1234567890123456789012345678901234567890123456789012345678901234'));
var_dump(hash('haval192,5', '1234567890123456789012345678901234567890123456789012345678901234'));
var_dump(hash('haval224,5', '1234567890123456789012345678901234567890123456789012345678901234'));
var_dump(hash('haval256,5', '1234567890123456789012345678901234567890123456789012345678901234'));
?>
--EXPECTF--
string(32) "f3f0d23819b87228b4b70ee350afaa9d"
string(40) "aded6485e137f11d7292212ba3fa961714df0564"
string(48) "e53da2b16269fe732e9a898a96707a9f28404d7333b02286"
string(56) "c574fb307f0817b514b9bb2e7c4bfaffb7ad667aca3c8b523fefcf10"
string(64) "fb73c19300b14d5cb393d929bf005e6c2d459a4c9c009e9813af1d2d3637ee8f"
+1 -1
View File
@@ -64,7 +64,7 @@ unlink($file);
adler32: ff87222e
crc32: 61664d33
gost: d9e65f0c0c2ef944e4f8a01f4a46365c4f33a2853756878182a7f03e1490a4cd
haval128,3: 8bb81269aca8b7f87829020d76a4e841
haval128,3: c25962b13383c3ed9f13817c8f2ae7d6
md2: 70f791c0d8fa9edd7d08e32fcba8c354
md4: a9d034b16bb290c57a645afd6f14cd3b
md5: 704bf818448f5bbb94061332d2c889aa
+1 -1
View File
@@ -45,7 +45,7 @@ echo "sha256(raw): " . bin2hex(hash_hmac('sha256', $content, $key, TRUE)) . "\n"
adler32: 12c803f7
crc32: 96859101
gost: a4a3c80bdf3f8665bf07376a34dc9c1b11af7c813f4928f62e39f0c0dc564dad
haval128,3: 82cd0f4bd36729b5c80c33efa8c13ac5
haval128,3: 4d1318607f0406bd1b7bd50907772672
md2: 6d111dab563025e4cb5f4425c991fa12
md4: 10cdbfe843000c623f8b8da0d5d20b0b
md5: 2a632783e2812cf23de100d7d6a463ae
+1 -1
View File
@@ -73,7 +73,7 @@ unlink($file);
adler32: 0f8c02f9
crc32: f2a60b9c
gost: 94c39a40d5db852a8dc3d24e37eebf2d53e3d711457c59cd02b614f792a9d918
haval128,3: e8fcff647f1a675acb429130fb94a17e
haval128,3: f1cea637451097d790354a86de3f54a3
md2: a685475e600314bb549ab4f33c3b27cb
md4: cbc6bff781f48f57378d3effa27553e4
md5: 8bddf39dd1c566c27acc7fa85ec36acf
+1 -1
View File
@@ -5,7 +5,7 @@ Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--SKIPIF--
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
<?php if(substr(PHP_OS, 0, 3) == 'WIN' ) {die('skip not for windows');} ?>
<?php if(setlocale(LC_ALL, "en_US.utf8",) === false) { die('skip en_US.utf8 locales not available'); } ?>
<?php if(setlocale(LC_ALL, "en_US.utf8") === false) { die('skip en_US.utf8 locales not available'); } ?>
--FILE--
<?php
setlocale(LC_ALL, "en_US.utf8");
+10 -5
View File
@@ -20,9 +20,9 @@ AC_DEFUN([IMAP_LIB_CHK],[
done
])
dnl PHP_IMAP_TEST_BUILD(function, action-if-ok, action-if-not-ok, extra-libs)
dnl PHP_IMAP_TEST_BUILD(function, action-if-ok, action-if-not-ok, extra-libs, extra-source)
AC_DEFUN([PHP_IMAP_TEST_BUILD], [
PHP_TEST_BUILD([$1], [$2], [$3], [$4],
PHP_TEST_BUILD([$1], [$2], [$3], [$4], [$5]
[
#if defined(__GNUC__) && __GNUC__ >= 4
# define PHP_IMAP_EXPORT __attribute__ ((visibility("default")))
@@ -228,10 +228,15 @@ if test "$PHP_IMAP" != "no"; then
AC_DEFINE(HAVE_IMAP_AUTH_GSS, 1, [ ])
], [], $TST_LIBS)
dnl Check if utf8_to_mutf7 exists
PHP_IMAP_TEST_BUILD(utf8_to_mutf7, [
dnl Check if utf8_to_mutf7 exists. We need to do some gymnastics because
dnl utf8_to_mutf7 takes an argument and will segfault without it. We
dnl therefore test another function utf8_to_mutf7_php() which calls
dnl the utf8_to_mutf7() function with the empty string as an argument.
PHP_IMAP_TEST_BUILD(utf8_to_mutf7_php, [
AC_DEFINE(HAVE_IMAP_MUTF7, 1, [ ])
], [], $TST_LIBS)
], [], $TST_LIBS, [
char utf8_to_mutf7_php(){ return utf8_to_mutf7(""); }
])
AC_MSG_CHECKING(whether rfc822_output_address_list function present)
PHP_TEST_BUILD(foobar, [
+2 -2
View File
@@ -17,7 +17,7 @@ setlocale(LC_ALL, $l);
function ut_main()
{
setlocale(LC_ALL, 'de_DE');
setlocale(LC_ALL, 'de_DE.UTF-8');
$fmt = new NumberFormatter( 'sl_SI.UTF-8', NumberFormatter::DECIMAL);
$num = "1.234.567,891";
$res_str = $fmt->parse($num)."\n";
@@ -31,5 +31,5 @@ ut_run();
?>
--EXPECT--
1234567,891
de_DE
de_DE.UTF-8
-1
View File
@@ -20,7 +20,6 @@ var_dump(json_encode(array(), JSON_FORCE_OBJECT));
var_dump(json_encode(1));
var_dump(json_encode("руссиш"));
echo "Done\n";
?>
--EXPECTF--
+6 -7
View File
@@ -4,15 +4,14 @@ json_encode() & extended encoding
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
$a = array('<foo>',"'bar'",'"baz"','&blong&');
$a = array('<foo>', "'bar'", '"baz"', '&blong&');
echo "Normal: ", json_encode($a), "\n";
echo "Tags: ", json_encode($a,JSON_HEX_TAG), "\n";
echo "Apos: ", json_encode($a,JSON_HEX_APOS), "\n";
echo "Quot: ", json_encode($a,JSON_HEX_QUOT), "\n";
echo "Amp: ", json_encode($a,JSON_HEX_AMP), "\n";
echo "All: ", json_encode($a,JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n";
echo "Tags: ", json_encode($a, JSON_HEX_TAG), "\n";
echo "Apos: ", json_encode($a, JSON_HEX_APOS), "\n";
echo "Quot: ", json_encode($a, JSON_HEX_QUOT), "\n";
echo "Amp: ", json_encode($a, JSON_HEX_AMP), "\n";
echo "All: ", json_encode($a, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n";
?>
--EXPECT--
Normal: ["<foo>","'bar'","\"baz\"","&blong&"]
-1
View File
@@ -15,7 +15,6 @@ var_dump(json_last_error(), json_last_error_msg());
var_dump(json_decode("[1"));
var_dump(json_last_error(), json_last_error_msg());
echo "Done\n";
?>
--EXPECT--
+4 -4
View File
@@ -6,14 +6,14 @@ precision=14
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
function show_eq($x,$y) {
echo "$x ". ($x==$y ? "==" : "!=") ." $y\n";
function json_test_show_eq($x, $y) {
echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n";
}
$value = 0x7FFFFFFF; #2147483647;
show_eq("$value", json_encode($value));
json_test_show_eq("$value", json_encode($value));
$value++;
show_eq("$value", json_encode($value));
json_test_show_eq("$value", json_encode($value));
?>
--EXPECT--
+1 -1
View File
@@ -4,7 +4,7 @@ Bug #41034 (json_encode() ignores null byte started keys in arrays)
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
echo json_encode(array(0,"\0ab"=>1,"\0null-prefixed value"));
echo json_encode(array(0, "\0ab"=>1, "\0null-prefixed value"));
echo "\nDone\n";
?>
--EXPECT--
-2
View File
@@ -2,9 +2,7 @@
Bug #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.')
--SKIPIF--
<?php
if (!extension_loaded('json')) die('skip');
if (setlocale(LC_NUMERIC, "de_DE") === false) {
die("skip no de_DE locale");
}
+6 -7
View File
@@ -2,20 +2,19 @@
Bug #42785 (Incorrect formatting of double values with non-english locales)
--SKIPIF--
<?php
if (!extension_loaded("json")) {
print "skip";
} else if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
die("skip locale needed for this test is not supported on this platform");
}
if (!extension_loaded('json')) die('skip');
if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
die("skip locale needed for this test is not supported on this platform");
}
?>
--FILE--
<?php
setlocale(LC_ALL, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
$foo = Array(100.10,"bar");
$foo = array(100.10,"bar");
var_dump(json_encode($foo));
Class bar {}
class bar {}
$bar1 = new bar;
$bar1->a = 100.10;
$bar1->b = "foo";
+2 -6
View File
@@ -1,16 +1,12 @@
--TEST--
Bug #46215 (json_encode mutates its parameter and has some class-specific state)
--SKIPIF--
<?php
if (!extension_loaded("json")) {
die('skip JSON extension not available in this build');
}
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
class foo {
protected $a = array();
protected $a = array();
}
$a = new foo;
+2 -2
View File
@@ -6,8 +6,8 @@ Bug #46944 (json_encode() doesn't handle 3 byte utf8 correctly)
<?php
for ($i = 1; $i <= 16; $i++) {
$first = 0xf0|($i >> 2);
$second = 0x8f|($i & 3) << 4;
$first = 0xf0 | ($i >> 2);
$second = 0x8f | ($i & 3) << 4;
$string = sprintf("aa%c%c\xbf\xbdzz", $first, $second);
echo json_encode($string) . "\n";
}
+2 -2
View File
@@ -2,8 +2,8 @@
Bug #47644 (valid large integers are truncated)
--SKIPIF--
<?php
if (!extension_loaded('json')) die('skip: json extension not available');
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
if (!extension_loaded('json')) die('skip');
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
?>
--FILE--
<?php
+2 -2
View File
@@ -22,8 +22,8 @@ json_encode($b);
var_dump(json_last_error(), json_last_error_msg());
$c = array(
'foo' => $bad_utf8,
'bar' => 1
'foo' => $bad_utf8,
'bar' => 1
);
json_encode($c);
var_dump(json_last_error(), json_last_error_msg());
-2
View File
@@ -10,11 +10,9 @@ var_dump(json_last_error());
json_decode("");
var_dump(json_last_error());
json_decode("invalid json");
var_dump(json_last_error());
json_decode("");
var_dump(json_last_error());
?>
+16 -16
View File
@@ -6,25 +6,25 @@ Bug #61978 (Object recursion not detected for classes that implement JsonSeriali
<?php
class JsonTest1 {
public $test;
public $me;
public function __construct() {
$this->test = '123';
$this->me = $this;
}
public $test;
public $me;
public function __construct() {
$this->test = '123';
$this->me = $this;
}
}
class JsonTest2 implements JsonSerializable {
public $test;
public function __construct() {
$this->test = '123';
}
public function jsonSerialize() {
return array(
'test' => $this->test,
'me' => $this
);
}
public $test;
public function __construct() {
$this->test = '123';
}
public function jsonSerialize() {
return array(
'test' => $this->test,
'me' => $this
);
}
}
+14 -14
View File
@@ -6,28 +6,28 @@ FR #62369 (Segfault on json_encode(deeply_nested_array)
<?php
$array = array();
for ($i=0; $i<550; $i++) {
$array = array($array);
for ($i=0; $i < 550; $i++) {
$array = array($array);
}
json_encode($array, 0, 551);
switch (json_last_error()) {
case JSON_ERROR_NONE:
echo 'OK'.PHP_EOL;
break;
case JSON_ERROR_DEPTH:
echo 'ERROR'.PHP_EOL;
break;
case JSON_ERROR_NONE:
echo 'OK' . PHP_EOL;
break;
case JSON_ERROR_DEPTH:
echo 'ERROR' . PHP_EOL;
break;
}
json_encode($array, 0, 540);
switch (json_last_error()) {
case JSON_ERROR_NONE:
echo 'OK'.PHP_EOL;
break;
case JSON_ERROR_DEPTH:
echo 'ERROR'.PHP_EOL;
break;
case JSON_ERROR_NONE:
echo 'OK' . PHP_EOL;
break;
case JSON_ERROR_DEPTH:
echo 'ERROR' . PHP_EOL;
break;
}
--EXPECTF--
OK
+4 -4
View File
@@ -5,10 +5,10 @@ Bug #63737 (json_decode does not properly decode with options parameter)
--FILE--
<?php
function decode($json) {
$x = json_decode($json);
var_dump($x);
$x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
var_dump($x);
$x = json_decode($json);
var_dump($x);
$x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
var_dump($x);
}
decode('123456789012345678901234567890');
+3 -3
View File
@@ -5,9 +5,9 @@ Whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitiv
--FILE--
<?php
function decode($json) {
var_dump(json_decode($json));
var_dump(json_last_error() !== 0);
echo "\n";
var_dump(json_decode($json));
var_dump(json_last_error() !== 0);
echo "\n";
}
// Leading whitespace should be ignored
+2 -2
View File
@@ -5,8 +5,8 @@ Case-sensitivity part of bug #64874 ("json_decode handles whitespace and case-se
--FILE--
<?php
function decode($json) {
var_dump(json_decode($json));
echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
var_dump(json_decode($json));
echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
}
// Only lowercase should work
+1 -1
View File
@@ -9,7 +9,7 @@ class Foo {
private $bar = 'baz';
}
echo json_encode([[], (object)[], new Foo], JSON_PRETTY_PRINT), "\n";
echo json_encode(array(array(), (object) array(), new Foo), JSON_PRETTY_PRINT);
?>
--EXPECT--
+33 -32
View File
@@ -2,43 +2,44 @@
JSON (http://www.crockford.com/JSON/JSON_checker/test/fail*.json)
--SKIPIF--
<?php
if (!extension_loaded('json')) die('skip: json extension not available');
if (!extension_loaded('json')) die('skip');
?>
--FILE--
<?php
$tests = array('"A JSON payload should be an object or array, not a string."',
'["Unclosed array"',
'{unquoted_key: "keys must be quoted}',
'["extra comma",]',
'["double extra comma",,]',
'[ , "<-- missing value"]',
'["Comma after the close"],',
'["Extra close"]]',
'{"Extra comma": true,}',
'{"Extra value after close": true} "misplaced quoted value"',
'{"Illegal expression": 1 + 2}',
'{"Illegal invocation": alert()}',
'{"Numbers cannot have leading zeroes": 013}',
'{"Numbers cannot be hex": 0x14}',
'["Illegal backslash escape: \\x15"]',
'["Illegal backslash escape: \\\'"]',
'["Illegal backslash escape: \\017"]',
'[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
'{"Missing colon" null}',
'{"Double colon":: null}',
'{"Comma instead of colon", null}',
'["Colon instead of comma": false]',
'["Bad value", truth]',
"['single quote']");
$tests = array(
'"A JSON payload should be an object or array, not a string."',
'["Unclosed array"',
'{unquoted_key: "keys must be quoted}',
'["extra comma",]',
'["double extra comma",,]',
'[ , "<-- missing value"]',
'["Comma after the close"],',
'["Extra close"]]',
'{"Extra comma": true,}',
'{"Extra value after close": true} "misplaced quoted value"',
'{"Illegal expression": 1 + 2}',
'{"Illegal invocation": alert()}',
'{"Numbers cannot have leading zeroes": 013}',
'{"Numbers cannot be hex": 0x14}',
'["Illegal backslash escape: \\x15"]',
'["Illegal backslash escape: \\\'"]',
'["Illegal backslash escape: \\017"]',
'[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
'{"Missing colon" null}',
'{"Double colon":: null}',
'{"Comma instead of colon", null}',
'["Colon instead of comma": false]',
'["Bad value", truth]',
"['single quote']"
);
foreach ($tests as $test)
{
echo 'Testing: ' . $test . "\n";
echo "AS OBJECT\n";
var_dump(json_decode($test));
echo "AS ARRAY\n";
var_dump(json_decode($test, true));
foreach ($tests as $test) {
echo 'Testing: ' . $test . "\n";
echo "AS OBJECT\n";
var_dump(json_decode($test));
echo "AS ARRAY\n";
var_dump(json_decode($test, true));
}
?>
+24 -33
View File
@@ -1,50 +1,41 @@
--TEST--
Test json_decode() function : basic functionality
--SKIPIF--
<?php
if (!extension_loaded("json")) {
die('skip JSON extension not available in this build');
}
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
/* Prototype : mixed json_decode ( string $json [, bool $assoc ] )
* Description: Decodes a JSON string
* Source code: ext/json/php_json.c
* Alias to functions:
*/
echo "*** Testing json_decode() : basic functionality ***\n";
// array with different values for $string
$inputs = array (
'0',
'123',
'-123',
'2147483647',
'-2147483648',
'123.456',
'1230',
'-1230',
'true',
'false',
'null',
'"abc"',
'"Hello World\r\n"',
'[]',
'[1,2,3,4,5]',
'{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}',
'{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}',
'""',
'{}'
'0',
'123',
'-123',
'2147483647',
'-2147483648',
'123.456',
'1230',
'-1230',
'true',
'false',
'null',
'"abc"',
'"Hello World\r\n"',
'[]',
'[1,2,3,4,5]',
'{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}',
'{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}',
'""',
'{}'
);
// loop through with each element of the $inputs array to test json_decode() function
$count = 1;
foreach($inputs as $input) {
echo "-- Iteration $count --\n";
var_dump(json_decode($input));
var_dump(json_decode($input, TRUE));
$count ++;
echo "-- Iteration $count --\n";
var_dump(json_decode($input));
var_dump(json_decode($input, true));
$count++;
}
?>
+3 -12
View File
@@ -1,26 +1,17 @@
--TEST--
Test json_decode() function : error conditions
--SKIPIF--
<?php
if (!extension_loaded("json")) {
die('skip JSON extension not available in this build');
}
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
/* Prototype : mixed json_decode ( string $json [, bool $assoc=false [, int $depth=512 ]] )
* Description: Decodes a JSON string
* Source code: ext/json/php_json.c
* Alias to functions:
*/
echo "*** Testing json_decode() : error conditions ***\n";
echo "\n-- Testing json_decode() function with no arguments --\n";
var_dump( json_decode() );
var_dump(json_decode());
echo "\n-- Testing json_decode() function with more than expected no. of arguments --\n";
$extra_arg = 10;
var_dump( json_decode('"abc"', TRUE, 512, 0, $extra_arg) );
var_dump(json_decode('"abc"', true, 512, 0, $extra_arg));
?>
===Done===
+44 -54
View File
@@ -1,18 +1,9 @@
--TEST--
Test json_encode() function : basic functionality
--SKIPIF--
<?php
if (!extension_loaded("json")) {
die('skip JSON extension not available in this build');
}
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
/* Prototype : string json_encode ( mixed $value )
* Description: Returns the JSON representation of a value
* Source code: ext/json/php_json.c
* Alias to functions:
*/
echo "*** Testing json_encode() : basic functionality ***\n";
//get an unset variable
@@ -35,64 +26,63 @@ $obj->MyString = "Hello World";
// array with different values for $string
$inputs = array (
// integers
0,
123,
-123,
2147483647,
-2147483648,
// integers
/*1*/ 0,
123,
-123,
2147483647,
-2147483648,
// floats
123.456,
1.23E3,
-1.23E3,
// floats
/*6*/ 123.456,
1.23E3,
-1.23E3,
// boolean
TRUE,
true,
FALSE,
false,
// NULL
NULL,
null,
// boolean
/*9*/ TRUE,
true,
FALSE,
false,
// strings
"abc",
'abc',
"Hello\t\tWorld\n",
// NULL
/*13*/ NULL,
null,
// strings
/*15*/ "abc",
'abc',
"Hello\t\tWorld\n",
// arrays
/*18*/ array(),
array(1,2,3,4,5),
array(1 => "Sun", 2=>"Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"),
array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30),
// empty data
/*22*/ "",
'',
// arrays
array(),
array(1,2,3,4,5),
array(1 => "Sun", 2 => "Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"),
array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30),
// undefined data
/*24*/ @$undefined_var,
// empty data
"",
'',
// unset data
/*25*/ @$unset_var,
// undefined data
@$undefined_var,
// resource variable
/*26*/ $fp,
// unset data
@$unset_var,
// object variable
/*27*/ $obj
// resource variable
$fp,
// object variable
$obj
);
// loop through with each element of the $inputs array to test json_encode() function
$count = 1;
foreach($inputs as $input) {
echo "-- Iteration $count --\n";
var_dump(json_encode($input));
$count ++;
echo "-- Iteration $count --\n";
var_dump(json_encode($input));
$count ++;
}
?>
+1 -10
View File
@@ -1,18 +1,9 @@
--TEST--
Test json_encode() function : basic functionality with UTF8 string input
--SKIPIF--
<?php
if (!extension_loaded("json")) {
die('skip JSON extension not available in this build');
}
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
/* Prototype : string json_encode ( mixed $value )
* Description: Returns the JSON representation of a value
* Source code: ext/json/php_json.c
* Alias to functions:
*/
echo "*** Testing json_encode() : basic functionality with UTF-8 input***\n";
$utf8_string = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+3 -13
View File
@@ -1,27 +1,17 @@
--TEST--
Test json_encode() function : error conditions
--SKIPIF--
<?php
if (!extension_loaded("json")) {
die('skip JSON extension not available in this build');
}
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
/* Prototype : string json_encode ( mixed $value [, int $options=0 ] )
* Description: Returns the JSON representation of a value
* Source code: ext/json/php_json.c
* Alias to functions:
*/
echo "*** Testing json_encode() : error conditions ***\n";
echo "\n-- Testing json_encode() function with no arguments --\n";
var_dump( json_encode() );
var_dump(json_encode());
echo "\n-- Testing json_encode() function with more than expected no. of arguments --\n";
$extra_arg = 10;
var_dump( json_encode("abc", 0, $extra_arg) );
var_dump(json_encode("abc", 0, $extra_arg));
?>
===Done===
+1 -5
View File
@@ -1,11 +1,7 @@
--TEST--
Test json_encode() function with numeric flag
--SKIPIF--
<?php
if (!extension_loaded("json")) {
die('skip JSON extension not available in this build');
}
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
var_dump(
+2 -3
View File
@@ -1,15 +1,14 @@
--TEST--
json_last_error() failures
--SKIPIF--
<?php !extension_loaded('json') && die('skip json extension not available') ?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
var_dump(json_last_error());
var_dump(json_last_error(TRUE));
var_dump(json_last_error(true));
var_dump(json_last_error('some', 4, 'args', 'here'));
?>
--EXPECTF--
int(0)
@@ -1,12 +1,12 @@
--TEST--
json_last_error_msg() failures
--SKIPIF--
<?php !extension_loaded('json') && die('skip json extension not available') ?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
var_dump(json_last_error_msg());
var_dump(json_last_error_msg(TRUE));
var_dump(json_last_error_msg(true));
var_dump(json_last_error_msg('some', 4, 'args', 'here'));
?>
+2 -2
View File
@@ -4,8 +4,8 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json)
precision=14
--SKIPIF--
<?php
if (!extension_loaded('json')) die('skip: json extension not available');
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
if (!extension_loaded('json')) die('skip');
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
?>
--FILE--
<?php
+2 -2
View File
@@ -4,8 +4,8 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json)
precision=14
--SKIPIF--
<?php
if (!extension_loaded('json')) die('skip: json extension not available');
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
if (!extension_loaded('json')) die('skip');
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
?>
--FILE--
<?php
+1 -1
View File
@@ -4,7 +4,7 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json)
precision=14
--SKIPIF--
<?php
if (!extension_loaded('json')) die('skip: json extension not available');
if (!extension_loaded('json')) die('skip');
?>
--FILE--
<?php
+1 -3
View File
@@ -1,9 +1,7 @@
--TEST--
JSON (http://www.crockford.com/JSON/JSON_checker/test/pass2.json)
--SKIPIF--
<?php
if (!extension_loaded('json')) die('skip: json extension not available');
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
+1 -3
View File
@@ -1,9 +1,7 @@
--TEST--
JSON (http://www.crockford.com/JSON/JSON_checker/test/pass3.json)
--SKIPIF--
<?php
if (!extension_loaded('json')) die('skip: json extension not available');
?>
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
+46 -3
View File
@@ -190,6 +190,9 @@ PHP_MINIT_FUNCTION(ldap)
REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS);
#elif defined (LDAP_X_OPT_CONNECT_TIMEOUT)
REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS);
#endif
#ifdef LDAP_OPT_TIMEOUT
REGISTER_LONG_CONSTANT("LDAP_OPT_TIMEOUT", LDAP_OPT_TIMEOUT, CONST_PERSISTENT | CONST_CS);
#endif
REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS);
@@ -346,6 +349,9 @@ PHP_FUNCTION(ldap_connect)
RETURN_FALSE;
}
#endif
if (!port) {
port = LDAP_PORT;
}
if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", LDAPG(num_links));
@@ -366,7 +372,12 @@ PHP_FUNCTION(ldap_connect)
}
url = emalloc(urllen);
snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port );
if (host && (strchr(host, ':') != NULL)) {
/* Legacy support for host:port */
snprintf( url, urllen, "ldap://%s", host );
} else {
snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port );
}
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP
@@ -665,7 +676,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
/* timelimit */
if (timelimit > -1) {
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_timelimit);
ldap_get_option(ldap, LDAP_OPT_TIMELIMIT, old_timelimit);
ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
#else
*old_timelimit = ldap->ld_timelimit;
@@ -676,7 +687,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
/* deref */
if (deref > -1) {
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_deref);
ldap_get_option(ldap, LDAP_OPT_DEREF, old_deref);
ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
#else
*old_deref = ldap->ld_deref;
@@ -2066,6 +2077,25 @@ PHP_FUNCTION(ldap_get_option)
zval_dtor(retval);
ZVAL_LONG(retval, (timeout / 1000));
} break;
#endif
#ifdef LDAP_OPT_TIMEOUT
case LDAP_OPT_TIMEOUT:
{
struct timeval *timeout = NULL;
if (ldap_get_option(ld->link, LDAP_OPT_TIMEOUT, (void *) &timeout)) {
if (timeout) {
ldap_memfree(timeout);
}
RETURN_FALSE;
}
if (!timeout) {
RETURN_FALSE;
}
zval_dtor(retval);
ZVAL_LONG(retval, timeout->tv_sec);
ldap_memfree(timeout);
} break;
#endif
/* options with string value */
case LDAP_OPT_ERROR_STRING:
@@ -2169,6 +2199,19 @@ PHP_FUNCTION(ldap_set_option)
RETURN_FALSE;
}
} break;
#endif
#ifdef LDAP_OPT_TIMEOUT
case LDAP_OPT_TIMEOUT:
{
struct timeval timeout;
convert_to_long_ex(newval);
timeout.tv_sec = Z_LVAL_PP(newval);
timeout.tv_usec = 0;
if (ldap_set_option(ldap, LDAP_OPT_TIMEOUT, (void *) &timeout)) {
RETURN_FALSE;
}
} break;
#endif
/* options with string value */
case LDAP_OPT_ERROR_STRING:
@@ -28,6 +28,10 @@ var_dump($link);
// bad hostname (connect should work, not bind)
$link = ldap_connect("nonexistent" . $host);
var_dump($link);
// Legacy host:port syntax
$link = ldap_connect("$host:$port");
var_dump($link);
?>
===DONE===
--EXPECTF--
@@ -36,4 +40,5 @@ resource(%d) of type (ldap link)
resource(%d) of type (ldap link)
resource(%d) of type (ldap link)
resource(%d) of type (ldap link)
resource(%d) of type (ldap link)
===DONE===
@@ -21,6 +21,7 @@ ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
ldap_set_option($link, LDAP_OPT_TIMEOUT, 55);
ldap_set_option($link, LDAP_OPT_REFERRALS, false);
ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls);
ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls);
@@ -35,6 +36,8 @@ var_dump(
$option,
ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
$option,
ldap_get_option($link, LDAP_OPT_TIMEOUT, $option),
$option,
ldap_get_option($link, LDAP_OPT_REFERRALS, $option),
$option,
ldap_get_option($link, LDAP_OPT_RESTART, $option),
@@ -56,6 +59,8 @@ int(33)
bool(true)
int(44)
bool(true)
int(55)
bool(true)
int(0)
bool(true)
int(0)
+215
View File
@@ -0,0 +1,215 @@
--TEST--
ldap_search() test - test that overrides aren't permanent
--CREDITS--
Tyson Andre <tandre@ifwe.co>
# Based on ldap_search_basic.phpt
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifbindfailure.inc');
?>
--FILE--
<?php
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_SEARCHING);
ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
insert_dummy_data($link, $base);
var_dump(
$result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER),
ldap_get_entries($link, $result)
);
var_dump(
ldap_get_option($link, LDAP_OPT_DEREF, $option),
$option,
ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
$option,
ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
$option,
ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
$option
);
?>
===DONE===
--CLEAN--
<?php
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result)
array(4) {
["count"]=>
int(3)
[0]=>
array(14) {
["objectclass"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(6) "person"
}
[0]=>
string(11) "objectclass"
["cn"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(5) "userA"
}
[1]=>
string(2) "cn"
["sn"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(7) "testSN1"
}
[2]=>
string(2) "sn"
["userpassword"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(4) "oops"
}
[3]=>
string(12) "userpassword"
["telephonenumber"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(14) "xx-xx-xx-xx-xx"
}
[4]=>
string(15) "telephonenumber"
["description"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(6) "user A"
}
[5]=>
string(11) "description"
["count"]=>
int(6)
["dn"]=>
string(%d) "cn=userA,%s"
}
[1]=>
array(12) {
["objectclass"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(6) "person"
}
[0]=>
string(11) "objectclass"
["cn"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(5) "userB"
}
[1]=>
string(2) "cn"
["sn"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(7) "testSN2"
}
[2]=>
string(2) "sn"
["userpassword"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(15) "oopsIDitItAgain"
}
[3]=>
string(12) "userpassword"
["description"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(6) "user B"
}
[4]=>
string(11) "description"
["count"]=>
int(5)
["dn"]=>
string(%d) "cn=userB,%s"
}
[2]=>
array(10) {
["objectclass"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(6) "person"
}
[0]=>
string(11) "objectclass"
["cn"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(5) "userC"
}
[1]=>
string(2) "cn"
["sn"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(7) "testSN3"
}
[2]=>
string(2) "sn"
["userpassword"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(17) "0r1g1na1 passw0rd"
}
[3]=>
string(12) "userpassword"
["count"]=>
int(4)
["dn"]=>
string(%d) "cn=userC,cn=userB,%s"
}
}
bool(true)
int(1)
bool(true)
int(123)
bool(true)
int(33)
bool(true)
int(44)
===DONE===
+4
View File
@@ -1237,6 +1237,10 @@ static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size TSR
{
if (mcrypt_enc_mode_has_iv(td) == 1) {
int expected_iv_size = mcrypt_enc_get_iv_size(td);
if (expected_iv_size == 0) {
/* Algorithm does not use IV, even though mode supports it */
return SUCCESS;
}
if (!iv) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #70625: mcrypt_encrypt() : won't return data when no IV was specified under RC4
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$key = 'secretkey';
$ciphertext = mcrypt_encrypt(MCRYPT_ARCFOUR, $key, 'payload', MCRYPT_MODE_STREAM);
var_dump(bin2hex($ciphertext));
$plaintext = mcrypt_decrypt(MCRYPT_ARCFOUR, $key, $ciphertext, MCRYPT_MODE_STREAM);
var_dump($plaintext);
?>
--EXPECT--
string(14) "d5c9a57023d0f1"
string(7) "payload"
+2
View File
@@ -799,6 +799,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
passwd_len = passwd? strlen(passwd):0;
}
#if !defined(MYSQL_USE_MYSQLND)
/* disable local infile option for open_basedir */
#if PHP_API_VERSION < 20100412
if (((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) && (client_flags & CLIENT_LOCAL_FILES)) {
@@ -807,6 +808,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
#endif
client_flags ^= CLIENT_LOCAL_FILES;
}
#endif
#ifdef CLIENT_MULTI_RESULTS
client_flags |= CLIENT_MULTI_RESULTS; /* compatibility with 5.2, see bug#50416 */
+9 -1
View File
@@ -715,6 +715,12 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT);
#ifdef CLIENT_SSL_VERIFY_SERVER_CERT
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT", CLIENT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
#if defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT", CLIENT_SSL_DONT_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
#endif
#endif
#if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT);
@@ -798,7 +804,9 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT);
#ifdef FIELD_TYPE_JSON
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_JSON", FIELD_TYPE_JSON, CONST_CS | CONST_PERSISTENT);
#endif
#if MYSQL_VERSION_ID > 50002 || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT);
+2
View File
@@ -1824,6 +1824,7 @@ PHP_FUNCTION(mysqli_options)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_INITIALIZED);
#if !defined(MYSQLI_USE_MYSQLND)
#if PHP_API_VERSION < 20100412
if ((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) {
#else
@@ -1833,6 +1834,7 @@ PHP_FUNCTION(mysqli_options)
RETURN_FALSE;
}
}
#endif
expected_type = mysqli_options_get_option_zval_type(mysql_option);
if (expected_type != Z_TYPE_PP(mysql_value)) {
switch (expected_type) {
+2
View File
@@ -120,9 +120,11 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */
/* remove some insecure options */
flags &= ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */
#if !defined(MYSQLI_USE_MYSQLND)
if (PG(open_basedir) && PG(open_basedir)[0] != '\0') {
flags &= ~CLIENT_LOCAL_FILES;
}
#endif
}
if (!socket_len || !socket) {
Loaded 100 of 234 files, more files were not shown because too many files have changed in this diff. Show more