Compare commits

...
Author SHA1 Message Date
Sara Golemon fb33ebf641 Update versions for PHP 7.2.0RC6 2017-11-07 11:33:56 +00:00
Sara Golemon 29cd6eb799 Update NEWS for PHP 7.2.0RC6 2017-11-07 11:33:56 +00:00
Anatol Belski b6336b0d3e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  7.0.27 next
2017-11-07 10:10:41 +01:00
Anatol Belski c842e1ac53 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  7.0.27 next
2017-11-07 10:09:52 +01:00
Anatol Belski bc7d4dc523 7.0.27 next 2017-11-07 10:07:52 +01:00
David Carlier c189845951 date module, replacing abs call with the llabs's like one due to bigger type 2017-11-07 05:27:27 +00:00
Michael Moravec f70ca770b6 Revert BC break caused by fixing bug #74035
This reverts commit 9ffc6ca62f.
2017-11-06 17:52:17 -05:00
Simon JAILLET 5060fc2349 Fixes #68948 related to a BC break introduced by #68532 fix. 2017-11-06 17:34:42 -05:00
Christoph M. Becker b152633ecb Scale support for bcmod()
As of commit 90dcbbe (PHP-7.2+) bcmod() supports non-integral
parameters as well. Since formerly only integer modulus has been
supported, it did not make much sense to cater to the scale with regard
to the result. However, now it does for consistency with other BCMath
operations.

Therefore, we add support for an optional `scale` parameter and fall
back to the default scale (`bcmath.scale`) as usual.
2017-11-06 17:26:52 -05:00
Tyson Andre 5cdf37e603 Fix proto documents for new global functions
See NEWS and UPGRADING (or arginfo/implementation) for details.
2017-11-06 07:24:42 +00:00
Tyson Andre 88e94a0bd1 Mention spl_object_id in UPGRADING notes
This was implemented in PR #2611
2017-11-06 07:18:39 +00:00
Joe Watkins c3ee17065b Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  fix wrong check of definition_phi->constraint.range.max_ssa_var
2017-11-03 17:49:52 +00:00
MITSUNARI Shigeo 21dbd2ffcd fix wrong check of definition_phi->constraint.range.max_ssa_var 2017-11-03 17:49:42 +00:00
Anatol Belski 0166e5c466 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update libs_version.txt
2017-11-02 22:46:25 +01:00
Anatol Belski 91c7460c53 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Update libs_version.txt
2017-11-02 22:44:27 +01:00
Anatol Belski c3be49e07d Update libs_version.txt 2017-11-02 22:41:12 +01:00
Nikita Popov f3c7e1cefb Merge branch 'PHP-7.1' into PHP-7.2 2017-11-02 20:56:35 +01:00
Nikita Popov 1f736085f1 Merge branch 'PHP-7.0' into PHP-7.1 2017-11-02 20:56:25 +01:00
Nikita Popov d88ef8d7e1 Fix ext/soap/tests/bug69137.phpt
Switch to example.org. Also mark it as an online test.
2017-11-02 20:56:03 +01:00
Anatol Belski 8a4702223d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Sync and fix tests for ICU 60.1 compat
2017-11-02 12:39:04 +01:00
Anatol Belski e8af216ce5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Sync and fix tests for ICU 60.1 compat
2017-11-02 12:38:32 +01:00
Anatol Belski dbfa0140ae Sync and fix tests for ICU 60.1 compat 2017-11-02 12:37:04 +01:00
Anatol Belski 5a3688fe2c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Yet one /nologo
2017-11-02 09:24:22 +01:00
Anatol Belski ba50b27284 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Yet one /nologo
2017-11-02 09:22:25 +01:00
Anatol Belski f5358c0e23 Yet one /nologo 2017-11-02 09:21:22 +01:00
Anatol Belski da9da5742c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix year
  Add /nologo
2017-10-31 10:38:18 +01:00
Anatol Belski 98422cfa3d Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix year
  Add /nologo
2017-10-31 10:35:59 +01:00
Anatol Belski 8a3e2a6b14 Fix year 2017-10-31 10:25:15 +01:00
Anatol Belski 164167f3da Add /nologo 2017-10-31 10:24:34 +01:00
Anatol Belski e3b2859c8a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Add missing ICU version check
2017-10-30 18:16:47 +01:00
Anatol Belski 6eb4daabeb Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Add missing ICU version check
2017-10-30 18:16:03 +01:00
Anatol Belski 68c500421c Add missing ICU version check 2017-10-30 18:15:26 +01:00
Jakub Zelenka 19c62e83fa Merge branch 'PHP-7.1' into PHP-7.2 2017-10-30 16:43:36 +00:00
Jakub Zelenka 7c2031bfca Merge branch 'PHP-7.0' into PHP-7.1 2017-10-30 16:42:23 +00:00
Jakub Zelenka fc169d2133 Prevent leaking x509 and csr resources if it is not requested
All functions using php_openssl_x509_from_zval or php_openssl_csr_from_zval
with makeresource equal to 0 do not deref the resource which means there
is a leak till the end of the request. This can cause issues for long
running apps. It is a generic solution for bug #75363 which also covers
other functions.
2017-10-30 16:40:56 +00:00
Jakub Zelenka d8ccffa79a Extend and speed up pkey export tests 2017-10-30 16:40:56 +00:00
Jakub Zelenka e78e839e53 Rewrite openssl_csr_get_subject test to improve coverage 2017-10-30 16:40:56 +00:00
Jakub Zelenka 528aa540b4 Add openssl_csr_get_public_key test 2017-10-30 16:40:56 +00:00
Jakub Zelenka 548798818b Extend openssl_pkcs7_* tests to cover resource cert 2017-10-30 16:40:56 +00:00
Jakub Zelenka 55d92413b9 Fix cleaning tmp output file in openssl_csr_export_to_file test 2017-10-30 16:40:56 +00:00
Jelle van der Waa 5812f7a8d3 openssl: add basic openssl_csr_export_to_file tests
Add a basic test for openssl_csr_export_to_file.
2017-10-30 16:40:56 +00:00
Jakub Zelenka 628a52d365 Extend openssl_csr_sign test to cover cert resource 2017-10-30 16:40:56 +00:00
Jakub Zelenka 80191eebec Set different invalid path in openssl_pkcs12_export so it is more unlikely to exist 2017-10-30 16:40:55 +00:00
Jakub Zelenka cd66aad141 Extend openssl_x509_parse to cover cert resource 2017-10-30 16:40:55 +00:00
Jakub Zelenka c1d98588a2 Rename and test resource cert in openssl_x509_checkpurpose test 2017-10-30 16:40:55 +00:00
Jakub Zelenka d23d4fd61b Extend openssl_x509_check_private_key to test resource cert 2017-10-30 16:40:55 +00:00
Jakub Zelenka be0758b75a Extend openssl_x509_fingerprint test to cover resource cert with sha1 2017-10-30 16:40:55 +00:00
Joe Watkins ccba0f5948 Merge branch 'PHP-7.2' of git.php.net:/php-src into PHP-7.2
* 'PHP-7.2' of git.php.net:/php-src:
  Yet one attempt to mitigate the unzip error on AppVeyor
  Ensure SDK is checked out before asking for version
  Fix fetching the SDK version
  Fix SDK version comparison and add more verbosity
  Don't use the cache dependency, SDK version is handled in script
  Remove status check on the SDK repo and add version check
  Use abbrev
  Catch with the latest AppVeyor unzip errors
  Fixed type inference
2017-10-30 14:16:38 +00:00
Joe Watkins 37b0ad5537 Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:/php-src:
  Yet one attempt to mitigate the unzip error on AppVeyor
  Ensure SDK is checked out before asking for version
  Fix fetching the SDK version
  Fix SDK version comparison and add more verbosity
  Don't use the cache dependency, SDK version is handled in script
  Remove status check on the SDK repo and add version check
  Use abbrev
  Catch with the latest AppVeyor unzip errors
  Fixed type inference
2017-10-30 14:16:27 +00:00
Joe Watkins cfa885830a Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src:
  Yet one attempt to mitigate the unzip error on AppVeyor
  Ensure SDK is checked out before asking for version
  Fix fetching the SDK version
  Fix SDK version comparison and add more verbosity
  Don't use the cache dependency, SDK version is handled in script
  Remove status check on the SDK repo and add version check
  Catch with the latest AppVeyor unzip errors
2017-10-30 14:16:16 +00:00
Joe Watkins 118db2d2f7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #75464 Wrong reflection on SoapClient::__setSoapHeaders
2017-10-30 14:14:21 +00:00
Joe Watkins 5262bd9ea3 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #75464 Wrong reflection on SoapClient::__setSoapHeaders
2017-10-30 14:13:31 +00:00
Fabien Villepinte a308000ff2 Fix bug #75464 Wrong reflection on SoapClient::__setSoapHeaders 2017-10-30 14:13:05 +00:00
Anatol Belski f10d8c21ab Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Yet one attempt to mitigate the unzip error on AppVeyor
2017-10-30 12:20:24 +01:00
Anatol Belski a2cd2965d7 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Yet one attempt to mitigate the unzip error on AppVeyor
2017-10-30 12:17:53 +01:00
Anatol Belski 7ea44da104 Yet one attempt to mitigate the unzip error on AppVeyor 2017-10-30 12:16:53 +01:00
Anatol Belski 8be5bb8b10 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Ensure SDK is checked out before asking for version
2017-10-30 12:09:15 +01:00
Anatol Belski c32e53b641 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Ensure SDK is checked out before asking for version
2017-10-30 12:08:50 +01:00
Anatol Belski e305e8fb7a Ensure SDK is checked out before asking for version 2017-10-30 12:07:27 +01:00
Anatol Belski ddcef0fc0f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix fetching the SDK version
2017-10-30 11:30:19 +01:00
Anatol Belski dfadda3d09 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix fetching the SDK version
2017-10-30 11:29:40 +01:00
Anatol Belski 7bf2947016 Fix fetching the SDK version 2017-10-30 11:28:32 +01:00
Xinchen Hui d4b81223cd Merge branch 'PHP-7.2' of git.php.net:/php-src into PHP-7.2
* 'PHP-7.2' of git.php.net:/php-src:
  Fix SDK version comparison and add more verbosity
  Don't use the cache dependency, SDK version is handled in script
2017-10-30 18:21:00 +08:00
Xinchen Hui 6336c4f629 Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:/php-src:
  Fix SDK version comparison and add more verbosity
  Don't use the cache dependency, SDK version is handled in script
2017-10-30 18:20:20 +08:00
Xinchen Hui db4eb54149 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Use abbrev
2017-10-30 18:17:41 +08:00
Xinchen Hui a3286a8ee4 Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:/php-src:
  Remove status check on the SDK repo and add version check
2017-10-30 18:17:27 +08:00
Anatol Belski a438a633e9 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix SDK version comparison and add more verbosity
  Don't use the cache dependency, SDK version is handled in script
2017-10-30 11:16:33 +01:00
Anatol Belski bba09a53f4 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix SDK version comparison and add more verbosity
  Don't use the cache dependency, SDK version is handled in script
2017-10-30 11:15:51 +01:00
Anatol Belski c6e8c2bc9f Fix SDK version comparison and add more verbosity 2017-10-30 10:53:12 +01:00
Anatol Belski 591e811a35 Don't use the cache dependency, SDK version is handled in script 2017-10-30 10:34:11 +01:00
Anatol Belski e5179054fb Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Remove status check on the SDK repo and add version check
2017-10-30 10:17:25 +01:00
Anatol Belski f361caa5c0 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Remove status check on the SDK repo and add version check
2017-10-30 10:16:39 +01:00
Anatol Belski bc410c2609 Remove status check on the SDK repo and add version check
If Appveyor fails to unzip, .git would be in an arbitrary state anyway.
Thus this check doesn't help. For the version check - rely on the branch
naming scheme in the SDK.
2017-10-30 10:14:05 +01:00
Xinchen Hui d9de0f8683 Use abbrev 2017-10-30 16:26:59 +08:00
Anatol Belski af6ba57d95 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Catch with the latest AppVeyor unzip errors
2017-10-30 08:57:29 +01:00
Anatol Belski 26eb6c5bab Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Catch with the latest AppVeyor unzip errors
2017-10-30 08:56:52 +01:00
Dmitry Stogov 49256dcf6f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed type inference
2017-10-30 10:44:12 +03:00
Anatol Belski 741efa7807 Catch with the latest AppVeyor unzip errors 2017-10-30 08:42:59 +01:00
Dmitry Stogov 230e505fd8 Fixed type inference 2017-10-30 10:41:27 +03:00
Joe Watkins 1a72d3225c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #75453 Incorrect reflection on ibase_connect and ibase_pconnect
2017-10-30 06:55:58 +00:00
Joe Watkins 63c0ecc445 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #75453 Incorrect reflection on ibase_connect and ibase_pconnect
2017-10-30 06:55:28 +00:00
Fabien Villepinte e6aea3dc78 Fix bug #75453 Incorrect reflection on ibase_connect and ibase_pconnect 2017-10-30 06:55:00 +00:00
Anatol Belski 2c317bea2c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Re-enable AppVeyor cache
2017-10-29 10:09:45 +01:00
Anatol Belski 83d51baf83 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Re-enable AppVeyor cache
2017-10-29 10:09:18 +01:00
Anatol Belski 123b1d79eb Re-enable AppVeyor cache 2017-10-29 10:08:31 +01:00
Joe Watkins cb04599d27 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  make sure run-tests reports exit status upon prerequisite error
2017-10-29 04:38:08 +00:00
Joe Watkins 6c90612d13 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  make sure run-tests reports exit status upon prerequisite error
2017-10-29 04:37:55 +00:00
Joe Watkins 59d413ceb8 make sure run-tests reports exit status upon prerequisite error 2017-10-29 04:37:21 +00:00
Nikita Popov 58f90ab569 Merge branch 'PHP-7.1' into PHP-7.2 2017-10-28 12:58:23 +02:00
Nikita Popov 27856f64c3 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-28 12:57:46 +02:00
Fabien Villepinte 938f256ed9 Fix bug #75434 Wrong reflection for mysqli_fetch_all function 2017-10-28 12:57:25 +02:00
Sara Golemon cc96166f74 Don't optimize input arrays with suffix holes 2017-10-27 13:07:33 -04:00
Joe Watkins f2367d4626 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #75307 Wrong reflection for openssl_open function
2017-10-27 16:06:57 +01:00
Joe Watkins 14be7dcf8e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #75307 Wrong reflection for openssl_open function
2017-10-27 16:06:29 +01:00
Fabien Villepinte 51ea2cfbe1 Fix bug #75307 Wrong reflection for openssl_open function 2017-10-27 16:06:01 +01:00
Anatol Belski cbf385e68c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Skip test on PostgreSQL 10
2017-10-27 16:23:50 +02:00
Anatol Belski 005205714b Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Skip test on PostgreSQL 10
2017-10-27 16:23:19 +02:00
Anatol Belski 15a71fe045 Skip test on PostgreSQL 10
The 42P18 error is not produced by the server anymore.
2017-10-27 16:19:42 +02:00
Anatol Belski f936a17c12 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test compat for PostgreSQL 10
2017-10-27 15:04:54 +02:00
Anatol Belski 36b27f2ba5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix test compat for PostgreSQL 10
2017-10-27 15:04:29 +02:00
Anatol Belski 24b1bb0abd Fix test compat for PostgreSQL 10 2017-10-27 14:58:43 +02:00
Anatol Belski 40f76c9f0c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Apply upstream patch for CVE-2017-14107
  Backport and apply upstream patch for CVE-2017-14107
2017-10-27 14:18:27 +02:00
Anatol Belski 211dacd7b5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Apply upstream patch for CVE-2017-14107
  Backport and apply upstream patch for CVE-2017-14107
2017-10-27 14:17:57 +02:00
Anatol Belski 10dc1950f7 Apply upstream patch for CVE-2017-14107 2017-10-27 13:20:15 +02:00
Anatol Belski f0a42d9fe4 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Backport and apply upstream patch for CVE-2017-14107
2017-10-27 13:18:41 +02:00
Anatol Belski f6e8ce8121 Backport and apply upstream patch for CVE-2017-14107 2017-10-27 13:16:56 +02:00
Anatol Belski f577a03c04 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Binary SDK 2.0.12 stable
2017-10-26 21:27:09 +02:00
Anatol Belski fb1c573a29 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Binary SDK 2.0.12 stable
2017-10-26 21:26:03 +02:00
Anatol Belski 9eb6f86765 Binary SDK 2.0.12 stable 2017-10-26 21:25:08 +02:00
Dmitry Stogov 1d846fdfb2 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed indirect modification of magic ArrayAccess method arguments
2017-10-26 16:07:49 +03:00
Dmitry Stogov 503df277ab Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed indirect modification of magic ArrayAccess method arguments
2017-10-26 16:04:20 +03:00
Dmitry Stogov 98eee90734 Fixed indirect modification of magic ArrayAccess method arguments 2017-10-26 16:03:42 +03:00
Dmitry Stogov 25d988e91a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Backport tests
2017-10-26 14:12:45 +03:00
Dmitry Stogov d3146889ab Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Backport tests
2017-10-26 14:12:33 +03:00
Dmitry Stogov 502cfddf28 Backport tests 2017-10-26 14:12:08 +03:00
Dmitry Stogov e3997b2c82 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed indirect modification of magic method arguments.
2017-10-26 13:12:52 +03:00
Dmitry Stogov 177cdcf313 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed indirect modification of magic method arguments.
2017-10-26 13:11:59 +03:00
Dmitry Stogov bc59289b7a Fixed indirect modification of magic method arguments. 2017-10-26 13:05:23 +03:00
Xinchen Hui 887ae8a380 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed test
2017-10-26 10:24:00 +08:00
Xinchen Hui 6b637ac589 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed test
2017-10-26 10:23:52 +08:00
Xinchen Hui eaeccc1d99 Fixed test 2017-10-26 10:23:43 +08:00
Xinchen Hui ed02dce2a4 Update NEWS 2017-10-26 10:11:13 +08:00
Xinchen Hui 11a4b57e61 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS)
2017-10-26 10:09:57 +08:00
Xinchen Hui 7d3c057bd1 Update NEWS 2017-10-26 10:09:41 +08:00
Xinchen Hui 3c4c9a23bc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS)

Conflicts:
	Zend/zend_object_handlers.c
2017-10-26 10:08:39 +08:00
Xinchen Hui d2047503cb Fixed bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS) 2017-10-26 10:07:08 +08:00
Joe Watkins 25a3ebdc73 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix typo in comments
2017-10-25 21:00:03 +01:00
Joe Watkins 5e9f7f619e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix typo in comments
2017-10-25 20:59:51 +01:00
Fabien Villepinte 578ba71b3b Fix typo in comments 2017-10-25 20:59:40 +01:00
Anatol Belski 777e189445 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Don't create plist files when using clang analyzer
2017-10-25 18:11:40 +02:00
Anatol Belski 8ad4de887f Don't create plist files when using clang analyzer 2017-10-25 18:06:56 +02:00
Christoph M. Becker a059244b3c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix the SKIPIF part in /ext/gd/tests/bug75437.phpt
2017-10-25 14:53:01 +02:00
Christoph M. Becker b6b0289f5e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix the SKIPIF part in /ext/gd/tests/bug75437.phpt
2017-10-25 14:47:11 +02:00
Fabien Villepinte e763a1cdc7 Fix the SKIPIF part in /ext/gd/tests/bug75437.phpt 2017-10-25 14:39:38 +02:00
Christoph M. Becker c78813a6b8 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #75437 Wrong reflection on imagewebp
2017-10-25 13:03:42 +02:00
Christoph M. Becker 9d59beb8ba Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #75437 Wrong reflection on imagewebp
2017-10-25 12:56:25 +02:00
Fabien Villepinte 0fbb9f343f Fix bug #75437 Wrong reflection on imagewebp 2017-10-25 12:54:05 +02:00
Ferenc Kovacs 58ccfb051b Merge branch 'PHP-7.1' into PHP-7.2 2017-10-25 03:42:55 +02:00
Ferenc Kovacs 298db6fc92 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-25 03:40:49 +02:00
Ferenc Kovacs 9fbf13a496 Merge branch 'PHP-5.6' into PHP-7.0 2017-10-25 03:39:34 +02:00
Ferenc Kovacs f600785f65 5.6.33 is next 2017-10-25 03:36:30 +02:00
Ferenc Kovacs 92dd3df148 Merge branch 'PHP-7.1' into PHP-7.2 2017-10-25 03:20:34 +02:00
Ferenc Kovacs 9e47f868d3 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-25 03:17:14 +02:00
Ferenc Kovacs b53fb886a4 use trusty explicitly 2017-10-25 03:14:51 +02:00
Ferenc Kovacs 6125ce9d33 Merge branch 'PHP-5.6' into PHP-7.0 2017-10-25 03:13:40 +02:00
Rasmus Lerdorf ad7ed6fe21 These tests all assume that IPV6 is available. 2017-10-25 02:21:16 +02:00
Ferenc Kovacs 787e3a1ee4 fix the travis build for PHP-5.6 using precise instead of trusty 2017-10-25 01:51:48 +02:00
Ferenc Kovacs 9839d3a953 fix the travis build for PHP-5.6 using precise instead of trusty 2017-10-25 01:47:50 +02:00
Sara Golemon a8ffc69288 Update NEWS for 7.2.0RC6 2017-10-24 14:32:38 -04:00
Sara Golemon 98f28a911c Update NEWS for PHP 7.2.0RC5 2017-10-24 14:32:38 -04:00
Anatol Belski ffeb8d1b03 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Parametrize the expected value to avoid platform false positives
2017-10-24 18:38:44 +02:00
Anatol Belski 67b99b698f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Parametrize the expected value to avoid platform false positives
2017-10-24 18:38:23 +02:00
Anatol Belski e19bf29b53 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Parametrize the expected value to avoid platform false positives
2017-10-24 18:36:56 +02:00
Anatol Belski 45ac5edbd9 Parametrize the expected value to avoid platform false positives 2017-10-24 18:33:21 +02:00
Sara Golemon d0d7db8b3f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Decref default_link when clearing
2017-10-24 11:38:24 -04:00
Sara Golemon 53fe84bfcc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Decref default_link when clearing
2017-10-24 11:38:17 -04:00
Sara Golemon 68e27b0763 Decref default_link when clearing 2017-10-24 11:37:59 -04:00
Christoph M. Becker c04617aa61 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #65148 (imagerotate may alter image dimensions)
2017-10-24 17:17:18 +02:00
Christoph M. Becker 9c79de4d62 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #65148 (imagerotate may alter image dimensions)
2017-10-24 17:09:59 +02:00
Christoph M. Becker 22c487616f Fixed bug #65148 (imagerotate may alter image dimensions)
We apply the respective patches from external libgd, work around the
still missing `gdImageClone()`, and fix the special cased rotation
routines according to Pierre's patch
(https://gist.github.com/pierrejoye/59d72385ed1888cf8894a7ed437235ae).

We also cater to bug73272.phpt whose result obviously changes a bit.
2017-10-24 17:02:56 +02:00
Derick Rethans ca23b0484c Merge branch 'PHP-7.1' into PHP-7.2 2017-10-24 14:56:24 +01:00
Derick Rethans 7bc31238b4 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-24 14:55:48 +01:00
Derick Rethans 8e3260376c Update timezonemap.h, which needs to match the bundled TZ db 2017-10-24 14:55:13 +01:00
Anatol Belski 4ec299437d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test
2017-10-24 14:58:56 +02:00
Anatol Belski 8ad71bc1d2 Fix test 2017-10-24 14:58:01 +02:00
Anatol Belski ab85763997 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] update NEWS
  [ci skip] update NEWS
  [ci skip] update NEWS
2017-10-24 14:22:44 +02:00
Anatol Belski ab8c0f194a [ci skip] update NEWS 2017-10-24 14:22:25 +02:00
Anatol Belski c05fcc4687 [ci skip] update NEWS 2017-10-24 14:21:11 +02:00
Anatol Belski 0b5825d0e9 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  [ci skip] update NEWS
  [ci skip] update NEWS
2017-10-24 14:19:45 +02:00
Anatol Belski 75d0ba5179 [ci skip] update NEWS 2017-10-24 14:18:59 +02:00
Anatol Belski fadcfc8149 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  [ci skip] update NEWS
2017-10-24 14:17:21 +02:00
Anatol Belski 7d06a5c89f [ci skip] update NEWS 2017-10-24 14:16:54 +02:00
Anatol Belski 176c9b61a4 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #72535 arcfour encryption stream filter crashes php
2017-10-24 14:07:32 +02:00
Anatol Belski 9138966c67 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #72535 arcfour encryption stream filter crashes php
2017-10-24 14:05:18 +02:00
Anatol Belski 968c8fc0d5 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed bug #72535 arcfour encryption stream filter crashes php
2017-10-24 14:04:08 +02:00
Anatol Belski 37acebcc8c Fixed bug #72535 arcfour encryption stream filter crashes php 2017-10-24 13:59:18 +02:00
Anatol Belski e97b10f1a0 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75055 Out-Of-Bounds Read in timelib_meridian()
  Apply upstream patch for CVE-2016-1283
2017-10-24 13:45:16 +02:00
Anatol Belski 4d31ee9043 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75055 Out-Of-Bounds Read in timelib_meridian()
  Apply upstream patch for CVE-2016-1283
2017-10-24 13:44:03 +02:00
Anatol Belski 5efbcd1882 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed bug #75055 Out-Of-Bounds Read in timelib_meridian()
  Apply upstream patch for CVE-2016-1283
2017-10-24 13:38:48 +02:00
Anatol Belski a7815e63bd Fixed bug #75055 Out-Of-Bounds Read in timelib_meridian() 2017-10-24 11:28:17 +02:00
Anatol Belski d37658be6c Apply upstream patch for CVE-2016-1283
Fix bug #75207, see also
https://bugzilla.redhat.com/show_bug.cgi?id=1295385
https://vcs.pcre.org/pcre?view=revision&revision=1636

(cherry picked from commit d11fceab15)
2017-10-24 11:10:11 +02:00
Sara Golemon e83e187a9f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  NEWS entry for pg_close() fix
2017-10-23 14:56:50 -04:00
Sara Golemon 1758525df9 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  NEWS entry for pg_close() fix
2017-10-23 14:56:10 -04:00
Sara Golemon 9fca585488 NEWS entry for pg_close() fix 2017-10-23 14:55:32 -04:00
Sara Golemon ece23ea20f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Bugfix#75419 Fix clearing of default link during pg_close()
2017-10-23 14:44:40 -04:00
Sara Golemon 781521e112 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Bugfix#75419 Fix clearing of default link during pg_close()
2017-10-23 14:44:28 -04:00
Sara Golemon a645af4456 Bugfix#75419 Fix clearing of default link during pg_close() 2017-10-23 14:44:00 -04:00
Anatol Belski b4db9e9acc Update libmagic.patch 2017-10-23 19:18:25 +02:00
Anatol Belski 734c1f3cd4 Fail hard when re2c is not found or the version requirement not met
With 7.2, the binary SDK supplies the minimal required version, thus no
reason to fail later at the compilation time.
2017-10-23 19:01:14 +02:00
Anatol Belski fb0be397d0 Fix mismatching alloc 2017-10-23 18:49:17 +02:00
Derick Rethans 12e2fc4ab6 Updated to version 2017.3 (2017c) 2017-10-23 17:31:23 +01:00
Derick Rethans 9290c826fa Empty merge 2017-10-23 17:31:23 +01:00
Derick Rethans b07b526b95 Updated to version 2017.3 (2017c) 2017-10-23 17:31:21 +01:00
Derick Rethans eca1623f1b Empty merge 2017-10-23 17:31:21 +01:00
Derick Rethans b2dfcb30eb Updated to version 2017.3 (2017c) 2017-10-23 17:31:20 +01:00
Anatol Belski 9beb743b07 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix memory leak
2017-10-23 15:40:37 +02:00
Anatol Belski 5b497797f2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix memory leak
2017-10-23 15:40:05 +02:00
Anatol Belski 1cb2079d6c Fix memory leak 2017-10-23 15:26:08 +02:00
Anatol Belski 0e44c980f9 Fix uninitialized vars 2017-10-23 12:02:41 +02:00
Anatol Belski 8f35685744 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Renaming cache folder is not a solution, too. Disable cache for now.
  Revert "Rename build cache folder and separate sdk"
2017-10-23 07:14:14 +02:00
Anatol Belski 0a3ea6091c Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Renaming cache folder is not a solution, too. Disable cache for now.
  Revert "Rename build cache folder and separate sdk"
2017-10-23 07:13:51 +02:00
Anatol Belski 9f00e26008 Renaming cache folder is not a solution, too. Disable cache for now. 2017-10-23 07:13:00 +02:00
Anatol Belski c9a14b3aee Revert "Rename build cache folder and separate sdk"
This reverts commit 58dd892156.
2017-10-23 07:12:33 +02:00
Anatol Belski bba881e424 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Rename build cache folder and separate sdk
  Revert "Invalidate the whole cache when .appveyor.yml was changed"
2017-10-23 07:09:52 +02:00
Anatol Belski a10ef3d5cc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Rename build cache folder and separate sdk
  Revert "Invalidate the whole cache when .appveyor.yml was changed"
2017-10-23 07:09:35 +02:00
Anatol Belski 58dd892156 Rename build cache folder and separate sdk 2017-10-23 07:08:45 +02:00
Anatol Belski eead6bf97a Revert "Invalidate the whole cache when .appveyor.yml was changed"
This reverts commit 25d40602cb.
2017-10-23 07:05:48 +02:00
Anatol Belski ae5dbea5e7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Invalidate the whole cache when .appveyor.yml was changed
2017-10-23 07:02:15 +02:00
Anatol Belski a2c9ba78dd Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Invalidate the whole cache when .appveyor.yml was changed
2017-10-23 07:01:43 +02:00
Anatol Belski 25d40602cb Invalidate the whole cache when .appveyor.yml was changed 2017-10-23 07:00:36 +02:00
Jakub Zelenka e33721978e Merge branch 'PHP-7.1' into PHP-7.2 2017-10-22 18:58:15 +01:00
Jakub Zelenka f10fd89f99 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-22 18:57:14 +01:00
Jakub Zelenka 34ed75fab7 Fix clean up for openssl_pkcs12_export_to_file_basic 2017-10-22 18:54:15 +01:00
Jelle van der Waa 314bef5d03 openssl: Fix openssl_pkcs12_export extracerts test
Fix the openssl_pkcs12_export testcase for extracerts, the 'extracerts'
option needs to be the key of the certificate value otherwise
openssl_pkcs12_export will ignore it.
2017-10-22 18:53:30 +01:00
Anatol Belski bb0a15f499 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  With ICU 58+, set the default restriction level to high
2017-10-21 17:24:42 +02:00
Anatol Belski e986f71527 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  With ICU 58+, set the default restriction level to high
2017-10-21 17:24:15 +02:00
Anatol Belski 1d781fbdb1 With ICU 58+, set the default restriction level to high
Further experiments show, that CJK scripts should be ok. If there are
any issues, the moderate level can still be set later.
2017-10-21 17:21:41 +02:00
Anatol Belski ff1b1c2761 Add TZ and Unicode versions to intl MINFO 2017-10-21 16:17:31 +02:00
Anatol Belski 73d68ff3e0 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Reenable AppVeyor cache
2017-10-21 12:00:26 +02:00
Anatol Belski 5ce28090e0 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Reenable AppVeyor cache
2017-10-21 12:00:02 +02:00
Anatol Belski 44b3bc847b Reenable AppVeyor cache 2017-10-21 11:59:22 +02:00
Anatol Belski 839b3d1677 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Disable AppVeyor cache to unlock build
2017-10-21 10:52:48 +02:00
Anatol Belski f588a02463 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Disable AppVeyor cache to unlock build
2017-10-21 10:52:22 +02:00
Anatol Belski 0b71ae7a15 Disable AppVeyor cache to unlock build 2017-10-21 10:49:20 +02:00
Anatol Belski 3eb7ea55ae Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Rework these new tests to match with diffs in ICU 58, 59 and upcoming 60
2017-10-21 10:30:43 +02:00
Anatol Belski 88ec44dfe3 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Rework these new tests to match with diffs in ICU 58, 59 and upcoming 60
2017-10-21 10:30:14 +02:00
Anatol Belski 5d85d967bd Rework these new tests to match with diffs in ICU 58, 59 and upcoming 60 2017-10-21 10:29:04 +02:00
Anatol Belski 42ccf41e96 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [skip ci] Update NEWS
  [ci skip] Update NEWS
2017-10-20 20:49:17 +02:00
Anatol Belski 858614e92a [ci skip] Update NEWS 2017-10-20 20:48:59 +02:00
Anatol Belski ffa4d48e70 [skip ci] Update NEWS 2017-10-20 20:47:36 +02:00
Anatol Belski f508734e2f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  [ci skip] Update NEWS
2017-10-20 20:47:16 +02:00
Anatol Belski ede8cee9e6 [ci skip] Update NEWS 2017-10-20 20:46:42 +02:00
Anatol Belski 416c993c8e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #73655 Spoofchecker::isSuspicious behavior change due to upstream changes
  Add test for newer ICU version
2017-10-20 20:14:48 +02:00
Anatol Belski 6f395736e2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73655 Spoofchecker::isSuspicious behavior change due to upstream changes
  Add test for newer ICU version
2017-10-20 20:14:08 +02:00
Anatol Belski f95063647c Fixed bug #73655 Spoofchecker::isSuspicious behavior change due to upstream changes
There are significant changes in the spoof checking reflecting
http://www.unicode.org/reports/tr39/tr39-15.html and relying on the
restriction levels. ICU 58+ removes WSC and MSC handling and otherwise
undergoes big changes in both code and data areas. Keep up with the
basic points for now, as we need to move forward and provide an
acceptable experience to PHP users linking to a newer ICU. The most
distros ATM don't provide ICU > 57.1, though. We'll need for sure to
keep up with the BC breach in ICU 58+ in possible further aspects.
2017-10-20 19:23:32 +02:00
Anatol Belski 2198d38cbc Add test for newer ICU version 2017-10-20 19:02:42 +02:00
Anatol Belski 57fc9fcba4 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Further test fixes for ICU >= 58
  Version checks
2017-10-20 18:40:55 +02:00
Anatol Belski 3d55910f35 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Further test fixes for ICU >= 58
2017-10-20 18:40:26 +02:00
Anatol Belski e02c41fc72 Further test fixes for ICU >= 58 2017-10-20 18:39:46 +02:00
Anatol Belski 7027a1643f Version checks 2017-10-20 18:26:14 +02:00
Anatol Belski fb88cee0fc Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Yet two wrong version checks
2017-10-20 16:55:32 +02:00
Anatol Belski 65d4bd0311 Yet two wrong version checks 2017-10-20 16:54:47 +02:00
Anatol Belski 0f7ddf0d47 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix version checks in tests
  Fix version checks in tests
2017-10-20 15:25:27 +02:00
Anatol Belski ae6d877f54 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix version checks in tests
2017-10-20 15:25:01 +02:00
Anatol Belski 2f444640b4 Fix version checks in tests 2017-10-20 15:24:43 +02:00
Anatol Belski 7240d99838 Fix version checks in tests 2017-10-20 15:23:09 +02:00
Anatol Belski 7775f9e872 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Sync some tests for compat with ICU 58.1, PHP 7.1+ part
  Sync some tests for compat with ICU 58.1+
2017-10-20 13:58:53 +02:00
Anatol Belski e2afa00b4c Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Sync some tests for compat with ICU 58.1+
2017-10-20 13:57:44 +02:00
Anatol Belski 26473523b0 Sync some tests for compat with ICU 58.1, PHP 7.1+ part 2017-10-20 13:56:58 +02:00
Anatol Belski 877e0b04bc Sync some tests for compat with ICU 58.1+ 2017-10-20 13:55:32 +02:00
Anatol Belski 2a361b14ea Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Add skip for incompatible ICU version
2017-10-20 11:30:09 +02:00
Anatol Belski 7751ae59ae Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Add skip for incompatible ICU version
2017-10-20 11:28:51 +02:00
Anatol Belski 9071ff5c87 Add skip for incompatible ICU version 2017-10-20 11:27:54 +02:00
Joe Watkins 4b67943501 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed #75317 - UConverter::setDestinationEncoding changes source instead of destinatination
2017-10-19 12:03:19 +01:00
Joe Watkins 8eee20d876 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed #75317 - UConverter::setDestinationEncoding changes source instead of destinatination
2017-10-19 12:02:52 +01:00
Nester 80c3b078b8 Fixed #75317 - UConverter::setDestinationEncoding changes source instead of destinatination 2017-10-19 12:02:22 +01:00
Joe Watkins cf91d81b31 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update .editorconfig with some more configs
2017-10-19 11:54:01 +01:00
Joe Watkins 85c243ef66 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Update .editorconfig with some more configs
2017-10-19 11:53:50 +01:00
Peter Kokot aa143515d6 Update .editorconfig with some more configs
Added support for .awk, .w32, .bat, .mk, .frag, .m4, .sh, .php, .phpt,
and Markdown files based on the current most used coding style in the
php-src repository.
2017-10-19 11:53:37 +01:00
Joe Watkins 0397b8c5c5 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix issue with zend signals in php_request_startup
2017-10-19 11:48:27 +01:00
Herman J. Radtke III bb1814b5c3 Fix issue with zend signals in php_request_startup
The zend_signals_activate() function is called in php_request_startup()
even if `--disable-zend-signals` is used. This causes uninitialized
variables to be used on ZTS builds.

This was removed in 7.1 in c870633. Removing guards from the SAPIs
should be fine, but removing the guard from main/main.c prevents anyone
using the static embedded library to integrate PHP into their programs.

For more details, see the "Additional remark" section in
https://bugs.php.net/bug.php?id=74149
2017-10-19 11:48:16 +01:00
Joe Watkins 965daf4349 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Escape newline on curl config.m4
2017-10-19 11:40:48 +01:00
Joe Watkins 925d969f9e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Escape newline on curl config.m4
2017-10-19 11:40:05 +01:00
Ryan Volz 4e85dd0346 Escape newline on curl config.m4 2017-10-19 11:39:54 +01:00
Anatol Belski 2b76520d86 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Move to php-sdk-2.0.0beta3 for Appveyor
2017-10-18 17:47:27 +02:00
Anatol Belski 3c2b087b3e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Move to php-sdk-2.0.0beta3 for Appveyor
2017-10-18 17:46:40 +02:00
Anatol Belski 5f7707cc8a Move to php-sdk-2.0.0beta3 for Appveyor
Supposed to fix sporadic tool crashes on the test image
2017-10-18 17:45:33 +02:00
Anatol Belski 5315cea6e2 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Backport 7ff13badda into 7.0+
2017-10-18 16:27:31 +02:00
Anatol Belski 53d8775015 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Backport 7ff13badda into 7.0+
2017-10-18 16:24:23 +02:00
Anatol Belski d82805f097 Backport 7ff13badda into 7.0+ 2017-10-18 16:02:56 +02:00
Anatol Belski 63a0ddb013 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  One more folder to delete in AppVeyor image
2017-10-17 15:37:23 +02:00
Anatol Belski b9b06c4bdf Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  One more folder to delete in AppVeyor image
2017-10-17 15:34:42 +02:00
Anatol Belski 9891f11f84 One more folder to delete in AppVeyor image 2017-10-17 15:32:47 +02:00
Xinchen Hui e53a9aaa4a Fixed bug (assertion fails with extended info generated) 2017-10-17 19:47:29 +08:00
Xinchen Hui 0292456262 Fixed test 2017-10-17 12:20:43 +08:00
Xinchen Hui 2f73f2436a Try to fix test 2017-10-17 11:35:40 +08:00
Tianfang Yang 77ad860bf0 Merge branch 'PHP-7.1' into PHP-7.2 2017-10-16 19:27:21 -04:00
Tianfang Yang d1f43b1a58 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-16 19:24:08 -04:00
Tianfang Yang f955cff54c Fixed valgrind issue 2017-10-16 19:20:24 -04:00
Tianfang Yang aad4544e95 Fixed valgrind issue 2017-10-16 19:16:30 -04:00
Anatol Belski d30477f23a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Move to next binary SDK version for AppVeyor
2017-10-16 18:07:41 +02:00
Anatol Belski c3177f8279 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Move to next binary SDK version for AppVeyor
2017-10-16 18:06:38 +02:00
Anatol Belski 7778106f40 Move to next binary SDK version for AppVeyor 2017-10-16 18:05:56 +02:00
Dmitry Stogov 5d6912d185 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Prevent crash on ext/pdo_mysql/tests/bug_39858.phpt when built with libmysql
2017-10-16 19:02:22 +03:00
Dmitry Stogov c33ca443ee Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Prevent crash on ext/pdo_mysql/tests/bug_39858.phpt when built with libmysql
2017-10-16 19:02:07 +03:00
Dmitry Stogov 8bfe748fb0 Prevent crash on ext/pdo_mysql/tests/bug_39858.phpt when built with libmysql 2017-10-16 19:00:12 +03:00
Xinchen Hui 6fab62e923 Merge branch 'PHP-7.2' of git.php.net:/php-src into PHP-7.2
* 'PHP-7.2' of git.php.net:/php-src:
  [ci skip] Fixed bug #75383 (The date is "Sep", it should say "Oct")
  Properly fix #75363 and address some other leaks with cert
2017-10-16 19:07:55 +08:00
Xinchen Hui 863acd7753 Fixed bug #75378 ([REGRESSION] IntlDateFormatter::parse() does not change $position argument) 2017-10-16 19:07:34 +08:00
Christoph M. Becker 08c04c9245 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Fixed bug #75383 (The date is "Sep", it should say "Oct")
2017-10-16 11:12:17 +02:00
Christoph M. Becker 200d526a9c [ci skip] Fixed bug #75383 (The date is "Sep", it should say "Oct") 2017-10-16 11:11:34 +02:00
Jakub Zelenka 532aec7af2 Merge branch 'PHP-7.2' of git.php.net:php-src into PHP-7.2 2017-10-16 09:54:03 +01:00
Xinchen Hui 8e147f12b9 Fixed bug (Phi sources removel) 2017-10-16 15:01:06 +08:00
Jakub Zelenka a3da46b524 Merge branch 'PHP-7.1' into PHP-7.2 2017-10-15 20:33:22 +01:00
Jakub Zelenka 547fee9cd4 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-15 20:31:25 +01:00
Jakub Zelenka 999fe36d40 Properly fix #75363 and address some other leaks with cert 2017-10-15 20:25:58 +01:00
Jakub Zelenka 7c556c44a1 Fix bug #68567 (JSON_PARTIAL_OUTPUT_ON_ERROR can result in JSON with null key) 2017-10-15 19:36:15 +01:00
Christoph M. Becker 46d87c1f10 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #53070 (enchant_broker_get_path crashes if no path is set)
2017-10-15 14:07:41 +02:00
Christoph M. Becker 5e2751e7ff Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #53070 (enchant_broker_get_path crashes if no path is set)
2017-10-15 14:02:31 +02:00
Jelle van der Waa 5acb8381b2 Fixed bug #53070 (enchant_broker_get_path crashes if no path is set)
enchant_broker_get_dict_path segfaults when the dict path is not setup,
instead of segfaulting return false instead.
2017-10-15 13:57:44 +02:00
Christoph M. Becker de5f15ed4e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75365 (Enchant still reports version 1.1.0)
2017-10-15 13:35:59 +02:00
Christoph M. Becker fd993b1045 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75365 (Enchant still reports version 1.1.0)
2017-10-15 13:30:06 +02:00
Christoph M. Becker fb09021432 Fixed bug #75365 (Enchant still reports version 1.1.0)
Since Enchant is bundled, we make `PHP_ENCHANT_VERSION` an alias of
`PHP_VERSION` and also drop the rather meaningless revision hash from
the PHP info.
2017-10-15 13:19:17 +02:00
Xinchen Hui 481a65a028 Update NEWS 2017-10-15 10:29:40 +08:00
Xinchen Hui 9f5ed133b3 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75287 (Builtin webserver crash after chdir in a shutdown function)
2017-10-15 10:29:28 +08:00
Xinchen Hui b9b2ae703c Update NEWS 2017-10-15 10:29:10 +08:00
Xinchen Hui 49702ad7fb Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75287 (Builtin webserver crash after chdir in a shutdown function)
2017-10-15 10:28:46 +08:00
Xinchen Hui 816758eda2 Fixed bug #75287 (Builtin webserver crash after chdir in a shutdown function) 2017-10-15 10:28:28 +08:00
Xinchen Hui abbdbc21b0 Fixed bug #75357 (segfault loading WordPress wp-admin) 2017-10-14 23:12:29 +08:00
Dmitry Stogov 7045362ce7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75368 (mmap/munmap trashing on unlucky allocations)
2017-10-13 14:00:21 +03:00
Dmitry Stogov bf1c1d07db Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75368 (mmap/munmap trashing on unlucky allocations)
2017-10-13 13:56:23 +03:00
Dmitry Stogov 397f5cb687 Fixed bug #75368 (mmap/munmap trashing on unlucky allocations) 2017-10-13 13:56:06 +03:00
Xinchen Hui 21f049b45c Prevent from being affected by local php.ini 2017-10-13 18:23:56 +08:00
Xinchen Hui a52d1088e5 Added skipf 2017-10-13 18:21:41 +08:00
Xinchen Hui e4f7ff9c0f Fixed bug #75370 (Webserver hangs on valid PHP text) 2017-10-13 18:18:10 +08:00
Xinchen Hui e50cc4d3af Fixed typo 2017-10-13 17:35:02 +08:00
Christoph M. Becker 3f8961dfac Fixed bug #75221 (Argon2i always throws NUL at the end)
Apparently, `argon2_encodedlen()` also counts the terminating NUL byte;
that doesn't appear to be documented somewhere, but from looking at the
implementation[1] it is pretty obvious.  Therefore, the respective
`zend_string` has to be one byte shorter.

[1] <https://github.com/P-H-C/phc-winner-argon2/blob/20161029/src/argon2.c#L431-L436>
2017-10-12 12:52:37 +02:00
Bob Weinand ee36507423 Merge branch 'PHP-7.1' into PHP-7.2 2017-10-12 12:32:30 +02:00
Bob Weinand f8ff4c4918 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-12 12:31:20 +02:00
Bob Weinand a55af1e271 Fixed bug #75363 (openssl_x509_parse leaks memory) 2017-10-12 12:30:20 +02:00
Anatol Belski 81473829d4 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  It looks like i should've taken joint response on ext/fileinfo long ago
2017-10-11 22:25:27 +02:00
Anatol Belski 677cd85cb7 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  It looks like i should've taken joint response on ext/fileinfo long ago
2017-10-11 22:24:52 +02:00
Anatol Belski 23e97b0222 It looks like i should've taken joint response on ext/fileinfo long ago 2017-10-11 22:21:34 +02:00
Anatol Belski e7aebcc186 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Put php-sdk-2.0.12beta1 for AppVeyor
2017-10-11 20:31:58 +02:00
Anatol Belski f63a0fef6b Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Put php-sdk-2.0.12beta1 for AppVeyor
2017-10-11 20:30:40 +02:00
Anatol Belski d432bdb4ab Put php-sdk-2.0.12beta1 for AppVeyor
Quite some tool upgrades there, especially re2c 1.0.2
2017-10-11 20:27:27 +02:00
Anatol Belski 4d61091ac7 [ci skip] update NEWS 2017-10-11 19:02:51 +02:00
Anatol Belski 747f70ba82 Cleanup irrelevant info 2017-10-11 18:40:16 +02:00
Anatol Belski 08d8623dec Upgrade bundled libmagic to 5.31 2017-10-11 18:18:55 +02:00
Christoph M. Becker 1f150fcde1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix Bug #75299 Wrong reflection on inflate_init and inflate_add
2017-10-11 17:30:45 +02:00
Christoph M. Becker d3d23e0cb8 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix Bug #75299 Wrong reflection on inflate_init and inflate_add
2017-10-11 17:29:36 +02:00
Christoph M. Becker 787bf7eaf7 Merge branch 'pull-request/2798' into PHP-7.0
* pull-request/2798:
  Fix Bug #75299 Wrong reflection on inflate_init and inflate_add
2017-10-11 17:28:30 +02:00
Christoph M. Becker 50bd4996fd Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Use PHP_VERSION for exif
2017-10-11 14:44:43 +02:00
Christoph M. Becker 62098a10aa Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Use PHP_VERSION for exif
2017-10-11 14:43:51 +02:00
Christoph M. Becker b497b6edf9 Merge branch 'pull-request/2799' into PHP-7.0
* pull-request/2799:
  Use PHP_VERSION for exif
2017-10-11 14:42:46 +02:00
Christoph M. Becker b65e6cfe35 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  bump version
2017-10-11 14:38:12 +02:00
Anatol Belski 53169dc480 Fix datatype 2017-10-11 08:58:59 +02:00
Dmitry Stogov 2929110ce1 Fixed cleanup after optimization passes 2017-10-10 19:25:51 +03:00
Sara Golemon 6c3c18723c Revert "Update NEWS for PHP 7.2.0RC4"
This reverts commit 1ea657c65e.
2017-10-10 11:55:50 -04:00
Sara Golemon 6c8a5817ec Revert "Update NEWS for 7.2.0RC5"
This reverts commit ef25e56ae6.
2017-10-10 11:55:41 -04:00
Sara Golemon ef25e56ae6 Update NEWS for 7.2.0RC5 2017-10-10 15:49:16 +00:00
Sara Golemon 1ea657c65e Update NEWS for PHP 7.2.0RC4 2017-10-10 15:27:31 +00:00
Joe Watkins c2bfdf3712 bump version 2017-10-10 16:12:36 +01:00
Anatol Belski ad279bd180 Fix path in makefile fragment 2017-10-10 14:32:19 +02:00
Christoph M. Becker fcaf183174 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Add NEWS entry for bug #75349
2017-10-10 13:59:28 +02:00
Christoph M. Becker fee21a45df Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  [ci skip] Add NEWS entry for bug #75349
2017-10-10 13:56:47 +02:00
Christoph M. Becker c8eccf8451 [ci skip] Add NEWS entry for bug #75349 2017-10-10 13:54:52 +02:00
Anatol Belski 9c5a1dad64 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix re2c version detection
2017-10-10 13:00:26 +02:00
Anatol Belski 30f121f9bc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix re2c version detection
2017-10-10 12:59:14 +02:00
Remi Collet f3cda1a3a5 Update NEWS for 7.2.0RC5 2017-10-10 10:27:37 +00:00
Remi Collet 9317e910fe Update NEWS for PHP 7.2.0RC4 2017-10-10 10:12:30 +00:00
Anatol Belski d1fc9b425f Fix re2c version detection 2017-10-10 10:52:52 +02:00
Anatol Belski 406622d117 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Move dev to 7.0.26
2017-10-10 08:28:09 +02:00
Anatol Belski c8732b1c5f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Move dev to 7.0.26
2017-10-10 08:27:37 +02:00
Anatol Belski 51658bac35 Move dev to 7.0.26 2017-10-10 08:26:04 +02:00
Anatol Belski 611d117b24 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix array access on undeclared properties in DateInterval
2017-10-09 15:38:37 +02:00
Anatol Belski d8881f4eb4 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix array access on undeclared properties in DateInterval
2017-10-09 15:38:21 +02:00
Anatol Belski f48abfa902 Fix array access on undeclared properties in DateInterval 2017-10-09 15:35:38 +02:00
Anatol Belski a51c542b53 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix ftok() multibyte path support
2017-10-09 13:13:51 +02:00
Anatol Belski dc3b9fe619 Fix ftok() multibyte path support 2017-10-09 13:12:40 +02:00
Sara Golemon 1db7e4a962 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Bugfix #74556 stream_socket_get_name() returns null bytes on MacOS
2017-10-07 10:14:03 -04:00
Sara Golemon ac1fd769ad Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Bugfix #74556 stream_socket_get_name() returns null bytes on MacOS
2017-10-07 10:13:54 -04:00
Sara Golemon 843e492c68 Bugfix #74556 stream_socket_get_name() returns null bytes on MacOS 2017-10-07 10:08:34 -04:00
Rasmus Lerdorf ec3ea3081d Add line numbers to Optimizer debug output 2017-10-06 17:18:58 -03:00
Christoph M. Becker d0146c2506 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75318 (The parameter of UConverter::getAliases() is not optional)
2017-10-06 16:57:20 +02:00
Christoph M. Becker 0f55138533 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75318 (The parameter of UConverter::getAliases() is not optional)
2017-10-06 16:46:51 +02:00
Christoph M. Becker ec3d864784 Fixed bug #75318 (The parameter of UConverter::getAliases() is not optional)
Of course, reflection has to know that as well.
2017-10-06 16:45:07 +02:00
Nikita Popov 0e8ccb179d Merge branch 'PHP-7.1' into PHP-7.2 2017-10-05 12:26:19 +02:00
Nikita Popov d34c8fa802 Merge branch 'PHP-7.0' into PHP-7.1 2017-10-05 12:25:37 +02:00
Mathieu CARBONNEAUX 6b9ccda936 Fixed bug #75311 2017-10-05 12:24:57 +02:00
Peter Kokot 74124de048 Use PHP_VERSION for exif 2017-10-04 23:25:36 +02:00
Dmitry Stogov e9426cf816 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed rarely possible use-after-free
2017-10-04 16:39:47 +03:00
Dmitry Stogov b6e34eaf04 Fixed rarely possible use-after-free 2017-10-04 16:38:55 +03:00
Dmitry Stogov c3bb81d5a4 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Bumped ext/oci8 version
  Use dereferenced value
  Fixed compilation errors
  Restored code for BOOL variables
  Fixed few ext/oci8 bugs
2017-10-04 09:59:27 +03:00
Dmitry Stogov c935b832dc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Bumped ext/oci8 version
  Use dereferenced value
  Fixed compilation errors
  Restored code for BOOL variables
  Fixed few ext/oci8 bugs
2017-10-04 09:58:32 +03:00
Dmitry Stogov 1195de87ff Bumped ext/oci8 version 2017-10-04 09:56:25 +03:00
Dmitry Stogov ee50fcfa27 Merge branch 'oci8_fix' into PHP-7.0
* oci8_fix:
  Use dereferenced value
  Fixed compilation errors
  Restored code for BOOL variables
  Fixed few ext/oci8 bugs
2017-10-04 09:49:40 +03:00
Christoph M. Becker 2b83f0da89 [ci skip] Merge branch 'pull-request/2776' into PHP-7.2
* pull-request/2776:
  Change EXTENSIONS file encoding from iso-8859-1 to utf-8
2017-10-04 00:30:57 +02:00
Dmitry Stogov 24e595bf26 Use dereferenced value 2017-10-03 10:49:56 +03:00
Joe Watkins 6e39258302 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Typo in status.html
2017-10-03 07:22:15 +01:00
Joe Watkins d0cda9d0bd Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Typo in status.html
2017-10-03 07:22:04 +01:00
Viktor Szépe e995b7e475 Typo in status.html
feet needs -> fit needs
2017-10-03 07:21:53 +01:00
Joe Watkins 4c12da6aca Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #74905
2017-10-03 07:19:23 +01:00
Joe Watkins 1322c2c86a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #74905
2017-10-03 07:19:00 +01:00
Peter Kokot 6d1dd8b0af Fix bug #74905 2017-10-03 07:18:38 +01:00
Joe Watkins a87434bda8 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Remove ident gitattribute for ext/zip/php_zip.c
2017-10-03 07:15:14 +01:00
Joe Watkins 2019b25daa Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Remove ident gitattribute for ext/zip/php_zip.c
2017-10-03 07:15:02 +01:00
Peter Kokot 7b248a1b32 Remove ident gitattribute for ext/zip/php_zip.c 2017-10-03 07:14:50 +01:00
Dmitry Stogov 4d69587035 Fixed compilation errors 2017-10-03 09:08:28 +03:00
Remi Collet ca6d701994 NEWS 2017-10-03 06:42:39 +02:00
Remi Collet d67873ec99 Fix Bug #75284 sha3 is not supported on bigendian machine 2017-10-03 06:41:46 +02:00
Frank Denis a1c0824518 NEWS 2017-10-02 22:47:06 +02:00
Frank Denis 9d236d63f9 ext/sodium: untab tests 2017-10-02 22:28:46 +02:00
Frank Denis 1dc47286d1 ext/sodium: import secretstream test 2017-10-02 22:28:33 +02:00
Frank Denis 6de12a5f1e ext/sodium: sodium_compare() is always available 2017-10-02 22:23:53 +02:00
Frank Denis 40ab4c9d4e ext/sodium: fix funky indentation 2017-10-02 22:22:22 +02:00
Frank Denis 7fc396c15d ext/sodium: move pwhash_scrypt() after pwhash() 2017-10-02 22:19:55 +02:00
Frank Denis 986a9e879a ext/sodium: checks for crypto_box_SEALBYTES are not required 2017-10-02 22:11:29 +02:00
Frank Denis 4d1707b764 ext/sodium: explicitly include <string.h> 2017-10-02 22:10:30 +02:00
Frank Denis 0726d0be9f ext/sodium: zend_parse_parameters -> zend_parse_parameters_throw 2017-10-02 22:05:59 +02:00
Frank Denis e4917d141a ext/sodium: fix funky indent on zend_parse_parameters_throw() calls 2017-10-02 22:02:47 +02:00
Frank Denis 72f7d0b184 ext/sodium: import bindings for secretstream 2017-10-02 21:59:51 +02:00
Frank Denis 7d53e65125 ext/sodium: add crypto_pwhash_str_needs_rehash()
Also properly define xchacha20poly1305_ietf_keygen()
2017-10-02 21:54:50 +02:00
Frank Denis e22094eb13 ext/sodium: +base64 codecs (timing-safe) 2017-10-02 21:43:54 +02:00
Frank Denis ad120c5ae9 ext/sodium: add arginfo definitions that will be required later
Don't check for existence of aesgcm symbols, since we only support
libsodium >= 1.0.8
2017-10-02 21:40:38 +02:00
Frank Denis 519ca1d53b ext/sodium: sort prototypes 2017-10-02 21:36:35 +02:00
Dmitry Stogov c8dea7ae1e Restored code for BOOL variables 2017-10-02 17:04:26 +03:00
Remi Collet 2606c5f0fe Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  NEWS
  Fixed bug #75303 sha3 hangs on bigendian
2017-10-02 11:26:46 +02:00
Remi Collet 03aef5f65c NEWS 2017-10-02 11:26:08 +02:00
Remi Collet fa78afa112 Fixed bug #75303 sha3 hangs on bigendian 2017-10-02 11:25:23 +02:00
Sara Golemon ec90310ea9 Guard against AI_NUMERICSERV not being defined. 2017-10-01 21:37:04 -04:00
Frank Denis 0663ca135d ext/sodium: fix pwhash_argon2i test 2017-10-01 16:00:41 +02:00
Fabien Villepinte 9d9873b3b5 Fix Bug #75299 Wrong reflection on inflate_init and inflate_add 2017-10-01 11:27:16 +02:00
Xinchen Hui 92ceb64faf Merge branch 'patch-compile-warning' of https://github.com/petk/php-src into PHP-7.2
* 'patch-compile-warning' of https://github.com/petk/php-src:
  Fix bug #75279
2017-09-30 12:14:21 +08:00
Andrea Faulds 15efa985df Merge branch 'PHP-7.1' into PHP-7.2 2017-09-29 21:38:52 +01:00
Andrea Faulds 4372293192 Merge branch 'PHP-7.0' into PHP-7.1 2017-09-29 21:38:30 +01:00
Andrea Faulds abefb6dfe7 Fix bug #75290 2017-09-29 21:38:08 +01:00
Remi Collet 7e21f472c6 NEWS 2017-09-29 15:50:38 +02:00
Remi Collet 7c8357929c Fixed bug #75285i Broken build when system libpcre don't have jit support
Detect JIT support in system library,
So --with-pcre-jit is only for bundled library.
2017-09-29 15:47:50 +02:00
Peter Kokot 8d87f6f6dd Fix bug #75279 2017-09-29 14:33:54 +02:00
Anatol Belski c3a1cc382a Revert --with-pcre-valgrind by default in debug build
After quite a few people reported this option enabled to be in many cases
not handy by default, it's reverted to no by default everywhere. If enabled,
it requires Valgrind dev packages, where just a few have Valgrind itself
installed or care. Still for PCRE related work this option is a must,
though will have to be turned on by hand.

Revert "fix default args for --with-pcre-valgrind"

This reverts commit 24de0fe9f4.

Revert "Enable valgrind support for PCRE by default in debug builds"

This reverts commit 850bb998d9.
2017-09-29 12:17:38 +02:00
Xinchen Hui d3aa65231e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75267 (possible &/&& mixup)
2017-09-29 11:17:07 +08:00
Xinchen Hui 9fd33c1f20 Fixed bug #75267 (possible &/&& mixup) 2017-09-29 11:16:32 +08:00
Sara Golemon a93fe32c1a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix word alignment on ILP64.
2017-09-28 10:48:43 -04:00
Sara Golemon b5bc88c64e Fix word alignment on ILP64. 2017-09-28 10:45:51 -04:00
Anatol Belski 4f1ea03528 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Apply upstream patch for CVE-2016-1283
2017-09-28 15:45:09 +02:00
Anatol Belski db9778dfb2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Apply upstream patch for CVE-2016-1283
2017-09-28 15:44:40 +02:00
Anatol Belski d11fceab15 Apply upstream patch for CVE-2016-1283
Fix bug #75207, see also
https://bugzilla.redhat.com/show_bug.cgi?id=1295385
https://vcs.pcre.org/pcre?view=revision&revision=1636
2017-09-28 15:40:49 +02:00
Anatol Belski 4f63024206 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix mkdir() special case for path length < 260 and > 248
2017-09-28 13:19:48 +02:00
Anatol Belski 72c008f945 Fix mkdir() special case for path length < 260 and > 248 2017-09-28 13:18:31 +02:00
Christoph M. Becker b0d6d27349 [ci skip] hash_hmac_algos() is new in PHP 7.2.0 2017-09-27 17:18:10 +02:00
Dmitry Stogov 978c6c4e31 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75255 (Request hangs and not finish)
2017-09-27 17:17:46 +03:00
Dmitry Stogov 1c68d63f35 Fixed bug #75255 (Request hangs and not finish) 2017-09-27 17:16:24 +03:00
jhdxr 7deb561f75 fix bug #75222 DateInterval microseconds property always 0 2017-09-27 06:23:42 +01:00
Joe Watkins b0950ff854 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix CGI m4 config message when CGI is disabled
2017-09-27 06:20:46 +01:00
Joe Watkins 1981c48e60 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix CGI m4 config message when CGI is disabled
2017-09-27 06:20:34 +01:00
Peter Kokot 29e673f8ed Fix CGI m4 config message when CGI is disabled 2017-09-27 06:20:09 +01:00
Joe Watkins 474ee702ab Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #75248 and #75251
2017-09-27 06:16:13 +01:00
Joe Watkins af71942da2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #75248 and #75251
2017-09-27 06:15:47 +01:00
Peter Kokot 6d0391b1a4 Fix bug #75248 and #75251 2017-09-27 06:15:12 +01:00
Joe Watkins 0d6c56a8ea Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed #75220 - Segfault when calling is_callable on parent
2017-09-27 06:08:49 +01:00
Joe Watkins 2dd77456fe Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed #75220 - Segfault when calling is_callable on parent
2017-09-27 06:08:01 +01:00
Nester a680d701ce Fixed #75220 - Segfault when calling is_callable on parent 2017-09-27 06:07:24 +01:00
Frank Denis 33b4405d84 ext/sodium: call crypto_pwhash_argon2id() explicitly if required 2017-09-26 18:09:00 +02:00
Frank Denis 47d75394c9 ext/sodium: avoid tautological comparisons 2017-09-26 17:58:16 +02:00
Frank Denis f64d00d684 ext/sodium: signing empty messages is fine 2017-09-26 17:37:04 +02:00
Remi Collet bffe657d94 Update NEWS for 7.2.0RC4 2017-09-26 09:38:23 +00:00
Remi Collet 8cdb9784d2 Update NEWS for PHP 7.2.0RC3 2017-09-26 09:23:07 +00:00
Nikita Popov 3a4db74ee4 Create $http_response_header even if not used
Extensions are relying on it.
2017-09-26 09:20:43 +02:00
Christoph M. Becker 296eb5193c Merge branch 'pull-request/2773' into PHP-7.2
* pull-request/2773:
  Fix PHP_GD_TTSTR: command not found warning in ext/gd
2017-09-26 00:45:21 +02:00
Anatol Belski 8466ef9096 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Remove some old sapi/apache_hooks and sapi/apache leftovers
2017-09-25 21:58:41 +02:00
Anatol Belski 0217a81722 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Remove some old sapi/apache_hooks and sapi/apache leftovers
2017-09-25 21:58:18 +02:00
Peter Kokot e095e6db63 Change EXTENSIONS file encoding from iso-8859-1 to utf-8
Also fix some characters to their correct letters.
2017-09-25 21:57:24 +02:00
Peter Kokot 3752d18ffe Remove some old sapi/apache_hooks and sapi/apache leftovers 2017-09-25 21:56:39 +02:00
Dmitry Stogov 2a33e357cd Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Added missed ~
2017-09-25 12:23:01 +03:00
Dmitry Stogov 550595c085 Added missed ~ 2017-09-25 12:22:35 +03:00
Dmitry Stogov 801cdb8945 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed type inference
2017-09-25 12:04:13 +03:00
Dmitry Stogov d526ddec85 Fixed type inference 2017-09-25 12:03:47 +03:00
Peter Kokot 8c85d7b732 Fix PHP_GD_TTSTR: command not found warning in ext/gd 2017-09-25 02:37:42 +02:00
Xinchen Hui ed2a5ebaeb Fixed bug #75230 (Invalid opcode 49/1/8 using opcache) 2017-09-24 18:01:29 +08:00
Xinchen Hui ccc0a92504 Update NEWS 2017-09-24 17:25:11 +08:00
Xinchen Hui bad5639386 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
  Compiler warning
2017-09-24 17:24:57 +08:00
Xinchen Hui 634f79d8d8 Update NEWS 2017-09-24 17:24:43 +08:00
Xinchen Hui e8c200515a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
  Compiler warning
2017-09-24 17:24:23 +08:00
Xinchen Hui b05ff14a9a Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()). 2017-09-24 17:24:11 +08:00
Xinchen Hui db63367871 Compiler warning 2017-09-24 17:19:05 +08:00
Nikita Popov 76b2b4a190 Merge branch 'PHP-7.1' into PHP-7.2 2017-09-24 08:55:12 +02:00
Nikita Popov 628c257f71 Merge branch 'PHP-7.0' into PHP-7.1 2017-09-24 08:54:36 +02:00
Nikita Popov 73d6456d7d Fixed bug #75252 2017-09-24 08:53:27 +02:00
Dmitry Stogov 28391b9e7f Using "enum" types as bit-fields is not portable. 2017-09-22 13:35:41 +03:00
Frank Denis 8a52a61e3a ext/sodium: avoid negations on unsigned values 2017-09-21 17:46:01 +02:00
Anatol Belski 95870dcc77 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix thread safety
2017-09-21 10:33:13 +02:00
Anatol Belski 96323d1bd7 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix thread safety
2017-09-21 10:32:47 +02:00
Anatol Belski da2f581833 Fix thread safety 2017-09-21 10:32:09 +02:00
Andrea Faulds 7418f6814f Merge branch 'PHP-7.1' into PHP-7.2 2017-09-21 00:04:56 +01:00
Andrea Faulds b71023e297 Merge branch 'PHP-7.0' into PHP-7.1 2017-09-21 00:04:08 +01:00
Andrea Faulds 418f97443a Fix bug #75236 2017-09-21 00:02:52 +01:00
Jannes Jeising c7a0177491 [ci skip] Fix more typos in UPGRADING 2017-09-20 15:50:06 -04:00
Christoph M. Becker 43152bc39f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
2017-09-20 15:54:07 +02:00
Christoph M. Becker 0c0b955d5f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
2017-09-20 15:47:02 +02:00
Dmitry Stogov 9a01fe712a Fixed few ext/oci8 bugs 2017-09-20 16:46:04 +03:00
Christoph M. Becker eedc060c92 Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
We must not overwrite the SPL_DLLIST_IT_FIX flag when changing the
iterator mode.
2017-09-20 15:46:04 +02:00
Dmitry Stogov 6544ec5460 Fixed NOP removal (empty blocks should be shifted as well) 2017-09-20 01:10:31 +03:00
Frank Denis fd86fdd7b8 ext/sodium: throw an exception if only the prefix of a hex string is valid 2017-09-19 14:37:21 +02:00
Remi Collet ee84f34344 rename test 2017-09-19 07:26:53 +02:00
Christoph M. Becker 3cd5f28899 [ci skip] Update NEWS 2017-09-18 22:52:18 +02:00
Dmitry Stogov 5ef10d08ec Use private names for new libpcre symbols. 2017-09-18 20:00:45 +03:00
Remi Collet 7d5c0f1906 NEWS 2017-09-18 18:09:35 +02:00
Remi Collet cfc6c4d297 Fixed Bug #75212 php_value acts like php_admin_value 2017-09-18 18:08:51 +02:00
Dmitry Stogov 084e34098a Fixed optimization (the bug caused endless-loop on micro_bench.php in master branch) 2017-09-18 14:10:18 +03:00
Anatol Belski d8f1afb45e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix the version check causing the test fail
2017-09-18 12:06:54 +02:00
Anatol Belski 5c59dd0047 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix the version check causing the test fail
2017-09-18 12:06:23 +02:00
Anatol Belski 9641586efa Fix the version check causing the test fail 2017-09-18 12:04:31 +02:00
Dmitry Stogov 41e5f916bf Fixed bug #74878 (Data race in ZTS builds) 2017-09-18 11:27:10 +03:00
Anatol Belski de2f28ede1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update lib_versions.txt
2017-09-18 09:37:46 +02:00
Anatol Belski e3e3d37fa9 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Update lib_versions.txt
2017-09-18 09:36:29 +02:00
Anatol Belski 7670590efd Update lib_versions.txt 2017-09-18 09:34:58 +02:00
Anatol Belski 9551818649 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Move to next binary SDK version for AppVeyor
2017-09-15 23:06:19 +02:00
Anatol Belski 351f98f5f3 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Move to next binary SDK version for AppVeyor
2017-09-15 23:05:25 +02:00
Anatol Belski 7910c1dee9 Move to next binary SDK version for AppVeyor 2017-09-15 23:04:15 +02:00
Christoph M. Becker b5052f0110 [ci skip] Fix typos in UPGRADING 2017-09-14 00:34:26 +02:00
Anatol Belski 46e0c474e0 [ci skip] update NEWS 2017-09-13 15:47:52 +02:00
Anatol Belski 66c7c28dbf Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] update NEWS
2017-09-13 15:47:19 +02:00
Anatol Belski fba792945e [ci skip] update NEWS
Fix format
2017-09-13 15:46:33 +02:00
Anatol Belski b134793b32 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75018, fixed bug #75177
2017-09-13 14:12:31 +02:00
Anatol Belski 3d93856c4a Fixed bug #75018, fixed bug #75177
Both are caused by the same cast issue in mysqlnd on 32-bit.
2017-09-13 14:10:30 +02:00
Remi Collet d99cd28925 fix tests for 32-bit 2017-09-13 12:20:05 +02:00
Dmitry Stogov 168ec3a6e1 Fixed ZTS build (disable deallocation of arg_info of internal functions with type hints) 2017-09-13 10:10:56 +03:00
Dmitry Stogov a84608d4e2 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Properly update string type flags
2017-09-13 01:46:23 +03:00
Dmitry Stogov c24b3eff11 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Properly update string type flags
2017-09-13 01:46:12 +03:00
Dmitry Stogov d7a10f0e32 Properly update string type flags 2017-09-13 01:45:57 +03:00
Dmitry Stogov 10a7f2cf62 Fixed memry leaks (free arg_info of internal functions with type hints) 2017-09-13 01:44:19 +03:00
Dmitry Stogov 40d15cb03d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Revert "Properly update string type flags"
2017-09-13 00:15:20 +03:00
Dmitry Stogov 5f1d553e7e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Revert "Properly update string type flags"
2017-09-13 00:15:08 +03:00
Dmitry Stogov 83d8ebc991 Revert "Properly update string type flags"
This reverts commit 99b1a62d55.
2017-09-13 00:14:39 +03:00
Dmitry Stogov c2cf132ecd Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed test
2017-09-12 23:47:52 +03:00
Dmitry Stogov 253d49369d Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed test
2017-09-12 23:47:39 +03:00
Dmitry Stogov 2874fa8fb0 Fixed test 2017-09-12 23:47:22 +03:00
Dmitry Stogov 73430d5362 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Properly update string type flags
2017-09-12 23:43:56 +03:00
Dmitry Stogov 7452fd0263 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Properly update string type flags
2017-09-12 23:43:42 +03:00
Dmitry Stogov 99b1a62d55 Properly update string type flags 2017-09-12 23:42:51 +03:00
Sara Golemon 0d37dcd21d Update NEWS for 7.2.0RC3 2017-09-12 12:47:55 -04:00
Sara Golemon 2272f408ed Update NEWS for PHP 7.2.0RC2 2017-09-12 12:47:55 -04:00
Anatol Belski 689f9956da Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test failure on 32-bit
2017-09-12 18:19:34 +02:00
Anatol Belski fcad6a97b8 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix test failure on 32-bit
2017-09-12 18:18:44 +02:00
Anatol Belski 7674b5e574 Fix test failure on 32-bit 2017-09-12 18:17:28 +02:00
Anatol Belski 7c5e454b09 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  bump versions
2017-09-12 18:11:05 +02:00
Joe Watkins 7f01872a24 bump versions 2017-09-12 15:34:30 +01:00
Remi Collet ea2507bc24 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  drop symbol definition, and not defined anywhere
2017-09-12 13:03:55 +02:00
Remi Collet 42e15813e2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  drop symbol definition, and not defined anywhere
2017-09-12 13:03:39 +02:00
Remi Collet 35deb4c88b drop symbol definition, and not defined anywhere 2017-09-12 13:03:18 +02:00
Anatol Belski 8ed0094f48 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] update NEWS
  [ci skip] update NEWS
2017-09-12 12:19:14 +02:00
Anatol Belski 1454dc20eb [ci skip] update NEWS 2017-09-12 12:18:58 +02:00
Anatol Belski ac6eefcf3d Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  [ci skip] update NEWS
2017-09-12 12:18:01 +02:00
Anatol Belski 3719aaebbf [ci skip] update NEWS 2017-09-12 12:17:46 +02:00
Anatol Belski 3d1cb7e32c [ci skip] update NEWS 2017-09-12 12:17:12 +02:00
Anatol Belski a54079b92f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75193 segfault in collator_convert_object_to_string
2017-09-12 12:14:24 +02:00
Anatol Belski 05c65de082 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75193 segfault in collator_convert_object_to_string
2017-09-12 12:13:42 +02:00
Remi Collet b09497c0e2 Fixed bug #75193 segfault in collator_convert_object_to_string 2017-09-12 12:12:06 +02:00
Anatol Belski 3a61773b45 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Move dev to 7.0.25
2017-09-12 09:03:31 +02:00
Anatol Belski 0cb5a2cb49 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Move dev to 7.0.25
2017-09-12 09:03:07 +02:00
Anatol Belski 5cf215536b Move dev to 7.0.25 2017-09-12 09:02:01 +02:00
Anatol Belski be57071e8c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Fix news entry format
2017-09-12 08:38:36 +02:00
Anatol Belski ea21b60dda Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  [ci skip] Fix news entry format
2017-09-12 08:38:10 +02:00
Anatol Belski c347f49a2d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Fix news entry format
2017-09-12 08:37:50 +02:00
Anatol Belski f5d478c8e6 [ci skip] Fix news entry format 2017-09-12 08:37:40 +02:00
Anatol Belski b5c9cd4df6 [ci skip] Fix news entry format 2017-09-12 08:36:05 +02:00
Anatol Belski 194547f591 [ci skip] Fix news entry format 2017-09-12 08:35:10 +02:00
Joe Watkins f87e513557 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  fix bug #75173 incorrect behavior of AppendIterator::append in foreach loop
2017-09-12 07:08:01 +01:00
Joe Watkins 7015d22116 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix bug #75173 incorrect behavior of AppendIterator::append in foreach loop
2017-09-12 07:06:35 +01:00
jhdxr 3e11b7fc21 fix bug #75173 incorrect behavior of AppendIterator::append in foreach loop 2017-09-12 07:05:58 +01:00
Dylan K. Taylor c3b0e68eb7 Fix LDFLAGS getting overwritten (ext/curl) 2017-09-12 07:03:22 +01:00
Xinchen Hui afd59b0c80 Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:/php-src:
  Fixed bug #46781 (BC math handles minus zero incorrectly)
  Fork test to keep up with libxsl >= 1.1.30
  Add symbol to libxml exports
  Fix test compat with libxml2 2.9.5
  Fix test compat with libxml2 2.9.5
  Fix test portability
  Fix test compatibility with libxml2 2.9.5
2017-09-12 13:27:40 +08:00
Xinchen Hui a8427e7d37 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed arginfo for get_defined_functions
2017-09-12 13:26:25 +08:00
Xinchen Hui 58aa726548 Fixed arginfo for get_defined_functions 2017-09-12 13:26:07 +08:00
Christoph M. Becker 77f3cef35c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #46781 (BC math handles minus zero incorrectly)
2017-09-11 23:52:14 +02:00
Christoph M. Becker 87a91aef83 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #46781 (BC math handles minus zero incorrectly)
2017-09-11 23:46:21 +02:00
Christoph M. Becker 9aa6898b9b Fixed bug #46781 (BC math handles minus zero incorrectly)
Actually, there is no negative zero at all.  We obey Postel's law, and
still accept negative zeroes, but we store them as positive zeroes
after the conversion from string, i.e. we normalize before further
processing.
2017-09-11 23:44:23 +02:00
Christoph M. Becker 613bac9eb3 [ci-skip] Add NEWS entry for bug #75185 2017-09-11 19:07:44 +02:00
Christoph M. Becker d95221ec4b [ci-skip] Add missing UPGRADING entry for commit 0d0f7cd
There is a respective entry in NEWS, but that would likely be missed by
the doc team.
2017-09-11 18:37:51 +02:00
Anatol Belski dcae6d6423 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fork test to keep up with libxsl >= 1.1.30
2017-09-11 18:20:42 +02:00
Anatol Belski 88c7556d99 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fork test to keep up with libxsl >= 1.1.30
2017-09-11 18:20:13 +02:00
Anatol Belski d103802003 Fork test to keep up with libxsl >= 1.1.30
The behavior of date parsing has changed and is reflected in the
changelog. Invalid dates are not accepted, in particular dates with a
negative year, as in this test.
2017-09-11 18:14:51 +02:00
Anatol Belski 2d60b35147 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Add symbol to libxml exports
2017-09-11 17:37:10 +02:00
Anatol Belski 75cb69740e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Add symbol to libxml exports
2017-09-11 17:36:25 +02:00
Anatol Belski 04a6bbae6c Add symbol to libxml exports 2017-09-11 17:35:25 +02:00
Anatol Belski 8a9ff55397 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test compat with libxml2 2.9.5
2017-09-11 16:16:09 +02:00
Anatol Belski a77eddff96 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix test compat with libxml2 2.9.5
2017-09-11 16:15:32 +02:00
Anatol Belski cab41ecb93 Fix test compat with libxml2 2.9.5
One warning disappeared, but the flow is still valid.
2017-09-11 16:12:04 +02:00
Anatol Belski 45613b3473 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test compat with libxml2 2.9.5
2017-09-11 14:35:51 +02:00
Anatol Belski b5d7663444 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix test compat with libxml2 2.9.5
2017-09-11 14:35:24 +02:00
Anatol Belski 3549d9184a Fix test compat with libxml2 2.9.5
From 2.9.5 on libxml explcitly initializes the keepBlanks flag.
2017-09-11 14:32:54 +02:00
Anatol Belski 2f5129cacb Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test portability
2017-09-11 12:40:11 +02:00
Anatol Belski d33194d2aa Fix test portability
The message comes from the C runtime, so it is not reliable to check the
exact wording.
2017-09-11 12:38:20 +02:00
Anatol Belski a6bbb534d5 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test compatibility with libxml2 2.9.5
2017-09-11 12:18:37 +02:00
Anatol Belski 9ca0cd0a1a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix test compatibility with libxml2 2.9.5
2017-09-11 12:18:06 +02:00
Anatol Belski 5f9ae45e22 Fix test compatibility with libxml2 2.9.5 2017-09-11 12:12:19 +02:00
Xinchen Hui cbb72a2f8e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Not sure why these lines are removed :<
2017-09-11 13:36:09 +08:00
Xinchen Hui c40c0b8111 Not sure why these lines are removed :< 2017-09-11 13:35:49 +08:00
Xinchen Hui 8cb0627325 Update NEWS 2017-09-11 12:48:02 +08:00
Xinchen Hui 82d4727dbb Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75152 (signed integer overflow in parse_iv)

Conflicts:
	ext/standard/var_unserializer.c
2017-09-11 12:47:47 +08:00
Xinchen Hui 822c13b9ef Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:/php-src:
  Fixed bug #73730 (textdomain(null) throws in strict mode)
  Fix bug75178.phpt on Windows
  Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
  Add BC define for users of the typoed zend_symbtable_add_new
  Fix typo in zend_symtable_add_new() API name
  Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
  Fixed bug #44995 (bcpowmod() fails if scale != 0)
  Add missing null termination
  Fixed bug #70470
  Add test for bug #75155
  Revert "Fixed #74977 - Appending AppendIterator leads to segfault"
2017-09-11 12:46:26 +08:00
Xinchen Hui 6b2813c3a7 Fixed bug #75152 (signed integer overflow in parse_iv) 2017-09-11 12:46:11 +08:00
Christoph M. Becker 674fe0af38 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #73730 (textdomain(null) throws in strict mode)
2017-09-10 18:47:16 +02:00
Christoph M. Becker b394343a31 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73730 (textdomain(null) throws in strict mode)
2017-09-10 18:41:00 +02:00
Christoph M. Becker 4b746fce1c Fixed bug #73730 (textdomain(null) throws in strict mode)
The $text_domain parameter may be NULL, which we have to cater to
explicitly with regard to strict_types.
2017-09-10 18:39:29 +02:00
Christoph M. Becker 20fe838c76 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug75178.phpt on Windows
2017-09-09 17:04:42 +02:00
Christoph M. Becker 6602cc0385 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug75178.phpt on Windows
2017-09-09 16:54:23 +02:00
Christoph M. Becker 3fd08a1595 Fix bug75178.phpt on Windows
bug75178.phpt fails on Windows, because the stderr output is not
interspersed with stdout output there, but rather is appended to the
end. The fix is analogous to bug72093.phpt.
2017-09-09 16:46:32 +02:00
Christoph M. Becker 21eab49a53 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
2017-09-09 13:30:40 +02:00
Christoph M. Becker afa39038c2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
2017-09-09 13:20:14 +02:00
Christoph M. Becker 44eec946e8 Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
Since `bcpowmod()` does not support non-integral operands, we have to
truncate these in addition to emitting a respective warning. We also
have to work with the truncated values in the following.

We recognize that the division by one to enforce the truncation is
actually overkill, but we stick with it for now, and shall tackle the
issue for PHP 7.3.
2017-09-09 13:18:26 +02:00
Sara Golemon 55562dfb00 Do not include BC for zend_symbtable_add_new on 7.2/master 2017-09-07 17:37:20 -04:00
Sara Golemon 361d3007a6 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Add BC define for users of the typoed zend_symbtable_add_new
2017-09-07 17:36:35 -04:00
Sara Golemon a1573d5620 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Add BC define for users of the typoed zend_symbtable_add_new
2017-09-07 17:36:04 -04:00
Sara Golemon 0413feb29c Add BC define for users of the typoed zend_symbtable_add_new 2017-09-07 17:35:54 -04:00
Sara Golemon ff04db4420 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix typo in zend_symtable_add_new() API name
2017-09-07 16:29:57 -04:00
Sara Golemon 9369843ee2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix typo in zend_symtable_add_new() API name
2017-09-07 16:26:45 -04:00
Sara Golemon f18cf46d07 Fix typo in zend_symtable_add_new() API name 2017-09-07 16:25:25 -04:00
Sammy Kaye Powers b786e1b45c Improve sodium "invalid parameters" error messages 2017-09-07 22:18:48 +02:00
Nikita Popov fd07302024 Fixed bug #75170
This change may result in different mt_rand/rand sequences being
generated on 64-bit systems for a specific seed.

See also https://externals.io/message/100229.
2017-09-07 20:04:38 +02:00
Côme Chilliet e67379399a Removing client controls attribute from ldap_exop signature
Client controls will not get implemented in php-ldap as
 they are specific to each client ldap lib and most of the
 time unused any way. (servers controls on the other end are used
 and will get implemented)
2017-09-07 16:31:03 +02:00
Dmitry Stogov 251a5599b4 Fixed SSA reconstruction 2017-09-07 17:10:38 +03:00
Christoph M. Becker d01453b129 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
2017-09-07 00:38:59 +02:00
Christoph M. Becker 0f88a49fd5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
2017-09-07 00:32:39 +02:00
Christoph M. Becker b2919853f8 Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
`x mod 1` is always zero; we have to take the scale into account,
though.
2017-09-07 00:30:05 +02:00
Christoph M. Becker 5ce744091c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #44995 (bcpowmod() fails if scale != 0)
2017-09-06 23:41:46 +02:00
Christoph M. Becker d724d8c107 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #44995 (bcpowmod() fails if scale != 0)
2017-09-06 23:33:48 +02:00
Christoph M. Becker dea41f3c3a Fixed bug #44995 (bcpowmod() fails if scale != 0)
`bc_divmod()` is supposed to do integer division, so we must not apply
a scale factor here.
2017-09-06 23:30:53 +02:00
Nikita Popov d78a7909c8 Merge branch 'PHP-7.1' into PHP-7.2 2017-09-05 18:14:16 +02:00
Nikita Popov 0b69ce72b8 Merge branch 'PHP-7.0' into PHP-7.1 2017-09-05 18:14:10 +02:00
Nikita Popov 42549b7844 Add missing null termination 2017-09-05 18:13:50 +02:00
Nikita Popov dc00b6cf3f Fix assertion failure in SoapFault ctor
Resetting the IAP on a shared array violates COW. I'm replacing this
with code to look up indexes 0 and 1, even though this is not
strictly the same.
2017-09-05 17:38:50 +02:00
Ken Guest 056df0dcb2 Add test for invalid SoapFault parameters 2017-09-05 17:36:01 +02:00
Sammy Kaye Powers a8862d215c Fix a few places where ZPP throw got reverted to ZPP 2017-09-05 16:39:24 +02:00
Sammy Kaye Powers f1fd11f4ca Update NEWS that did not get updated in #2442
[ci skip]
2017-09-05 16:33:57 +02:00
Nikita Popov 9fbd8620fb Merge branch 'PHP-7.1' into PHP-7.2 2017-09-05 16:24:40 +02:00
Nikita Popov e866e05b0d Merge branch 'PHP-7.0' into PHP-7.1 2017-09-05 16:24:21 +02:00
Bouke van der Bijl cd9d90f4d4 Fixed bug #70470 2017-09-05 16:23:32 +02:00
Remi Collet 7378967206 UPGRADING 2017-09-05 08:20:04 +02:00
Remi Collet 81ad6a978a NEWS 2017-09-05 08:18:58 +02:00
Remi Collet e967de6bfa Fixed bug #75142 buildcheck.sh check for autoconf version needs to be updated for v2.64 2017-09-05 08:16:33 +02:00
Derick Rethans c0383b5039 Upgrade timelib to 2017.05beta9 2017-09-04 22:45:34 +01:00
Nikita Popov b2824629c2 Merge branch 'PHP-7.1' into PHP-7.2 2017-09-04 21:24:32 +02:00
Nikita Popov c2e3541cc1 Add test for bug #75155 2017-09-04 21:23:07 +02:00
Nikita Popov b689857d53 Revert "Fixed #74977 - Appending AppendIterator leads to segfault"
This reverts commit dbc2ffba82.
2017-09-04 21:20:49 +02:00
Dmitry Stogov 384da65a97 Fixed edge-case in SSA use/def chain construction and type inference. 2017-09-04 21:58:24 +03:00
Dmitry Stogov b5935c339e Fixed tests 2017-09-04 20:12:17 +03:00
Remi Collet 6355e650f7 NEWS 2017-09-04 18:37:45 +02:00
Remi Collet a1bf36778a Fixed Bug #75149 redefinition of typedefs ttinfo and t1info
Minimal fix from upstream
Better name for struct will come later
2017-09-04 18:35:42 +02:00
Dmitry Stogov ea734e2ac2 Fixed incorect constant conditional jump elimination 2017-09-04 19:11:17 +03:00
Dmitry Stogov 97b3cce755 Merge branch 'PHP-7.2' of git.php.net:php-src into PHP-7.2
* 'PHP-7.2' of git.php.net:php-src:
  improve warn (bzip2 requires libzip >= 1.3.0)
  libzip 1.3.0 supports also bz2 compression
2017-09-04 16:50:44 +03:00
Dmitry Stogov eb21300a26 Revert "Fixed incorrect optimizaton (update of jump instructions should be also reflected in CFG update)"
This reverts commit db5b8dbcdf.
2017-09-04 16:50:12 +03:00
Remi Collet 5bbd459609 improve warn (bzip2 requires libzip >= 1.3.0) 2017-09-04 14:47:03 +02:00
Anatol Belski b971087354 libzip 1.3.0 supports also bz2 compression 2017-09-04 13:27:53 +02:00
Dmitry Stogov db5b8dbcdf Fixed incorrect optimizaton (update of jump instructions should be also reflected in CFG update) 2017-09-04 14:07:37 +03:00
Dmitry Stogov ebb00c1e0f Fixed typo 2017-09-04 13:01:30 +03:00
Dmitry Stogov 4f1c2c22ca Prevent duplicate debug output 2017-09-04 12:58:40 +03:00
Anatol Belski ecc8f3cf16 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix command
2017-09-02 16:58:58 +02:00
Anatol Belski 296d0826da Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix command
2017-09-02 16:58:44 +02:00
Anatol Belski 24da62d342 Fix command 2017-09-02 16:56:52 +02:00
Christoph M. Becker b4dc3de5ab Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?)
2017-09-02 00:20:46 +02:00
Christoph M. Becker afad9006c7 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?)
2017-09-02 00:11:36 +02:00
Christoph M. Becker e20a6b0213 Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?)
We back-port https://github.com/libgd/libgd/commit/dd48286 even though
we cannot come up with a regression test, because the erroneous
condition appears to be impossible to trigger.

We also parenthesize the inner ternary operation to avoid confusion.
2017-09-02 00:04:02 +02:00
Anatol Belski a6456f0a6c Fixed bug #75143 new method setEncryptionName() seems not to exist in ZipArchive
update NEWS
2017-09-01 10:53:09 +02:00
Anatol Belski fb597a8123 Yet one DLL to ignore 2017-09-01 10:37:59 +02:00
Anatol Belski 8191b9790b Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Make for exclusion per regex
2017-08-31 23:57:58 +02:00
Anatol Belski db78eff4c9 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Make for exclusion per regex
2017-08-31 23:57:36 +02:00
Anatol Belski a86df6bcb0 Make for exclusion per regex 2017-08-31 23:56:42 +02:00
Anatol Belski 01171db15d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Extend ignore list for DLLs to not to look after
2017-08-31 20:55:53 +02:00
Anatol Belski 965570541b Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Extend ignore list for DLLs to not to look after
2017-08-31 20:55:12 +02:00
Anatol Belski 6ec494016b Extend ignore list for DLLs to not to look after
fix typo
2017-08-31 20:54:11 +02:00
Anatol Belski e7c1c86ceb Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix `nmake install` fails when there are no shared extensions
2017-08-31 20:34:03 +02:00
Anatol Belski 1f977d2377 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix `nmake install` fails when there are no shared extensions
2017-08-31 20:33:31 +02:00
Dylan K. Taylor 2e77f5eed3 Fix nmake install fails when there are no shared extensions
check for existence instead of muting everything

check for exe existence before trying to copy
2017-08-31 20:32:36 +02:00
Anatol Belski 7ebf2902e7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Copy dependencies of the core DLL in `nmake snap` for statically-compiled extensions when packaging builds
2017-08-31 19:48:43 +02:00
Anatol Belski 020d3decb3 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Copy dependencies of the core DLL in `nmake snap` for statically-compiled extensions when packaging builds
2017-08-31 19:48:11 +02:00
Dylan K. Taylor 4e9c3e9396 Copy dependencies of the core DLL in nmake snap for statically-compiled extensions when packaging builds 2017-08-31 19:46:47 +02:00
Remi Collet 1248e0f7f5 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  move AC_DEFINE in the right position (in bundled lib conditon)
2017-08-31 07:56:13 +02:00
Remi Collet bcf50b7261 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  move AC_DEFINE in the right position (in bundled lib conditon)
2017-08-31 07:56:00 +02:00
Remi Collet 3239f6d679 move AC_DEFINE in the right position (in bundled lib conditon) 2017-08-31 07:55:45 +02:00
Jakub Zelenka 1f843a8fb5 Automatically load OpenSSL configuration file 2017-08-30 17:31:17 +01:00
Jakub Zelenka 58df6a3b61 Do not explicitly initialize and clean up OpenSSL for OpenSSL 1.1 2017-08-30 17:29:24 +01:00
Anatol Belski 752fc86f2b Fix symbol name 2017-08-30 01:11:19 +02:00
Frank Denis 04c87ea815 ext/sodium: the second parameter of sodium_hex2bin() is optional 2017-08-29 19:25:01 +02:00
Frank Denis b1a7885dd7 ext/sodium: AI_StringRef_And_String -> AI_StringRefAndString for consistency 2017-08-29 19:23:22 +02:00
Frank Denis 6383c6e3d0 ext/sodium: sort functions list 2017-08-29 19:22:17 +02:00
Remi Collet 045d18d246 Update NEWS for 7.2.0RC2 2017-08-29 11:08:14 +00:00
Remi Collet 4f64716f37 Update NEWS for PHP 7.2.0RC1 2017-08-29 10:52:59 +00:00
Sammy Kaye Powers 56a999885a Fix constant references in error messages in ext/sodium 2017-08-28 22:16:35 -04:00
Anatol Belski c22cda5999 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Move to next bin SDK version for AppVeyor
2017-08-28 13:15:07 +02:00
Anatol Belski ae364546d6 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Move to next bin SDK version for AppVeyor
2017-08-28 13:14:08 +02:00
Anatol Belski 0966f9de41 Move to next bin SDK version for AppVeyor 2017-08-28 13:12:51 +02:00
Christoph M. Becker 1aeafb7d4a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75124 (gdImageGrayScale() may produce colors)
2017-08-27 14:07:55 +02:00
Christoph M. Becker a9ff4d1f5a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75124 (gdImageGrayScale() may produce colors)
2017-08-27 13:55:23 +02:00
Christoph M. Becker 499f5480f1 Fixed bug #75124 (gdImageGrayScale() may produce colors)
We have to make sure to avoid alpha-blending issues by explicitly
switching to `gdEffectReplace` and to restore the old value afterwards.

This is a port of <https://github.com/libgd/libgd/commit/a7a7ece>.
2017-08-27 13:53:39 +02:00
Remi Collet cc577749a8 Improve pkg-config usage
- use default path when run using --with-curl=/usr (for debian)
- fallback to headers search when libcurl.pc not found
- issue warnings for explanation
2017-08-27 07:48:52 +02:00
Christoph M. Becker 3a2ad5b2c5 Update to SQLite 3.20.1 2017-08-26 12:13:06 +02:00
David Carlier 24c0a17d78 Sync strlcat() implementation
Sync with last version made few days after.
2017-08-25 22:12:23 +02:00
Nikita Popov 3ef8964997 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-25 22:03:23 +02:00
Nikita Popov 52e854f0ab Merge branch 'PHP-7.0' into PHP-7.1 2017-08-25 22:03:00 +02:00
Thomas Punt be9edd83c2 Fixed bug #75090 2017-08-25 22:02:19 +02:00
Remi Collet df7f2a5df3 NEWS 2017-08-25 17:02:24 +02:00
Remi Collet b8c6ce91b2 Switch from curl-config to pkg-config for curl extension
First attemp to fix multiarch support (#74125) for curl
introduce some debian specificity (dpkg command)
so is not suitable for other environmant.

This is mostly related to a broken "curl-config" config on debian
which doesn't provide the correct build options, while pkg-config
works as expected.

This new attemp rely on pkg-config output instead.

Notice: this make pkg-config a hard dependency.
Is there system without pkg-config ?
2017-08-25 17:01:12 +02:00
Anatol Belski bd823a076c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  update libs versions
2017-08-25 11:29:12 +02:00
Anatol Belski 3641ba4332 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  update libs versions
2017-08-25 11:28:54 +02:00
Anatol Belski 55db2c31cd update libs versions 2017-08-25 11:28:12 +02:00
Anatol Belski a454e38b7c Enable PGO for Opcache 2017-08-24 23:36:21 +02:00
Anatol Belski 99ca99f079 Switch to non deprecated PGO options 2017-08-24 17:14:24 +02:00
Frank Denis 48907e57ff sodium ext: if it's a length, call it "length"! 2017-08-24 16:17:41 +02:00
Frank Denis 3691f36913 sodium ext: add bindings for sodium_pad() and sodium_unpad() 2017-08-24 16:12:18 +02:00
Christoph M. Becker 5cd348c1d6 Fixed bug #75111 (Memory disclosure or DoS via crafted .bmp image)
Crafted BMP images can cause dynamicSeek() to be called with a negative
position which must not be allowed, since dynamicSeek() works like
fseek() in SEEK_SET mode. We solve this by bailing out if `pos` is
negative, and let the image reading fail gracefully.
2017-08-24 14:07:10 +02:00
Frank Denis cf6f25bd37 sodium ext: restore sodium_remove_param_values_from_backtrace() call 2017-08-24 11:01:08 +02:00
Frank Denis a966d21aa8 sodium ext: sync sodium_crypto_kdf_derive_from_key() with the standalone ext
Use libsodium's native function if available, use correct constant names
in error messages
2017-08-24 10:59:02 +02:00
Frank Denis 271f0c4f90 sodium ext: Constants were renamed SODIUM_*
Adjust error messages accordingly.
2017-08-24 10:50:34 +02:00
Remi Collet 03361e9aa5 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  From documentation, only the sign of returned value is relevant
2017-08-24 10:30:06 +02:00
Remi Collet c449057808 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  From documentation, only the sign of returned value is relevant
2017-08-24 10:29:44 +02:00
Remi Collet b7e96f8e0e From documentation, only the sign of returned value is relevant
With recent glibc, memcmp sometime return a negative value instead of -1
2017-08-24 10:27:38 +02:00
Remi Collet f4792750a5 timelib now have a function for this, use it 2017-08-22 12:55:13 +02:00
Frank Denis 3fff74aab5 sodium ext: If sodium_init() returns 1, this is fine.
We actually want to do this so that multiple extensions using libsodium
can be loaded simultaneously.
2017-08-22 09:40:38 +02:00
Tianfang Yang 708349eeac Update NEWS 2017-08-22 01:51:15 -04:00
Tianfang Yang d128fdc2dc Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized before PHP-FPM sets it up)
2017-08-22 01:44:20 -04:00
Tianfang Yang 1b8a71e740 Update NEWS 2017-08-22 01:43:07 -04:00
Tianfang Yang 441487cd05 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized before PHP-FPM sets it up)
2017-08-22 01:39:55 -04:00
Tianfang Yang 4bf1a11c07 Merge branch 'pull-request/2534' into PHP-7.0
* pull-request/2534:
  Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized before PHP-FPM sets it up)
2017-08-22 01:10:58 -04:00
Ingmar Runge 079bc324cd Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized before PHP-FPM sets it up) 2017-08-22 01:09:35 -04:00
Anatol Belski 5b4b19981c Correct default value 2017-08-21 19:37:41 +02:00
Xinchen Hui ccab684d9f Attempt to fix unstable test 2017-08-21 18:51:03 +08:00
Xinchen Hui ee26c1efbc Fixed type-infer 2017-08-21 16:35:07 +08:00
Andrea Faulds 799b52e87f Retroactively correct NEWS omission 2017-08-19 21:09:18 +01:00
Andrea Faulds ccb09d2c12 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-19 20:38:02 +01:00
Andrea Faulds 158b06cffb Merge branch 'PHP-7.0' into PHP-7.1 2017-08-19 20:35:22 +01:00
Andrea Faulds 61538ebadc Fixed bug #75097 (gethostname fails if your host name is 64 chars long)
PHP contained two different off-by-one errors, which are fixed here. First,
it created a buffer of size HOST_NAME_MAX, not adding space for a null
terminator. Second, it subtracted 1 from the size of that buffer when passing
its size to gethostname(), despite gethostname() expecting it to be a buffer
size including space for a terminating null byte, not a string length.
2017-08-19 20:31:54 +01:00
Sammy Kaye Powers e8f552aeba Remove param values from backtrace in exception thrown from ZPP throw 2017-08-19 15:18:41 +02:00
Sammy Kaye Powers 0591fe2494 Change zend_parse_parameters() to zend_parse_parameters_throw() in ext/sodium 2017-08-19 15:16:45 +02:00
Xinchen Hui 2e002eaf70 Fixed for RESOURCE too 2017-08-19 18:55:56 +08:00
Xinchen Hui 4b6345a3ae Fixed RC1 Hanlding 2017-08-19 18:51:17 +08:00
Xinchen Hui ea0df07398 Fixed type-info for ZEND_FETCH_DIIM_UNSET 2017-08-19 18:48:10 +08:00
Anatol Belski 9b327ff15f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] update NEWS
  [ci skip] update NEWS
2017-08-19 02:41:24 +02:00
Anatol Belski 11d3a7869c Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  [ci skip] update NEWS
2017-08-19 02:41:07 +02:00
Anatol Belski 95ef8e96d2 [ci skip] update NEWS 2017-08-19 02:40:50 +02:00
Anatol Belski 3cad07b84f [ci skip] update NEWS 2017-08-19 02:40:17 +02:00
Anatol Belski 00b97d34c1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix issues with phpt and EXTENSION on windows (BUG 75042)
2017-08-19 02:01:23 +02:00
Anatol Belski 97ed208cfd Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix issues with phpt and EXTENSION on windows (BUG 75042)
2017-08-19 02:01:03 +02:00
John Boehr 71b12940d0 Fix issues with phpt and EXTENSION on windows (BUG 75042)
* Commands are not properly escaped for windows
* Specifying "-n" to check loaded modules causes "Module already loaded"
warning
* Extensions to be loaded need the "php_" prefix on Windows

Bug: https://bugs.php.net/bug.php?id=75042

Add back -n flag to fetch loaded extensions in run-tests.php

Add test for phpt EXTENSIONS directive

Add a second test for bug 75042

Add test to test loading of nonexistent shared module

with the EXTENSIONS phpt block

Pass ini settings when checking loaded extensions

Fix skipifs
2017-08-19 01:59:48 +02:00
Anatol Belski f2ed8c1087 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix .pgd name for ts build
2017-08-19 00:32:11 +02:00
Anatol Belski 5ef63b6f0e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix .pgd name for ts build
2017-08-19 00:31:55 +02:00
Anatol Belski ba59b6f11b Fix .pgd name for ts build 2017-08-19 00:31:04 +02:00
Anatol Belski 07e8cb4205 [ci skip] update NEWS 2017-08-18 19:40:43 +02:00
Anatol Belski f1c664d379 Fix skipifs 2017-08-18 17:38:16 +02:00
John Boehr 59558ffd96 Fix issues with phpt and EXTENSION on windows (BUG 75042)
* Commands are not properly escaped for windows
* Specifying "-n" to check loaded modules causes "Module already loaded"
warning
* Extensions to be loaded need the "php_" prefix on Windows

Bug: https://bugs.php.net/bug.php?id=75042

Add back -n flag to fetch loaded extensions in run-tests.php

Add test for phpt EXTENSIONS directive

Add a second test for bug 75042

Add test to test loading of nonexistent shared module

with the EXTENSIONS phpt block

Pass ini settings when checking loaded extensions
2017-08-18 17:34:48 +02:00
Remi Collet debbaba93f NEWS 2017-08-18 14:52:58 +02:00
Remi Collet ef96411f60 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  NEWS
  NEWS
  Fixed bug #75093 OpenSSL support not detected
2017-08-18 14:52:43 +02:00
Remi Collet de0b816b49 NEWS 2017-08-18 14:52:30 +02:00
Remi Collet acf09c416b Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  NEWS
  Fixed bug #75093 OpenSSL support not detected
2017-08-18 14:52:22 +02:00
Remi Collet b28912b0f7 NEWS 2017-08-18 14:52:11 +02:00
Remi Collet a7594cb74f Fixed bug #75093 OpenSSL support not detected 2017-08-18 14:51:44 +02:00
Dmitry Stogov ef90e37bd1 Fixed bug #75089 (preg_grep() is not reporting PREG_BAD_UTF8_ERROR after first input string) 2017-08-18 14:56:28 +03:00
Anatol Belski 6c3c88074c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix phpize exit status
2017-08-18 12:06:19 +02:00
Anatol Belski 4494ad6911 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix phpize exit status
2017-08-18 12:06:07 +02:00
Anatol Belski 065551bc9c Fix phpize exit status
Configure and others are generated, not copied. Seems there's yet much
more to do wrt exit status catching.
2017-08-18 11:54:56 +02:00
Anatol Belski 642983c59a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Add dump env target
2017-08-18 11:10:18 +02:00
Anatol Belski 264271f69e Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Add dump env target
2017-08-18 11:09:59 +02:00
Anatol Belski e7f4e67155 Add dump env target 2017-08-18 11:08:27 +02:00
Anatol Belski 90a2e7c014 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  bump versions
2017-08-18 11:07:04 +02:00
Dmitry Stogov 3866c1699e More accurate reference counting inference 2017-08-17 20:03:12 +03:00
Xinchen Hui 30fb70dd25 Fixed type-infer on ZEND_FETCH_DIM_FUNC_ARG 2017-08-17 21:57:28 +08:00
Joe Watkins d53d793673 Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:/php-src:
  Do the revert properly, and put back fraction support in 7.1
2017-08-16 16:41:48 +01:00
Joe Watkins 5b02d10584 bump versions 2017-08-16 16:41:15 +01:00
Derick Rethans 4e03ebc04a Merge branch 'PHP-7.1' into PHP-7.2 2017-08-16 16:00:20 +01:00
Derick Rethans 7121b8d0a2 Do the revert properly, and put back fraction support in 7.1 2017-08-16 15:59:56 +01:00
Derick Rethans 43c78b2422 Fixed 32-bit tests as well. 2017-08-16 15:28:50 +01:00
Derick Rethans 6f2bc07182 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-16 15:21:02 +01:00
Derick Rethans 547f9fd389 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-16 15:20:45 +01:00
Derick Rethans 60a6feed07 Revert "Upgrade timelib to 2017.05beta7"
This reverts commit bdd56f3107.
2017-08-16 15:19:18 +01:00
Derick Rethans 8af70958fc Revert "Remove removed header files from configuration files."
This reverts commit 3df753c6ca.
2017-08-16 15:19:11 +01:00
Derick Rethans 21493e0824 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-16 11:14:53 +01:00
Derick Rethans 9a72a7c58f Merge branch 'PHP-7.0' into PHP-7.1 2017-08-16 11:14:47 +01:00
Derick Rethans 5d2c303438 Fixed stupid test 2017-08-16 11:14:41 +01:00
Derick Rethans e92a4891aa Merge branch 'PHP-7.1' into PHP-7.2 2017-08-16 09:51:36 +01:00
Derick Rethans 4dc8f4f9d1 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-16 09:51:28 +01:00
Derick Rethans 7829f9b1d2 Added timelib version to phpinfo() 2017-08-16 09:51:21 +01:00
Dmitry Stogov db2807e4d2 Added few more jump threading optimisation patterns 2017-08-16 09:17:32 +03:00
Remi Collet 05e75d6aaa Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  cleanup
2017-08-16 07:46:42 +02:00
Remi Collet 44209573e3 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  cleanup
2017-08-16 07:46:23 +02:00
Remi Collet 01735f4d9f cleanup 2017-08-16 07:46:07 +02:00
Derick Rethans decf4c6880 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-15 20:24:44 +01:00
Derick Rethans 336cfd9980 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-15 20:24:21 +01:00
Derick Rethans 3df753c6ca Remove removed header files from configuration files. 2017-08-15 20:22:41 +01:00
Derick Rethans a063d55395 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-15 15:07:24 +01:00
Derick Rethans 584db6f38f Merged PHP-7.0 by hand due to conflicts. 2017-08-15 15:06:18 +01:00
Derick Rethans bdd56f3107 Upgrade timelib to 2017.05beta7 2017-08-15 14:10:23 +01:00
Dmitry Stogov b096eacdd1 Fixed possible incorrect result of type verification. 2017-08-15 14:46:18 +03:00
Dmitry Stogov 389ea45b12 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Made test 32/64-bit independent
2017-08-15 13:13:27 +03:00
Dmitry Stogov 3bc1226804 Made test 32/64-bit independent 2017-08-15 13:12:54 +03:00
Dmitry Stogov 1cbe4e009c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Skip 64-bit related test
2017-08-15 13:01:06 +03:00
Dmitry Stogov 0f3e01f5cc Skip 64-bit related test 2017-08-15 13:00:45 +03:00
Remi Collet 3e66ae67a8 Update NEWS for 7.2.0RC1 2017-08-15 08:54:17 +00:00
Remi Collet 6c1c49d1b5 Update NEWS for PHP 7.2.0beta3 2017-08-15 08:39:24 +00:00
Anatol Belski 6e3356837d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  move dev to 7.0.24
2017-08-15 09:36:41 +02:00
Anatol Belski 49501f8f41 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  move dev to 7.0.24
2017-08-15 09:36:14 +02:00
Anatol Belski 3af6201224 move dev to 7.0.24 2017-08-15 09:33:30 +02:00
Xinchen Hui 6b77792dc2 Update NEWS 2017-08-15 12:35:17 +08:00
Xinchen Hui 05de40a651 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75075 (unpack with X* causes infinity loop)
2017-08-15 12:35:10 +08:00
Xinchen Hui 6275825c68 Update NEWS 2017-08-15 12:34:58 +08:00
Xinchen Hui 4f8e703854 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75075 (unpack with X* causes infinity loop)
2017-08-15 12:34:37 +08:00
Xinchen Hui d8c80af71e Fixed bug #75075 (unpack with X* causes infinity loop) 2017-08-15 12:34:13 +08:00
Tianfang Yang 9ec0a2071c Merge branch 'PHP-7.1' into PHP-7.2 2017-08-14 21:22:17 -04:00
Tianfang Yang e112d71435 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-14 21:21:11 -04:00
Tianfang Yang 2def85688d Merge branch 'syncoci8' into PHP-7.0 2017-08-14 21:16:34 -04:00
Tianfang Yang 259477826c Prepare for PECL release 2017-08-14 21:14:14 -04:00
Anatol Belski 5dc847c53d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Test cleanup improvements, files might be locked in the test process
2017-08-14 14:40:26 +02:00
Anatol Belski 1f3b87dc11 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Test cleanup improvements, files might be locked in the test process
2017-08-14 14:39:58 +02:00
Anatol Belski ab07265573 Test cleanup improvements, files might be locked in the test process 2017-08-14 13:08:04 +02:00
Anatol Belski 707b2a529e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  fix test cleanup
2017-08-14 12:56:49 +02:00
Anatol Belski bd0b0cc8c9 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix test cleanup
2017-08-14 12:55:58 +02:00
Anatol Belski 71fd58652f fix test cleanup 2017-08-14 12:55:14 +02:00
Dmitry Stogov df5104bfc9 Fixed removing dead live ranges 2017-08-14 13:54:52 +03:00
Anatol Belski 112afb9250 [ci skip] update NEWS 2017-08-14 12:24:51 +02:00
Anatol Belski 2492add033 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] update NEWS
2017-08-14 12:24:20 +02:00
Anatol Belski 73d84d4bbd [ci skip] update NEWS 2017-08-14 12:23:51 +02:00
Dmitry Stogov 18f567a3b4 Fixed test 2017-08-14 12:37:37 +03:00
Dmitry Stogov a80e462fbd Order live ranges according to "start" position 2017-08-14 12:21:07 +03:00
Dmitry Stogov cd6893aed1 Fixed attempt to free invalid structure (result of ROPE_INIT is not a zval) 2017-08-14 12:11:25 +03:00
Dmitry Stogov d6406bbf5f Merge branch 'PHP-7.2' of git.php.net:php-src into PHP-7.2
* 'PHP-7.2' of git.php.net:php-src:
  Revert "Fixed live_range removing (bug can be triggred by JIT)"
2017-08-14 12:00:30 +03:00
Dmitry Stogov 2fab62271a Revert "Fixed live_range removing (bug can be triggred by JIT)"
This reverts commit aecf996510.
2017-08-14 12:00:02 +03:00
Xinchen Hui 6445b3a68f Revert "Fixed live_range removing (bug can be triggred by JIT)"
This reverts commit aecf996510.
2017-08-14 16:59:01 +08:00
Tianfang Yang 1135161b4f Merge branch 'PHP-7.1' into PHP-7.2 2017-08-14 00:36:33 -04:00
Tianfang Yang 4d936c1254 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-14 00:23:41 -04:00
Tianfang Yang f555224743 Sync OCI8 on PHP 7.x branches 2017-08-13 23:44:24 -04:00
Anatol Belski 0a2a136111 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75063
2017-08-14 00:51:47 +02:00
Anatol Belski 3069ad8dd1 Fixed bug #75063 2017-08-14 00:44:19 +02:00
Christoph M. Becker 36eddfc785 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #73793 (WDDX uses wrong decimal seperator)
2017-08-13 21:05:57 +02:00
Christoph M. Becker 207105b1a3 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73793 (WDDX uses wrong decimal seperator)
2017-08-13 21:03:45 +02:00
Christoph M. Becker f64be0b013 Fixed bug #73793 (WDDX uses wrong decimal seperator)
The WDDX specification[1] requires to serialize floats with a decimal
point, but `snprintf()` is locale-dependent and may use a decimal
comma. We fix that afterwards by replacing an eventual comma with a
point.

[1] <http://xml.coverpages.org/wddx0090-dtd-19980928.txt>
2017-08-13 20:51:53 +02:00
Christoph M. Becker bbf39c550f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Skip this test if ext/session is not available
2017-08-13 18:10:37 +02:00
Christoph M. Becker de5a5f6fdc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Skip this test if ext/session is not available
2017-08-13 18:07:42 +02:00
Christoph M. Becker 472b25921e Skip this test if ext/session is not available 2017-08-13 18:05:45 +02:00
Nikita Popov b202587e09 Note deprecation of $errcontext 2017-08-12 20:34:44 +02:00
Nikita Popov a871badf2a Merge branch 'PHP-7.1' into PHP-7.2 2017-08-12 13:17:24 +02:00
Nikita Popov 4fb7665c09 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-12 13:15:48 +02:00
Nikita Popov 1a23ebc1ff Fixed bug #74103 and bug #75054
Directly fail unserialization when trying to acquire an r/R
reference to an UNDEF HT slot. Previously this left an UNDEF and
later deleted the index/key from the HT.

What actually caused the issue here is a combination of two
factors: First, the key deletion was performed using the hash API,
rather than the symtable API, such that the element was not actually
removed if it used an integral string key. Second, a subsequent
deletion operation, while collecting trailing UNDEF ranges, would
mark the element as available for reuse (leaving a corrupted HT
state with nNumOfElemnts > nNumUsed).

Fix this by failing early and dropping the deletion code.
2017-08-12 13:11:35 +02:00
Andrea Faulds f877b86604 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-12 01:38:46 +01:00
Andrea Faulds e88ab74886 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-12 01:37:47 +01:00
Andrea Faulds b59718bdc4 Fix bug #74725 (html_errors=1 breaks unhandled exceptions) 2017-08-12 01:37:20 +01:00
Xinchen Hui aecf996510 Fixed live_range removing (bug can be triggred by JIT) 2017-08-11 21:56:30 +08:00
Jakub Zelenka e53dd027c5 Reset utf8_invalid in json scanner 2017-08-10 19:47:58 +01:00
Jakub Zelenka f5b4cb7130 Fix possible overflow in json scanner utf8_invalid_count 2017-08-10 19:40:02 +01:00
Xinchen Hui 4375a6c5cd Fixed type infer for FUNC_GET_ARGS 2017-08-11 00:33:55 +08:00
Xinchen Hui f7cf839213 Update NEWs 2017-08-09 11:29:54 +08:00
Xinchen Hui e7dd9c781b Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75049 (spl_autoload_unregister can't handle spl_autoload_functions results)
2017-08-09 11:29:46 +08:00
Xinchen Hui 46ecda76ba Update NEWS 2017-08-09 11:29:32 +08:00
Xinchen Hui 307acb6618 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75049 (spl_autoload_unregister can't handle spl_autoload_functions results)
2017-08-09 11:29:13 +08:00
Xinchen Hui b06f8cb58b Fixed bug #75049 (spl_autoload_unregister can't handle spl_autoload_functions results) 2017-08-09 11:28:53 +08:00
Anatol Belski 823ca5c697 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Remove mistakingly added line
2017-08-08 19:40:42 +02:00
Anatol Belski 42608a3401 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Remove mistakingly added line
2017-08-08 19:40:28 +02:00
Anatol Belski afb20f4895 Remove mistakingly added line 2017-08-08 19:37:55 +02:00
Anatol Belski e62db6309c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Sync makefile options for phpize
2017-08-08 17:59:44 +02:00
Anatol Belski 315d3910fa Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Sync makefile options for phpize
2017-08-08 17:59:15 +02:00
Anatol Belski 075986f214 Sync makefile options for phpize
- run target
- debugger mode
2017-08-08 17:58:10 +02:00
Frank Denis ef0bd7b215 sodium ext: Use _ietf_ vs _IETF_ consistently 2017-08-08 17:50:17 +02:00
Frank Denis 03314e3f69 sodium ext: No need for #ifdef crypto_aead_chacha20poly1305_IETF_
chacha20poly1305_ietf was implemented in libsodium 1.0.4 which is way earlier
than the minimum version we support.
2017-08-08 17:42:38 +02:00
Frank Denis 596a892c5e Sodium ext: Isolate a return statement for consistency 2017-08-08 17:38:13 +02:00
Frank Denis a0d1e0915c sodium ext: The default password hashing function is not supposed to be Argon2i 2017-08-08 17:37:06 +02:00
Frank Denis 631fc3c9c1 sodium ext: long -> zend_long 2017-08-08 17:36:06 +02:00
Frank Denis 3140d40421 sodium ext: Add missing "return" statements after zend_throw_exception() 2017-08-08 17:34:20 +02:00
Darek Slusarczyk abd97b8bcb Merge branch 'PHP-7.1' into PHP-7.2
# Conflicts:
#	ext/json/config.w32
2017-08-08 16:08:19 +02:00
Darek Slusarczyk 86aa1ca990 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-08 16:05:13 +02:00
Darek Slusarczyk 618dcd6520 JSON: fix config.w32 / Install headers on windows 2017-08-08 15:52:53 +02:00
Andrey Hristov f589e5c791 Add new enum options defined in MySQL 5.7 2017-08-08 14:57:01 +03:00
Anatol Belski dcd669b4d9 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Unify EOL
2017-08-07 17:04:15 +02:00
Anatol Belski 9ebf813ea4 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Unify EOL
2017-08-07 17:03:54 +02:00
Anatol Belski 4c9fe5a490 Unify EOL 2017-08-07 17:03:17 +02:00
Anatol Belski d36344e888 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  fix test target for phpize
2017-08-07 16:45:57 +02:00
Anatol Belski da966a93ac Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix test target for phpize
2017-08-07 16:45:41 +02:00
Anatol Belski d058e30917 fix test target for phpize 2017-08-07 16:45:02 +02:00
Jakub Zelenka 41d7621f48 Fix segfault in json ignoring of invalid UTF8 2017-08-06 17:20:31 +01:00
Nikita Popov 6b73b2d6eb Check for empty string in mb_ord() 2017-08-04 22:20:05 +02:00
Côme Chilliet aa0e402acf Added controls parameters to ldap_exop so that control support can be added later 2017-08-04 18:10:49 +02:00
Remi Collet 17bb8d575a win32 for pdo_sqlite 2017-08-04 13:28:48 +02:00
Remi Collet bf1c242cf4 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  use AC_DEFINE + win32
2017-08-04 13:21:54 +02:00
Remi Collet aee20e637a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  use AC_DEFINE + win32
2017-08-04 13:21:41 +02:00
Remi Collet 159e5c1048 use AC_DEFINE + win32 2017-08-04 13:21:28 +02:00
Nikita Popov 353f7bf461 Also check for invalid codepoints in mb_ord()
And return false in that case, instead of returning 0x3f...
2017-08-04 13:01:03 +02:00
Nikita Popov e53162a32b Return false on invalid codepoint in mb_chr()
Instead of returning the encoding of the current substitution
character. This allows a robust check for the failure case. The
substitution character (especially the default of "?") is also
a valid output of mb_chr() for a valid input (for "?" that would be
0x3f), so it's a bad choice for an error value.
2017-08-03 22:36:42 +02:00
Nikita Popov 41e9ba6333 Always use Unicode codepoints in mb_ord() and mb_chr()
Previously mb_chr() had two different encoding-dependent behaviors:
 * For "Unicode-encodings" it took a Unicode codepoint and returned
   its encoded representation.
 * Otherwise it returned a big-endian binary encoding of the passed
   integer.

Now the input is always interpreted as a Unicode codepoint. If
a big-endian binary encoding is what you want, you don't need
mbstring to implement that.
2017-08-03 22:14:00 +02:00
Nikita Popov fb9bf5b64b Revert/fix substitution character fallback
The introduced checks were not correct in two respects:
 * It was checked whether the source encoding of the string matches
   the internal encoding, while the actually relevant encoding is
   the *target* encoding.
 * Even if the correct encoding is used, the checks are still too
   conservative. Just because something is not a "Unicode-encoding"
   does not mean that it does not map any non-ASCII characters.

I've reverted the added checks and instead adjusted mbfl_convert
to first try to use the provided substitution character and if
that fails, perform the fallback to '?' at that point. This means
that any codepoint mapped in the target encoding should now be
correctly supported and anything else should fall back to '?'.
2017-08-03 21:53:59 +02:00
Nikita Popov a8a9e93e9a Revert/fix mb_substitute_character() codepoint checks
The introduced checks did not treat "non-Unicode" encodings correctly,
because they treated the passed integer as encoded in the internal
encoding in that case, while in actuality the substitute character
is always a Unicode codepoint.

Additionally checking the codepoint against the internal encoding
is not correct in any case, because the substitution character must
be mapped in the *target* encoding of the conversion, which does
not necessarily coincide with the internal encoding (the internal
encoding is the default *source* encoding, not *target* encoding).

This reverts the checks back to simple range checks, but in a way
that still resolves #69079: Characters outside the Basic
Multilingual Plane are now accepted and Surrogate Codepoints are
rejected. A distinction between UTF-8 and non-UTF-8 encodings is
not made for surrogate checks (as in the original patch), as
surrogates are always illegal on their own. Specifying a surrogate
as substitution character would only make sense if you could
specify a substitution string with more than one character --
however we do not support that.
2017-08-03 21:12:41 +02:00
Anatol Belski 355743600d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Increase expected timing on Travis
2017-08-03 15:08:05 +02:00
Anatol Belski 21c6ba3412 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Increase expected timing on Travis
2017-08-03 15:07:47 +02:00
Anatol Belski 9689796c10 Increase expected timing on Travis
If 5ms to read/write 8 bytes still has issue, probably next this test
should skip on Travis to avoid false positive fails.
2017-08-03 15:05:22 +02:00
Anatol Belski 93c2c56a1b Rework automatic interactive cli activation
There are still systems delivering buggy console info. If a file was
passed, obviously no interaction is meant.
2017-08-03 11:23:50 +02:00
Anatol Belski 39f0e810c9 [ci skip] update NEWS 2017-08-02 21:51:35 +02:00
Anatol Belski fbc8596b68 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] update NEWS
  update NEWS
2017-08-02 21:51:01 +02:00
Anatol Belski 54e2224df7 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  update NEWS
2017-08-02 21:50:26 +02:00
Anatol Belski 3e5b8c1e89 [ci skip] update NEWS 2017-08-02 21:49:56 +02:00
Anatol Belski 9ba2cfd33e update NEWS 2017-08-02 21:49:21 +02:00
Andreas Treichel 29e4d4eee6 Add ftp_append to create a new file or append data to an existing file (RFC959) 2017-08-02 20:52:28 +02:00
Nikita Popov aa925cb0ad Merge branch 'PHP-7.1' into PHP-7.2 2017-08-02 18:50:18 +02:00
Nikita Popov 4988e83fe9 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-02 18:50:04 +02:00
Andreas Treichel c2b8066efb Bug #74975: Different serialization for classes 2017-08-02 18:49:26 +02:00
Nikita Popov 042ff13ca9 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-02 18:18:23 +02:00
Nikita Popov 9871555090 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-02 18:16:56 +02:00
Nikita Popov 9ca1b2a775 Merge remote-tracking branch 'php-src/PHP-7.0' into PHP-7.0 2017-08-02 18:16:18 +02:00
Nikita Popov 91240073ea Merge branch 'PHP-7.1' into PHP-7.2 2017-08-02 18:11:12 +02:00
Nikita Popov 63607375f5 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-02 18:09:09 +02:00
Fabien Villepinte 2cc1cbf2f4 Fix Bug #75001: Wrong reflection on mb_eregi_replace 2017-08-02 18:08:42 +02:00
Fabien Villepinte 15abb2b56e Fix test transliterator_create_inverse_basic.phpt 2017-08-02 18:04:43 +02:00
George Wang e78712791d take care of compile warnings. 2017-08-02 11:59:41 -04:00
Tyson Andre 5097e2ee13 Implement spl_object_id(object $x) : int
spl_object_id is a new function returning the object handle,
as a signed integer.

Discussion for this new function is ongoing on php-internals, see
https://marc.info/?t=143835274500003&r=1&w=2

The object id is unique for the lifetime of the object.
When the object is garbage collected,
different objects may & will have the same object id.

- This is also the case for the string generated by spl_object_hash

It is always possible to cast the object handle to a **signed** zend_long
in php 7.2. _zend_object->handle is always of the type `uint32_t`.
(zend_long is 32 bits on 32 bit builds, 64 bits on 64 bit builds)

As of php 7.0, the object id uniquely identifies the object,
there can't be two objects with the same id but different handlers
(See the implementation of spl_object_hash)

Skip the pointless XORing, as discussed in internals.

- It was intended to avoid exposing in-memory addresses.
- The object handle is not a memory address.
- The output of var_dump() includes the object handle(id)
2017-08-02 17:54:07 +02:00
Anatol Belski b4bce59fe9 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75002 Null Pointer Dereference in timelib_time_clone
2017-08-02 16:42:20 +02:00
Anatol Belski 1fdc518971 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75002 Null Pointer Dereference in timelib_time_clone
2017-08-02 16:41:48 +02:00
Derick Rethans b112d09013 Fixed bug #75002 Null Pointer Dereference in timelib_time_clone 2017-08-02 16:40:48 +02:00
Remi Collet afdf7519d1 fix build with old system libsqlite (sqlite3_close_v2 may be missing) 2017-08-02 16:09:36 +02:00
Remi Collet 5e5895a464 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  fix build with old system libsqlite (sqlite3_errstr may be missing)
2017-08-02 14:03:23 +02:00
Remi Collet 5f030924c1 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix build with old system libsqlite (sqlite3_errstr may be missing)
2017-08-02 14:03:02 +02:00
Remi Collet 666cb6c802 fix build with old system libsqlite (sqlite3_errstr may be missing) 2017-08-02 14:01:56 +02:00
Joe Watkins 6202c821a9 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  fixed #endif comments
2017-08-02 08:35:51 +01:00
Joe Watkins 9c6262f39b Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fixed #endif comments
2017-08-02 08:35:38 +01:00
clwu b2934d2612 fixed #endif comments 2017-08-02 08:35:27 +01:00
Christoph M. Becker 43e7656241 Update NEWS 2017-08-02 00:11:11 +02:00
Sara Golemon 6278f6140f Update NEWS for 7.2.0beta3 2017-08-01 12:50:56 -04:00
Sara Golemon 1b05a2373b Update NEWS for PHP 7.2.0beta2 2017-08-01 12:50:55 -04:00
Christoph M. Becker fe107cce45 Update to SQLite 3.20.0 2017-08-01 18:26:14 +02:00
428 changed files with 156537 additions and 138645 deletions

No files matched your search

+1 -2
View File
@@ -18,13 +18,12 @@ clone_depth: 64
cache:
- c:\build-cache
- c:\build-cache\sdk -> .appveyor.yml
environment:
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.9
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.12
PHP_BUILD_CRT: vc15
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
+25 -6
View File
@@ -1,16 +1,35 @@
; http://editorconfig.org/
# http://editorconfig.org/
root = true
[*.{c,h}]
charset = UTF-8
end_of_line = LF
[*.{c,h,awk,w32,bat,mk,frag}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
[*.{php,phpt}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
[*.{yml,m4,sh}]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
charset = utf-8
end_of_line = lf
indent_style = space
trim_trailing_whitespace = false
insert_final_newline = true
-4
View File
@@ -15,11 +15,8 @@ ext/dba/libflatfile/flatfile.c ident
ext/dba/libcdb/cdb_make.c ident
ext/dba/libcdb/cdb.c ident
ext/filter/filter.c ident
ext/zip/php_zip.c ident
README.input_filter ident
run-tests.php ident
sapi/nsapi/nsapi.c ident
sapi/continuity/capi.c ident
Zend/RFCs/002.txt ident
Zend/RFCs/003.txt ident
ext/exif/exif.c ident
@@ -32,7 +29,6 @@ UPGRADING.INTERNALS merge=NEWS
/ext/bz2/tests/with_strings.phpt -crlf
/ext/dom/tests/bug40836.phpt -crlf
/ext/dom/tests/domelement.phpt -crlf
/ext/ereg/tests/eregi_basic_002.phpt -crlf
/ext/iconv/tests/iconv004.phpt -crlf
/ext/iconv/tests/iconv_basic.phpt -crlf
/ext/iconv/tests/iconv_strpos.phpt -crlf
-2
View File
@@ -179,9 +179,7 @@ pear/phpize
pear/run-tests
pear/php-config
pear/scripts
sapi/apache/libphp7.module
sapi/apache2handler/libphp7.module
sapi/apache_hooks/libphp7.module
sapi/cgi/php-cgi
sapi/cgi/php-cgi.1
sapi/cli/php.1
+1
View File
@@ -1,3 +1,4 @@
dist: trusty
language: c
sudo: false
addons:
+17 -17
View File
@@ -37,7 +37,7 @@ MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: cli
MAINTENANCE: Marcus Boerger <helly@php.net>, Edin Kadribasic <edink@php.net>
MAINTENANCE: Marcus Börger <helly@php.net>, Edin Kadribasic <edink@php.net>
STATUS: Working
SINCE: 4.3.0
-------------------------------------------------------------------------------
@@ -68,7 +68,7 @@ STATUS: 5.6
-------------------------------------------------------------------------------
EXTENSION: dba
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>,Christopher Jones <sixd@php.net>, Pierre-Alain Joye <pajoye@php.net>
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>,Christopher Jones <sixd@php.net>, Pierre-Alain Joye <pajoye@php.net>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: DBM abstraction for db2, db3, db4, dbm, ndbm, gdbm, ini
@@ -79,13 +79,13 @@ MAINTENANCE: Odd fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mysqli
PRIMARY MAINTAINER: Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
PRIMARY MAINTAINER: Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0
-------------------------------------------------------------------------------
EXTENSION: mysqlnd
PRIMARY MAINTAINER: Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
PRIMARY MAINTAINER: Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
@@ -99,7 +99,7 @@ EXTENSION: odbc
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Working
COMMENT: Working
-------------------------------------------------------------------------------
EXTENSION: pdo
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>, Wez Furlong <wez@php.net>
@@ -120,7 +120,7 @@ STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_mysql
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>, Johannes Schlüter <johannes@php.net>, Andrey Hristov <andrey@php.net>, Ulf Wendel <uw@php.net>
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>, Johannes Schlüter <johannes@php.net>, Andrey Hristov <andrey@php.net>, Ulf Wendel <uw@php.net>
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
@@ -150,7 +150,7 @@ STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pgsql
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Yasuo Ohgaki <yohgaki@php.net>
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Yasuo Ohgaki <yohgaki@php.net>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug.
@@ -168,13 +168,13 @@ COMMENT: Integrates SQLite 3 embeddable SQL database engine.
-------------------------------------------------------------------------------
EXTENSION: dom
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Boerger <helly@php.net>
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Börger <helly@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0
-------------------------------------------------------------------------------
EXTENSION: simplexml
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0
@@ -195,12 +195,12 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: libxml
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: xmlreader
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -335,7 +335,7 @@ STATUS: Working
SINCE: 5.2
-------------------------------------------------------------------------------
EXTENSION: ldap
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>, Douglas Goldstein <cardoe@php.net>, Pierre-Alain Joye <pajoye@php.net>, Côme Bernigaud <mcmic@php.net>
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>, Douglas Goldstein <cardoe@php.net>, Pierre-Alain Joye <pajoye@php.net>, Côme Bernigaud <mcmic@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -367,13 +367,13 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: phar
PRIMARY MAINTAINER: Greg Beaver <cellog@php.net>, Marcus Börger <helly@php.net>, Steph Fox <sfox@php.net>
PRIMARY MAINTAINER: Greg Beaver <cellog@php.net>, Marcus Börger <helly@php.net>, Steph Fox <sfox@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: posix
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -388,12 +388,12 @@ MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: recode
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: reflection
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Johannes Schlüter <johannes@php.net>
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Johannes Schlüter <johannes@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -426,7 +426,7 @@ STATUS: Working
SINCE: 7.2.0
-------------------------------------------------------------------------------
EXTENSION: spl
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Etienne Kneuss <colder@php.net>
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Etienne Kneuss <colder@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0.0
+4 -4
View File
@@ -5,7 +5,7 @@ INSTALL_DATA = $(INSTALL) -m 644
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
all: $(all_targets)
all: $(all_targets)
@echo
@echo "Build complete."
@echo "Don't forget to run 'make test'."
@@ -112,13 +112,13 @@ test: all
clean:
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
rm -f php7.spec main/build-defs.h scripts/phpize
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
@@ -135,7 +135,7 @@ prof-gen:
prof-clean:
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
+280 -1
View File
@@ -1,12 +1,287 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2017, PHP 7.2.0beta2
09 Nov 2017, PHP 7.2.0RC6
- Core:
. Fixed bug #75420 (Crash when modifing property name in __isset for
BP_VAR_IS). (Laruence)
- GD:
. Fixed bug #75437 (Wrong reflection on imagewebp). (Fabien Villepinte)
- interbase:
. Fixed bug #75453 (Incorrect reflection for ibase_[p]connect). (villfa)
- Mysqli:
. Fixed bug #75434 (Wrong reflection for mysqli_fetch_all function). (Fabien
Villepinte)
- SOAP:
. Fixed bug #75464 (Wrong reflection on SoapClient::__setSoapHeaders). (villfa)
26 Oct 2017, PHP 7.2.0RC5
- Core:
. Fixed bug #75368 (mmap/munmap trashing on unlucky allocations). (Nikita,
Dmitry)
- CLI:
. Fixed bug #75287 (Builtin webserver crash after chdir in a shutdown
function). (Laruence)
- Date:
. Fixed bug #75055 (Out-Of-Bounds Read in timelib_meridian()). (Derick)
- Enchant:
. Fixed bug #53070 (enchant_broker_get_path crashes if no path is set). (jelle
van der Waa, cmb)
. Fixed bug #75365 (Enchant still reports version 1.1.0). (cmb)
- Exif:
. Fixed bug #75301 (Exif extension has built in revision version). (Peter
Kokot)
- Fileinfo:
. Upgrade bundled libmagic to 5.31. (Anatol)
- GD:
. Fixed bug #65148 (imagerotate may alter image dimensions). (cmb)
- Intl:
. Fixed bug #75378 ([REGRESSION] IntlDateFormatter::parse() does not change
$position argument). (Laruence)
. Fixed bug #75317 (UConverter::setDestinationEncoding changes source instead
of destination). (andrewnester)
- JSON:
. Fixed bug #68567 (JSON_PARTIAL_OUTPUT_ON_ERROR can result in JSON with null
key). (Jakub Zelenka)
- OCI8:
. Fixed valgrind issue. (Tianfang Yang)
- Opcache:
. Fixed bug (assertion fails with extended info generated). (Laruence)
. Fixed bug (Phi sources removel). (Laruence)
. Fixed bug #75370 (Webserver hangs on valid PHP text). (Laruence)
. Fixed bug #75357 (segfault loading WordPress wp-admin). (Laruence)
. Fixed bug #75373 (Warning Internal error: wrong size calculation). (Laruence, Dmitry)
- Openssl:
. Fixed bug #75363 (openssl_x509_parse leaks memory). (Bob)
. Fixed bug #75307 (Wrong reflection for openssl_open function). (villfa)
- PCRE:
. Fixed bug #75207 (applied upstream patch for CVE-2016-1283). (Anatol)
- PGSQL:
. Fixed bug #75419 (Default link incorrectly cleared/linked by pg_close()). (Sara)
- Standard:
. Fixed bug #75221 (Argon2i always throws NUL at the end). (cmb)
- Zlib:
. Fixed bug #75299 (Wrong reflection on inflate_init and inflate_add). (Fabien
Villepinte)
12 Oct 2017, PHP 7.2.0RC4
- Core
. Fixed bug #75220 (Segfault when calling is_callable on parent).
(andrewnester)
. Fixed bug #75290 (debug info of Closures of internal functions contain
garbage argument names). (Andrea)
- Apache2Handler:
. Fixed bug #75311 (error: 'zend_hash_key' has no member named 'arKey' in
apache2handler). (mcarbonneaux)
- Date:
. Fixed bug #75222 (DateInterval microseconds property always 0). (jhdxr)
- Hash:
. Fixed Bug #75284 (sha3 is not supported on bigendian machine). (Remi)
- Intl:
. Fixed bug #75318 (The parameter of UConverter::getAliases() is not
optional). (cmb)
- litespeed:
. Fixed bug #75248 (Binary directory doesn't get created when building
only litespeed SAPI). (petk)
. Fixed bug #75251 (Missing program prefix and suffix). (petk)
- OCI8:
. Fixed incorrect reference counting. (Dmitry, Tianfang Yang)
- Opcache
. Fixed bug #75255 (Request hangs and not finish). (Dmitry)
- PCRE:
. Fixed bug #75285 (Broken build when system libpcre don't have jit support).
(Remi)
- Sodium:
. Added missing bindings for libsodium > 1.0.13. (Frank)
28 Sep 2017, PHP 7.2.0RC3
- Core
. Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
(Laruence)
. Fixed bug #74878 (Data race in ZTS builds). (Nikita, Dmitry)
. Fixed bug #75236 (infinite loop when printing an error-message). (Andrea)
. Fixed bug #75252 (Incorrect token formatting on two parse errors in one
request). (Nikita)
- FPM:
. Fixed bug #75212 (php_value acts like php_admin_value). (Remi)
- MySQLi:
. Fixed bug #75018 (Data corruption when reading fields of bit type). (Anatol)
- Opcache:
. Fixed bug #75230 (Invalid opcode 49/1/8 using opcache). (Laruence)
- PCRE:
. Fixed bug ##75223 (PCRE JIT broken in 7.2). (Dmitry)
- PDO_mysql:
. Fixed bug #75177 (Type 'bit' is fetched as unexpected string). (Anatol)
- SPL:
. Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags).
(J. Jeising, cmb)
14 Sep 2017, PHP 7.2.0RC2
- Core:
. Fixed Bug #75142 (buildcheck.sh check for autoconf version needs to be updated
for v2.64). (zizzy at zizzy dot net, Remi)
- BCMath:
. Fixed bug #44995 (bcpowmod() fails if scale != 0). (cmb)
. Fixed bug #46781 (BC math handles minus zero incorrectly). (cmb)
. Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1). (okano1220, cmb)
. Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus). (cmb)
- CLI server:
. Fixed bug #70470 (Built-in server truncates headers spanning over TCP
packets). (bouk)
- Date:
. Fixed bug #75149 (redefinition of typedefs ttinfo and t1info). (Remi)
- GD:
. Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?). (cmb)
- Intl:
. Fixed bug #75193 (segfault in collator_convert_object_to_string). (Remi)
- Gettext:
. Fixed bug #73730 (textdomain(null) throws in strict mode). (cmb)
- Opcache
. Fixed incorect constant conditional jump elimination. (Dmitry)
- OpenSSL
. Automatically load OpenSSL configuration file. (Jakub Zelenka)
- SPL:
. Fixed bug #75155 (AppendIterator::append() is broken when appending another
AppendIterator). (Nikita)
. Fixed bug #75173 (incorrect behavior of AppendIterator::append in foreach loop).
(jhdxr)
- Standard:
. Fixed bug #75152 (signed integer overflow in parse_iv). (Laruence)
. Fixed bug #75170 (mt_rand() bias on 64-bit machines). (Nikita)
- ZIP:
. Fixed bug #75143 (new method setEncryptionName() seems not to exist
in ZipArchive). (Anatol)
31 Aug 2017, PHP 7.2.0RC1
- Core:
. Fixed bug #75042 (run-tests.php issues with EXTENSION block). (John Boehr)
- CURL:
. Fixed bug #75093 (OpenSSL support not detected). (Remi)
. Better fix for #74125 (use pkg-config instead of curl-config). (Remi)
- GD:
. Fixed bug #75111 (Memory disclosure or DoS via crafted .bmp image). (cmb)
. Fixed bug #75124 (gdImageGrayScale() may produce colors). (cmb)
- Intl:
. Fixed bug #75090 (IntlGregorianCalendar doesn't have constants from parent
class). (tpunt)
- PCRE:
. Fixed bug #75089 (preg_grep() is not reporting PREG_BAD_UTF8_ERROR after
first input string). (Dmitry)
- PDO_OCI:
. Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized
before PHP-FPM sets it up). (Ingmar Runge)
- SQLite3:
. Update to Sqlite 3.20.1. (cmb)
- Standard:
. Fixed bug #75097 (gethostname fails if your host name is 64 chars long). (Andrea)
17 Aug 2017, PHP 7.2.0beta3
- Core:
. Fixed bug #75063 (Main CWD initialized with wrong codepage). (Anatol)
. Fixed bug #74725 (html_errors=1 breaks unhandled exceptions). (Andrea)
- Date:
. Fixed bug #75002 (Null Pointer Dereference in timelib_time_clone). (Derick)
- FTP:
. Added ftp_append() function. (blar)
- JSON:
. Fixed bug #75185 (Buffer overflow in json_decode() with
JSON_INVALID_UTF8_IGNORE or JSON_INVALID). (Jakub Zelenka)
- Mbstring:
. Fixed bug #75001 (Wrong reflection on mb_eregi_replace). (Fabien
Villepinte)
- SQLite3:
. Updated to SQLite 3.20.0. (cmb)
- SPL:
. Fixed bug #75049 (spl_autoload_unregister can't handle
spl_autoload_functions results). (Laruence)
. Added spl_object_id(). (Tyson Andre)
- Standard:
. Fixed bug #75075 (unpack with X* causes infinity loop). (Laruence)
. Fixed bug #74103 (heap-use-after-free when unserializing invalid array
size). (Nikita)
. Fixed bug #75054 (A Denial of Service Vulnerability was found when
performing deserialization). (Nikita)
- WDDX:
. Fixed bug #73793 (WDDX uses wrong decimal seperator). (cmb)
- XMLRPC:
. Fixed bug #74975 (Incorrect xmlrpc serialization for classes with declared
properties). (blar)
03 Aug 2017, PHP 7.2.0beta2
- Core:
. Implemented FR #74963 (Improved error message on fetching property of
non-object). (Laruence)
. Fixed bug #74947 (Segfault in scanner on INF number). (Laruence)
. Fixed bug #74954 (null deref and segfault in zend_generator_resume()). (Bob)
. Fixed bug #75349 (NAN comparison). (Sara)
- CLI:
. Fixed bug #74979 (Interactive shell opening instead of script execution
@@ -302,6 +577,10 @@ PHP NEWS
- Calendar:
. Fix integer overflows (Joshua Rogers)
- CLI server:
. Fixed bug #60471 (Random "Invalid request (unexpected EOF)" using a router
script). (SammyK)
- Date:
. Fixed bug #55407 (Impossible to prototype DateTime::createFromFormat).
(kelunik)
+27 -4
View File
@@ -24,7 +24,7 @@ PHP 7.2 UPGRADE NOTES
closed resources.
. is_object() will now return true for objects of class
__PHP_Incomplete_Class.
. Support for Netware operating systems have been removed.
. Support for Netware operating systems has been removed.
. Casting arrays to objects (with (object) or settype()) will now convert
integer keys to string property names. This fixes the behaviour of previous
versions, where integer keys would become inaccessible properties with
@@ -94,6 +94,10 @@ PHP 7.2 UPGRADE NOTES
sessions. Use output buffer just like web applications to resolve problems on
CLI scripts.
- Standard:
. Sequences generated by mt_rand() and rand() for a specific seed may differ
from PHP 7.1 on 64-bit machines. This change was necessary to resolve a
modulo bias bug in the implementation.
========================================
2. New Features
@@ -115,6 +119,11 @@ PHP 7.2 UPGRADE NOTES
- DBA:
. Implemented support for the LMDB backend.
- JSON:
. Added JSON_INVALID_UTF8_IGNORE and JSON_INVALID_UTF8_SUBSTITUTE options for
json_encode() and json_decode() to ignore and replace invalid UTF-8 byte
sequences, respectively.
- OCI8:
. Added Oracle Database Transparent Application Failover (TAF) callback support.
@@ -169,9 +178,11 @@ PHP 8.0.
. The create_function() function has been deprecated, use anonymous functions
instead.
. The each() function has been deprecated, use a foreach loop instead.
. The $errcontext error handler argument has been deprecated. However, using
it does not trigger a deprecation warning for technical reasons.
- EXIF:
. The read_exif_data() alias have been deprecated, use exif_read_data() instead.
. The read_exif_data() alias has been deprecated, use exif_read_data() instead.
- GD:
. png2wbmp() and jpeg2wbmp() have been deprecated.
@@ -233,15 +244,21 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
. DomNodeList implements Countable, added DomNodeList::count().
. DOMNamedNodeMap implements Countable, added DOMNamedNodeMap::count().
- FTP:
. Added ftp_append().
- GD:
. Added imagesetclip() and imagegetclip().
. Added imageopenpolygon().
. Added imageresolution().
. Added imagecreatefrombmp() and imagebmp().
- Hash:
. Added hash_hmac_algos().
- Mbstring:
. Added mb_chr() and mb_ord().
. Added mb_scurb() that scrub broken multibyte strings.
. Added mb_scrub() that scrubs broken multibyte strings.
- OCI8:
. Added oci_register_taf_callback() and oci_disable_taf_callback() for
@@ -251,6 +268,9 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
. Added socket_addrinfo_lookup(), socket_addrinfo_connect(),
socket_addrinfo_bind() and socket_addrinfo_explain().
- SPL:
. Added spl_object_id().
========================================
7. New Classes and Interfaces
========================================
@@ -331,7 +351,7 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
========================================
- sql.safe_mode
. This INI directive have been removed.
. This INI directive has been removed.
- realpath_cache_size
. Set to 4096k by default
@@ -351,3 +371,6 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
13. Other Changes
========================================
- Build system
Autoconf minimal version is now 2.64.
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #75241 (Null pointer dereference in zend_mm_alloc_small())
--FILE--
<?php
function eh(){}
set_error_handler('eh');
$d->d = &$d + $d->d/=0;
var_dump($d);
?>
--EXPECT--
float(INF)
+28
View File
@@ -0,0 +1,28 @@
--TEST--
Bug #75252: Incorrect token formatting on two parse errors in one request
--FILE--
<?php
$code = <<<'CODE'
function test_missing_semicolon() : string {
$x = []
FOO
}
CODE;
try {
eval($code);
} catch (ParseError $e) {
var_dump($e->getMessage());
}
try {
eval($code);
} catch (ParseError $e) {
var_dump($e->getMessage());
}
?>
--EXPECT--
string(41) "syntax error, unexpected 'FOO' (T_STRING)"
string(41) "syntax error, unexpected 'FOO' (T_STRING)"
+26
View File
@@ -0,0 +1,26 @@
--TEST--
Bug #75290 (debug info of Closures of internal functions contain garbage argument names)
--FILE--
<?php
var_dump((new ReflectionFunction('sin'))->getClosure());
var_dump(function ($someThing) {});
?>
--EXPECT--
object(Closure)#2 (1) {
["parameter"]=>
array(1) {
["$number"]=>
string(10) "<required>"
}
}
object(Closure)#2 (1) {
["parameter"]=>
array(1) {
["$someThing"]=>
string(10) "<required>"
}
}
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #75420.1 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
$name = "foo";
var_dump($obj->$name ?? 12);
var_dump($name);
?>
--EXPECT--
string(3) "foo"
int(42)
int(24)
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #75420.10 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
public function offsetGet($x) { var_dump($x); return 42; }
public function offsetSet($x, $y) { }
public function offsetUnset($x) { }
}
$obj = new Test;
$name = "foo";
$name = str_repeat($name, 2);
var_dump($obj[$name] ?? 12);
var_dump($name);
?>
--EXPECT--
string(6) "foofoo"
int(42)
int(24)
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #75420.11 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
public function offsetGet($x) { var_dump($x); return 42; }
public function offsetSet($x, $y) { }
public function offsetUnset($x) { }
}
$obj = new Test;
$name = "foo";
var_dump(empty($obj[$name]));
var_dump($name);
?>
--EXPECT--
string(3) "foo"
bool(false)
int(24)
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #75420.12 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
public function offsetGet($x) { var_dump($x); return 42; }
public function offsetSet($x, $y) { }
public function offsetUnset($x) { }
}
$obj = new Test;
$name = "foo";
$name = str_repeat($name, 2);
var_dump(empty($obj[$name]));
var_dump($name);
?>
--EXPECT--
string(6) "foofoo"
bool(false)
int(24)
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #75420.13 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; }
public function offsetGet($x) { var_dump($x); return 42; }
public function offsetSet($x, $y) { }
public function offsetUnset($x) { }
}
$obj = new Test;
$name = "foo";
var_dump($obj[$name] ?? 12);
var_dump($obj);
?>
--EXPECT--
string(3) "foo"
int(42)
int(24)
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #75420.14 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; }
public function offsetGet($x) { var_dump($x); return 42; }
public function offsetSet($x, $y) { }
public function offsetUnset($x) { }
}
$obj = new Test;
$name = "foo";
var_dump(empty($obj[$name]));
var_dump($obj);
?>
--EXPECT--
string(3) "foo"
bool(false)
int(24)
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #75420.15 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
public function offsetExists($x) { }
public function offsetGet($x) { }
public function offsetSet($x, $y) { $GLOBALS["name"] = 24; var_dump($x); }
public function offsetUnset($x) { }
}
$obj = new Test;
$name = "foo";
$name = str_repeat($name, 2);
$obj[$name] = 1;
var_dump($name);
?>
--EXPECT--
string(6) "foofoo"
int(24)
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #75420.16 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
public function offsetExists($x) { }
public function offsetGet($x) { }
public function offsetSet($x, $y) { $GLOBALS["obj"] = 24; var_dump($this); }
public function offsetUnset($x) { }
}
$obj = new Test;
$name = "foo";
$obj[$name] = 1;
var_dump($obj);
?>
--EXPECT--
object(Test)#1 (0) {
}
int(24)
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #75420.2 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
$name = "foo";
$name = str_repeat($name, 2);
var_dump($obj->$name ?? 12);
var_dump($name);
?>
--EXPECT--
string(6) "foofoo"
int(42)
int(24)
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #75420.3 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
$name = "foo";
var_dump(empty($obj->$name));
var_dump($name);
?>
--EXPECT--
string(3) "foo"
bool(false)
int(24)
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #75420.4 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
$name = "foo";
$name = str_repeat($name, 2);
var_dump(empty($obj->$name));
?>
--EXPECT--
string(6) "foofoo"
bool(false)
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #75420.5 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
public function __isset($x) { $GLOBALS["obj"] = 24; return true; }
public function __get($x) { var_dump($this); return 42; }
}
$obj = new Test;
$name = "foo";
var_dump($obj->$name ?? 12);
var_dump($obj);
?>
--EXPECT--
object(Test)#1 (0) {
}
int(42)
int(24)
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #75420.6 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
public function __isset($x) { $GLOBALS["obj"] = 24; return true; }
public function __get($x) { var_dump($this); return 42; }
}
$obj = new Test;
$name = "foo";
var_dump(empty($obj->$name));
var_dump($obj);
?>
--EXPECT--
object(Test)#1 (0) {
}
bool(false)
int(24)
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #75420.7 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
public function __set($x,$v) { $GLOBALS["name"] = 24; var_dump($x); }
}
$obj = new Test;
$name = "foo";
$name = str_repeat($name, 2);
$obj->$name = 1;
var_dump($name);
?>
--EXPECT--
string(6) "foofoo"
int(24)
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #75420.8 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
public function __set($x,$v) { $GLOBALS["obj"] = 24; var_dump($this); }
}
$obj = new Test;
$name = "foo";
$obj->$name = 1;
var_dump($obj);
?>
--EXPECT--
object(Test)#1 (0) {
}
int(24)
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #75420.9 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
public function offsetGet($x) { var_dump($x); return 42; }
public function offsetSet($x, $y) { }
public function offsetUnset($x) { }
}
$obj = new Test;
$name = "foo";
var_dump($obj[$name] ?? 12);
var_dump($name);
?>
--EXPECT--
string(3) "foo"
int(42)
int(24)
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS)
--FILE--
<?php
class Test {
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
$name = "foo";
var_dump($obj->$name ?? 12);
?>
--EXPECT--
string(3) "foo"
int(42)
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Attempt to free invalid structure (result of ROPE_INIT is not a zval)
--FILE--
<?php
set_error_handler(function () {
throw new Exception();
});
$a = [];
$b = "";
try {
echo "$a$b\n";
} catch (Exception $ex) {
}
?>
DONE
--EXPECT--
DONE
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Live ranges should be ordered according to "start" position
--FILE--
<?php
set_error_handler(function($no, $msg) { throw new Exception; });
try {
$a = [];
$str = "$a${"y$a$a"}y";
} catch (Exception $e) {
}
?>
DONE
--EXPECT--
DONE
+7 -1
View File
@@ -717,6 +717,10 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
extern zend_php_scanner_globals language_scanner_globals;
#endif
#ifdef ZEND_WIN32
php_win32_cp_set_by_id(65001);
#endif
start_memory_manager();
virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
@@ -769,7 +773,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
zend_compile_file = compile_file;
zend_execute_ex = execute_ex;
zend_execute_internal = NULL;
#endif /* HAVE_SYS_SDT_H */
#endif /* HAVE_DTRACE */
zend_compile_string = compile_string;
zend_throw_exception_hook = NULL;
@@ -943,6 +947,8 @@ void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */
/* this should be compatible with the standard zenderror */
ZEND_COLD void zenderror(const char *error) /* {{{ */
{
CG(parse_error) = 0;
if (EG(exception)) {
/* An exception was thrown in the lexer, don't throw another in the parser. */
return;
-1
View File
@@ -283,7 +283,6 @@ ZEND_COLD void zenderror(const char *error);
#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
extern ZEND_API zend_class_entry *zend_standard_class_def;
extern ZEND_API zend_utility_values zend_uv;
extern ZEND_API zval zval_used_for_init;
/* If DTrace is available and enabled */
extern ZEND_API zend_bool zend_dtrace_enabled;
+10 -3
View File
@@ -3129,7 +3129,8 @@ get_function_via_handler:
(!fcc->function_handler->common.scope ||
!instanceof_function(ce_org, fcc->function_handler->common.scope))) {
if (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
fcc->function_handler->common.function_name) {
zend_string_release(fcc->function_handler->common.function_name);
}
zend_free_trampoline(fcc->function_handler);
@@ -3355,7 +3356,8 @@ again:
((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
fcc->function_handler->common.function_name) {
zend_string_release(fcc->function_handler->common.function_name);
}
zend_free_trampoline(fcc->function_handler);
@@ -3413,7 +3415,8 @@ again:
((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
fcc->function_handler->common.function_name) {
zend_string_release(fcc->function_handler->common.function_name);
}
zend_free_trampoline(fcc->function_handler);
@@ -3741,7 +3744,11 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
default:
break;
}
/* Must be interned to avoid ZTS data races */
name = zend_new_interned_string(zend_string_copy(name));
}
if (access_type & ZEND_ACC_PUBLIC) {
property_info->name = zend_string_copy(name);
} else if (access_type & ZEND_ACC_PRIVATE) {
+20 -2
View File
@@ -260,6 +260,8 @@ struct _zend_mm_heap {
int peak_chunks_count; /* peak number of allocated chunks for current request */
int cached_chunks_count; /* number of cached chunks */
double avg_chunks_count; /* average number of chunks allocated per request */
int last_chunks_delete_boundary; /* numer of chunks after last deletion */
int last_chunks_delete_count; /* number of deletion over the last boundary */
#if ZEND_MM_CUSTOM
union {
struct {
@@ -283,7 +285,7 @@ struct _zend_mm_chunk {
uint32_t free_pages; /* number of free pages */
uint32_t free_tail; /* number of free pages at the end of chunk */
uint32_t num;
char reserve[64 - (sizeof(void*) * 3 + sizeof(int) * 3)];
char reserve[64 - (sizeof(void*) * 3 + sizeof(uint32_t) * 3)];
zend_mm_heap heap_slot; /* used only in main chunk */
zend_mm_page_map free_map; /* 512 bits or 64 bytes */
zend_mm_page_info map[ZEND_MM_PAGES]; /* 2 KB = 512 * 4 */
@@ -1076,7 +1078,9 @@ static zend_always_inline void zend_mm_delete_chunk(zend_mm_heap *heap, zend_mm_
chunk->next->prev = chunk->prev;
chunk->prev->next = chunk->next;
heap->chunks_count--;
if (heap->chunks_count + heap->cached_chunks_count < heap->avg_chunks_count + 0.1) {
if (heap->chunks_count + heap->cached_chunks_count < heap->avg_chunks_count + 0.1
|| (heap->chunks_count == heap->last_chunks_delete_boundary
&& heap->last_chunks_delete_count >= 4)) {
/* delay deletion */
heap->cached_chunks_count++;
chunk->next = heap->cached_chunks;
@@ -1085,6 +1089,14 @@ static zend_always_inline void zend_mm_delete_chunk(zend_mm_heap *heap, zend_mm_
#if ZEND_MM_STAT || ZEND_MM_LIMIT
heap->real_size -= ZEND_MM_CHUNK_SIZE;
#endif
if (!heap->cached_chunks) {
if (heap->chunks_count != heap->last_chunks_delete_boundary) {
heap->last_chunks_delete_boundary = heap->chunks_count;
heap->last_chunks_delete_count = 0;
} else {
heap->last_chunks_delete_count++;
}
}
if (!heap->cached_chunks || chunk->num > heap->cached_chunks->num) {
zend_mm_chunk_free(heap, chunk, ZEND_MM_CHUNK_SIZE);
} else {
@@ -1819,6 +1831,8 @@ static zend_mm_heap *zend_mm_init(void)
heap->peak_chunks_count = 1;
heap->cached_chunks_count = 0;
heap->avg_chunks_count = 1.0;
heap->last_chunks_delete_boundary = 0;
heap->last_chunks_delete_count = 0;
#if ZEND_MM_STAT || ZEND_MM_LIMIT
heap->real_size = ZEND_MM_CHUNK_SIZE;
#endif
@@ -2235,6 +2249,8 @@ void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent)
p->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
heap->chunks_count = 1;
heap->peak_chunks_count = 1;
heap->last_chunks_delete_boundary = 0;
heap->last_chunks_delete_count = 0;
#if ZEND_MM_STAT || ZEND_MM_LIMIT
heap->real_size = ZEND_MM_CHUNK_SIZE;
#endif
@@ -2758,6 +2774,8 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void
heap->peak_chunks_count = 1;
heap->cached_chunks_count = 0;
heap->avg_chunks_count = 1.0;
heap->last_chunks_delete_boundary = 0;
heap->last_chunks_delete_count = 0;
#if ZEND_MM_STAT || ZEND_MM_LIMIT
heap->real_size = ZEND_MM_CHUNK_SIZE;
#endif
+6 -2
View File
@@ -193,6 +193,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_set_exception_handler, 0, 0, 1)
ZEND_ARG_INFO(0, exception_handler)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_get_defined_functions, 0, 0, 1)
ZEND_ARG_INFO(0, exclude_disabled)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_create_function, 0, 0, 2)
ZEND_ARG_INFO(0, args)
ZEND_ARG_INFO(0, code)
@@ -270,7 +274,7 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
ZEND_FE(get_declared_classes, arginfo_zend__void)
ZEND_FE(get_declared_traits, arginfo_zend__void)
ZEND_FE(get_declared_interfaces, arginfo_zend__void)
ZEND_FE(get_defined_functions, arginfo_zend__void)
ZEND_FE(get_defined_functions, arginfo_get_defined_functions)
ZEND_FE(get_defined_vars, arginfo_zend__void)
ZEND_DEP_FE(create_function, arginfo_create_function)
ZEND_FE(get_resource_type, arginfo_get_resource_type)
@@ -1176,7 +1180,7 @@ ZEND_FUNCTION(get_object_vars)
*/
zend_hash_str_add_new(Z_ARRVAL_P(return_value), prop_name, prop_len, value);
} else {
zend_symbtable_add_new(Z_ARRVAL_P(return_value), key, value);
zend_symtable_add_new(Z_ARRVAL_P(return_value), key, value);
}
} ZEND_HASH_FOREACH_END();
}
+10 -3
View File
@@ -500,6 +500,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
zval val;
struct _zend_arg_info *arg_info = closure->func.common.arg_info;
HashTable *debug_info;
zend_bool zstr_args = (closure->func.type == ZEND_USER_FUNCTION) || (closure->func.common.fn_flags & ZEND_ACC_USER_ARG_INFO);
*is_temp = 1;
@@ -532,9 +533,15 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
zend_string *name;
zval info;
if (arg_info->name) {
name = zend_strpprintf(0, "%s$%s",
arg_info->pass_by_reference ? "&" : "",
ZSTR_VAL(arg_info->name));
if (zstr_args) {
name = zend_strpprintf(0, "%s$%s",
arg_info->pass_by_reference ? "&" : "",
ZSTR_VAL(arg_info->name));
} else {
name = zend_strpprintf(0, "%s$%s",
arg_info->pass_by_reference ? "&" : "",
((zend_internal_arg_info*)arg_info)->name);
}
} else {
name = zend_strpprintf(0, "%s$param%d",
arg_info->pass_by_reference ? "&" : "",
+1 -1
View File
@@ -7844,7 +7844,7 @@ static void zend_compile_encaps_list(znode *result, zend_ast *ast) /* {{{ */
GET_NODE(result, opline->result);
} else {
uint32_t var;
uint32_t range = zend_start_live_range(CG(active_op_array), rope_init_lineno);
uint32_t range = zend_start_live_range_ex(CG(active_op_array), rope_init_lineno);
init_opline->extended_value = j;
opline->opcode = ZEND_ROPE_END;
+1
View File
@@ -843,6 +843,7 @@ static zend_always_inline zend_bool zend_check_type(
if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
return instanceof_function(Z_OBJCE_P(arg), *ce);
}
return Z_TYPE_P(arg) == IS_NULL && (ZEND_TYPE_ALLOW_NULL(type) || (default_value && is_null_constant(scope, default_value)));
} else if (EXPECTED(ZEND_TYPE_CODE(type) == Z_TYPE_P(arg))) {
return 1;
}
+1 -1
View File
@@ -346,7 +346,7 @@ static zend_always_inline int zend_hash_str_exists_ind(const HashTable *ht, cons
Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF);
}
static zend_always_inline zval *zend_symbtable_add_new(HashTable *ht, zend_string *key, zval *pData)
static zend_always_inline zval *zend_symtable_add_new(HashTable *ht, zend_string *key, zval *pData)
{
zend_ulong idx;
+60 -31
View File
@@ -562,9 +562,10 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
zval tmp_member, tmp_object;
zval *retval;
uint32_t property_offset;
uint32_t *guard = NULL;
zobj = Z_OBJ_P(object);
@@ -597,12 +598,18 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
goto exit;
}
ZVAL_UNDEF(&tmp_object);
/* magic isset */
if ((type == BP_VAR_IS) && zobj->ce->__isset) {
zval tmp_object, tmp_result;
uint32_t *guard = zend_get_property_guard(zobj, Z_STR_P(member));
zval tmp_result;
guard = zend_get_property_guard(zobj, Z_STR_P(member));
if (!((*guard) & IN_ISSET)) {
if (Z_TYPE(tmp_member) == IS_UNDEF) {
ZVAL_COPY(&tmp_member, member);
member = &tmp_member;
}
ZVAL_COPY(&tmp_object, object);
ZVAL_UNDEF(&tmp_result);
@@ -617,19 +624,20 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
goto exit;
}
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_result);
}
}
/* magic get */
if (zobj->ce->__get) {
uint32_t *guard = zend_get_property_guard(zobj, Z_STR_P(member));
if (guard == NULL) {
guard = zend_get_property_guard(zobj, Z_STR_P(member));
}
if (!((*guard) & IN_GET)) {
zval tmp_object;
/* have getter - try with it! */
ZVAL_COPY(&tmp_object, object);
if (Z_TYPE(tmp_object) == IS_UNDEF) {
ZVAL_COPY(&tmp_object, object);
}
*guard |= IN_GET; /* prevent circular getting */
zend_std_call_getter(&tmp_object, member, rv);
*guard &= ~IN_GET;
@@ -649,6 +657,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
zval_ptr_dtor(&tmp_object);
goto exit;
} else {
zval_ptr_dtor(&tmp_object);
if (Z_STRVAL_P(member)[0] == '\0' && Z_STRLEN_P(member) != 0) {
zend_throw_error(NULL, "Cannot access property started with '\\0'");
retval = &EG(uninitialized_zval);
@@ -656,6 +665,9 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
}
}
}
zval_ptr_dtor(&tmp_object);
if ((type != BP_VAR_IS)) {
zend_error(E_NOTICE,"Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), Z_STRVAL_P(member));
}
@@ -764,34 +776,38 @@ exit:
zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zval tmp;
zval tmp_offset, tmp_object;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
if (offset == NULL) {
/* [] construct */
ZVAL_NULL(&tmp);
offset = &tmp;
ZVAL_NULL(&tmp_offset);
} else {
SEPARATE_ARG_IF_REF(offset);
ZVAL_DEREF(offset);
ZVAL_COPY(&tmp_offset, offset);
}
ZVAL_COPY(&tmp_object, object);
if (type == BP_VAR_IS) {
zend_call_method_with_1_params(object, ce, NULL, "offsetexists", rv, offset);
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", rv, &tmp_offset);
if (UNEXPECTED(Z_ISUNDEF_P(rv))) {
zval_ptr_dtor(offset);
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_offset);
return NULL;
}
if (!i_zend_is_true(rv)) {
zval_ptr_dtor(offset);
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_offset);
zval_ptr_dtor(rv);
return &EG(uninitialized_zval);
}
zval_ptr_dtor(rv);
}
zend_call_method_with_1_params(object, ce, NULL, "offsetget", rv, offset);
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", rv, &tmp_offset);
zval_ptr_dtor(offset);
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_offset);
if (UNEXPECTED(Z_TYPE_P(rv) == IS_UNDEF)) {
if (UNEXPECTED(!EG(exception))) {
@@ -810,17 +826,19 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /*
static void zend_std_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zval tmp;
zval tmp_offset, tmp_object;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
if (!offset) {
ZVAL_NULL(&tmp);
offset = &tmp;
ZVAL_NULL(&tmp_offset);
} else {
SEPARATE_ARG_IF_REF(offset);
ZVAL_DEREF(offset);
ZVAL_COPY(&tmp_offset, offset);
}
zend_call_method_with_2_params(object, ce, NULL, "offsetset", NULL, offset, value);
zval_ptr_dtor(offset);
ZVAL_COPY(&tmp_object, object);
zend_call_method_with_2_params(&tmp_object, ce, NULL, "offsetset", NULL, &tmp_offset, value);
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
}
@@ -830,17 +848,19 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value) /*
static int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zval retval;
zval retval, tmp_offset, tmp_object;
int result;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, ce, NULL, "offsetexists", &retval, offset);
ZVAL_DEREF(offset);
ZVAL_COPY(&tmp_offset, offset);
ZVAL_COPY(&tmp_object, object);
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", &retval, &tmp_offset);
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
if (check_empty && result && EXPECTED(!EG(exception))) {
zend_call_method_with_1_params(object, ce, NULL, "offsetget", &retval, offset);
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", &retval, &tmp_offset);
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
@@ -849,7 +869,8 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /
} else {
result = 0;
}
zval_ptr_dtor(offset);
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
return 0;
@@ -1006,11 +1027,15 @@ exit:
static void zend_std_unset_dimension(zval *object, zval *offset) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zval tmp_offset, tmp_object;
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1)) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, offset);
zval_ptr_dtor(offset);
ZVAL_DEREF(offset);
ZVAL_COPY(&tmp_offset, offset);
ZVAL_COPY(&tmp_object, object);
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetunset", NULL, &tmp_offset);
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
}
@@ -1561,6 +1586,10 @@ found:
zval tmp_object;
/* have issetter - try with it! */
if (Z_TYPE(tmp_member) == IS_UNDEF) {
ZVAL_COPY(&tmp_member, member);
member = &tmp_member;
}
ZVAL_COPY(&tmp_object, object);
(*guard) |= IN_ISSET; /* prevent circular getting */
zend_std_call_issetter(&tmp_object, member, &rv);
+31
View File
@@ -142,6 +142,25 @@ ZEND_API void zend_function_dtor(zval *zv)
ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION);
ZEND_ASSERT(function->common.function_name);
zend_string_release(function->common.function_name);
#ifndef ZTS
if ((function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) &&
!function->common.scope && function->common.arg_info) {
uint32_t i;
uint32_t num_args = function->common.num_args + 1;
zend_arg_info *arg_info = function->common.arg_info - 1;
if (function->common.fn_flags & ZEND_ACC_VARIADIC) {
num_args++;
}
for (i = 0 ; i < num_args; i++) {
if (ZEND_TYPE_IS_CLASS(arg_info[i].type)) {
zend_string_release(ZEND_TYPE_NAME(arg_info[i].type));
}
}
free(arg_info);
}
#endif
if (!(function->common.fn_flags & ZEND_ACC_ARENA_ALLOCATED)) {
pefree(function, 1);
}
@@ -227,6 +246,9 @@ ZEND_API void destroy_zend_class(zval *zv)
{
zend_property_info *prop_info;
zend_class_entry *ce = Z_PTR_P(zv);
#ifndef ZTS
zend_function *fn;
#endif
if (--ce->refcount > 0) {
return;
@@ -310,6 +332,15 @@ ZEND_API void destroy_zend_class(zval *zv)
}
zend_hash_destroy(&ce->properties_info);
zend_string_release(ce->name);
#ifndef ZTS
ZEND_HASH_FOREACH_PTR(&ce->function_table, fn) {
if ((fn->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) &&
fn->common.scope == ce) {
/* reset function scope to allow arg_info removing */
fn->common.scope = NULL;
}
} ZEND_HASH_FOREACH_END();
#endif
zend_hash_destroy(&ce->function_table);
if (zend_hash_num_elements(&ce->constants_table)) {
zend_class_constant *c;
+3 -1
View File
@@ -225,8 +225,10 @@ ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op) /* {{{ */
if (Z_TYPE(holder) == IS_LONG) { \
if (op == result) { \
zval_ptr_dtor(op); \
ZVAL_LONG(op, Z_LVAL(holder)); \
} else { \
(op) = &(holder); \
} \
(op) = &(holder); \
} \
break; \
} \
+4 -2
View File
@@ -167,8 +167,10 @@ ZEND_API void ZEND_FASTCALL _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
{
if (EXPECTED(Z_TYPE_P(zvalue) == IS_ARRAY)) {
ZVAL_ARR(zvalue, zend_array_dup(Z_ARRVAL_P(zvalue)));
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_STRING) ||
EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT)) {
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_STRING)) {
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
ZVAL_NEW_STR(zvalue, zend_string_dup(Z_STR_P(zvalue), 0));
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT)) {
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
Z_STR_P(zvalue) = zend_string_dup(Z_STR_P(zvalue), 0);
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT_AST)) {
+13 -3
View File
@@ -389,16 +389,21 @@ static void cwd_globals_dtor(virtual_cwd_globals *cwd_g) /* {{{ */
}
/* }}} */
CWD_API void virtual_cwd_startup(void) /* {{{ */
void virtual_cwd_main_cwd_init(uint8_t reinit) /* {{{ */
{
char cwd[MAXPATHLEN];
char *result;
if (reinit) {
free(main_cwd_state.cwd);
}
#ifdef ZEND_WIN32
ZeroMemory(&cwd, sizeof(cwd));
#endif
result = php_win32_ioutil_getcwd(cwd, sizeof(cwd));
#else
result = getcwd(cwd, sizeof(cwd));
#endif
if (!result) {
cwd[0] = '\0';
@@ -411,7 +416,12 @@ CWD_API void virtual_cwd_startup(void) /* {{{ */
}
#endif
main_cwd_state.cwd = strdup(cwd);
}
/* }}} */
CWD_API void virtual_cwd_startup(void) /* {{{ */
{
virtual_cwd_main_cwd_init(0);
#ifdef ZTS
ts_allocate_id(&cwd_globals_id, sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor);
#else
@@ -606,7 +616,7 @@ CWD_API void realpath_cache_del(const char *path, size_t path_len) /* {{{ */
}
/* }}} */
static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, size_t realpath_len, int is_dir, time_t t) /* {{{ */
static inline void realpath_cache_add(const char *path, size_t path_len, const char *realpath, size_t realpath_len, int is_dir, time_t t) /* {{{ */
{
zend_long size = sizeof(realpath_cache_bucket) + path_len + 1;
int same = 1;
+4
View File
@@ -238,6 +238,10 @@ CWD_API zend_long realpath_cache_size(void);
CWD_API zend_long realpath_cache_max_buckets(void);
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
#ifdef CWD_EXPORTS
extern void virtual_cwd_main_cwd_init(uint8_t);
#endif
/* The actual macros to be used in programs using TSRM
* If the program defines VIRTUAL_DIR it will use the
* virtual_* functions
+1
View File
@@ -7080,6 +7080,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
if (throw_op->result_type & (IS_VAR | IS_TMP_VAR)) {
switch (throw_op->opcode) {
case ZEND_ADD_ARRAY_ELEMENT:
case ZEND_ROPE_INIT:
case ZEND_ROPE_ADD:
break; /* exception while building structures, live range handling will free those */
+1
View File
@@ -1776,6 +1776,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(
if (throw_op->result_type & (IS_VAR | IS_TMP_VAR)) {
switch (throw_op->opcode) {
case ZEND_ADD_ARRAY_ELEMENT:
case ZEND_ROPE_INIT:
case ZEND_ROPE_ADD:
break; /* exception while building structures, live range handling will free those */
+11 -2
View File
@@ -2,6 +2,7 @@
set SDK_REMOTE=https://github.com/OSTC/php-sdk-binary-tools.git
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
echo Creating %PHP_BUILD_CACHE_BASE_DIR%
@@ -13,17 +14,25 @@ if not exist "%PHP_BUILD_OBJ_DIR%" (
mkdir "%PHP_BUILD_OBJ_DIR%"
)
if not exist "%SDK_RUNNER%" (
if exist "%PHP_BUILD_CACHE_SDK_DIR%" rmdir /s /q "%PHP_BUILD_CACHE_SDK_DIR%"
)
if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
echo Cloning remote SDK repository
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
) else (
)
for /f "tokens=*" %%a in ('type %PHP_BUILD_CACHE_SDK_DIR%\VERSION') do set GOT_SDK_VER=%%a
echo Got SDK version %GOT_SDK_VER%
if NOT "%GOT_SDK_VER%" == "%PHP_BUILD_SDK_BRANCH:~8%" (
echo Switching to the configured SDK version %SDK_BRANCH:~8%
echo Fetching remote SDK repository
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
echo Checkout SDK repository branch
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
)
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
if not exist "%SDK_RUNNER%" (
echo "%SDK_RUNNER%" doesn't exist
exit /b 3
+2
View File
@@ -8,6 +8,8 @@ if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q C:\msys64 >NUL 2>NUL
if %errorlevel% neq 0 exit /b 3
cd /D %APPVEYOR_BUILD_FOLDER%
if %errorlevel% neq 0 exit /b 3
+4 -4
View File
@@ -28,18 +28,18 @@ if test -z "$PHP_AUTOCONF"; then
PHP_AUTOCONF='autoconf'
fi
# autoconf 2.59 or newer
# autoconf 2.64 or newer
ac_version=`$PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
if test -z "$ac_version"; then
echo "buildconf: autoconf not found."
echo " You need autoconf version 2.59 or newer installed"
echo " You need autoconf version 2.64 or newer installed"
echo " to build PHP from Git."
exit 1
fi
IFS=.; set $ac_version; IFS=' '
if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then
if test "$1" = "2" -a "$2" -lt "64" || test "$1" -lt "2"; then
echo "buildconf: autoconf version $ac_version found."
echo " You need autoconf version 2.59 or newer installed"
echo " You need autoconf version 2.64 or newer installed"
echo " to build PHP from Git."
exit 1
else
+1 -1
View File
@@ -108,7 +108,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=2
PHP_RELEASE_VERSION=0
PHP_EXTRA_VERSION="-dev"
PHP_EXTRA_VERSION="RC6"
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`
+17 -4
View File
@@ -60,9 +60,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_bcdiv, 0, 0, 2)
ZEND_ARG_INFO(0, scale)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_bcmod, 0)
ZEND_BEGIN_ARG_INFO_EX(arginfo_bcmod, 0, 0, 2)
ZEND_ARG_INFO(0, left_operand)
ZEND_ARG_INFO(0, right_operand)
ZEND_ARG_INFO(0, scale)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_bcpowmod, 0, 0, 3)
@@ -388,26 +389,38 @@ PHP_FUNCTION(bcdiv)
}
/* }}} */
/* {{{ proto string bcmod(string left_operand, string right_operand)
/* {{{ proto string bcmod(string left_operand, string right_operand [, int scale])
Returns the modulus of the two arbitrary precision operands */
PHP_FUNCTION(bcmod)
{
zend_string *left, *right;
zend_long scale_param = 0;
bc_num first, second, result;
int scale = (int)BCG(bc_precision);
ZEND_PARSE_PARAMETERS_START(2, 2)
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(left)
Z_PARAM_STR(right)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(scale_param)
ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 3) {
scale = (int) ((int)scale_param < 0 ? 0 : scale_param);
}
bc_init_num(&first);
bc_init_num(&second);
bc_init_num(&result);
php_str2num(&first, ZSTR_VAL(left));
php_str2num(&second, ZSTR_VAL(right));
switch (bc_modulo(first, second, &result, 0)) {
switch (bc_modulo(first, second, &result, scale)) {
case 0:
if (result->n_scale > scale) {
result = split_bc_num(result);
result->n_scale = scale;
}
RETVAL_STR(bc_num2str(result));
break;
case -1:
+1 -1
View File
@@ -59,7 +59,7 @@ bc_divmod (bc_num num1, bc_num num2, bc_num *quot, bc_num *rem, int scale)
bc_init_num(&temp);
/* Calculate it. */
bc_divide (num1, num2, &temp, scale);
bc_divide (num1, num2, &temp, 0);
if (quot)
quotient = bc_copy_num (temp);
bc_multiply (temp, num2, &temp, rscale);
+27 -12
View File
@@ -45,7 +45,7 @@
int
bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)
{
bc_num power, exponent, parity, temp;
bc_num power, exponent, modulus, parity, temp;
int rscale;
/* Check for correct numbers. */
@@ -55,12 +55,16 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)
/* Set initial values. */
power = bc_copy_num (base);
exponent = bc_copy_num (expo);
modulus = bc_copy_num (mod);
temp = bc_copy_num (BCG(_one_));
bc_init_num(&parity);
/* Check the base for scale digits. */
if (base->n_scale != 0)
if (power->n_scale != 0)
{
bc_rt_warn ("non-zero scale in base");
bc_divide (power, BCG(_one_), &power, 0); /*truncate */
}
/* Check the exponent for scale digits. */
if (exponent->n_scale != 0)
@@ -70,27 +74,38 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)
}
/* Check the modulus for scale digits. */
if (mod->n_scale != 0)
if (modulus->n_scale != 0)
{
bc_rt_warn ("non-zero scale in modulus");
bc_divide (modulus, BCG(_one_), &modulus, 0); /*truncate */
}
/* Do the calculation. */
rscale = MAX(scale, base->n_scale);
while ( !bc_is_zero(exponent) )
rscale = MAX(scale, power->n_scale);
if ( !bc_compare(modulus, BCG(_one_)) )
{
(void) bc_divmod (exponent, BCG(_two_), &exponent, &parity, 0);
if ( !bc_is_zero(parity) )
temp = bc_new_num (1, scale);
}
else
{
while ( !bc_is_zero(exponent) )
{
bc_multiply (temp, power, &temp, rscale);
(void) bc_modulo (temp, mod, &temp, scale);
}
(void) bc_divmod (exponent, BCG(_two_), &exponent, &parity, 0);
if ( !bc_is_zero(parity) )
{
bc_multiply (temp, power, &temp, rscale);
(void) bc_modulo (temp, modulus, &temp, scale);
}
bc_multiply (power, power, &power, rscale);
(void) bc_modulo (power, mod, &power, scale);
bc_multiply (power, power, &power, rscale);
(void) bc_modulo (power, modulus, &power, scale);
}
}
/* Assign the value. */
bc_free_num (&power);
bc_free_num (&exponent);
bc_free_num (&modulus);
bc_free_num (result);
bc_free_num (&parity);
*result = temp;
+3
View File
@@ -105,5 +105,8 @@ bc_str2num (bc_num *num, char *str, int scale)
for (;strscale > 0; strscale--)
*nptr++ = CH_VAL(*ptr++);
}
if (bc_is_zero (*num))
(*num)->n_sign = PLUS;
}
+2 -2
View File
@@ -9,7 +9,7 @@ bcmath.scale=0
echo bcmod("11", "2"),"\n";
echo bcmod("-1", "5"),"\n";
echo bcmod("8728932001983192837219398127471", "1928372132132819737213"),"\n";
echo bcmod("3.5", "4"),"\n";
echo bcmod("3.5", "4", 1),"\n";
echo bcmod("1071", "357.5"),"\n";
?>
--EXPECT--
@@ -17,4 +17,4 @@ echo bcmod("1071", "357.5"),"\n";
-1
1459434331351930289678
3.5
356.0
356
+2 -2
View File
@@ -7,7 +7,7 @@ antoni@solucionsinternet.com
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--FILE--
<?php
echo bcmod('1', '2', '3');
echo bcmod('1', '2', '3', '4');
?>
--EXPECTF--
Warning: bcmod() expects exactly 2 parameters, 3 given in %s.php on line %d
Warning: bcmod() expects at most 3 parameters, 4 given in %s.php on line %d
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #44995 (bcpowmod() fails if scale != 0)
--SKIPIF--
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
?>
--FILE--
<?php
var_dump(bcpowmod('4', '4', '3', 1));
var_dump(bcpowmod('3234', '32345', '22345', 1));
?>
===DONE===
--EXPECT--
string(3) "1.0"
string(7) "17334.0"
===DONE===
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #46781 (BC math handles minus zero incorrectly)
--SKIPIF--
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
?>
--FILE--
<?php
var_dump(bcadd('-0.0', '-0.0', 1));
var_dump(bccomp('-0.0', '0', 1));
?>
===DONE===
--EXPECT--
string(3) "0.0"
int(0)
===DONE===
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #54598 (bcpowmod() may return 1 if modulus is 1)
--SKIPIF--
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
?>
--FILE--
<?php
var_dump(bcpowmod(5, 0, 1));
var_dump(bcpowmod(5, 0, 1, 3));
?>
===DONE===
--EXPECT--
string(1) "0"
string(5) "0.000"
===DONE===
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
--SKIPIF--
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
if (substr(PHP_OS, 0, 3) != 'WIN') {
die('skip valid only for windows');
}
?>
--FILE--
<?php
var_dump(bcpowmod('4.1', '4', '3', 3));
var_dump(bcpowmod('4', '4', '3.1', 3));
?>
===DONE===
--EXPECT--
string(5) "1.000"
string(5) "1.000"
===DONE===
bc math warning: non-zero scale in base
bc math warning: non-zero scale in modulus
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
--SKIPIF--
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip Not valid for windows');
}
?>
--FILE--
<?php
var_dump(bcpowmod('4.1', '4', '3', 3));
var_dump(bcpowmod('4', '4', '3.1', 3));
?>
===DONE===
--EXPECT--
bc math warning: non-zero scale in base
string(5) "1.000"
bc math warning: non-zero scale in modulus
string(5) "1.000"
===DONE===
+82 -53
View File
@@ -6,73 +6,101 @@ PHP_ARG_WITH(curl, for cURL support,
[ --with-curl[=DIR] Include cURL support])
if test "$PHP_CURL" != "no"; then
if test -r $PHP_CURL/include/curl/easy.h; then
CURL_DIR=$PHP_CURL
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test -x "$PKG_CONFIG"; then
dnl using pkg-config output
AC_MSG_CHECKING(for libcurl.pc)
if test "$PHP_CURL" == "yes" -o "$PHP_CURL" == "/usr"; then
PKNAME=libcurl
AC_MSG_RESULT(using default path)
elif test -r $PHP_CURL/$PHP_LIBDIR/pkgconfig/libcurl.pc; then
PKNAME=$PHP_CURL/$PHP_LIBDIR/pkgconfig/libcurl.pc
AC_MSG_RESULT(using $PKNAME)
elif test -r $PHP_CURL/lib/pkgconfig/libcurl.pc; then
PKNAME=$PHP_CURL/lib/pkgconfig/libcurl.pc
AC_MSG_RESULT(using $PKNAME)
else
AC_MSG_RESULT(not found)
AC_MSG_WARN(Could not find libcurl.pc. Try without $PHP_CURL or set PKG_CONFIG_PATH)
fi
fi
if test -n "$PKNAME"; then
AC_MSG_CHECKING(for cURL 7.10.5 or greater)
if $PKG_CONFIG --atleast-version 7.10.5 $PKNAME; then
curl_version_full=`$PKG_CONFIG --modversion $PKNAME`
AC_MSG_RESULT($curl_version_full)
else
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
fi
CURL_LIBS=`$PKG_CONFIG --libs $PKNAME`
CURL_INCL=`$PKG_CONFIG --cflags $PKNAME`
CURL_SSL=`$PKG_CONFIG --variable=supported_features $PKNAME| $EGREP SSL`
else
AC_MSG_CHECKING(for cURL in default path)
for i in /usr/local /usr; do
if test -r $i/include/curl/easy.h; then
CURL_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
dnl fallback to old vay, using curl-config
AC_MSG_WARN(Fallback: search for curl headers and curl-config)
if test -r $PHP_CURL/include/curl/easy.h; then
CURL_DIR=$PHP_CURL
else
AC_MSG_CHECKING(for cURL in default path)
for i in /usr/local /usr; do
if test -r $i/include/curl/easy.h; then
CURL_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
if test -z "$CURL_DIR"; then
AC_MSG_RESULT(not found)
if which dpkg-architecture>/dev/null; then
AC_MSG_CHECKING(for cURL in multiarch path)
CURL_MULTIARCH_INCLUDE=/usr/include/$(dpkg-architecture -qDEB_HOST_MULTIARCH)
if test -r $CURL_MULTIARCH_INCLUDE/curl/easy.h; then
CURL_DIR=/usr
AC_MSG_RESULT(found in $CURL_MULTIARCH_INCLUDE)
else
AC_MSG_RESULT(not found)
fi
AC_MSG_ERROR(Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/)
fi
CURL_CONFIG="curl-config"
AC_MSG_CHECKING(for cURL 7.10.5 or greater)
if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then
CURL_CONFIG=${CURL_DIR}/bin/curl-config
else
if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
CURL_CONFIG=${CURL_DIR}/curl-config
fi
fi
fi
if test -z "$CURL_DIR"; then
AC_MSG_ERROR(Could not find cURL, please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/)
fi
CURL_CONFIG="curl-config"
AC_MSG_CHECKING(for cURL 7.10.5 or greater)
if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then
CURL_CONFIG=${CURL_DIR}/bin/curl-config
else
if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
CURL_CONFIG=${CURL_DIR}/curl-config
curl_version_full=`$CURL_CONFIG --version`
curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$curl_version" -ge 7010005; then
AC_MSG_RESULT($curl_version_full)
CURL_LIBS=`$CURL_CONFIG --libs`
CURL_INCL=`$CURL_CONFIG --cflags`
CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
else
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
fi
fi
curl_version_full=`$CURL_CONFIG --version`
curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$curl_version" -ge 7010005; then
AC_MSG_RESULT($curl_version_full)
CURL_LIBS=`$CURL_CONFIG --libs`
else
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
fi
dnl common stuff (pkg-config / curl-config)
if test -z "$CURL_MULTIARCH_INCLUDE"; then
PHP_ADD_INCLUDE($CURL_DIR/include)
else
PHP_ADD_INCLUDE($CURL_MULTIARCH_INCLUDE)
fi
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, CURL_SHARED_LIBADD)
PHP_EVAL_INCLINE($CURL_INCL, CURL_SHARED_LIBADD)
AC_MSG_CHECKING([for SSL support in libcurl])
CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
if test "$CURL_SSL" = "SSL"; then
if test -n "$CURL_SSL"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
save_CFLAGS="$CFLAGS"
CFLAGS="`$CURL_CONFIG --cflags`"
CFLAGS=$CURL_INCL
save_LDFLAGS="$LDFLAGS"
LDFLAGS=$CURL_LIBS
AC_PROG_CPP
AC_MSG_CHECKING([for openssl support in libcurl])
@@ -132,6 +160,7 @@ int main(int argc, char *argv[])
])
CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"
else
AC_MSG_RESULT([no])
fi
@@ -142,21 +171,21 @@ int main(int argc, char *argv[])
],[
AC_MSG_ERROR(There is something wrong. Please check config.log for more information.)
],[
$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
$CURL_LIBS
])
PHP_CHECK_LIBRARY(curl,curl_easy_strerror,
[
AC_DEFINE(HAVE_CURL_EASY_STRERROR,1,[ ])
],[],[
$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
$CURL_LIBS
])
PHP_CHECK_LIBRARY(curl,curl_multi_strerror,
[
AC_DEFINE(HAVE_CURL_MULTI_STRERROR,1,[ ])
],[],[
$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
$CURL_LIBS
])
PHP_NEW_EXTENSION(curl, interface.c multi.c share.c curl_file.c, $ext_shared)
+1 -1
View File
@@ -20,5 +20,5 @@ tl_config.WriteLine("#define timelib_strdup estrdup");
tl_config.WriteLine("#define timelib_free efree");
tl_config.Close();
PHP_INSTALL_HEADERS("ext/date/", "php_date.h lib/timelib.h lib/timelib_structs.h lib/timelib_config.h");
PHP_INSTALL_HEADERS("ext/date/", "php_date.h lib/timelib.h lib/timelib_config.h");
AC_DEFINE('HAVE_TIMELIB_CONFIG_H', 1, 'Have timelib_config.h')
+1 -1
View File
@@ -14,7 +14,7 @@ PHP_ADD_BUILD_DIR([$ext_builddir/lib], 1)
PHP_ADD_INCLUDE([$ext_builddir/lib])
PHP_ADD_INCLUDE([$ext_srcdir/lib])
PHP_INSTALL_HEADERS([ext/date], [php_date.h lib/timelib.h lib/timelib_structs.h lib/timelib_config.h])
PHP_INSTALL_HEADERS([ext/date], [php_date.h lib/timelib.h lib/timelib_config.h])
AC_DEFINE([HAVE_TIMELIB_CONFIG_H], [1], [Have timelib_config.h])
cat > $ext_builddir/lib/timelib_config.h <<EOF
+2 -1
View File
@@ -1,6 +1,7 @@
The MIT License (MIT)
Copyright (c) 2015 Derick Rethans
Copyright (c) 2015-2017 Derick Rethans
Copyright (c) 2017 MongoDB, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+15 -10
View File
@@ -26,15 +26,15 @@
| Schlyter, who wrote this in December 1992 |
*/
#include "timelib.h"
#include <stdio.h>
#include <math.h>
#include "timelib.h"
#define days_since_2000_Jan_0(y,m,d) \
(367L*(y)-((7*((y)+(((m)+9)/12)))/4)+((275*(m))/9)+(d)-730530L)
#ifndef PI
#define PI 3.1415926535897932384
# define PI 3.1415926535897932384
#endif
#define RADEG ( 180.0 / PI )
@@ -230,7 +230,8 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
t_loc->i = t_loc->s = 0;
timelib_update_ts(t_loc, NULL);
/* Calculate TS belonging to UTC 00:00 of the current day */
/* Calculate TS belonging to UTC 00:00 of the current day, for input into
* the algorithm */
t_utc = timelib_time_ctor();
t_utc->y = t_loc->y;
t_utc->m = t_loc->m;
@@ -239,8 +240,8 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
timelib_update_ts(t_utc, NULL);
/* Compute d of 12h local mean solar time */
timestamp = t_loc->sse;
d = timelib_ts_to_juliandate(timestamp) - lon/360.0;
timestamp = t_utc->sse;
d = timelib_ts_to_j2000(timestamp) + 2 - lon/360.0;
/* Compute local sidereal time of this moment */
sidtime = astro_revolution(astro_GMST0(d) + 180.0 + lon);
@@ -295,14 +296,18 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
return rc;
}
double timelib_ts_to_juliandate(timelib_sll ts)
double timelib_ts_to_julianday(timelib_sll ts)
{
double tmp;
tmp = ts;
tmp /= 86400;
tmp += 2440587.5;
tmp -= 2451543;
tmp = (double) ts;
tmp /= (double) 86400;
tmp += (double) 2440587.5;
return tmp;
}
double timelib_ts_to_j2000(timelib_sll ts)
{
return timelib_ts_to_julianday(ts) - 2451545;
}
+58 -3
View File
@@ -23,6 +23,7 @@
*/
#include "timelib.h"
#include "timelib_private.h"
static int m_table_common[13] = { -1, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
static int m_table_leap[13] = { -1, 6, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
@@ -137,17 +138,71 @@ void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
}
}
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d)
void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id)
{
timelib_isoweek_from_date(y, m, d, iw, iy);
*id = timelib_day_of_week_ex(y, m, d, 1);
}
static timelib_sll timelib_daynr_from_weeknr_ex(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y)
{
timelib_sll dow, day;
/* Figure out the dayofweek for y-1-1 */
dow = timelib_day_of_week(y, 1, 1);
dow = timelib_day_of_week(iy, 1, 1);
/* then use that to figure out the offset for day 1 of week 1 */
day = 0 - (dow > 4 ? dow - 7 : dow);
/* and adjust the year to the natural year if we need to */
*y = (iw == 1 && day < 0 && id < dow) ? iy - 1 : iy;
/* Add weeks and days */
return day + ((w - 1) * 7) + d;
return day + ((iw - 1) * 7) + id;
}
timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id)
{
timelib_sll dummy_iso_year;
return timelib_daynr_from_weeknr_ex(iy, iw, id, &dummy_iso_year);
}
void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d)
{
timelib_sll daynr = timelib_daynr_from_weeknr_ex(iy, iw, id, y) + 1;
int *table;
*m = 0;
if (daynr <= 0) {
*y += 1;
}
if (timelib_is_leap(*y)) {
table = ml_table_leap;
if (daynr > 366) {
*y += 1;
daynr -= 366;
}
} else {
table = ml_table_common;
if (daynr > 365) {
*y += 1;
daynr -= 365;
}
}
do {
daynr -= table[*m];
(*m)++;
} while (daynr > table[*m]);
if (daynr <= 0) {
daynr += 31;
*y -= 1;
*m = 12;
}
*d = daynr;
}
int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s)
+42 -42
View File
@@ -1,42 +1,42 @@
{ "sst", 0, -660, "Pacific/Apia" },
{ "hst", 0, -600, "Pacific/Honolulu" },
{ "akst", 0, -540, "America/Anchorage" },
{ "akdt", 1, -480, "America/Anchorage" },
{ "pst", 0, -480, "America/Los_Angeles" },
{ "pdt", 1, -420, "America/Los_Angeles" },
{ "mst", 0, -420, "America/Denver" },
{ "mdt", 1, -360, "America/Denver" },
{ "cst", 0, -360, "America/Chicago" },
{ "cdt", 1, -300, "America/Chicago" },
{ "est", 0, -300, "America/New_York" },
{ "vet", 0, -270, "America/Caracas" },
{ "edt", 1, -240, "America/New_York" },
{ "ast", 0, -240, "America/Halifax" },
{ "adt", 1, -180, "America/Halifax" },
{ "brt", 0, -180, "America/Sao_Paulo" },
{ "brst", 1, -120, "America/Sao_Paulo" },
{ "azost", 0, -60, "Atlantic/Azores" },
{ "azodt", 1, 0, "Atlantic/Azores" },
{ "gmt", 0, 0, "Europe/London" },
{ "bst", 1, 60, "Europe/London" },
{ "cet", 0, 60, "Europe/Paris" },
{ "cest", 1, 120, "Europe/Paris" },
{ "eet", 0, 120, "Europe/Helsinki" },
{ "eest", 1, 180, "Europe/Helsinki" },
{ "msk", 0, 180, "Europe/Moscow" },
{ "msd", 1, 240, "Europe/Moscow" },
{ "gst", 0, 240, "Asia/Dubai" },
{ "pkt", 0, 300, "Asia/Karachi" },
{ "ist", 0, 330, "Asia/Kolkata" },
{ "npt", 0, 345, "Asia/Katmandu" },
{ "yekt", 1, 360, "Asia/Yekaterinburg" },
{ "novst", 1, 420, "Asia/Novosibirsk" },
{ "krat", 0, 420, "Asia/Krasnoyarsk" },
{ "cst", 0, 480, "Asia/Shanghai" },
{ "krast", 1, 480, "Asia/Krasnoyarsk" },
{ "jst", 0, 540, "Asia/Tokyo" },
{ "est", 0, 600, "Australia/Melbourne" },
{ "cst", 1, 630, "Australia/Adelaide" },
{ "est", 1, 660, "Australia/Melbourne" },
{ "nzst", 0, 720, "Pacific/Auckland" },
{ "nzdt", 1, 780, "Pacific/Auckland" },
{ "sst", 0, -660 * 60, "Pacific/Apia" },
{ "hst", 0, -600 * 60, "Pacific/Honolulu" },
{ "akst", 0, -540 * 60, "America/Anchorage" },
{ "akdt", 1, -480 * 60, "America/Anchorage" },
{ "pst", 0, -480 * 60, "America/Los_Angeles" },
{ "pdt", 1, -420 * 60, "America/Los_Angeles" },
{ "mst", 0, -420 * 60, "America/Denver" },
{ "mdt", 1, -360 * 60, "America/Denver" },
{ "cst", 0, -360 * 60, "America/Chicago" },
{ "cdt", 1, -300 * 60, "America/Chicago" },
{ "est", 0, -300 * 60, "America/New_York" },
{ "vet", 0, -270 * 60, "America/Caracas" },
{ "edt", 1, -240 * 60, "America/New_York" },
{ "ast", 0, -240 * 60, "America/Halifax" },
{ "adt", 1, -180 * 60, "America/Halifax" },
{ "brt", 0, -180 * 60, "America/Sao_Paulo" },
{ "brst", 1, -120 * 60, "America/Sao_Paulo" },
{ "azost", 0, -60 * 60, "Atlantic/Azores" },
{ "azodt", 1, 0 * 60, "Atlantic/Azores" },
{ "gmt", 0, 0 * 60, "Europe/London" },
{ "bst", 1, 60 * 60, "Europe/London" },
{ "cet", 0, 60 * 60, "Europe/Paris" },
{ "cest", 1, 120 * 60, "Europe/Paris" },
{ "eet", 0, 120 * 60, "Europe/Helsinki" },
{ "eest", 1, 180 * 60, "Europe/Helsinki" },
{ "msk", 0, 180 * 60, "Europe/Moscow" },
{ "msd", 1, 240 * 60, "Europe/Moscow" },
{ "gst", 0, 240 * 60, "Asia/Dubai" },
{ "pkt", 0, 300 * 60, "Asia/Karachi" },
{ "ist", 0, 330 * 60, "Asia/Kolkata" },
{ "npt", 0, 345 * 60, "Asia/Katmandu" },
{ "yekt", 1, 360 * 60, "Asia/Yekaterinburg" },
{ "novst", 1, 420 * 60, "Asia/Novosibirsk" },
{ "krat", 0, 420 * 60, "Asia/Krasnoyarsk" },
{ "cst", 0, 480 * 60, "Asia/Shanghai" },
{ "krast", 1, 480 * 60, "Asia/Krasnoyarsk" },
{ "jst", 0, 540 * 60, "Asia/Tokyo" },
{ "est", 0, 600 * 60, "Australia/Melbourne" },
{ "cst", 1, 630 * 60, "Australia/Adelaide" },
{ "est", 1, 660 * 60, "Australia/Melbourne" },
{ "nzst", 0, 720 * 60, "Pacific/Auckland" },
{ "nzdt", 1, 780 * 60, "Pacific/Auckland" },
+7 -6
View File
@@ -23,6 +23,7 @@
*/
#include "timelib.h"
#include "timelib_private.h"
#include <math.h>
timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
@@ -65,7 +66,7 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
rt->h = two->h - one->h;
rt->i = two->i - one->i;
rt->s = two->s - one->s;
rt->f = two->f - one->f;
rt->us = two->us - one->us;
if (one_backup.dst == 0 && two_backup.dst == 1 && two->sse >= one->sse + 86400 - dst_corr) {
rt->h += dst_h_corr;
rt->i += dst_m_corr;
@@ -99,19 +100,19 @@ timelib_time *timelib_add(timelib_time *old_time, timelib_rel_time *interval)
timelib_time *t = timelib_time_clone(old_time);
if (interval->have_weekday_relative || interval->have_special_relative) {
memcpy(&t->relative, interval, sizeof(struct timelib_rel_time));
memcpy(&t->relative, interval, sizeof(timelib_rel_time));
} else {
if (interval->invert) {
bias = -1;
}
memset(&t->relative, 0, sizeof(struct timelib_rel_time));
memset(&t->relative, 0, sizeof(timelib_rel_time));
t->relative.y = interval->y * bias;
t->relative.m = interval->m * bias;
t->relative.d = interval->d * bias;
t->relative.h = interval->h * bias;
t->relative.i = interval->i * bias;
t->relative.s = interval->s * bias;
t->relative.f = interval->f * bias;
t->relative.us = interval->us * bias;
}
t->have_relative = 1;
t->sse_uptodate = 0;
@@ -140,14 +141,14 @@ timelib_time *timelib_sub(timelib_time *old_time, timelib_rel_time *interval)
bias = -1;
}
memset(&t->relative, 0, sizeof(struct timelib_rel_time));
memset(&t->relative, 0, sizeof(timelib_rel_time));
t->relative.y = 0 - (interval->y * bias);
t->relative.m = 0 - (interval->m * bias);
t->relative.d = 0 - (interval->d * bias);
t->relative.h = 0 - (interval->h * bias);
t->relative.i = 0 - (interval->i * bias);
t->relative.s = 0 - (interval->s * bias);
t->relative.f = 0 - (interval->f * bias);
t->relative.us = 0 - (interval->us * bias);
t->have_relative = 1;
t->sse_uptodate = 0;
+2668 -1007
View File
File diff suppressed because it is too large. Load diff
+134 -118
View File
@@ -25,21 +25,12 @@
/* $Id$ */
#include "timelib.h"
#include "timelib_private.h"
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <assert.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#if defined(_MSC_VER)
# define strtoll(s, f, b) _atoi64(s)
#elif !defined(HAVE_STRTOLL)
@@ -50,18 +41,6 @@
# endif
#endif
#define TIMELIB_UNSET -99999
#define TIMELIB_SECOND 1
#define TIMELIB_MINUTE 2
#define TIMELIB_HOUR 3
#define TIMELIB_DAY 4
#define TIMELIB_MONTH 5
#define TIMELIB_YEAR 6
#define TIMELIB_WEEKDAY 7
#define TIMELIB_SPECIAL 8
#define TIMELIB_MICROSEC 9
#define EOI 257
#define TIME 258
#define DATE 259
@@ -113,14 +92,14 @@ typedef unsigned char uchar;
#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; }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { add_error(s, "Double date specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { add_error(s, TIMELIB_ERR_DOUBLE_TIME, "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->us = 0; } }
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->us = 0; }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { add_error(s, TIMELIB_ERR_DOUBLE_DATE, "Double date specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_weekday_relative = 1; }
#define TIMELIB_HAVE_SPECIAL_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_special_relative = 1; }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { s->time->have_zone > 1 ? add_error(s, "Double timezone specification") : add_warning(s, "Double timezone specification"); timelib_string_free(str); s->time->have_zone++; return TIMELIB_ERROR; } else { s->time->have_zone++; } }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { s->time->have_zone > 1 ? add_error(s, TIMELIB_ERR_DOUBLE_TZ, "Double timezone specification") : add_warning(s, TIMELIB_WARN_DOUBLE_TZ, "Double timezone specification"); timelib_string_free(str); s->time->have_zone++; return TIMELIB_ERROR; } else { s->time->have_zone++; } }
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
#define TIMELIB_DEINIT timelib_string_free(str)
@@ -146,20 +125,18 @@ typedef unsigned char uchar;
#define YYDEBUG(s,c)
#endif
#include "timelib_structs.h"
typedef struct timelib_elems {
typedef struct _timelib_elems {
unsigned int c; /* Number of elements */
char **v; /* Values */
} timelib_elems;
typedef struct Scanner {
typedef struct _Scanner {
int fd;
uchar *lim, *str, *ptr, *cur, *tok, *pos;
unsigned int line, len;
struct timelib_error_container *errors;
timelib_error_container *errors;
struct timelib_time *time;
timelib_time *time;
const timelib_tzdb *tzdb;
} Scanner;
@@ -176,17 +153,17 @@ typedef struct _timelib_relunit {
} timelib_relunit;
/* The timezone table. */
const static timelib_tz_lookup_table timelib_timezone_lookup[] = {
static const timelib_tz_lookup_table timelib_timezone_lookup[] = {
#include "timezonemap.h"
{ NULL, 0, 0, NULL },
};
const static timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
static const timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
#include "fallbackmap.h"
{ NULL, 0, 0, NULL },
};
const static timelib_tz_lookup_table timelib_timezone_utc[] = {
static const timelib_tz_lookup_table timelib_timezone_utc[] = {
{ "utc", 0, 0, "UTC" },
};
@@ -355,37 +332,41 @@ uchar *fill(Scanner *s, uchar *cursor){
}
#endif
static void add_warning(Scanner *s, char *error)
static void add_warning(Scanner *s, int error_code, char *error)
{
s->errors->warning_count++;
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].error_code = error_code;
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 = timelib_strdup(error);
}
static void add_error(Scanner *s, char *error)
static void add_error(Scanner *s, int error_code, char *error)
{
s->errors->error_count++;
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].error_code = error_code;
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 = timelib_strdup(error);
}
static void add_pbf_warning(Scanner *s, char *error, char *sptr, char *cptr)
static void add_pbf_warning(Scanner *s, int error_code, char *error, char *sptr, char *cptr)
{
s->errors->warning_count++;
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].error_code = error_code;
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 = timelib_strdup(error);
}
static void add_pbf_error(Scanner *s, char *error, char *sptr, char *cptr)
static void add_pbf_error(Scanner *s, int error_code, char *error, char *sptr, char *cptr)
{
s->errors->error_count++;
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].error_code = error_code;
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 = timelib_strdup(error);
@@ -505,7 +486,7 @@ static void timelib_skip_day_suffix(char **ptr)
}
}
static double timelib_get_frac_nr(char **ptr, int max_length)
static timelib_sll timelib_get_frac_nr(char **ptr, int max_length)
{
char *begin, *end, *str;
double tmp_nr = TIMELIB_UNSET;
@@ -523,12 +504,9 @@ static double timelib_get_frac_nr(char **ptr, int max_length)
++len;
}
end = *ptr;
str = timelib_calloc(1, end - begin + 1);
memcpy(str, begin, end - begin);
if (str[0] == ':') {
str[0] = '.';
}
tmp_nr = strtod(str, NULL);
str = timelib_calloc(1, end - begin);
memcpy(str, begin + 1, end - begin - 1);
tmp_nr = strtod(str, NULL) * pow(10, 7 - (end - begin));
timelib_free(str);
return tmp_nr;
}
@@ -668,7 +646,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
switch (relunit->unit) {
case TIMELIB_MICROSEC: s->time->relative.f += (((double) amount * (double) relunit->multiplier) / 1000000); break;
case TIMELIB_MICROSEC: s->time->relative.us += amount * relunit->multiplier; break;
case TIMELIB_SECOND: s->time->relative.s += amount * relunit->multiplier; break;
case TIMELIB_MINUTE: s->time->relative.i += amount * relunit->multiplier; break;
case TIMELIB_HOUR: s->time->relative.h += amount * relunit->multiplier; break;
@@ -692,7 +670,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, timelib_long gmtoffset, int isdst)
static const 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;
@@ -723,7 +701,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
if (fmp->gmtoffset == gmtoffset && fmp->type == isdst) {
return fmp;
}
}
@@ -745,9 +723,9 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
memcpy(word, begin, end - begin);
if ((tp = abbr_search(word, -1, 0))) {
value = -tp->gmtoffset / 60;
value = tp->gmtoffset;
*dst = tp->type;
value += tp->type * 60;
value -= tp->type * 3600;
*found = 1;
} else {
*found = 0;
@@ -757,6 +735,42 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
return value;
}
#define sHOUR(a) (int)(a * 3600)
#define sMIN(a) (int)(a * 60)
static timelib_long timelib_parse_tz_cor(char **ptr)
{
char *begin = *ptr, *end;
timelib_long tmp;
while (isdigit(**ptr) || **ptr == ':') {
++*ptr;
}
end = *ptr;
switch (end - begin) {
case 1: /* H */
case 2: /* HH */
return sHOUR(strtol(begin, NULL, 10));
break;
case 3: /* H:M */
case 4: /* H:MM, HH:M, HHMM */
if (begin[1] == ':') {
tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 2, NULL, 10));
return tmp;
} else if (begin[2] == ':') {
tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 3, NULL, 10));
return tmp;
} else {
tmp = strtol(begin, NULL, 10);
return sHOUR(tmp / 100) + sMIN(tmp % 100);
}
case 5: /* HH:MM */
tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 3, NULL, 10));
return tmp;
}
return 0;
}
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;
@@ -777,7 +791,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
*tz_not_found = 0;
t->dst = 0;
retval = -1 * timelib_parse_tz_cor(ptr);
retval = timelib_parse_tz_cor(ptr);
} else if (**ptr == '-') {
++*ptr;
t->is_localtime = 1;
@@ -785,7 +799,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
*tz_not_found = 0;
t->dst = 0;
retval = timelib_parse_tz_cor(ptr);
retval = -1 * timelib_parse_tz_cor(ptr);
} else {
int found = 0;
timelib_long offset = 0;
@@ -802,7 +816,9 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
/* Otherwise, we look if we have a TimeZone identifier */
if (!found || strcmp("UTC", tz_abbr) == 0) {
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
int dummy_error_code;
if ((res = tz_wrapper(tz_abbr, tzdb, &dummy_error_code)) != NULL) {
t->tz_info = res;
t->zone_type = TIMELIB_ZONETYPE_ID;
found++;
@@ -931,8 +947,8 @@ isoweek = year4 "-"? "W" weekofyear;
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
firstdayof = 'first day of';
lastdayof = 'last day of';
backof = 'back of ' hour24 space? meridian?;
frontof = 'front of ' hour24 space? meridian?;
backof = 'back of ' hour24 (space? meridian)?;
frontof = 'front of ' hour24 (space? meridian)?;
/* Common Log Format: 10/Oct/2000:13:55:36 -0700 */
clf = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" secondlz space tzcorrection;
@@ -1036,7 +1052,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
s->time->m = 1;
s->time->d = 1;
s->time->h = s->time->i = s->time->s = 0;
s->time->f = 0.0;
s->time->us = 0;
s->time->relative.s += i;
s->time->is_localtime = 1;
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
@@ -1049,7 +1065,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
timestampms
{
timelib_ull i, ms;
timelib_ull i, us;
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
@@ -1058,14 +1074,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
TIMELIB_HAVE_TZ();
i = timelib_get_unsigned_nr((char **) &ptr, 24);
ms = timelib_get_unsigned_nr((char **) &ptr, 24);
us = timelib_get_unsigned_nr((char **) &ptr, 24);
s->time->y = 1970;
s->time->m = 1;
s->time->d = 1;
s->time->h = s->time->i = s->time->s = 0;
s->time->f = 0.0;
s->time->us = 0;
s->time->relative.s += i;
s->time->relative.f = ((double) ms) / 1000000.0;
s->time->relative.us = us;
s->time->is_localtime = 1;
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
s->time->z = 0;
@@ -1165,7 +1181,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':' || *ptr == '.') {
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
}
}
timelib_eat_spaces((char **) &ptr);
@@ -1186,14 +1202,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == '.') {
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
}
}
if (*ptr != '\0') {
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
}
}
TIMELIB_DEINIT;
@@ -1215,7 +1231,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
break;
default:
TIMELIB_DEINIT;
add_error(s, "Double time specification");
add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification");
return TIMELIB_ERROR;
}
s->time->have_time++;
@@ -1259,7 +1275,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
if (*ptr != '\0') {
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
}
}
TIMELIB_DEINIT;
@@ -1457,11 +1473,11 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
s->time->i = timelib_get_nr((char **) &ptr, 2);
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == '.') {
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
s->time->us = timelib_get_frac_nr((char **) &ptr, 9);
if (*ptr) { /* timezone is optional */
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
}
}
}
@@ -1564,7 +1580,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
s->time->s = timelib_get_nr((char **) &ptr, 2);
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
}
TIMELIB_DEINIT;
return TIMELIB_CLF;
@@ -1677,7 +1693,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
TIMELIB_HAVE_TZ();
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
}
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
@@ -1698,7 +1714,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == '.') {
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
}
}
@@ -1723,14 +1739,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == '.') {
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
}
}
if (*ptr != '\0') {
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
}
}
TIMELIB_DEINIT;
@@ -1766,7 +1782,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
any
{
add_error(s, "Unexpected character");
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
*/
@@ -1774,14 +1790,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
/*!max:re2c */
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)
timelib_time* timelib_strtotime(char *s, size_t len, 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 = timelib_malloc(sizeof(struct timelib_error_container));
in.errors = timelib_malloc(sizeof(timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
@@ -1797,13 +1813,13 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
}
if (e - s < 0) {
in.time = timelib_time_ctor();
add_error(&in, "Empty string");
add_error(&in, TIMELIB_ERR_EMPTY_STRING, "Empty string");
if (errors) {
*errors = in.errors;
} else {
timelib_error_container_dtor(in.errors);
}
in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->f = in.time->dst = in.time->z = TIMELIB_UNSET;
in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->us = in.time->dst = in.time->z = TIMELIB_UNSET;
in.time->is_localtime = in.time->zone_type = 0;
return in.time;
}
@@ -1821,7 +1837,7 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
in.time->h = TIMELIB_UNSET;
in.time->i = TIMELIB_UNSET;
in.time->s = TIMELIB_UNSET;
in.time->f = TIMELIB_UNSET;
in.time->us = TIMELIB_UNSET;
in.time->z = TIMELIB_UNSET;
in.time->dst = TIMELIB_UNSET;
in.tzdb = tzdb;
@@ -1838,11 +1854,11 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
/* do funky checking whether the parsed time was valid time */
if (in.time->have_time && !timelib_valid_time( in.time->h, in.time->i, in.time->s)) {
add_warning(&in, "The parsed time was invalid");
add_warning(&in, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid");
}
/* do funky checking whether the parsed date was valid date */
if (in.time->have_date && !timelib_valid_date( in.time->y, in.time->m, in.time->d)) {
add_warning(&in, "The parsed date was invalid");
add_warning(&in, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid");
}
timelib_free(in.str);
@@ -1857,12 +1873,12 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
#define TIMELIB_CHECK_NUMBER \
if (strchr("0123456789", *ptr) == NULL) \
{ \
add_pbf_error(s, "Unexpected data found.", string, begin); \
add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
}
#define TIMELIB_CHECK_SIGNED_NUMBER \
if (strchr("-0123456789", *ptr) == NULL) \
{ \
add_pbf_error(s, "Unexpected data found.", string, begin); \
add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
}
static void timelib_time_reset_fields(timelib_time *time)
@@ -1873,7 +1889,7 @@ static void timelib_time_reset_fields(timelib_time *time)
time->m = 1;
time->d = 1;
time->h = time->i = time->s = 0;
time->f = 0.0;
time->us = 0;
time->tz_info = NULL;
}
@@ -1887,7 +1903,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time)
if (time->h == TIMELIB_UNSET ) time->h = 0;
if (time->i == TIMELIB_UNSET ) time->i = 0;
if (time->s == TIMELIB_UNSET ) time->s = 0;
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
if (time->us == TIMELIB_UNSET ) time->us = 0;
}
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)
@@ -1901,7 +1917,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
int allow_extra = 0;
memset(&in, 0, sizeof(in));
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
in.errors = timelib_malloc(sizeof(timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
@@ -1914,7 +1930,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
in.time->h = TIMELIB_UNSET;
in.time->i = TIMELIB_UNSET;
in.time->s = TIMELIB_UNSET;
in.time->f = TIMELIB_UNSET;
in.time->us = TIMELIB_UNSET;
in.time->z = TIMELIB_UNSET;
in.time->dst = TIMELIB_UNSET;
in.tzdb = tzdb;
@@ -1932,7 +1948,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
tmprel = timelib_lookup_relunit((char **) &ptr);
if (!tmprel) {
add_pbf_error(s, "A textual day could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TEXTUAL_DAY, "A textual day could not be found", string, begin);
break;
} else {
in.time->have_relative = 1;
@@ -1946,7 +1962,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
case 'j': /* two digit day, without leading zero */
TIMELIB_CHECK_NUMBER;
if ((s->time->d = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
add_pbf_error(s, "A two digit day could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_DAY, "A two digit day could not be found", string, begin);
}
break;
case 'S': /* day suffix, ignored, nor checked */
@@ -1955,7 +1971,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
case 'z': /* day of year - resets month (0 based) - also initializes everything else to !TIMELIB_UNSET */
TIMELIB_CHECK_NUMBER;
if ((tmp = timelib_get_nr((char **) &ptr, 3)) == TIMELIB_UNSET) {
add_pbf_error(s, "A three digit day-of-year could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_THREE_DIGIT_DAY_OF_YEAR, "A three digit day-of-year could not be found", string, begin);
} else {
s->time->m = 1;
s->time->d = tmp + 1;
@@ -1967,14 +1983,14 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
case 'n': /* two digit month, without leading zero */
TIMELIB_CHECK_NUMBER;
if ((s->time->m = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
add_pbf_error(s, "A two digit month could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_MONTH, "A two digit month could not be found", string, begin);
}
break;
case 'M': /* three letter month */
case 'F': /* full month */
tmp = timelib_lookup_month((char **) &ptr);
if (!tmp) {
add_pbf_error(s, "A textual month could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TEXTUAL_MONTH, "A textual month could not be found", string, begin);
} else {
s->time->m = tmp;
}
@@ -1984,7 +2000,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
int length = 0;
TIMELIB_CHECK_NUMBER;
if ((s->time->y = timelib_get_nr_ex((char **) &ptr, 2, &length)) == TIMELIB_UNSET) {
add_pbf_error(s, "A two digit year could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_YEAR, "A two digit year could not be found", string, begin);
}
TIMELIB_PROCESS_YEAR(s->time->y, length);
}
@@ -1992,32 +2008,32 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
case 'Y': /* four digit year */
TIMELIB_CHECK_NUMBER;
if ((s->time->y = timelib_get_nr((char **) &ptr, 4)) == TIMELIB_UNSET) {
add_pbf_error(s, "A four digit year could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_FOUR_DIGIT_YEAR, "A four digit year could not be found", string, begin);
}
break;
case 'g': /* two digit hour, with leading zero */
case 'h': /* two digit hour, without leading zero */
TIMELIB_CHECK_NUMBER;
if ((s->time->h = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
add_pbf_error(s, "A two digit hour could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_HOUR, "A two digit hour could not be found", string, begin);
}
if (s->time->h > 12) {
add_pbf_error(s, "Hour can not be higher than 12", string, begin);
add_pbf_error(s, TIMELIB_ERR_HOUR_LARGER_THAN_12, "Hour can not be higher than 12", string, begin);
}
break;
case 'G': /* two digit hour, with leading zero */
case 'H': /* two digit hour, without leading zero */
TIMELIB_CHECK_NUMBER;
if ((s->time->h = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
add_pbf_error(s, "A two digit hour could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_HOUR, "A two digit hour could not be found", string, begin);
}
break;
case 'a': /* am/pm/a.m./p.m. */
case 'A': /* AM/PM/A.M./P.M. */
if (s->time->h == TIMELIB_UNSET) {
add_pbf_error(s, "Meridian can only come after an hour has been found", string, begin);
add_pbf_error(s, TIMELIB_ERR_MERIDIAN_BEFORE_HOUR, "Meridian can only come after an hour has been found", string, begin);
} else if ((tmp = timelib_meridian_with_check((char **) &ptr, s->time->h)) == TIMELIB_UNSET) {
add_pbf_error(s, "A meridian could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_MERIDIAN, "A meridian could not be found", string, begin);
} else {
s->time->h += tmp;
}
@@ -2030,7 +2046,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
TIMELIB_CHECK_NUMBER;
min = timelib_get_nr_ex((char **) &ptr, 2, &length);
if (min == TIMELIB_UNSET || length != 2) {
add_pbf_error(s, "A two digit minute could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_MINUTE, "A two digit minute could not be found", string, begin);
} else {
s->time->i = min;
}
@@ -2044,13 +2060,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
TIMELIB_CHECK_NUMBER;
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
if (sec == TIMELIB_UNSET || length != 2) {
add_pbf_error(s, "A two digit second could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_SECOND, "A two digit second could not be found", string, begin);
} else {
s->time->s = sec;
}
}
break;
case 'u': /* up to six digit millisecond */
case 'u': /* up to six digit microsecond */
{
double f;
char *tptr;
@@ -2058,9 +2074,9 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
TIMELIB_CHECK_NUMBER;
tptr = ptr;
if ((f = timelib_get_nr((char **) &ptr, 6)) == TIMELIB_UNSET || (ptr - tptr < 1)) {
add_pbf_error(s, "A six digit millisecond could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_SIX_DIGIT_MICROSECOND, "A six digit microsecond could not be found", string, begin);
} else {
s->time->f = (f / pow(10, (ptr - tptr)));
s->time->us = (f * pow(10, 6 - (ptr - tptr)));
}
}
break;
@@ -2090,7 +2106,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
int tz_not_found;
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
if (tz_not_found) {
add_pbf_error(s, "The timezone could not be found in the database", string, begin);
add_pbf_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database", string, begin);
}
}
break;
@@ -2099,7 +2115,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
if (*ptr == ';' || *ptr == ':' || *ptr == '/' || *ptr == '.' || *ptr == ',' || *ptr == '-' || *ptr == '(' || *ptr == ')') {
++ptr;
} else {
add_pbf_error(s, "The separation symbol ([;:/.,-]) could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_SEP_SYMBOL, "The separation symbol ([;:/.,-]) could not be found", string, begin);
}
break;
@@ -2114,7 +2130,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
if (*ptr == *fptr) {
++ptr;
} else {
add_pbf_error(s, "The separation symbol could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_SEP_SYMBOL, "The separation symbol could not be found", string, begin);
}
break;
@@ -2132,14 +2148,14 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
case '\\': /* escaped char */
if(!fptr[1]) {
add_pbf_error(s, "Escaped character expected", string, begin);
add_pbf_error(s, TIMELIB_ERR_EXPECTED_ESCAPE_CHAR, "Escaped character expected", string, begin);
break;
}
fptr++;
if (*ptr == *fptr) {
++ptr;
} else {
add_pbf_error(s, "The escaped character could not be found", string, begin);
add_pbf_error(s, TIMELIB_ERR_NO_ESCAPED_CHAR, "The escaped character could not be found", string, begin);
}
break;
@@ -2153,7 +2169,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
default:
if (*fptr != *ptr) {
add_pbf_error(s, "The format separator does not match", string, begin);
add_pbf_error(s, TIMELIB_ERR_WRONG_FORMAT_SEP, "The format separator does not match", string, begin);
}
ptr++;
}
@@ -2161,9 +2177,9 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
}
if (*ptr) {
if (allow_extra) {
add_pbf_warning(s, "Trailing data", string, ptr);
add_pbf_warning(s, TIMELIB_WARN_TRAILING_DATA, "Trailing data", string, ptr);
} else {
add_pbf_error(s, "Trailing data", string, ptr);
add_pbf_error(s, TIMELIB_ERR_TRAILING_DATA, "Trailing data", string, ptr);
}
}
/* ignore trailing +'s */
@@ -2184,7 +2200,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
break;
default:
add_pbf_error(s, "Data missing", string, ptr);
add_pbf_error(s, TIMELIB_ERR_DATA_MISSING, "Data missing", string, ptr);
done = 1;
}
}
@@ -2207,13 +2223,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
s->time->s != TIMELIB_UNSET &&
!timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
add_pbf_warning(s, "The parsed time was invalid", string, ptr);
add_pbf_warning(s, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid", string, ptr);
}
/* do funky checking whether the parsed date was valid date */
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
!timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
add_pbf_warning(s, "The parsed date was invalid", string, ptr);
add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);
}
if (errors) {
@@ -2230,15 +2246,15 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
parsed->h = 0;
parsed->i = 0;
parsed->s = 0;
parsed->f = 0;
parsed->us = 0;
}
if (
parsed->y != TIMELIB_UNSET || parsed->m != TIMELIB_UNSET || parsed->d != TIMELIB_UNSET ||
parsed->h != TIMELIB_UNSET || parsed->i != TIMELIB_UNSET || parsed->s != TIMELIB_UNSET
) {
if (parsed->f == TIMELIB_UNSET) parsed->f = 0;
if (parsed->us == TIMELIB_UNSET) parsed->us = 0;
} else {
if (parsed->f == TIMELIB_UNSET) parsed->f = now->f != TIMELIB_UNSET ? now->f : 0;
if (parsed->us == TIMELIB_UNSET) parsed->us = now->us != TIMELIB_UNSET ? now->us : 0;
}
if (parsed->y == TIMELIB_UNSET) parsed->y = now->y != TIMELIB_UNSET ? now->y : 0;
if (parsed->m == TIMELIB_UNSET) parsed->m = now->m != TIMELIB_UNSET ? now->m : 0;
+162 -141
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Thu Aug 13 10:30:12 2015 */
/* Generated by re2c 0.15.3 on Mon Sep 4 22:44:07 2017 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
* The MIT License (MIT)
@@ -27,19 +27,10 @@
/* $Id$ */
#include "timelib.h"
#include "timelib_private.h"
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#if defined(_MSC_VER)
# define strtoll(s, f, b) _atoi64(s)
#elif !defined(HAVE_STRTOLL)
@@ -50,15 +41,6 @@
# endif
#endif
#define TIMELIB_UNSET -99999
#define TIMELIB_SECOND 1
#define TIMELIB_MINUTE 2
#define TIMELIB_HOUR 3
#define TIMELIB_DAY 4
#define TIMELIB_MONTH 5
#define TIMELIB_YEAR 6
#define EOI 257
#define TIMELIB_PERIOD 260
@@ -90,18 +72,16 @@ typedef unsigned char uchar;
#define YYDEBUG(s,c)
#endif
#include "timelib_structs.h"
typedef struct Scanner {
typedef struct _Scanner {
int fd;
uchar *lim, *str, *ptr, *cur, *tok, *pos;
unsigned int line, len;
struct timelib_error_container *errors;
timelib_error_container *errors;
struct timelib_time *begin;
struct timelib_time *end;
struct timelib_rel_time *period;
int recurrences;
timelib_time *begin;
timelib_time *end;
timelib_rel_time *period;
int recurrences;
int have_period;
int have_recurrences;
@@ -110,15 +90,6 @@ typedef struct Scanner {
int have_end_date;
} Scanner;
static void add_warning(Scanner *s, char *error)
{
s->errors->warning_count++;
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 = timelib_strdup(error);
}
static void add_error(Scanner *s, char *error)
{
s->errors->error_count++;
@@ -182,55 +153,6 @@ static timelib_ull timelib_get_unsigned_nr(char **ptr, int max_length)
return dir * timelib_get_nr(ptr, max_length);
}
static void timelib_eat_spaces(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t') {
++*ptr;
}
}
static void timelib_eat_until_separator(char **ptr)
{
while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
++*ptr;
}
}
static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
{
timelib_long retval = 0;
*tz_not_found = 0;
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
++*ptr;
}
if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == '-')) {
*ptr += 3;
}
if (**ptr == '+') {
++*ptr;
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
*tz_not_found = 0;
t->dst = 0;
retval = -1 * timelib_parse_tz_cor(ptr);
} else if (**ptr == '-') {
++*ptr;
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
*tz_not_found = 0;
t->dst = 0;
retval = timelib_parse_tz_cor(ptr);
}
while (**ptr == ')') {
++*ptr;
}
return retval;
}
#define timelib_split_free(arg) { \
int i; \
for (i = 0; i < arg.c; i++) { \
@@ -254,49 +176,49 @@ static int scan(Scanner *s)
std:
s->tok = cursor;
s->len = 0;
#line 282 "ext/date/lib/parse_iso_intervals.re"
#line 204 "ext/date/lib/parse_iso_intervals.re"
#line 262 "ext/date/lib/parse_iso_intervals.c"
#line 184 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
YYDEBUG(0, *YYCURSOR);
if ((YYLIMIT - YYCURSOR) < 20) YYFILL(20);
yych = *YYCURSOR;
if (yych <= ',') {
@@ -321,30 +243,35 @@ std:
if (yych != 'R') goto yy11;
}
}
YYDEBUG(2, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '/') goto yy3;
if (yych <= '9') goto yy98;
yy3:
#line 395 "ext/date/lib/parse_iso_intervals.re"
YYDEBUG(3, *YYCURSOR);
#line 317 "ext/date/lib/parse_iso_intervals.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 334 "ext/date/lib/parse_iso_intervals.c"
#line 258 "<stdout>"
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:
#line 322 "ext/date/lib/parse_iso_intervals.re"
YYDEBUG(6, *YYCURSOR);
#line 244 "ext/date/lib/parse_iso_intervals.re"
{
timelib_sll nr;
int in_time = 0;
@@ -385,26 +312,32 @@ yy6:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
#line 389 "ext/date/lib/parse_iso_intervals.c"
#line 316 "<stdout>"
yy7:
YYDEBUG(7, *YYCURSOR);
++YYCURSOR;
#line 384 "ext/date/lib/parse_iso_intervals.re"
YYDEBUG(8, *YYCURSOR);
#line 306 "ext/date/lib/parse_iso_intervals.re"
{
goto std;
}
#line 396 "ext/date/lib/parse_iso_intervals.c"
#line 325 "<stdout>"
yy9:
YYDEBUG(9, *YYCURSOR);
++YYCURSOR;
#line 389 "ext/date/lib/parse_iso_intervals.re"
YYDEBUG(10, *YYCURSOR);
#line 311 "ext/date/lib/parse_iso_intervals.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 404 "ext/date/lib/parse_iso_intervals.c"
#line 335 "<stdout>"
yy11:
YYDEBUG(11, *YYCURSOR);
yych = *++YYCURSOR;
goto yy3;
yy12:
YYDEBUG(12, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'L') {
if (yych <= '9') {
@@ -421,13 +354,15 @@ yy12:
}
}
yy13:
YYDEBUG(13, *YYCURSOR);
YYCURSOR = YYMARKER;
if (yyaccept <= 0) {
if (yyaccept == 0) {
goto yy3;
} else {
goto yy6;
}
yy14:
YYDEBUG(14, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 128) {
@@ -435,9 +370,11 @@ 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;
}
@@ -449,23 +386,28 @@ 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;
@@ -476,18 +418,22 @@ 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') {
@@ -507,6 +453,7 @@ yy25:
}
}
yy26:
YYDEBUG(26, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
@@ -514,6 +461,7 @@ yy26:
if (yych == 'T') goto yy14;
goto yy6;
yy27:
YYDEBUG(27, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
@@ -521,6 +469,7 @@ yy27:
if (yych == 'T') goto yy14;
goto yy6;
yy28:
YYDEBUG(28, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') goto yy6;
@@ -528,9 +477,11 @@ 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;
@@ -546,9 +497,11 @@ 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;
@@ -559,14 +512,17 @@ 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') {
@@ -585,18 +541,22 @@ 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;
@@ -616,17 +576,21 @@ 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;
@@ -634,55 +598,70 @@ 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;
#line 364 "ext/date/lib/parse_iso_intervals.re"
YYDEBUG(58, *YYCURSOR);
#line 286 "ext/date/lib/parse_iso_intervals.re"
{
DEBUG_OUTPUT("combinedrep");
TIMELIB_INIT;
@@ -701,14 +680,17 @@ yy51:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
#line 705 "ext/date/lib/parse_iso_intervals.c"
#line 684 "<stdout>"
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;
@@ -719,33 +701,40 @@ 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;
@@ -753,58 +742,74 @@ 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;
#line 298 "ext/date/lib/parse_iso_intervals.re"
YYDEBUG(84, *YYCURSOR);
#line 220 "ext/date/lib/parse_iso_intervals.re"
{
timelib_time *current;
@@ -827,8 +832,9 @@ yy83:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 831 "ext/date/lib/parse_iso_intervals.c"
#line 836 "<stdout>"
yy85:
YYDEBUG(85, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '/') goto yy13;
if (yych <= '0') goto yy86;
@@ -836,60 +842,75 @@ 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:
#line 287 "ext/date/lib/parse_iso_intervals.re"
YYDEBUG(100, *YYCURSOR);
#line 209 "ext/date/lib/parse_iso_intervals.re"
{
DEBUG_OUTPUT("recurrences");
TIMELIB_INIT;
@@ -899,9 +920,9 @@ yy100:
s->have_recurrences = 1;
return TIMELIB_PERIOD;
}
#line 903 "ext/date/lib/parse_iso_intervals.c"
#line 924 "<stdout>"
}
#line 399 "ext/date/lib/parse_iso_intervals.re"
#line 321 "ext/date/lib/parse_iso_intervals.re"
}
#ifdef PHP_WIN32
@@ -913,14 +934,14 @@ yy100:
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)
timelib_error_container **errors)
{
Scanner in;
int t;
char *e = s + len - 1;
memset(&in, 0, sizeof(in));
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
in.errors = timelib_malloc(sizeof(timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
@@ -960,7 +981,7 @@ void timelib_strtointerval(char *s, size_t len,
in.begin->h = TIMELIB_UNSET;
in.begin->i = TIMELIB_UNSET;
in.begin->s = TIMELIB_UNSET;
in.begin->f = 0;
in.begin->us = 0;
in.begin->z = 0;
in.begin->dst = 0;
in.begin->is_localtime = 0;
@@ -973,7 +994,7 @@ void timelib_strtointerval(char *s, size_t len,
in.end->h = TIMELIB_UNSET;
in.end->i = TIMELIB_UNSET;
in.end->s = TIMELIB_UNSET;
in.end->f = 0;
in.end->us = 0;
in.end->z = 0;
in.end->dst = 0;
in.end->is_localtime = 0;
+11 -89
View File
@@ -25,19 +25,10 @@
/* $Id$ */
#include "timelib.h"
#include "timelib_private.h"
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#if defined(_MSC_VER)
# define strtoll(s, f, b) _atoi64(s)
#elif !defined(HAVE_STRTOLL)
@@ -48,15 +39,6 @@
# endif
#endif
#define TIMELIB_UNSET -99999
#define TIMELIB_SECOND 1
#define TIMELIB_MINUTE 2
#define TIMELIB_HOUR 3
#define TIMELIB_DAY 4
#define TIMELIB_MONTH 5
#define TIMELIB_YEAR 6
#define EOI 257
#define TIMELIB_PERIOD 260
@@ -88,18 +70,16 @@ typedef unsigned char uchar;
#define YYDEBUG(s,c)
#endif
#include "timelib_structs.h"
typedef struct Scanner {
typedef struct _Scanner {
int fd;
uchar *lim, *str, *ptr, *cur, *tok, *pos;
unsigned int line, len;
struct timelib_error_container *errors;
timelib_error_container *errors;
struct timelib_time *begin;
struct timelib_time *end;
struct timelib_rel_time *period;
int recurrences;
timelib_time *begin;
timelib_time *end;
timelib_rel_time *period;
int recurrences;
int have_period;
int have_recurrences;
@@ -108,15 +88,6 @@ typedef struct Scanner {
int have_end_date;
} Scanner;
static void add_warning(Scanner *s, char *error)
{
s->errors->warning_count++;
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 = timelib_strdup(error);
}
static void add_error(Scanner *s, char *error)
{
s->errors->error_count++;
@@ -180,55 +151,6 @@ static timelib_ull timelib_get_unsigned_nr(char **ptr, int max_length)
return dir * timelib_get_nr(ptr, max_length);
}
static void timelib_eat_spaces(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t') {
++*ptr;
}
}
static void timelib_eat_until_separator(char **ptr)
{
while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
++*ptr;
}
}
static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
{
timelib_long retval = 0;
*tz_not_found = 0;
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
++*ptr;
}
if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == '-')) {
*ptr += 3;
}
if (**ptr == '+') {
++*ptr;
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
*tz_not_found = 0;
t->dst = 0;
retval = -1 * timelib_parse_tz_cor(ptr);
} else if (**ptr == '-') {
++*ptr;
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
*tz_not_found = 0;
t->dst = 0;
retval = timelib_parse_tz_cor(ptr);
}
while (**ptr == ')') {
++*ptr;
}
return retval;
}
#define timelib_split_free(arg) { \
int i; \
for (i = 0; i < arg.c; i++) { \
@@ -407,14 +329,14 @@ isoweek = year4 "-"? "W" weekofyear;
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)
timelib_error_container **errors)
{
Scanner in;
int t;
char *e = s + len - 1;
memset(&in, 0, sizeof(in));
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
in.errors = timelib_malloc(sizeof(timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
@@ -454,7 +376,7 @@ void timelib_strtointerval(char *s, size_t len,
in.begin->h = TIMELIB_UNSET;
in.begin->i = TIMELIB_UNSET;
in.begin->s = TIMELIB_UNSET;
in.begin->f = 0;
in.begin->us = 0;
in.begin->z = 0;
in.begin->dst = 0;
in.begin->is_localtime = 0;
@@ -467,7 +389,7 @@ void timelib_strtointerval(char *s, size_t len,
in.end->h = TIMELIB_UNSET;
in.end->i = TIMELIB_UNSET;
in.end->s = TIMELIB_UNSET;
in.end->f = 0;
in.end->us = 0;
in.end->z = 0;
in.end->dst = 0;
in.end->is_localtime = 0;
+234 -67
View File
@@ -23,18 +23,7 @@
*/
#include "timelib.h"
#include <stdio.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "timelib_private.h"
#define TIMELIB_SUPPORTS_V2DATA
#include "timezonedb.h"
@@ -49,13 +38,32 @@
# endif
#endif
#ifdef WORDS_BIGENDIAN
#define timelib_conv_int(l) (l)
#else
#define timelib_conv_int(l) ((l & 0x000000ff) << 24) + ((l & 0x0000ff00) << 8) + ((l & 0x00ff0000) >> 8) + ((l & 0xff000000) >> 24)
#if defined(__s390__)
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define WORDS_BIGENDIAN
# else
# undef WORDS_BIGENDIAN
# endif
#endif
static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
#ifdef WORDS_BIGENDIAN
static inline uint32_t timelib_conv_int_unsigned(uint32_t value)
{
return value;
}
#else
static inline uint32_t timelib_conv_int_unsigned(uint32_t value)
{
return ((value & 0x000000ff) << 24) +
((value & 0x0000ff00) << 8) +
((value & 0x00ff0000) >> 8) +
((value & 0xff000000) >> 24);
}
#endif
#define timelib_conv_int_signed(value) ((int32_t) timelib_conv_int_unsigned((int32_t) value))
static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
{
uint32_t version;
@@ -78,21 +86,67 @@ static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
return version;
}
static int read_tzif_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
{
uint32_t version;
/* read ID */
switch ((*tzf)[4]) {
case '\0':
version = 0;
break;
case '2':
version = 2;
break;
case '3':
version = 3;
break;
default:
return -1;
}
*tzf += 5;
/* set BC flag and country code to default */
tz->bc = 0;
tz->location.country_code[0] = '?';
tz->location.country_code[1] = '?';
tz->location.country_code[2] = '\0';
/* skip rest of preamble */
*tzf += 15;
return version;
}
static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz, unsigned int *type)
{
/* read marker (TZif) or (PHP) */
if (memcmp(*tzf, "PHP", 3) == 0) {
*type = TIMELIB_TZINFO_PHP;
return read_php_preamble(tzf, tz);
} else if (memcmp(*tzf, "TZif", 4) == 0) {
*type = TIMELIB_TZINFO_ZONEINFO;
return read_tzif_preamble(tzf, tz);
} else {
return -1;
}
}
static void read_header(const unsigned char **tzf, timelib_tzinfo *tz)
{
uint32_t buffer[6];
memcpy(&buffer, *tzf, sizeof(buffer));
tz->bit32.ttisgmtcnt = timelib_conv_int(buffer[0]);
tz->bit32.ttisstdcnt = timelib_conv_int(buffer[1]);
tz->bit32.leapcnt = timelib_conv_int(buffer[2]);
tz->bit32.timecnt = timelib_conv_int(buffer[3]);
tz->bit32.typecnt = timelib_conv_int(buffer[4]);
tz->bit32.charcnt = timelib_conv_int(buffer[5]);
tz->bit32.ttisgmtcnt = timelib_conv_int_unsigned(buffer[0]);
tz->bit32.ttisstdcnt = timelib_conv_int_unsigned(buffer[1]);
tz->bit32.leapcnt = timelib_conv_int_unsigned(buffer[2]);
tz->bit32.timecnt = timelib_conv_int_unsigned(buffer[3]);
tz->bit32.typecnt = timelib_conv_int_unsigned(buffer[4]);
tz->bit32.charcnt = timelib_conv_int_unsigned(buffer[5]);
*tzf += sizeof(buffer);
}
static void skip_64bit_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
static void skip_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
{
if (tz->bit64.timecnt) {
*tzf += (sizeof(int64_t) * tz->bit64.timecnt);
@@ -100,7 +154,7 @@ static void skip_64bit_transistions(const unsigned char **tzf, timelib_tzinfo *t
}
}
static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
static int read_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
{
int32_t *buffer = NULL;
uint32_t i;
@@ -109,18 +163,22 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
if (tz->bit32.timecnt) {
buffer = (int32_t*) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
if (!buffer) {
return;
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(buffer, *tzf, sizeof(int32_t) * tz->bit32.timecnt);
*tzf += (sizeof(int32_t) * tz->bit32.timecnt);
for (i = 0; i < tz->bit32.timecnt; i++) {
buffer[i] = timelib_conv_int(buffer[i]);
buffer[i] = timelib_conv_int_signed(buffer[i]);
/* Sanity check to see whether TS is just increasing */
if (i > 0 && !(buffer[i] > buffer[i - 1])) {
return TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE;
}
}
cbuffer = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
if (!cbuffer) {
timelib_free(buffer);
return;
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit32.timecnt);
*tzf += sizeof(unsigned char) * tz->bit32.timecnt;
@@ -128,6 +186,8 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
tz->trans = buffer;
tz->trans_idx = cbuffer;
return 0;
}
static void skip_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
@@ -145,7 +205,7 @@ static void skip_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
}
}
static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
static int read_types(const unsigned char **tzf, timelib_tzinfo *tz)
{
unsigned char *buffer;
int32_t *leap_buffer;
@@ -153,20 +213,21 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
buffer = (unsigned char*) timelib_malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
if (!buffer) {
return;
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit32.typecnt);
*tzf += sizeof(unsigned char) * 6 * tz->bit32.typecnt;
tz->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
tz->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(ttinfo));
if (!tz->type) {
timelib_free(buffer);
return;
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
for (i = 0; i < tz->bit32.typecnt; i++) {
j = i * 6;
tz->type[i].offset = (buffer[j] * 16777216) + (buffer[j + 1] * 65536) + (buffer[j + 2] * 256) + buffer[j + 3];
tz->type[i].offset = 0;
tz->type[i].offset += (int32_t) (((uint32_t) buffer[j]) << 24) + (buffer[j + 1] << 16) + (buffer[j + 2] << 8) + tz->type[i].offset + buffer[j + 3];
tz->type[i].isdst = buffer[j + 4];
tz->type[i].abbr_idx = buffer[j + 5];
}
@@ -174,7 +235,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
tz->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
if (!tz->timezone_abbr) {
return;
return TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION;
}
memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit32.charcnt);
*tzf += sizeof(char) * tz->bit32.charcnt;
@@ -182,7 +243,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
if (tz->bit32.leapcnt) {
leap_buffer = (int32_t *) timelib_malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
if (!leap_buffer) {
return;
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->bit32.leapcnt * 2);
*tzf += sizeof(int32_t) * tz->bit32.leapcnt * 2;
@@ -190,11 +251,11 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
tz->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
if (!tz->leap_times) {
timelib_free(leap_buffer);
return;
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
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]);
tz->leap_times[i].trans = timelib_conv_int_signed(leap_buffer[i * 2]);
tz->leap_times[i].offset = timelib_conv_int_signed(leap_buffer[i * 2 + 1]);
}
timelib_free(leap_buffer);
}
@@ -202,7 +263,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
if (tz->bit32.ttisstdcnt) {
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
if (!buffer) {
return;
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisstdcnt);
*tzf += sizeof(unsigned char) * tz->bit32.ttisstdcnt;
@@ -216,7 +277,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
if (tz->bit32.ttisgmtcnt) {
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
if (!buffer) {
return;
return TIMELIB_ERROR_CANNOT_ALLOCATE;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisgmtcnt);
*tzf += sizeof(unsigned char) * tz->bit32.ttisgmtcnt;
@@ -226,6 +287,8 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
}
timelib_free(buffer);
}
return 0;
}
static void skip_posix_string(const unsigned char **tzf, timelib_tzinfo *tz)
@@ -246,11 +309,11 @@ static void read_location(const unsigned char **tzf, timelib_tzinfo *tz)
uint32_t comments_len;
memcpy(&buffer, *tzf, sizeof(buffer));
tz->location.latitude = timelib_conv_int(buffer[0]);
tz->location.latitude = timelib_conv_int_unsigned(buffer[0]);
tz->location.latitude = (tz->location.latitude / 100000) - 90;
tz->location.longitude = timelib_conv_int(buffer[1]);
tz->location.longitude = timelib_conv_int_unsigned(buffer[1]);
tz->location.longitude = (tz->location.longitude / 100000) - 180;
comments_len = timelib_conv_int(buffer[2]);
comments_len = timelib_conv_int_unsigned(buffer[2]);
*tzf += sizeof(buffer);
tz->location.comments = timelib_malloc(comments_len + 1);
@@ -259,6 +322,15 @@ static void read_location(const unsigned char **tzf, timelib_tzinfo *tz)
*tzf += comments_len;
}
static void set_default_location_and_comments(const unsigned char **tzf, timelib_tzinfo *tz)
{
tz->location.latitude = 0;
tz->location.longitude = 0;
tz->location.comments = timelib_malloc(2);
tz->location.comments[0] = '?';
tz->location.comments[1] = '\0';
}
void timelib_dump_tzinfo(timelib_tzinfo *tz)
{
uint32_t i;
@@ -307,7 +379,13 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
int left = 0, right = tzdb->index_size - 1;
#ifdef HAVE_SETLOCALE
char *cur_locale = NULL, *tmp;
#endif
if (tzdb->index_size == 0) {
return 0;
}
#ifdef HAVE_SETLOCALE
tmp = setlocale(LC_CTYPE, NULL);
if (tmp) {
cur_locale = timelib_strdup(tmp);
@@ -346,10 +424,10 @@ const timelib_tzdb *timelib_builtin_db(void)
return &timezonedb_builtin;
}
const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count)
const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(timelib_tzdb *tzdb, int *count)
{
*count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin);
return timezonedb_idx_builtin;
*count = tzdb->index_size;
return tzdb->index;
}
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
@@ -358,9 +436,17 @@ int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
return (seek_to_tz_position(&tzf, timezone, tzdb));
}
static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
{
*tzf += 20;
if (memcmp(*tzf, "TZif2", 5) == 0) {
*tzf += 20;
return 1;
} else if (memcmp(*tzf, "TZif3", 5) == 0) {
*tzf += 20;
return 1;
} else {
return 0;
}
}
static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
@@ -368,43 +454,124 @@ static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
uint32_t buffer[6];
memcpy(&buffer, *tzf, sizeof(buffer));
tz->bit64.ttisgmtcnt = timelib_conv_int(buffer[0]);
tz->bit64.ttisstdcnt = timelib_conv_int(buffer[1]);
tz->bit64.leapcnt = timelib_conv_int(buffer[2]);
tz->bit64.timecnt = timelib_conv_int(buffer[3]);
tz->bit64.typecnt = timelib_conv_int(buffer[4]);
tz->bit64.charcnt = timelib_conv_int(buffer[5]);
tz->bit64.ttisgmtcnt = timelib_conv_int_unsigned(buffer[0]);
tz->bit64.ttisstdcnt = timelib_conv_int_unsigned(buffer[1]);
tz->bit64.leapcnt = timelib_conv_int_unsigned(buffer[2]);
tz->bit64.timecnt = timelib_conv_int_unsigned(buffer[3]);
tz->bit64.typecnt = timelib_conv_int_unsigned(buffer[4]);
tz->bit64.charcnt = timelib_conv_int_unsigned(buffer[5]);
*tzf += sizeof(buffer);
}
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
static timelib_tzinfo* timelib_tzinfo_ctor(char *name)
{
timelib_tzinfo *t;
t = timelib_calloc(1, sizeof(timelib_tzinfo));
t->name = timelib_strdup(name);
return t;
}
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code)
{
const unsigned char *tzf;
timelib_tzinfo *tmp;
int version;
int transitions_result, types_result;
unsigned int type; /* TIMELIB_TZINFO_PHP or TIMELIB_TZINFO_ZONEINFO */
if (seek_to_tz_position(&tzf, timezone, tzdb)) {
tmp = timelib_tzinfo_ctor(timezone);
version = read_preamble(&tzf, tmp);
version = read_preamble(&tzf, tmp, &type);
if (version == -1) {
*error_code = TIMELIB_ERROR_UNSUPPORTED_VERSION;
timelib_tzinfo_dtor(tmp);
return NULL;
}
//printf("- timezone: %s, version: %0d\n", timezone, version);
read_header(&tzf, tmp);
read_transistions(&tzf, tmp);
read_types(&tzf, tmp);
if (version == 2) {
skip_64bit_preamble(&tzf, tmp);
if ((transitions_result = read_transitions(&tzf, tmp)) != 0) {
/* Corrupt file as transitions do not increase */
*error_code = transitions_result;
timelib_tzinfo_dtor(tmp);
return NULL;
}
if ((types_result = read_types(&tzf, tmp)) != 0) {
*error_code = types_result;
timelib_tzinfo_dtor(tmp);
return NULL;
}
if (version == 2 || version == 3) {
if (!skip_64bit_preamble(&tzf, tmp)) {
/* 64 bit preamble is not in place */
*error_code = TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE;
return NULL;
}
read_64bit_header(&tzf, tmp);
skip_64bit_transistions(&tzf, tmp);
skip_64bit_transitions(&tzf, tmp);
skip_64bit_types(&tzf, tmp);
skip_posix_string(&tzf, tmp);
}
read_location(&tzf, tmp);
if (type == TIMELIB_TZINFO_PHP) {
read_location(&tzf, tmp);
} else {
set_default_location_and_comments(&tzf, tmp);
}
} else {
*error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE;
tmp = NULL;
}
return tmp;
}
void timelib_tzinfo_dtor(timelib_tzinfo *tz)
{
TIMELIB_TIME_FREE(tz->name);
TIMELIB_TIME_FREE(tz->trans);
TIMELIB_TIME_FREE(tz->trans_idx);
TIMELIB_TIME_FREE(tz->type);
TIMELIB_TIME_FREE(tz->timezone_abbr);
TIMELIB_TIME_FREE(tz->leap_times);
TIMELIB_TIME_FREE(tz->location.comments);
TIMELIB_TIME_FREE(tz);
tz = NULL;
}
timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
{
timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
tmp->bit32.leapcnt = tz->bit32.leapcnt;
tmp->bit32.timecnt = tz->bit32.timecnt;
tmp->bit32.typecnt = tz->bit32.typecnt;
tmp->bit32.charcnt = tz->bit32.charcnt;
if (tz->bit32.timecnt) {
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*) timelib_malloc(tz->bit32.typecnt * sizeof(ttinfo));
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(ttinfo));
tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
if (tz->bit32.leapcnt) {
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;
}
static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib_sll *transition_time)
{
uint32_t i;
@@ -483,18 +650,18 @@ timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *
int32_t offset = 0, leap_secs = 0;
char *abbr;
timelib_time_offset *tmp = timelib_time_offset_ctor();
timelib_sll transistion_time;
timelib_sll transition_time;
if ((to = fetch_timezone_offset(tz, ts, &transistion_time))) {
if ((to = fetch_timezone_offset(tz, ts, &transition_time))) {
offset = to->offset;
abbr = &(tz->timezone_abbr[to->abbr_idx]);
tmp->is_dst = to->isdst;
tmp->transistion_time = transistion_time;
tmp->transition_time = transition_time;
} else {
offset = 0;
abbr = tz->timezone_abbr;
tmp->is_dst = 0;
tmp->transistion_time = 0;
tmp->transition_time = 0;
}
if ((tl = fetch_leaptime_offset(tz, ts))) {
@@ -516,7 +683,7 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
switch (t->zone_type) {
case TIMELIB_ZONETYPE_ABBR:
case TIMELIB_ZONETYPE_OFFSET:
return (t->z + t->dst) * -60;
return t->z + (t->dst * 3600);
case TIMELIB_ZONETYPE_ID:
gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
+65 -123
View File
@@ -23,18 +23,31 @@
*/
#include "timelib.h"
#include "timelib_private.h"
#include <ctype.h>
#include <math.h>
#define TIMELIB_TIME_FREE(m) \
if (m) { \
timelib_free(m); \
m = NULL; \
} \
#define TIMELIB_LLABS(y) (y < 0 ? (y * -1) : y)
#define HOUR(a) (int)(a * 60)
const char *timelib_error_messages[8] = {
"No error",
"Can not allocate buffer for parsing",
"Corrupt tzfile: The transitions in the file don't always increase",
"Corrupt tzfile: The expected 64-bit preamble is missing",
"Corrupt tzfile: No abbreviation could be found for a transition",
"The version used in this timezone identifier is unsupported",
"No timezone with this name could be found",
};
const char *timelib_get_error_message(int error_code)
{
int entries = sizeof(timelib_error_messages) / sizeof(char*);
if (error_code >= 0 && error_code < entries) {
return timelib_error_messages[error_code];
}
return "Unknown error code";
}
timelib_time* timelib_time_ctor(void)
{
@@ -44,12 +57,23 @@ timelib_time* timelib_time_ctor(void)
return t;
}
timelib_rel_time* timelib_rel_time_ctor(void)
void timelib_time_dtor(timelib_time* t)
{
timelib_rel_time *t;
t = timelib_calloc(1, sizeof(timelib_rel_time));
TIMELIB_TIME_FREE(t->tz_abbr);
TIMELIB_TIME_FREE(t);
}
return t;
int timelib_time_compare(timelib_time *t1, timelib_time *t2)
{
if (t1->sse == t2->sse) {
if (t1->us == t2->us) {
return 0;
}
return (t1->us < t2->us) ? -1 : 1;
}
return (t1->sse < t2->sse) ? -1 : 1;
}
timelib_time* timelib_time_clone(timelib_time *orig)
@@ -65,21 +89,17 @@ timelib_time* timelib_time_clone(timelib_time *orig)
return tmp;
}
int timelib_time_compare(timelib_time *t1, timelib_time *t2)
timelib_rel_time* timelib_rel_time_ctor(void)
{
if (t1->sse == t2->sse) {
if (t1->f == t2->f) {
return 0;
}
timelib_rel_time *t;
t = timelib_calloc(1, sizeof(timelib_rel_time));
if (t1->sse < 0) {
return (t1->f < t2->f) ? 1 : -1;
} else {
return (t1->f < t2->f) ? -1 : 1;
}
}
return t;
}
return (t1->sse < t2->sse) ? -1 : 1;
void timelib_rel_time_dtor(timelib_rel_time* t)
{
TIMELIB_TIME_FREE(t);
}
timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel)
@@ -101,17 +121,6 @@ void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr)
}
}
void timelib_time_dtor(timelib_time* t)
{
TIMELIB_TIME_FREE(t->tz_abbr);
TIMELIB_TIME_FREE(t);
}
void timelib_rel_time_dtor(timelib_rel_time* t)
{
TIMELIB_TIME_FREE(t);
}
timelib_time_offset* timelib_time_offset_ctor(void)
{
timelib_time_offset *t;
@@ -126,55 +135,6 @@ void timelib_time_offset_dtor(timelib_time_offset* t)
TIMELIB_TIME_FREE(t);
}
timelib_tzinfo* timelib_tzinfo_ctor(char *name)
{
timelib_tzinfo *t;
t = timelib_calloc(1, sizeof(timelib_tzinfo));
t->name = timelib_strdup(name);
return t;
}
timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
{
timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
tmp->bit32.leapcnt = tz->bit32.leapcnt;
tmp->bit32.timecnt = tz->bit32.timecnt;
tmp->bit32.typecnt = tz->bit32.typecnt;
tmp->bit32.charcnt = tz->bit32.charcnt;
tmp->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*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(struct ttinfo));
tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
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;
}
void timelib_tzinfo_dtor(timelib_tzinfo *tz)
{
TIMELIB_TIME_FREE(tz->name);
TIMELIB_TIME_FREE(tz->trans);
TIMELIB_TIME_FREE(tz->trans_idx);
TIMELIB_TIME_FREE(tz->type);
TIMELIB_TIME_FREE(tz->timezone_abbr);
TIMELIB_TIME_FREE(tz->leap_times);
TIMELIB_TIME_FREE(tz->location.comments);
TIMELIB_TIME_FREE(tz);
tz = NULL;
}
char *timelib_get_tz_abbr_ptr(timelib_time *t)
{
if (!t->sse_uptodate) {
@@ -218,9 +178,24 @@ timelib_long timelib_date_to_int(timelib_time *d, int *error)
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
{
*hour = floor(h);
*min = floor((h - *hour) * 60);
*sec = (h - *hour - ((float) *min / 60)) * 3600;
if (h > 0) {
*hour = floor(h);
*min = floor((h - *hour) * 60);
*sec = (h - *hour - ((float) *min / 60)) * 3600;
} else {
*hour = ceil(h);
*min = 0 - ceil((h - *hour) * 60);
*sec = 0 - (h - *hour - ((float) *min / -60)) * 3600;
}
}
void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h)
{
if (hour > 0) {
*h = ((double)hour + (double)min / 60 + (double)sec / 3600);
} else {
*h = ((double)hour - (double)min / 60 - (double)sec / 3600);
}
}
void timelib_dump_date(timelib_time *d, int options)
@@ -230,8 +205,8 @@ void timelib_dump_date(timelib_time *d, int options)
}
printf("TS: %lld | %s%04lld-%02lld-%02lld %02lld:%02lld:%02lld",
d->sse, d->y < 0 ? "-" : "", TIMELIB_LLABS(d->y), d->m, d->d, d->h, d->i, d->s);
if (d->f > +0.0) {
printf(" %.6f", d->f);
if (d->us > 0) {
printf(" 0.%06lld", d->us);
}
if (d->is_localtime) {
@@ -260,8 +235,8 @@ void timelib_dump_date(timelib_time *d, int options)
if (d->have_relative) {
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
if (d->relative.f) {
printf(" %6f", d->relative.f);
if (d->relative.us) {
printf(" 0.%06lld", d->relative.us);
}
if (d->relative.first_last_day_of != 0) {
switch (d->relative.first_last_day_of) {
@@ -310,36 +285,3 @@ void timelib_dump_rel_time(timelib_rel_time *d)
}
printf("\n");
}
timelib_long timelib_parse_tz_cor(char **ptr)
{
char *begin = *ptr, *end;
timelib_long tmp;
while (isdigit(**ptr) || **ptr == ':') {
++*ptr;
}
end = *ptr;
switch (end - begin) {
case 1: /* H */
case 2: /* HH */
return HOUR(strtol(begin, NULL, 10));
break;
case 3: /* H:M */
case 4: /* H:MM, HH:M, HHMM */
if (begin[1] == ':') {
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 2, NULL, 10);
return tmp;
} else if (begin[2] == ':') {
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
return tmp;
} else {
tmp = strtol(begin, NULL, 10);
return HOUR(tmp / 100) + tmp % 100;
}
case 5: /* HH:MM */
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
return tmp;
}
return 0;
}
+772 -50
View File
@@ -25,11 +25,283 @@
#ifndef __TIMELIB_H__
#define __TIMELIB_H__
#include "timelib_structs.h"
#if HAVE_LIMITS_H
#include <limits.h>
#ifdef HAVE_TIMELIB_CONFIG_H
# include "timelib_config.h"
#endif
#include <stdlib.h>
#include <limits.h>
#include <inttypes.h>
# ifndef HAVE_INT32_T
# if SIZEOF_INT == 4
typedef int int32_t;
# elif SIZEOF_LONG == 4
typedef long int int32_t;
# endif
# endif
# ifndef HAVE_UINT32_T
# if SIZEOF_INT == 4
typedef unsigned int uint32_t;
# elif SIZEOF_LONG == 4
typedef unsigned long int uint32_t;
# endif
# endif
#ifdef _WIN32
# if _MSC_VER >= 1600
# include <stdint.h>
# endif
# ifndef SIZEOF_INT
# define SIZEOF_INT 4
# endif
# ifndef SIZEOF_LONG
# define SIZEOF_LONG 4
# endif
# ifndef int32_t
typedef __int32 int32_t;
# endif
# ifndef uint32_t
typedef unsigned __int32 uint32_t;
# endif
# ifndef int64_t
typedef __int64 int64_t;
# endif
# ifndef uint64_t
typedef unsigned __int64 uint64_t;
# endif
# ifndef PRId32
# define PRId32 "I32d"
# endif
# ifndef PRIu32
# define PRIu32 "I32u"
# endif
# ifndef PRId64
# define PRId64 "I64d"
# endif
# ifndef PRIu64
# define PRIu64 "I64u"
# endif
# ifndef INT32_MAX
#define INT32_MAX _I32_MAX
# endif
# ifndef INT32_MIN
#define INT32_MIN ((int32_t)_I32_MIN)
# endif
# ifndef UINT32_MAX
#define UINT32_MAX _UI32_MAX
# endif
# ifndef INT64_MIN
#define INT64_MIN ((int64_t)_I64_MIN)
# endif
# ifndef INT64_MAX
#define INT64_MAX _I64_MAX
# endif
# ifndef UINT64_MAX
#define UINT64_MAX _UI64_MAX
# endif
#endif
#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
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;
# define TIMELIB_LL_CONST(n) n ## i64
#else
typedef unsigned long long timelib_ull;
typedef signed long long timelib_sll;
# define TIMELIB_LL_CONST(n) n ## ll
#endif
typedef struct _ttinfo ttinfo;
typedef struct _tlinfo tlinfo;
typedef struct _tlocinfo
{
char country_code[3];
double latitude;
double longitude;
char *comments;
} tlocinfo;
typedef struct _timelib_tzinfo
{
char *name;
struct {
uint32_t ttisgmtcnt;
uint32_t ttisstdcnt;
uint32_t leapcnt;
uint32_t timecnt;
uint32_t typecnt;
uint32_t charcnt;
} bit32;
struct {
uint64_t ttisgmtcnt;
uint64_t ttisstdcnt;
uint64_t leapcnt;
uint64_t timecnt;
uint64_t typecnt;
uint64_t charcnt;
} bit64;
int32_t *trans;
unsigned char *trans_idx;
ttinfo *type;
char *timezone_abbr;
tlinfo *leap_times;
unsigned char bc;
tlocinfo location;
} timelib_tzinfo;
typedef struct _timelib_rel_time {
timelib_sll y, m, d; /* Years, Months and Days */
timelib_sll h, i, s; /* Hours, mInutes and Seconds */
timelib_sll us; /* Microseconds */
int weekday; /* Stores the day in 'next monday' */
int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
int first_last_day_of;
int invert; /* Whether the difference should be inverted */
timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
struct {
unsigned int type;
timelib_sll amount;
} special;
unsigned int have_weekday_relative, have_special_relative;
} timelib_rel_time;
typedef struct _timelib_time_offset {
int32_t offset;
unsigned int leap_secs;
unsigned int is_dst;
char *abbr;
timelib_sll transition_time;
} timelib_time_offset;
typedef struct _timelib_time {
timelib_sll y, m, d; /* Year, Month, Day */
timelib_sll h, i, s; /* Hour, mInute, Second */
timelib_sll us; /* Microseconds */
int z; /* UTC offset in seconds */
char *tz_abbr; /* Timezone abbreviation (display only) */
timelib_tzinfo *tz_info; /* Timezone structure */
signed int dst; /* Flag if we were parsing a DST zone */
timelib_rel_time relative;
timelib_sll sse; /* Seconds since epoch */
unsigned int have_time, have_date, have_zone, have_relative, have_weeknr_day;
unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
unsigned int zone_type; /* 1 time offset,
* 3 TimeZone identifier,
* 2 TimeZone abbreviation */
} timelib_time;
typedef struct _timelib_abbr_info {
timelib_sll utc_offset;
char *abbr;
int dst;
} timelib_abbr_info;
#define TIMELIB_WARN_MASK 0x1ff
#define TIMELIB_ERR_MASK 0x2ff
#define TIMELIB_WARN_DOUBLE_TZ 0x101
#define TIMELIB_WARN_INVALID_TIME 0x102
#define TIMELIB_WARN_INVALID_DATE 0x103
#define TIMELIB_WARN_TRAILING_DATA 0x11a
#define TIMELIB_ERR_DOUBLE_TZ 0x201
#define TIMELIB_ERR_TZID_NOT_FOUND 0x202
#define TIMELIB_ERR_DOUBLE_TIME 0x203
#define TIMELIB_ERR_DOUBLE_DATE 0x204
#define TIMELIB_ERR_UNEXPECTED_CHARACTER 0x205
#define TIMELIB_ERR_EMPTY_STRING 0x206
#define TIMELIB_ERR_UNEXPECTED_DATA 0x207
#define TIMELIB_ERR_NO_TEXTUAL_DAY 0x208
#define TIMELIB_ERR_NO_TWO_DIGIT_DAY 0x209
#define TIMELIB_ERR_NO_THREE_DIGIT_DAY_OF_YEAR 0x20a
#define TIMELIB_ERR_NO_TWO_DIGIT_MONTH 0x20b
#define TIMELIB_ERR_NO_TEXTUAL_MONTH 0x20c
#define TIMELIB_ERR_NO_TWO_DIGIT_YEAR 0x20d
#define TIMELIB_ERR_NO_FOUR_DIGIT_YEAR 0x20e
#define TIMELIB_ERR_NO_TWO_DIGIT_HOUR 0x20f
#define TIMELIB_ERR_HOUR_LARGER_THAN_12 0x210
#define TIMELIB_ERR_MERIDIAN_BEFORE_HOUR 0x211
#define TIMELIB_ERR_NO_MERIDIAN 0x212
#define TIMELIB_ERR_NO_TWO_DIGIT_MINUTE 0x213
#define TIMELIB_ERR_NO_TWO_DIGIT_SECOND 0x214
#define TIMELIB_ERR_NO_SIX_DIGIT_MICROSECOND 0x215
#define TIMELIB_ERR_NO_SEP_SYMBOL 0x216
#define TIMELIB_ERR_EXPECTED_ESCAPE_CHAR 0x217
#define TIMELIB_ERR_NO_ESCAPED_CHAR 0x218
#define TIMELIB_ERR_WRONG_FORMAT_SEP 0x219
#define TIMELIB_ERR_TRAILING_DATA 0x21a
#define TIMELIB_ERR_DATA_MISSING 0x21b
#define TIMELIB_ZONETYPE_OFFSET 1
#define TIMELIB_ZONETYPE_ABBR 2
#define TIMELIB_ZONETYPE_ID 3
typedef struct _timelib_error_message {
int error_code;
int position;
char character;
char *message;
} timelib_error_message;
typedef struct _timelib_error_container {
timelib_error_message *error_messages;
timelib_error_message *warning_messages;
int error_count;
int warning_count;
} timelib_error_container;
typedef struct _timelib_tz_lookup_table {
char *name;
int type;
float gmtoffset;
char *full_tz_name;
} timelib_tz_lookup_table;
typedef struct _timelib_tzdb_index_entry {
char *id;
unsigned int pos;
} timelib_tzdb_index_entry;
typedef struct _timelib_tzdb {
char *version;
int index_size;
const timelib_tzdb_index_entry *index;
const unsigned char *data;
} timelib_tzdb;
#ifndef timelib_malloc
# define timelib_malloc malloc
# define timelib_realloc realloc
@@ -38,8 +310,9 @@
# define timelib_free free
#endif
#define TIMELIB_VERSION 201605
#define TIMELIB_ASCII_VERSION "2016.05"
#define TIMELIB_VERSION 201705
#define TIMELIB_EXTENDED_VERSION 20170509
#define TIMELIB_ASCII_VERSION "2017.05beta9"
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
@@ -47,119 +320,568 @@
#define TIMELIB_UNSET -99999
#define TIMELIB_SPECIAL_WEEKDAY 0x01
#define TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH 0x02
#define TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH 0x03
/* An entry for each of these error codes is also in the
* timelib_error_messages array in timelib.c */
#define TIMELIB_ERROR_NO_ERROR 0x00
#define TIMELIB_ERROR_CANNOT_ALLOCATE 0x01
#define TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE 0x02
#define TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE 0x03
#define TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION 0x04
#define TIMELIB_ERROR_UNSUPPORTED_VERSION 0x05
#define TIMELIB_ERROR_NO_SUCH_TIMEZONE 0x06
#define TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH 0x01
#define TIMELIB_SPECIAL_LAST_DAY_OF_MONTH 0x02
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
#endif
#ifndef LONG_MIN
#define LONG_MIN (- LONG_MAX - 1)
#endif
#if defined(_MSC_VER) && !defined(strcasecmp)
#define strcasecmp stricmp
#endif
#if defined(_MSC_VER) && !defined(strncasecmp)
#define strncasecmp strnicmp
#ifdef __cplusplus
extern "C" {
#endif
/* Function pointers */
typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(char *tzname, const timelib_tzdb *tzdb);
typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(char *tzname, const timelib_tzdb *tzdb, int *error_code);
/* From dow.c */
/* Calculates the day of the week from y, m, and d. 0=Sunday..6=Saturday */
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
/* Calculates the day of the ISO week from y, m, and d. 1=Monday, 7=Sunday */
timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
/* Calculates the day of the year according to y-m-d. 0=Jan 1st..364/365=Dec
* 31st */
timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d);
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d);
/* Calculates the day of the year according to y-w-dow. 0..364/365 */
timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id);
/* Calculates the number of days in month m for year y. 28..31 */
timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
/* Calculates the ISO year and week from y, m, and d, into iw and iy */
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
/* Calculates the ISO year, week, and day of week from y, m, and d, into iy,
* iw, and id */
void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id);
/* Calculates the year, month, and day from iy, iw, and iw, into y, m, and d */
void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d);
/* Returns true if h, i and s fit in the range 00:00:00..23:59:59, false
* otherwise */
int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
/* Returns true if m fits in the range 1..12, and d fits in the range
* 1..<days-in-month> for year y */
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
/* From parse_date.re */
/* Parses the date/time string in 's' with length 'len' into the constituent
* parts of timelib_time*.
*
* Depending on the contents of the string 's', not all elements might be
* filled. You can check whether a specific element has been parsed by
* comparing with the TIMELIB_UNSET define.
*
* If errors occur, this function keeps already parsed elements in the
* returned timelib_time* value.
*
* If the **errors points to a timelib_error_container variable, warnings
* and errors will be recorded. You are responsible for freeing the stored
* information with timelib_error_container_dtor(). To see whether errors have
* occured, inspect errors->errors_count. To see whether warnings have occured,
* inspect errors->warnings_count.
*
* The returned timelib_time* value is dynamically allocated and should be
* freed with timelib_time_dtor().
*/
timelib_time *timelib_strtotime(char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
/* Parses the date/time string in 's' with length 'len' into the constituent
* parts of timelib_time* according to the format in 'format'.
*
* Depending on the contents of the string 's', not all elements might be
* filled. You can check whether a specific element has been parsed by
* comparing with the TIMELIB_UNSET define.
*
* If errors occur, this function keeps already parsed elements in the
* returned timelib_time* value.
*
* If the **errors points to a timelib_error_container variable, warnings
* and errors will be recorded. You are responsible for freeing the stored
* information with timelib_error_container_dtor(). To see whether errors have
* occured, inspect errors->errors_count. To see whether warnings have occured,
* inspect errors->warnings_count.
*
* The returned timelib_time* value is dynamically allocated and should be
* freed with timelib_time_dtor().
*/
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);
/* Fills the gaps in the parsed timelib_time with information from the reference date/time in 'now'
*
* If any of the 'parsed' y, m, d, h, i or s parameters is unset (TIMELIB_UNSET):
* - if microtime (us) is unset, then the us of the parsed time is set to 0.
* - else if microtime (us) is unset and 'now'->'us' is set, use it, otherwise use 0.
*
* For either of the 'parsed' y, m, d, h, i, s, z (utc offset in seconds) or
* dst is unset, set it to the corresponding value in 'now' if set, otherwise
* set it to 0.
*
* It duplicates tz_abbr if unset in 'parsed' but set in 'now'.
*
* It duplicates tz_info if unset in 'parsed', but set in 'now' unless
* TIMELIB_NO_CLONE is passed, in which case only the pointer in 'parsed' is
* set to 'now'.
*
* If the option TIMELIB_OVERRIDE_TIME is passed and the parsed date/time has
* no time portion, the function will ignore the time aspect in 'now' and
* instead fill it with zeros.
*/
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
/* Tries to convert a time zone abbreviation, gmtoffset and/or isdst flag
* combination to a time zone identifier.
*
* If 'abbr' is either 'utc' or 'gmt' (case insensitve) then "UTC" is
* returned.
*
* It first uses the data in the timezonemap.h file to find a matching
* abbreviation/GMT offset combination. If not found, it uses the data in
* fallbackmap.h to match only the GMT offset/isdst flag to try to find a
* match. If nothing is found, NULL is returned.
*
* The returned char* is not duplicated, and should not be freed.
*/
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
/* Returns an array of known time zone abbreviations
*
* This file is generated from the time zone database through the
* gettzmapping.php scripts, which requires that an up-to-date time zone
* database is used with the PHP binary that runs the script.
*
* Each item in the returned list contains the abbreviation, a flag whether
* it's an abbreviation used with DST, the UTC offset in seconds, and the name
* of the time zone identifier that this abbreviation belongs to.
*
* The order for each specific abbreviation is controlled through the
* preference list in the gettzmapping.php script. Time zones that match the
* pattern ±\d{2,4} are excluded
*/
const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
timelib_long timelib_parse_tz_cor(char**);
/**
* DEPRECATED, but still used by PHP.
*/
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 parse_iso_intervals.re */
/**
* Parses a subset of an ISO 8601 intervals specification string into its
* constituent parts.
*
* If the **errors points to a timelib_error_container variable, warnings
* and errors will be recorded. You are responsible for freeing the stored
* information with timelib_error_container_dtor(). To see whether errors have
* occured, inspect errors->errors_count. To see whether warnings have occured,
* inspect errors->warnings_count.
*/
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);
timelib_error_container **errors);
/* From tm2unixtime.c */
/**
* Uses the y/m/d/h/i/s fields to calculate and store the equivalent timestamp
* in the sse field.
*
* It uses the time zone information associated with 'time' to account for the
* right UTC offset and/or DST rules. You can associate time zone information
* with the timelib_set_timezone_* functions (see below).
*
* If the type is 'TIMELIB_ZONETYPE_ID' and there is no associated tzinfo, it
* will use the second argument 'tzi' to provide the rules necessary to
* calculate the right timestamp.
*/
void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
/**
* Takes the information from the y/m/d/h/i/s fields and makes sure their
* values are in the right range.
*
* If a value under- or overflows it will adjust the larger measure up (or
* down). It also takes into account leap days.
*/
void timelib_do_normalize(timelib_time *base);
/**
* Takes the information from the y/m/d/h/i/s fields of 'rt' and makes sure
* their values are in the right range.
*
* If a value under- or overflows it will adjust the larger measure up (or
* down). As this function operates on a *relative date/time*, it also takes
* into account leap days and correctly accounts for the difference depending
* on the base date/time in 'base'.
*/
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt);
/* From unixtime2tm.c */
int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
/**
* Takes the unix timestamp in seconds from 'ts' and populates the y/m/d/h/i/s
* fields of 'tm' without taking time zones into account
*/
void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
/**
* Takes the Unix timestamp from 'ts', and calculates the y/m/d/h/i/s fields
* according to the time zone information attached to 'tm'.
*/
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts);
/**
* Takes the Unix timestamp stored in 'tm', and calculates the y/m/d/h/i/s
* fields according to the time zone information attached to 'tm'.
*/
void timelib_update_from_sse(timelib_time *tm);
/**
* Attaches the UTC offset as time zone information to 't'.
*
* 'utc_offset' is in seconds East of UTC.
*/
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset);
/**
* Attaches the information from 'abbr_info' as time zone information to 't'.
*
* The timelib_abbr_info struct contains an abbreviation ('abbr') which string
* value is duplicated, as well as a 'utc_offset' and 'dst' flag. It only
* supports a 'dst' change over of 1 hour.
*/
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info);
/**
* Attaches the time zone information in 'tz' to to 't'.
*
* It fetches the right UTC offset that is currently stored in the time
* stamp field in 't' ('sse'), and assigns that to the 'z' field and 'dst'
* field (whether DST is in effect at the time). It also sets the current
* abbrevation to the 'tz_addr' field, making sure that if a value was already
* set it was freed.
*
* The time zone information in 'tz' is *not* duplicated into the 't' field so
* it should not be freed until all timelib_time* variables have been freed as
* well.
*/
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
/* From parse_tz.c */
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb);
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb);
int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz);
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);
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);
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr);
void timelib_time_tz_name_update(timelib_time* tm, char* tz_name);
/**
* Returns whether the time zone ID 'timezone' is available in the time zone
* database as pointed to be 'tzdb'.
*/
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb);
/**
* Converts the binary stored time zone information from 'tzdb' for the time
* zone 'timeozne' into a structure the library can use for calculations.
*
* The function can be used on both timelib_builtin_db as well as a time zone
* db as opened by timelib_zoneinfo.
* The function will return null upon failure, and also set an error code
* through 'error_code'. 'error_code' must not be a null pointer. The error
* code is one of the TIMELIB_ERROR_* constants as listed above. These error
* constants can be converted into a string by timelib_get_error_message.
*
* This function allocates memory for the new time zone structure, which must
* be freed after use. Although it is recommended that a cache of each used
* time zone is kept.
*/
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code);
/**
* Frees up the resources allocated by 'timelib_parse_tzfile'.
*/
void timelib_tzinfo_dtor(timelib_tzinfo *tz);
/**
* Deep-clones a timelib_tzinfo structure.
*
* This allocates resources that need to be freed with 'timelib_tzinfo_dtor'
*/
timelib_tzinfo* timelib_tzinfo_clone(timelib_tzinfo *tz);
/**
* Returns whether DST is active with time zone 'tz' for the time stamp 'ts'.
*
* Returns 0 if DST is not active, 1 if DST is active, or -1 if no transitions
* were available through 'tz'.
*/
int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
/**
* Returns offset information with time zone 'tz' for the time stamp 'ts'.
*
* The returned information contains: the offset in seconds East of UTC (in
* 'offset'), whether DST is active ('is_dst'), what the current time zone
* abbreviation is ('abbr') and the transition time that got to this state (in
* 'transistion_time');
*/
timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz);
/**
* Returns the UTC offset currently applicable for the information stored in 't'.
*
* The value returned is the UTC offset in seconds East.
*/
timelib_sll timelib_get_current_offset(timelib_time *t);
/**
* Displays debugging information about the time zone information in 'tz'.
*/
void timelib_dump_tzinfo(timelib_tzinfo *tz);
/**
* Returns a pointer to the built-in time zone database.
*
* You must *not* free the returned pointer as it is part of the text segment.
*/
const timelib_tzdb *timelib_builtin_db(void);
/**
* Returns a pointer to the start of an array containing a list of timezone identifiers.
*
* The amount of entries in the array is returned through the 'count' OUT parameter.
*
* Each entry contains the time zone ID ('id' field), and the position within the time zone
* information ('pos' field). The pos field should not be used.
*/
const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(timelib_tzdb *tzdb, int *count);
/* From parse_zoneinfo.c */
/**
* Scans the directory and subdirectories of 'directory' for valid time zone files and builds
* a time zone database out of these files.
*
* Typically, the directory should point to '/usr/share/zoneinfo'.
*
* Unlike 'timelib_builtin_db', the return value of this function must be freed
* with the 'timelib_zoneinfo_dtor' function.
*/
timelib_tzdb *timelib_zoneinfo(char *directory);
/**
* Frees up the resources as created through 'timelib_zoneinfo'.
*
* This function must be used to free up all the resources that have been
* allocated while calling 'timelib_zoneinfo'.
*/
void timelib_zoneinfo_dtor(timelib_tzdb *tzdb);
/* From timelib.c */
/**
* Returns a static string containing an error message belonging to a specific
* error code.
*/
const char *timelib_get_error_message(int error_code);
/**
* Allocates resources for the relative time structure.
*
* Must be freed with 'timelib_rel_time_dtor'.
*/
timelib_rel_time* timelib_rel_time_ctor(void);
/**
* Frees up the resources as allocated through 'timelib_rel_time_ctor'.
*/
void timelib_rel_time_dtor(timelib_rel_time* t);
/**
* Creates a new timelib_rel_time resource and copies over the information
* from 'tz'.
*
* Must be freed with 'timelib_rel_time_dtor'.
*/
timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *tz);
/**
* Allocates resources for the time structure.
*
* Must be freed with 'timelib_time_dtor'.
*/
timelib_time* timelib_time_ctor(void);
void timelib_time_set_option(timelib_time* tm, int option, void* option_value);
void timelib_time_dtor(timelib_time* t);
timelib_time* timelib_time_clone(timelib_time* orig);
int timelib_time_compare(timelib_time *t1, timelib_time *t2);
void timelib_set_fraction_from_timeval(timelib_time *t, struct timeval tp);
/**
* Frees up the resources as allocated through 'timelib_time_ctor'.
*/
void timelib_time_dtor(timelib_time* t);
/**
* Creates a new timelib_time resource and copies over the information
* from 'orig'.
*
* Must be freed with 'timelib_time_dtor'.
*/
timelib_time* timelib_time_clone(timelib_time* orig);
/**
* Compares two timelib_time structures and returns which one is earlier in
* time.
*
* To decide which comes earlier it uses the 'sse' (Seconds Since Epoch) and
* 'us' (microseconds) fields.
*
* Returns -1 if t1 < t2, 0 if t1 == t2, and -1 if t1 > t2.
*/
int timelib_time_compare(timelib_time *t1, timelib_time *t2);
/**
* Allocates resources for the time offset structure.
*
* Must be freed with 'timelib_time_offset_dtor'.
*/
timelib_time_offset* timelib_time_offset_ctor(void);
/**
* Frees up the resources as allocated through 'timelib_time_offset_ctor'.
*/
void timelib_time_offset_dtor(timelib_time_offset* t);
/**
* Frees up the resources allocated while converting strings to timelib_time
* structures with the timelib_strtotime and timelib_strtointerval functions.
*/
void timelib_error_container_dtor(timelib_error_container *errors);
/**
* Converts the 'sse' value of 'd' to a timelib_long type.
*
* If the value fits in the TIMELIB_LONG_MIN and TIMELIB_LONG_MAX range, the
* value is cast to (timelib_long) and returned. If *error is not a NULL
* pointer, it will be set to 0.
*
* If the value does *not* fit in the range, the function returns 0 and if
* *error is not a NULL pointer, it will be set to 1.
*
* timelib_long is a 32 bit signed long integer on 32 bit platforms, and a 64
* bit signed long long integer on 64 bit platforms. In other words, it makes
* sure that the value in 'sse' (which is always a signed long long 64 bit
* integer) can be used safely outside of the library.
*/
timelib_long timelib_date_to_int(timelib_time *d, int *error);
/**
* Displays debugging information about the date/time information stored in 'd'.
*
* 'options' is a bit field, where:
* - 1 controls whether the relative time portion is shown.
* - 2 controls whether the zone type is shown.
*/
void timelib_dump_date(timelib_time *d, int options);
/**
* Displays debugging information about the relative time information stored
* in 'd'.
*/
void timelib_dump_rel_time(timelib_rel_time *d);
/**
* Converts a decimal hour into hour/min/sec components
*/
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
timelib_long timelib_parse_tz_cor(char **ptr);
/**
* Converts hour/min/sec values into a decimal hour
*/
void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h);
/* from astro.c */
double timelib_ts_to_juliandate(timelib_sll ts);
/**
* Converts the Unix Epoch time stamp 'ts' to a Julian Day
*
* The value returned is the number of whole days since -4714-11-24T12:00:00 UTC
* (in the proleptic Gregorian calendar):
* https://en.wikipedia.org/wiki/Julian_day
*/
double timelib_ts_to_julianday(timelib_sll ts);
/**
* Converts the Unix Epoch time stamp 'ts' to the J2000 epoch
*
* The value returned is the number of whole days since 2000-01-01T12:00:00
* UTC: https://en.wikipedia.org/wiki/Epoch_(astronomy)#Julian_years_and_J2000
*/
double timelib_ts_to_j2000(timelib_sll ts);
/**
* Calculates when the Sun is above a certain latitude.
*
* Parameters:
* - time: A timelib_time time describing that needs to specific midnight for a
* specific day.
* - lon: The longitude of the observer (East positive, West negative).
* - lat: The latitude of the observer (North positive, South negative).
* - altit: The altitude. Set to -35/60 for rise/set, -6 for civil twilight,
* -12 for nautical, and -18 for astronomical twilight.
* - upper_limb: set to non-zero for rise/set calculations, and 0 for twilight
* calculations.
*
* Out Parameters:
* - h_rise: The decimal hour when the Sun rises
* - h_set: The decimal hour when the Sun sets
* - ts_rise: The Unix timestamp of the Sun rising
* - ts_set: The Unix timestamp of the Sun setting
* - ts_transit: The Unix timestmap of the Sun transitting through South
*
* Return Values:
* - 0: The Sun rises and sets.
* - +1: The Sun is always above the horizon. (ts_rise is set to ts_transit -
* (12 * 3600); ts_set is set to ts_transit + (12 * 3600).
* - -1: The Sun is awlays below the horizon. (ts_rise and ts_set are set
* to ts_transit)
*/
int timelib_astro_rise_set_altitude(timelib_time *time, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set, timelib_sll *ts_transit);
/* from interval.c */
/**
* Calculates the difference between two times
*
* The result is a timelib_rel_time structure that describes how you can
* convert from 'one' to 'two' with 'timelib_add'. This does *not* necessarily
* mean that you can go from 'two' to 'one' by using 'timelib_sub' due to the
* way months and days are calculated.
*/
timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two);
/**
* Adds the relative time information 'interval' to the base time 't'.
*
* This can be a relative time as created by 'timelib_diff', but also by more
* complex statements such as "next workday".
*/
timelib_time *timelib_add(timelib_time *t, timelib_rel_time *interval);
/**
* Subtracts the relative time information 'interval' to the base time 't'.
*
* This can be a relative time as created by 'timelib_diff'. Unlike with
* 'timelib_add', this does not support more complex statements such as "next
* workday".
*/
timelib_time *timelib_sub(timelib_time *t, timelib_rel_time *interval);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
+5 -2
View File
@@ -69,11 +69,14 @@ TL_CHECK_INT_TYPE(uint32_t)
dnl Check for headers needed by timelib
AC_CHECK_HEADERS([ \
sys/time.h \
sys/types.h \
inttypes.h \
stdint.h \
dirent.h \
string.h \
stdlib.h
strings.h \
unistd.h \
io.h
])
dnl Check for strtoll, atoll
+158
View File
@@ -0,0 +1,158 @@
/*
* 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.
*/
#ifndef __TIMELIB_PRIVATE_H__
#define __TIMELIB_PRIVATE_H__
#ifdef HAVE_SETLOCALE
# include "locale.h"
#endif
#ifdef HAVE_TIMELIB_CONFIG_H
# include "timelib_config.h"
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef _WIN32
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
# endif
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if defined(HAVE_STDINT_H)
# include <stdint.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#if HAVE_IO_H
# include <io.h>
#endif
#if HAVE_DIRENT_H
# include <dirent.h>
#endif
#include <stdio.h>
#if HAVE_LIMITS_H
#include <limits.h>
#endif
#define TIMELIB_SECOND 1
#define TIMELIB_MINUTE 2
#define TIMELIB_HOUR 3
#define TIMELIB_DAY 4
#define TIMELIB_MONTH 5
#define TIMELIB_YEAR 6
#define TIMELIB_WEEKDAY 7
#define TIMELIB_SPECIAL 8
#define TIMELIB_MICROSEC 9
#define TIMELIB_SPECIAL_WEEKDAY 0x01
#define TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH 0x02
#define TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH 0x03
#define TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH 0x01
#define TIMELIB_SPECIAL_LAST_DAY_OF_MONTH 0x02
#define SECS_PER_ERA TIMELIB_LL_CONST(12622780800)
#define SECS_PER_DAY 86400
#define DAYS_PER_YEAR 365
#define DAYS_PER_LYEAR 366
/* 400*365 days + 97 leap days */
#define DAYS_PER_LYEAR_PERIOD 146097
#define YEARS_PER_LYEAR_PERIOD 400
#define TIMELIB_TZINFO_PHP 0x01
#define TIMELIB_TZINFO_ZONEINFO 0x02
#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
#define TIMELIB_DEBUG(s) if (0) { s }
#define TIMELIB_TIME_FREE(m) \
if (m) { \
timelib_free(m); \
m = NULL; \
}
struct _ttinfo
{
int32_t offset;
int isdst;
unsigned int abbr_idx;
unsigned int isstdcnt;
unsigned int isgmtcnt;
};
struct _tlinfo
{
int32_t trans;
int32_t offset;
};
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
#endif
#ifndef LONG_MIN
#define LONG_MIN (- LONG_MAX - 1)
#endif
#if defined(_MSC_VER) && !defined(strcasecmp)
#define strcasecmp stricmp
#endif
#if defined(_MSC_VER) && !defined(strncasecmp)
#define strncasecmp strnicmp
#endif
/* From unixtime2tm.c */
int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
/* From parse_tz.c */
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr);
#endif
-316
View File
@@ -1,316 +0,0 @@
/*
* 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.
*/
#ifndef __TIMELIB_STRUCTS_H__
#define __TIMELIB_STRUCTS_H__
#ifdef HAVE_TIMELIB_CONFIG_H
# include "timelib_config.h"
#endif
#ifndef TIMELIB_OMIT_STDINT
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if defined(HAVE_INTTYPES_H)
#include <inttypes.h>
#elif defined(HAVE_STDINT_H)
#include <stdint.h>
#endif
# ifndef HAVE_INT32_T
# if SIZEOF_INT == 4
typedef int int32_t;
# elif SIZEOF_LONG == 4
typedef long int int32_t;
# endif
# endif
# ifndef HAVE_UINT32_T
# if SIZEOF_INT == 4
typedef unsigned int uint32_t;
# elif SIZEOF_LONG == 4
typedef unsigned long int uint32_t;
# endif
# endif
#ifdef _WIN32
# if _MSC_VER >= 1600
# include <stdint.h>
# endif
# ifndef SIZEOF_INT
# define SIZEOF_INT 4
# endif
# ifndef SIZEOF_LONG
# define SIZEOF_LONG 4
# endif
# ifndef int32_t
typedef __int32 int32_t;
# endif
# ifndef uint32_t
typedef unsigned __int32 uint32_t;
# endif
# ifndef int64_t
typedef __int64 int64_t;
# endif
# ifndef uint64_t
typedef unsigned __int64 uint64_t;
# endif
# ifndef PRId32
# define PRId32 "I32d"
# endif
# ifndef PRIu32
# define PRIu32 "I32u"
# endif
# ifndef PRId64
# define PRId64 "I64d"
# endif
# ifndef PRIu64
# define PRIu64 "I64u"
# endif
# ifndef INT32_MAX
#define INT32_MAX _I32_MAX
# endif
# ifndef INT32_MIN
#define INT32_MIN ((int32_t)_I32_MIN)
# endif
# ifndef UINT32_MAX
#define UINT32_MAX _UI32_MAX
# endif
# ifndef INT64_MIN
#define INT64_MIN ((int64_t)_I64_MIN)
# endif
# ifndef INT64_MAX
#define INT64_MAX _I64_MAX
# endif
# ifndef UINT64_MAX
#define UINT64_MAX _UI64_MAX
# endif
#endif
#endif /* TIMELIB_OMIT_STDINT */
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
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;
# define TIMELIB_LL_CONST(n) n ## i64
#else
typedef unsigned long long timelib_ull;
typedef signed long long timelib_sll;
# define TIMELIB_LL_CONST(n) n ## ll
#endif
typedef struct ttinfo
{
int32_t offset;
int isdst;
unsigned int abbr_idx;
unsigned int isstdcnt;
unsigned int isgmtcnt;
} ttinfo;
typedef struct tlinfo
{
int32_t trans;
int32_t offset;
} tlinfo;
typedef struct tlocinfo
{
char country_code[3];
double latitude;
double longitude;
char *comments;
} tlocinfo;
typedef struct timelib_tzinfo
{
char *name;
struct {
uint32_t ttisgmtcnt;
uint32_t ttisstdcnt;
uint32_t leapcnt;
uint32_t timecnt;
uint32_t typecnt;
uint32_t charcnt;
} bit32;
struct {
uint64_t ttisgmtcnt;
uint64_t ttisstdcnt;
uint64_t leapcnt;
uint64_t timecnt;
uint64_t typecnt;
uint64_t charcnt;
} bit64;
int32_t *trans;
unsigned char *trans_idx;
ttinfo *type;
char *timezone_abbr;
tlinfo *leap_times;
unsigned char bc;
tlocinfo location;
} timelib_tzinfo;
typedef struct timelib_special {
unsigned int type;
timelib_sll amount;
} timelib_special;
typedef struct timelib_rel_time {
timelib_sll y, m, d; /* Years, Months and Days */
timelib_sll h, i, s; /* Hours, mInutes and Seconds */
double f; /* Fraction */
int weekday; /* Stores the day in 'next monday' */
int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
int first_last_day_of;
int invert; /* Whether the difference should be inverted */
timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
timelib_special special;
unsigned int have_weekday_relative, have_special_relative;
} timelib_rel_time;
typedef struct timelib_time_offset {
int32_t offset;
unsigned int leap_secs;
unsigned int is_dst;
char *abbr;
timelib_sll transistion_time;
} timelib_time_offset;
typedef struct timelib_time {
timelib_sll y, m, d; /* Year, Month, Day */
timelib_sll h, i, s; /* Hour, mInute, Second */
double f; /* Fraction */
int z; /* GMT offset in minutes */
char *tz_abbr; /* Timezone abbreviation (display only) */
timelib_tzinfo *tz_info; /* Timezone structure */
signed int dst; /* Flag if we were parsing a DST zone */
timelib_rel_time relative;
timelib_sll sse; /* Seconds since epoch */
unsigned int have_time, have_date, have_zone, have_relative, have_weeknr_day;
unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
unsigned int zone_type; /* 1 time offset,
* 3 TimeZone identifier,
* 2 TimeZone abbreviation */
} timelib_time;
typedef struct timelib_abbr_info {
timelib_sll utc_offset;
char *abbr;
int dst;
} timelib_abbr_info;
typedef struct timelib_error_message {
int position;
char character;
char *message;
} timelib_error_message;
typedef struct timelib_error_container {
struct timelib_error_message *error_messages;
struct timelib_error_message *warning_messages;
int error_count;
int warning_count;
} timelib_error_container;
typedef struct _timelib_tz_lookup_table {
char *name;
int type;
float gmtoffset;
char *full_tz_name;
} timelib_tz_lookup_table;
typedef struct _timelib_tzdb_index_entry {
char *id;
unsigned int pos;
} timelib_tzdb_index_entry;
typedef struct _timelib_tzdb {
char *version;
int index_size;
const timelib_tzdb_index_entry *index;
const unsigned char *data;
} timelib_tzdb;
#define TIMELIB_ZONETYPE_OFFSET 1
#define TIMELIB_ZONETYPE_ABBR 2
#define TIMELIB_ZONETYPE_ID 3
#define SECS_PER_ERA TIMELIB_LL_CONST(12622780800)
#define SECS_PER_DAY 86400
#define DAYS_PER_YEAR 365
#define DAYS_PER_LYEAR 366
/* 400*365 days + 97 leap days */
#define DAYS_PER_LYEAR_PERIOD 146097
#define YEARS_PER_LYEAR_PERIOD 400
#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
#define TIMELIB_DEBUG(s) if (0) { s }
#endif
+1009 -1078
View File
File diff suppressed because it is too large. Load diff
+14 -489
View File
@@ -4,29 +4,18 @@
{ "acdt", 1, 37800, "Australia/North" },
{ "acdt", 1, 37800, "Australia/South" },
{ "acdt", 1, 37800, "Australia/Yancowinna" },
{ "acst", 1, -14400, "America/Porto_Acre" },
{ "acst", 0, 32400, "Australia/Adelaide" },
{ "acst", 0, 34200, "Australia/Adelaide" },
{ "acst", 1, -14400, "America/Eirunepe" },
{ "acst", 1, -14400, "America/Rio_Branco" },
{ "acst", 1, -14400, "Brazil/Acre" },
{ "acst", 0, 32400, "Australia/Broken_Hill" },
{ "acst", 0, 32400, "Australia/Darwin" },
{ "acst", 0, 32400, "Australia/North" },
{ "acst", 0, 32400, "Australia/South" },
{ "acst", 0, 32400, "Australia/Yancowinna" },
{ "acst", 0, 34200, "Asia/Jayapura" },
{ "acst", 0, 34200, "Australia/Broken_Hill" },
{ "acst", 0, 34200, "Australia/Darwin" },
{ "acst", 0, 34200, "Australia/North" },
{ "acst", 0, 34200, "Australia/South" },
{ "acst", 0, 34200, "Australia/Yancowinna" },
{ "act", 0, -18000, "America/Porto_Acre" },
{ "act", 0, -18000, "America/Eirunepe" },
{ "act", 0, -18000, "America/Rio_Branco" },
{ "act", 0, -18000, "Brazil/Acre" },
{ "acwdt", 1, 35100, "Australia/Eucla" },
{ "acwst", 0, 31500, "Australia/Eucla" },
{ "addt", 1, -7200, "America/Goose_Bay" },
{ "addt", 1, -7200, "America/Pangnirtung" },
{ "adt", 1, -10800, "America/Halifax" },
@@ -40,7 +29,6 @@
{ "adt", 1, -10800, "America/Thule" },
{ "adt", 1, -10800, "Atlantic/Bermuda" },
{ "adt", 1, -10800, "Canada/Atlantic" },
{ "adt", 1, 14400, "Asia/Baghdad" },
{ "aedt", 1, 39600, "Australia/Melbourne" },
{ "aedt", 1, 39600, "Antarctica/Macquarie" },
{ "aedt", 1, 39600, "Australia/ACT" },
@@ -69,8 +57,6 @@
{ "aest", 0, 36000, "Australia/Sydney" },
{ "aest", 0, 36000, "Australia/Tasmania" },
{ "aest", 0, 36000, "Australia/Victoria" },
{ "aft", 0, 16200, "Asia/Kabul" },
{ "aft", 0, 14400, "Asia/Kabul" },
{ "ahdt", 1, -32400, "America/Anchorage" },
{ "ahst", 0, -36000, "America/Anchorage" },
{ "ahst", 0, -36000, "America/Adak" },
@@ -87,31 +73,9 @@
{ "akst", 0, -32400, "America/Nome" },
{ "akst", 0, -32400, "America/Sitka" },
{ "akst", 0, -32400, "America/Yakutat" },
{ "amst", 1, -10800, "America/Boa_Vista" },
{ "amst", 1, -10800, "America/Campo_Grande" },
{ "amst", 1, -10800, "America/Cuiaba" },
{ "amst", 1, -10800, "America/Manaus" },
{ "amst", 1, -10800, "America/Porto_Velho" },
{ "amst", 1, -10800, "America/Santarem" },
{ "amst", 1, -10800, "Brazil/West" },
{ "amt", 0, -13840, "America/Asuncion" },
{ "amt", 0, -14400, "America/Boa_Vista" },
{ "amt", 0, -14400, "America/Campo_Grande" },
{ "amt", 0, -14400, "America/Cuiaba" },
{ "amt", 0, -14400, "America/Eirunepe" },
{ "amt", 0, -14400, "America/Manaus" },
{ "amt", 0, -14400, "America/Porto_Acre" },
{ "amt", 0, -14400, "America/Porto_Velho" },
{ "amt", 0, -14400, "America/Rio_Branco" },
{ "amt", 0, -14400, "America/Santarem" },
{ "amt", 0, -14400, "Brazil/Acre" },
{ "amt", 0, -14400, "Brazil/West" },
{ "amt", 0, 1172, "Europe/Amsterdam" },
{ "amt", 0, 5692, "Europe/Athens" },
{ "ant", 0, -16200, "America/Curacao" },
{ "ant", 0, -16200, "America/Aruba" },
{ "ant", 0, -16200, "America/Kralendijk" },
{ "ant", 0, -16200, "America/Lower_Princes" },
{ "apt", 1, -10800, "America/Halifax" },
{ "apt", 1, -10800, "America/Blanc-Sablon" },
{ "apt", 1, -10800, "America/Glace_Bay" },
@@ -119,87 +83,7 @@
{ "apt", 1, -10800, "America/Pangnirtung" },
{ "apt", 1, -10800, "America/Puerto_Rico" },
{ "apt", 1, -10800, "Canada/Atlantic" },
{ "arst", 1, -7200, "America/Buenos_Aires" },
{ "arst", 1, -10800, "America/Buenos_Aires" },
{ "arst", 1, -10800, "America/Argentina/Buenos_Aires" },
{ "arst", 1, -10800, "America/Argentina/Catamarca" },
{ "arst", 1, -10800, "America/Argentina/ComodRivadavia" },
{ "arst", 1, -10800, "America/Argentina/Cordoba" },
{ "arst", 1, -10800, "America/Argentina/Jujuy" },
{ "arst", 1, -10800, "America/Argentina/La_Rioja" },
{ "arst", 1, -10800, "America/Argentina/Mendoza" },
{ "arst", 1, -10800, "America/Argentina/Rio_Gallegos" },
{ "arst", 1, -10800, "America/Argentina/Salta" },
{ "arst", 1, -10800, "America/Argentina/San_Juan" },
{ "arst", 1, -10800, "America/Argentina/San_Luis" },
{ "arst", 1, -10800, "America/Argentina/Tucuman" },
{ "arst", 1, -10800, "America/Argentina/Ushuaia" },
{ "arst", 1, -10800, "America/Catamarca" },
{ "arst", 1, -10800, "America/Cordoba" },
{ "arst", 1, -10800, "America/Jujuy" },
{ "arst", 1, -10800, "America/Mendoza" },
{ "arst", 1, -10800, "America/Rosario" },
{ "arst", 1, -10800, "Antarctica/Palmer" },
{ "arst", 1, -7200, "America/Argentina/Buenos_Aires" },
{ "arst", 1, -7200, "America/Argentina/Catamarca" },
{ "arst", 1, -7200, "America/Argentina/ComodRivadavia" },
{ "arst", 1, -7200, "America/Argentina/Cordoba" },
{ "arst", 1, -7200, "America/Argentina/Jujuy" },
{ "arst", 1, -7200, "America/Argentina/La_Rioja" },
{ "arst", 1, -7200, "America/Argentina/Mendoza" },
{ "arst", 1, -7200, "America/Argentina/Rio_Gallegos" },
{ "arst", 1, -7200, "America/Argentina/Salta" },
{ "arst", 1, -7200, "America/Argentina/San_Juan" },
{ "arst", 1, -7200, "America/Argentina/San_Luis" },
{ "arst", 1, -7200, "America/Argentina/Tucuman" },
{ "arst", 1, -7200, "America/Argentina/Ushuaia" },
{ "arst", 1, -7200, "America/Catamarca" },
{ "arst", 1, -7200, "America/Cordoba" },
{ "arst", 1, -7200, "America/Jujuy" },
{ "arst", 1, -7200, "America/Mendoza" },
{ "arst", 1, -7200, "America/Rosario" },
{ "arst", 1, -7200, "Antarctica/Palmer" },
{ "art", 0, -10800, "America/Buenos_Aires" },
{ "art", 0, -14400, "America/Buenos_Aires" },
{ "art", 0, -10800, "America/Argentina/Buenos_Aires" },
{ "art", 0, -10800, "America/Argentina/Catamarca" },
{ "art", 0, -10800, "America/Argentina/ComodRivadavia" },
{ "art", 0, -10800, "America/Argentina/Cordoba" },
{ "art", 0, -10800, "America/Argentina/Jujuy" },
{ "art", 0, -10800, "America/Argentina/La_Rioja" },
{ "art", 0, -10800, "America/Argentina/Mendoza" },
{ "art", 0, -10800, "America/Argentina/Rio_Gallegos" },
{ "art", 0, -10800, "America/Argentina/Salta" },
{ "art", 0, -10800, "America/Argentina/San_Juan" },
{ "art", 0, -10800, "America/Argentina/San_Luis" },
{ "art", 0, -10800, "America/Argentina/Tucuman" },
{ "art", 0, -10800, "America/Argentina/Ushuaia" },
{ "art", 0, -10800, "America/Catamarca" },
{ "art", 0, -10800, "America/Cordoba" },
{ "art", 0, -10800, "America/Jujuy" },
{ "art", 0, -10800, "America/Mendoza" },
{ "art", 0, -10800, "America/Rosario" },
{ "art", 0, -10800, "Antarctica/Palmer" },
{ "art", 0, -14400, "America/Argentina/Buenos_Aires" },
{ "art", 0, -14400, "America/Argentina/Catamarca" },
{ "art", 0, -14400, "America/Argentina/ComodRivadavia" },
{ "art", 0, -14400, "America/Argentina/Cordoba" },
{ "art", 0, -14400, "America/Argentina/Jujuy" },
{ "art", 0, -14400, "America/Argentina/La_Rioja" },
{ "art", 0, -14400, "America/Argentina/Mendoza" },
{ "art", 0, -14400, "America/Argentina/Rio_Gallegos" },
{ "art", 0, -14400, "America/Argentina/Salta" },
{ "art", 0, -14400, "America/Argentina/San_Juan" },
{ "art", 0, -14400, "America/Argentina/San_Luis" },
{ "art", 0, -14400, "America/Argentina/Tucuman" },
{ "art", 0, -14400, "America/Argentina/Ushuaia" },
{ "art", 0, -14400, "America/Catamarca" },
{ "art", 0, -14400, "America/Cordoba" },
{ "art", 0, -14400, "America/Jujuy" },
{ "art", 0, -14400, "America/Mendoza" },
{ "art", 0, -14400, "America/Rosario" },
{ "art", 0, -14400, "Antarctica/Palmer" },
{ "ast", 0, 10800, "Asia/Riyadh" },
{ "apt", 1, -32400, "America/Anchorage" },
{ "ast", 0, -14400, "America/Anguilla" },
{ "ast", 0, -14400, "America/Antigua" },
{ "ast", 0, -14400, "America/Aruba" },
@@ -234,11 +118,7 @@
{ "ast", 0, -14400, "America/Virgin" },
{ "ast", 0, -14400, "Atlantic/Bermuda" },
{ "ast", 0, -14400, "Canada/Atlantic" },
{ "ast", 0, 10800, "Asia/Aden" },
{ "ast", 0, 10800, "Asia/Baghdad" },
{ "ast", 0, 10800, "Asia/Bahrain" },
{ "ast", 0, 10800, "Asia/Kuwait" },
{ "ast", 0, 10800, "Asia/Qatar" },
{ "ast", 0, -36000, "America/Anchorage" },
{ "awdt", 1, 32400, "Australia/Perth" },
{ "awdt", 1, 32400, "Australia/West" },
{ "awst", 0, 28800, "Australia/Perth" },
@@ -250,14 +130,8 @@
{ "awt", 1, -10800, "America/Pangnirtung" },
{ "awt", 1, -10800, "America/Puerto_Rico" },
{ "awt", 1, -10800, "Canada/Atlantic" },
{ "azomt", 1, 0, "Atlantic/Azores" },
{ "azost", 1, 0, "Atlantic/Azores" },
{ "azost", 1, -3600, "Atlantic/Azores" },
{ "azot", 0, -3600, "Atlantic/Azores" },
{ "azot", 0, -7200, "Atlantic/Azores" },
{ "awt", 1, -32400, "America/Anchorage" },
{ "bdst", 1, 7200, "Europe/London" },
{ "bdst", 1, 25200, "Asia/Dacca" },
{ "bdst", 1, 25200, "Asia/Dhaka" },
{ "bdst", 1, 7200, "Europe/Belfast" },
{ "bdst", 1, 7200, "Europe/Gibraltar" },
{ "bdst", 1, 7200, "Europe/Guernsey" },
@@ -265,32 +139,8 @@
{ "bdst", 1, 7200, "Europe/Jersey" },
{ "bdst", 1, 7200, "GB" },
{ "bdt", 1, -36000, "America/Adak" },
{ "bdt", 0, 21600, "Asia/Dacca" },
{ "bdt", 1, -36000, "America/Atka" },
{ "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" },
@@ -305,38 +155,12 @@
{ "bmt", 0, 25632, "Asia/Jakarta" },
{ "bmt", 0, 6264, "Europe/Bucharest" },
{ "bmt", 0, 6264, "Europe/Chisinau" },
{ "bnt", 0, 28800, "Asia/Brunei" },
{ "bnt", 0, 27000, "Asia/Brunei" },
{ "bortst", 1, 30000, "Asia/Kuching" },
{ "bort", 0, 28800, "Asia/Kuching" },
{ "bort", 0, 27000, "Asia/Kuching" },
{ "bost", 1, -12756, "America/La_Paz" },
{ "bot", 0, -14400, "America/La_Paz" },
{ "brst", 1, -7200, "America/Sao_Paulo" },
{ "brst", 1, -7200, "America/Araguaina" },
{ "brst", 1, -7200, "America/Bahia" },
{ "brst", 1, -7200, "America/Belem" },
{ "brst", 1, -7200, "America/Fortaleza" },
{ "brst", 1, -7200, "America/Maceio" },
{ "brst", 1, -7200, "America/Recife" },
{ "brst", 1, -7200, "Brazil/East" },
{ "brt", 0, -10800, "America/Sao_Paulo" },
{ "brt", 0, -10800, "America/Araguaina" },
{ "brt", 0, -10800, "America/Bahia" },
{ "brt", 0, -10800, "America/Belem" },
{ "brt", 0, -10800, "America/Fortaleza" },
{ "brt", 0, -10800, "America/Maceio" },
{ "brt", 0, -10800, "America/Recife" },
{ "brt", 0, -10800, "America/Santarem" },
{ "brt", 0, -10800, "Brazil/East" },
{ "bst", 1, 3600, "Europe/London" },
{ "bst", 0, 3600, "Europe/London" },
{ "bst", 0, -39600, "America/Adak" },
{ "bst", 0, -39600, "America/Atka" },
{ "bst", 0, -39600, "America/Nome" },
{ "bst", 0, -39600, "Pacific/Midway" },
{ "bst", 0, -39600, "Pacific/Pago_Pago" },
{ "bst", 0, -39600, "Pacific/Samoa" },
{ "bst", 0, 3600, "Europe/Belfast" },
{ "bst", 0, 3600, "Europe/Guernsey" },
{ "bst", 0, 3600, "Europe/Isle_of_Man" },
@@ -349,21 +173,9 @@
{ "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" },
{ "burt", 0, 23400, "Asia/Calcutta" },
{ "burt", 0, 23400, "Asia/Dacca" },
{ "burt", 0, 23400, "Asia/Dhaka" },
{ "burt", 0, 23400, "Asia/Rangoon" },
{ "burt", 0, 23400, "Asia/Yangon" },
{ "cant", 0, -3600, "Atlantic/Canary" },
{ "capt", 1, -32400, "America/Anchorage" },
{ "cast", 0, 34200, "Australia/Adelaide" },
{ "cast", 1, 10800, "Africa/Juba" },
{ "cast", 1, 10800, "Africa/Khartoum" },
{ "cat", 0, -36000, "America/Anchorage" },
{ "cat", 0, 7200, "Africa/Khartoum" },
{ "cat", 0, 7200, "Africa/Blantyre" },
{ "cat", 0, 7200, "Africa/Bujumbura" },
@@ -375,8 +187,6 @@
{ "cat", 0, 7200, "Africa/Lusaka" },
{ "cat", 0, 7200, "Africa/Maputo" },
{ "cat", 0, 7200, "Africa/Windhoek" },
{ "cawt", 1, -32400, "America/Anchorage" },
{ "cct", 0, 23400, "Indian/Cocos" },
{ "cddt", 1, -14400, "America/Rankin_Inlet" },
{ "cddt", 1, -14400, "America/Resolute" },
{ "cdt", 1, -18000, "America/Chicago" },
@@ -428,6 +238,8 @@
{ "cdt", 1, 32400, "Asia/Chongqing" },
{ "cdt", 1, 32400, "Asia/Chungking" },
{ "cdt", 1, 32400, "Asia/Harbin" },
{ "cdt", 1, 32400, "Asia/Macao" },
{ "cdt", 1, 32400, "Asia/Macau" },
{ "cdt", 1, 32400, "Asia/Taipei" },
{ "cdt", 1, 32400, "PRC" },
{ "cdt", 1, 32400, "ROC" },
@@ -537,32 +349,6 @@
{ "cet", 0, 3600, "Europe/Zagreb" },
{ "cet", 0, 3600, "Europe/Zaporozhye" },
{ "cet", 0, 3600, "Europe/Zurich" },
{ "cgst", 1, -3600, "America/Scoresbysund" },
{ "cgt", 0, -7200, "America/Scoresbysund" },
{ "chadt", 1, 49500, "Pacific/Chatham" },
{ "chast", 0, 45900, "Pacific/Chatham" },
{ "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" },
{ "chut", 0, 36000, "Pacific/Truk" },
{ "chut", 0, 36000, "Pacific/Yap" },
{ "ckhst", 1, -34200, "Pacific/Rarotonga" },
{ "ckt", 0, -36000, "Pacific/Rarotonga" },
{ "ckt", 0, -37800, "Pacific/Rarotonga" },
{ "clst", 1, -10800, "America/Santiago" },
{ "clst", 1, -14400, "America/Santiago" },
{ "clst", 1, -10800, "Antarctica/Palmer" },
{ "clst", 1, -10800, "Chile/Continental" },
{ "clst", 1, -14400, "Chile/Continental" },
{ "clt", 0, -14400, "America/Santiago" },
{ "clt", 0, -18000, "America/Santiago" },
{ "clt", 0, -14400, "Antarctica/Palmer" },
{ "clt", 0, -14400, "Chile/Continental" },
{ "clt", 0, -18000, "Chile/Continental" },
{ "cmt", 0, -15408, "America/Argentina/Buenos_Aires" },
{ "cmt", 0, -15408, "America/Argentina/Catamarca" },
{ "cmt", 0, -15408, "America/Argentina/ComodRivadavia" },
@@ -589,8 +375,6 @@
{ "cmt", 0, 3020, "Europe/Copenhagen" },
{ "cmt", 0, 6900, "Europe/Chisinau" },
{ "cmt", 0, 6900, "Europe/Tiraspol" },
{ "cost", 1, -14400, "America/Bogota" },
{ "cot", 0, -18000, "America/Bogota" },
{ "cpt", 1, -18000, "America/Chicago" },
{ "cpt", 1, -18000, "America/Atikokan" },
{ "cpt", 1, -18000, "America/Coral_Harbour" },
@@ -662,7 +446,6 @@
{ "cst", 0, -21600, "America/Thunder_Bay" },
{ "cst", 0, -21600, "America/Winnipeg" },
{ "cst", 0, -21600, "Canada/Central" },
{ "cst", 0, -21600, "Canada/East-Saskatchewan" },
{ "cst", 0, -21600, "Canada/Saskatchewan" },
{ "cst", 0, -21600, "Mexico/BajaSur" },
{ "cst", 0, -21600, "Mexico/General" },
@@ -675,10 +458,6 @@
{ "cst", 0, 28800, "Asia/Taipei" },
{ "cst", 0, 28800, "PRC" },
{ "cst", 0, 28800, "ROC" },
{ "cut", 0, 8400, "Europe/Zaporozhye" },
{ "cvst", 1, -3600, "Atlantic/Cape_Verde" },
{ "cvt", 0, -7200, "Atlantic/Cape_Verde" },
{ "cvt", 0, -3600, "Atlantic/Cape_Verde" },
{ "cwt", 1, -18000, "America/Chicago" },
{ "cwt", 1, -18000, "America/Atikokan" },
{ "cwt", 1, -18000, "America/Coral_Harbour" },
@@ -702,20 +481,9 @@
{ "cwt", 1, -18000, "America/Winnipeg" },
{ "cwt", 1, -18000, "Canada/Central" },
{ "cwt", 1, -18000, "Mexico/General" },
{ "cxt", 0, 25200, "Indian/Christmas" },
{ "chst", 0, 36000, "Pacific/Guam" },
{ "chst", 0, 36000, "Pacific/Saipan" },
{ "dact", 0, 21600, "Asia/Dacca" },
{ "dact", 0, 21600, "Asia/Dhaka" },
{ "dmt", 0, -1521, "Europe/Dublin" },
{ "easst", 1, -21600, "Chile/EasterIsland" },
{ "easst", 1, -18000, "Chile/EasterIsland" },
{ "easst", 1, -18000, "Pacific/Easter" },
{ "easst", 1, -21600, "Pacific/Easter" },
{ "east", 0, -21600, "Chile/EasterIsland" },
{ "east", 0, -25200, "Chile/EasterIsland" },
{ "east", 0, -21600, "Pacific/Easter" },
{ "east", 0, -25200, "Pacific/Easter" },
{ "eat", 0, 10800, "Africa/Khartoum" },
{ "eat", 0, 10800, "Africa/Addis_Ababa" },
{ "eat", 0, 10800, "Africa/Asmara" },
@@ -729,8 +497,6 @@
{ "eat", 0, 10800, "Indian/Antananarivo" },
{ "eat", 0, 10800, "Indian/Comoro" },
{ "eat", 0, 10800, "Indian/Mayotte" },
{ "ect", 0, -18000, "America/Guayaquil" },
{ "ect", 0, -18000, "Pacific/Galapagos" },
{ "eddt", 1, -10800, "America/Iqaluit" },
{ "edt", 1, -14400, "America/New_York" },
{ "edt", 1, -14400, "America/Cancun" },
@@ -764,6 +530,7 @@
{ "eest", 1, 10800, "Asia/Amman" },
{ "eest", 1, 10800, "Asia/Beirut" },
{ "eest", 1, 10800, "Asia/Damascus" },
{ "eest", 1, 10800, "Asia/Famagusta" },
{ "eest", 1, 10800, "Asia/Gaza" },
{ "eest", 1, 10800, "Asia/Hebron" },
{ "eest", 1, 10800, "Asia/Istanbul" },
@@ -788,13 +555,12 @@
{ "eest", 1, 10800, "Europe/Warsaw" },
{ "eest", 1, 10800, "Europe/Zaporozhye" },
{ "eet", 0, 7200, "Europe/Helsinki" },
{ "eet", 1, 10800, "Asia/Gaza" },
{ "eet", 1, 10800, "Asia/Hebron" },
{ "eet", 0, 7200, "Africa/Cairo" },
{ "eet", 0, 7200, "Africa/Tripoli" },
{ "eet", 0, 7200, "Asia/Amman" },
{ "eet", 0, 7200, "Asia/Beirut" },
{ "eet", 0, 7200, "Asia/Damascus" },
{ "eet", 0, 7200, "Asia/Famagusta" },
{ "eet", 0, 7200, "Asia/Gaza" },
{ "eet", 0, 7200, "Asia/Hebron" },
{ "eet", 0, 7200, "Asia/Istanbul" },
@@ -818,9 +584,6 @@
{ "eet", 0, 7200, "Europe/Vilnius" },
{ "eet", 0, 7200, "Europe/Warsaw" },
{ "eet", 0, 7200, "Europe/Zaporozhye" },
{ "egst", 1, 0, "America/Scoresbysund" },
{ "egt", 0, -3600, "America/Scoresbysund" },
{ "ehdt", 1, -16200, "America/Santo_Domingo" },
{ "emt", 0, -26248, "Chile/EasterIsland" },
{ "emt", 0, -26248, "Pacific/Easter" },
{ "ept", 1, -14400, "America/New_York" },
@@ -881,25 +644,7 @@
{ "ewt", 1, -14400, "America/Toronto" },
{ "ewt", 1, -14400, "Canada/Eastern" },
{ "ffmt", 0, -14660, "America/Martinique" },
{ "fjst", 1, 46800, "Pacific/Fiji" },
{ "fjt", 0, 43200, "Pacific/Fiji" },
{ "fkst", 1, -7200, "Atlantic/Stanley" },
{ "fkst", 0, -10800, "Atlantic/Stanley" },
{ "fkst", 1, -10800, "Atlantic/Stanley" },
{ "fkt", 0, -14400, "Atlantic/Stanley" },
{ "fkt", 0, -10800, "Atlantic/Stanley" },
{ "fmt", 0, -4056, "Atlantic/Madeira" },
{ "fnst", 1, -3600, "America/Noronha" },
{ "fnst", 1, -3600, "Brazil/DeNoronha" },
{ "fnt", 0, -7200, "America/Noronha" },
{ "fnt", 0, -7200, "Brazil/DeNoronha" },
{ "galt", 0, -21600, "Pacific/Galapagos" },
{ "gamt", 0, -32400, "Pacific/Gambier" },
{ "gbgt", 0, -13500, "America/Guyana" },
{ "gft", 0, -14400, "America/Cayenne" },
{ "gft", 0, -10800, "America/Cayenne" },
{ "ghst", 1, 1200, "Africa/Accra" },
{ "gilt", 0, 43200, "Pacific/Tarawa" },
{ "gmt", 0, 0, "Africa/Abidjan" },
{ "gmt", 0, 0, "Africa/Accra" },
{ "gmt", 0, 0, "Africa/Bamako" },
@@ -927,16 +672,8 @@
{ "gmt", 0, 0, "Europe/Jersey" },
{ "gmt", 0, 0, "Europe/London" },
{ "gmt", 0, 0, "GB" },
{ "gst", 0, 14400, "Asia/Dubai" },
{ "gst", 0, -7200, "Atlantic/South_Georgia" },
{ "gst", 0, 14400, "Asia/Bahrain" },
{ "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" },
{ "hdt", 1, -34200, "Pacific/Honolulu" },
{ "hdt", 1, -32400, "America/Adak" },
{ "hdt", 1, -32400, "America/Atka" },
@@ -951,95 +688,41 @@
{ "hmt", 0, 21200, "Asia/Kolkata" },
{ "hmt", 0, 5989, "Europe/Helsinki" },
{ "hmt", 0, 5989, "Europe/Mariehamn" },
{ "hovst", 1, 28800, "Asia/Hovd" },
{ "hovt", 0, 25200, "Asia/Hovd" },
{ "hovt", 0, 21600, "Asia/Hovd" },
{ "hst", 0, -36000, "Pacific/Honolulu" },
{ "hst", 0, -37800, "Pacific/Honolulu" },
{ "hst", 0, -36000, "America/Adak" },
{ "hst", 0, -36000, "America/Atka" },
{ "hst", 0, -36000, "Pacific/Johnston" },
{ "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" },
{ "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, 25025, "Asia/Irkutsk" },
{ "imt", 0, 7016, "Asia/Istanbul" },
{ "imt", 0, 7016, "Europe/Istanbul" },
{ "imt", 0, 7016, "Europe/Sofia" },
{ "iot", 0, 21600, "Indian/Chagos" },
{ "iot", 0, 18000, "Indian/Chagos" },
{ "irdt", 1, 16200, "Asia/Tehran" },
{ "irdt", 1, 18000, "Asia/Tehran" },
{ "irst", 0, 12600, "Asia/Tehran" },
{ "irst", 0, 14400, "Asia/Tehran" },
{ "isst", 1, 0, "Atlantic/Reykjavik" },
{ "ist", 0, 7200, "Asia/Jerusalem" },
{ "ist", 0, -3600, "Atlantic/Reykjavik" },
{ "ist", 0, 19800, "Asia/Calcutta" },
{ "ist", 0, 19800, "Asia/Colombo" },
{ "ist", 0, 19800, "Asia/Dacca" },
{ "ist", 0, 19800, "Asia/Dhaka" },
{ "ist", 0, 19800, "Asia/Karachi" },
{ "ist", 0, 19800, "Asia/Kathmandu" },
{ "ist", 0, 19800, "Asia/Katmandu" },
{ "ist", 0, 19800, "Asia/Kolkata" },
{ "ist", 0, 19800, "Asia/Thimbu" },
{ "ist", 0, 19800, "Asia/Thimphu" },
{ "ist", 1, 2079, "Europe/Dublin" },
{ "ist", 1, 23400, "Asia/Calcutta" },
{ "ist", 1, 23400, "Asia/Colombo" },
{ "ist", 1, 23400, "Asia/Karachi" },
{ "ist", 1, 23400, "Asia/Kolkata" },
{ "ist", 0, 3600, "Europe/Dublin" },
{ "ist", 1, 3600, "Europe/Dublin" },
{ "ist", 0, 7200, "Asia/Gaza" },
{ "ist", 0, 7200, "Asia/Hebron" },
{ "ist", 0, 7200, "Asia/Tel_Aviv" },
{ "javt", 0, 26400, "Asia/Jakarta" },
{ "jcst", 0, 32400, "Asia/Pyongyang" },
{ "jcst", 0, 32400, "Asia/Seoul" },
{ "jcst", 0, 32400, "Asia/Tokyo" },
{ "jcst", 0, 32400, "ROK" },
{ "jdt", 1, 36000, "Asia/Tokyo" },
{ "jmt", 0, 8440, "Asia/Jerusalem" },
{ "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" },
{ "jst", 0, 32400, "Asia/Kuching" },
{ "jst", 0, 32400, "Asia/Makassar" },
{ "jst", 0, 32400, "Asia/Manila" },
{ "jst", 0, 32400, "Asia/Pontianak" },
{ "jst", 0, 32400, "Asia/Pyongyang" },
{ "jst", 0, 32400, "Asia/Rangoon" },
{ "jst", 0, 32400, "Asia/Saigon" },
{ "jst", 0, 32400, "Asia/Seoul" },
{ "jst", 0, 32400, "Asia/Singapore" },
{ "jst", 0, 32400, "Asia/Taipei" },
{ "jst", 0, 32400, "Asia/Ujung_Pandang" },
{ "jst", 0, 32400, "Asia/Yangon" },
{ "jst", 0, 32400, "Pacific/Bougainville" },
{ "jst", 0, 32400, "Pacific/Nauru" },
{ "jst", 0, 32400, "ROC" },
{ "jst", 0, 32400, "ROK" },
{ "jwst", 0, 28800, "Asia/Taipei" },
{ "jwst", 0, 28800, "ROC" },
{ "kart", 0, 18000, "Asia/Karachi" },
{ "kdt", 1, 36000, "Asia/Seoul" },
{ "kdt", 1, 34200, "Asia/Seoul" },
{ "kdt", 1, 34200, "ROK" },
@@ -1048,40 +731,13 @@
{ "kmt", 0, -18431, "America/Grand_Turk" },
{ "kmt", 0, -18431, "America/Jamaica" },
{ "kmt", 0, 7324, "Europe/Kiev" },
{ "kost", 0, 43200, "Pacific/Kosrae" },
{ "kost", 0, 39600, "Pacific/Kosrae" },
{ "kst", 0, 30600, "Asia/Seoul" },
{ "kst", 0, 32400, "Asia/Pyongyang" },
{ "kst", 0, 32400, "Asia/Seoul" },
{ "kst", 0, 30600, "Asia/Pyongyang" },
{ "kst", 0, 30600, "ROK" },
{ "kst", 0, 32400, "ROK" },
{ "kwat", 0, -43200, "Pacific/Kwajalein" },
{ "lhdt", 1, 39600, "Australia/LHI" },
{ "lhdt", 1, 39600, "Australia/Lord_Howe" },
{ "lhdt", 1, 41400, "Australia/LHI" },
{ "lhdt", 1, 41400, "Australia/Lord_Howe" },
{ "lhst", 0, 37800, "Australia/Lord_Howe" },
{ "lhst", 0, 37800, "Australia/LHI" },
{ "lint", 0, 50400, "Pacific/Kiritimati" },
{ "lint", 0, -36000, "Pacific/Kiritimati" },
{ "lint", 0, -38400, "Pacific/Kiritimati" },
{ "lkt", 0, 23400, "Asia/Colombo" },
{ "lkt", 0, 21600, "Asia/Colombo" },
{ "lrt", 0, -2670, "Africa/Monrovia" },
{ "lst", 1, 9394, "Europe/Riga" },
{ "madmt", 1, 3600, "Atlantic/Madeira" },
{ "madst", 1, 0, "Atlantic/Madeira" },
{ "madt", 0, -3600, "Atlantic/Madeira" },
{ "malst", 1, 26400, "Asia/Singapore" },
{ "malst", 1, 26400, "Asia/Kuala_Lumpur" },
{ "malt", 0, 27000, "Asia/Singapore" },
{ "malt", 0, 25200, "Asia/Singapore" },
{ "malt", 0, 26400, "Asia/Singapore" },
{ "malt", 0, 25200, "Asia/Kuala_Lumpur" },
{ "malt", 0, 26400, "Asia/Kuala_Lumpur" },
{ "malt", 0, 27000, "Asia/Kuala_Lumpur" },
{ "mart", 0, -34200, "Pacific/Marquesas" },
{ "mddt", 1, -18000, "America/Cambridge_Bay" },
{ "mddt", 1, -18000, "America/Yellowknife" },
{ "mdst", 1, 16279, "Europe/Moscow" },
@@ -1103,33 +759,22 @@
{ "mdt", 1, -21600, "America/Shiprock" },
{ "mdt", 1, -21600, "America/Swift_Current" },
{ "mdt", 1, -21600, "America/Yellowknife" },
{ "mdt", 1, -21600, "Canada/East-Saskatchewan" },
{ "mdt", 1, -21600, "Canada/Mountain" },
{ "mdt", 1, -21600, "Canada/Saskatchewan" },
{ "mdt", 1, -21600, "Mexico/BajaSur" },
{ "mest", 1, 7200, "MET" },
{ "met", 0, 3600, "MET" },
{ "mht", 0, 43200, "Pacific/Kwajalein" },
{ "mht", 0, 39600, "Pacific/Kwajalein" },
{ "mht", 0, 39600, "Pacific/Majuro" },
{ "mht", 0, 43200, "Pacific/Majuro" },
{ "mist", 0, 39600, "Antarctica/Macquarie" },
{ "mmt", 0, 9017, "Europe/Moscow" },
{ "mmt", 0, 9079, "Europe/Moscow" },
{ "mmt", 0, -13484, "America/Montevideo" },
{ "mmt", 0, -20712, "America/Managua" },
{ "mmt", 0, -2588, "Africa/Monrovia" },
{ "mmt", 0, -2670, "Africa/Monrovia" },
{ "mmt", 0, 17640, "Indian/Maldives" },
{ "mmt", 0, 19172, "Asia/Colombo" },
{ "mmt", 0, 23400, "Asia/Rangoon" },
{ "mmt", 0, 23400, "Asia/Yangon" },
{ "mmt", 0, 19270, "Asia/Calcutta" },
{ "mmt", 0, 19270, "Asia/Kolkata" },
{ "mmt", 0, 28656, "Asia/Makassar" },
{ "mmt", 0, 28656, "Asia/Ujung_Pandang" },
{ "mmt", 0, 6600, "Europe/Minsk" },
{ "most", 1, 32400, "Asia/Macao" },
{ "most", 1, 32400, "Asia/Macau" },
{ "mot", 0, 28800, "Asia/Macao" },
{ "mot", 0, 28800, "Asia/Macau" },
{ "mpt", 1, -21600, "America/Denver" },
{ "mpt", 1, -21600, "America/Boise" },
{ "mpt", 1, -21600, "America/Cambridge_Bay" },
@@ -1141,7 +786,6 @@
{ "mpt", 1, -21600, "America/Shiprock" },
{ "mpt", 1, -21600, "America/Swift_Current" },
{ "mpt", 1, -21600, "America/Yellowknife" },
{ "mpt", 1, -21600, "Canada/East-Saskatchewan" },
{ "mpt", 1, -21600, "Canada/Mountain" },
{ "mpt", 1, -21600, "Canada/Saskatchewan" },
{ "msd", 1, 14400, "Europe/Moscow" },
@@ -1195,16 +839,12 @@
{ "mst", 0, -25200, "America/Swift_Current" },
{ "mst", 0, -25200, "America/Tijuana" },
{ "mst", 0, -25200, "America/Yellowknife" },
{ "mst", 0, -25200, "Canada/East-Saskatchewan" },
{ "mst", 0, -25200, "Canada/Mountain" },
{ "mst", 0, -25200, "Canada/Saskatchewan" },
{ "mst", 0, -25200, "Mexico/BajaNorte" },
{ "mst", 0, -25200, "Mexico/BajaSur" },
{ "mst", 0, -25200, "Mexico/General" },
{ "mst", 1, 12679, "Europe/Moscow" },
{ "must", 1, 18000, "Indian/Mauritius" },
{ "mut", 0, 14400, "Indian/Mauritius" },
{ "mvt", 0, 18000, "Indian/Maldives" },
{ "mwt", 1, -21600, "America/Denver" },
{ "mwt", 1, -21600, "America/Boise" },
{ "mwt", 1, -21600, "America/Cambridge_Bay" },
@@ -1217,13 +857,8 @@
{ "mwt", 1, -21600, "America/Shiprock" },
{ "mwt", 1, -21600, "America/Swift_Current" },
{ "mwt", 1, -21600, "America/Yellowknife" },
{ "mwt", 1, -21600, "Canada/East-Saskatchewan" },
{ "mwt", 1, -21600, "Canada/Mountain" },
{ "mwt", 1, -21600, "Canada/Saskatchewan" },
{ "myt", 0, 28800, "Asia/Kuala_Lumpur" },
{ "myt", 0, 28800, "Asia/Kuching" },
{ "ncst", 1, 43200, "Pacific/Noumea" },
{ "nct", 0, 39600, "Pacific/Noumea" },
{ "nddt", 1, -5400, "America/St_Johns" },
{ "nddt", 1, -5400, "Canada/Newfoundland" },
{ "ndt", 1, -9052, "America/St_Johns" },
@@ -1232,23 +867,12 @@
{ "ndt", 1, -9000, "Canada/Newfoundland" },
{ "ndt", 1, -9052, "America/Goose_Bay" },
{ "ndt", 1, -9052, "Canada/Newfoundland" },
{ "negt", 0, -12600, "America/Paramaribo" },
{ "nest", 1, 4800, "Europe/Amsterdam" },
{ "net", 0, 1200, "Europe/Amsterdam" },
{ "nfst", 1, 45000, "Pacific/Norfolk" },
{ "nft", 0, 41400, "Pacific/Norfolk" },
{ "nft", 0, 39600, "Pacific/Norfolk" },
{ "nmt", 0, 40320, "Pacific/Norfolk" },
{ "npt", 1, -9000, "America/St_Johns" },
{ "npt", 0, 20700, "Asia/Katmandu" },
{ "npt", 1, -36000, "America/Adak" },
{ "npt", 1, -36000, "America/Atka" },
{ "npt", 1, -36000, "America/Nome" },
{ "npt", 1, -9000, "America/Goose_Bay" },
{ "npt", 1, -9000, "Canada/Newfoundland" },
{ "npt", 0, 20700, "Asia/Kathmandu" },
{ "nrt", 0, 43200, "Pacific/Nauru" },
{ "nrt", 0, 41400, "Pacific/Nauru" },
{ "nst", 0, -12600, "America/St_Johns" },
{ "nst", 0, -12652, "America/St_Johns" },
{ "nst", 1, 4772, "Europe/Amsterdam" },
@@ -1259,12 +883,6 @@
{ "nst", 0, -39600, "America/Adak" },
{ "nst", 0, -39600, "America/Atka" },
{ "nst", 0, -39600, "America/Nome" },
{ "nst", 0, -39600, "Pacific/Midway" },
{ "nst", 0, -39600, "Pacific/Pago_Pago" },
{ "nst", 0, -39600, "Pacific/Samoa" },
{ "nut", 0, -39600, "Pacific/Niue" },
{ "nut", 0, -40800, "Pacific/Niue" },
{ "nut", 0, -41400, "Pacific/Niue" },
{ "nwt", 1, -9000, "America/St_Johns" },
{ "nwt", 1, -36000, "America/Adak" },
{ "nwt", 1, -36000, "America/Atka" },
@@ -1308,22 +926,12 @@
{ "pdt", 1, -25200, "Canada/Pacific" },
{ "pdt", 1, -25200, "Canada/Yukon" },
{ "pdt", 1, -25200, "Mexico/BajaNorte" },
{ "pest", 1, -14400, "America/Lima" },
{ "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" },
{ "phot", 0, -43200, "Pacific/Enderbury" },
{ "phst", 1, 32400, "Asia/Manila" },
{ "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" },
{ "pmmt", 0, 35312, "Pacific/Bougainville" },
{ "pmst", 0, -10800, "America/Miquelon" },
{ "pmmt", 0, 35312, "Pacific/Port_Moresby" },
{ "pmt", 0, -13236, "America/Paramaribo" },
{ "pmt", 0, -13252, "America/Paramaribo" },
{ "pmt", 0, 13505, "Asia/Yekaterinburg" },
@@ -1334,9 +942,6 @@
{ "pmt", 0, 561, "Africa/Tunis" },
{ "pmt", 0, 561, "Europe/Monaco" },
{ "pmt", 0, 561, "Europe/Paris" },
{ "pnt", 0, -30600, "Pacific/Pitcairn" },
{ "pont", 0, 39600, "Pacific/Pohnpei" },
{ "pont", 0, 39600, "Pacific/Ponape" },
{ "ppmt", 0, -17340, "America/Port-au-Prince" },
{ "ppt", 1, -25200, "America/Los_Angeles" },
{ "ppt", 1, -25200, "America/Dawson_Creek" },
@@ -1372,7 +977,6 @@
{ "pst", 0, -28800, "Canada/Yukon" },
{ "pst", 0, -28800, "Mexico/BajaNorte" },
{ "pst", 0, -28800, "Mexico/BajaSur" },
{ "pst", 0, -28800, "Pacific/Pitcairn" },
{ "pwt", 1, -25200, "America/Los_Angeles" },
{ "pwt", 1, -25200, "America/Dawson_Creek" },
{ "pwt", 1, -25200, "America/Ensenada" },
@@ -1385,15 +989,10 @@
{ "pwt", 1, -25200, "America/Vancouver" },
{ "pwt", 1, -25200, "Canada/Pacific" },
{ "pwt", 1, -25200, "Mexico/BajaNorte" },
{ "pwt", 0, 32400, "Pacific/Palau" },
{ "pyst", 1, -10800, "America/Asuncion" },
{ "pyt", 0, -14400, "America/Asuncion" },
{ "pyt", 0, -10800, "America/Asuncion" },
{ "qmt", 0, -18840, "America/Guayaquil" },
{ "ret", 0, 14400, "Indian/Reunion" },
{ "rmt", 0, 5794, "Europe/Riga" },
{ "rmt", 0, 23080, "Asia/Rangoon" },
{ "rmt", 0, 23080, "Asia/Yangon" },
{ "rmt", 0, 23087, "Asia/Rangoon" },
{ "rmt", 0, 23087, "Asia/Yangon" },
{ "rmt", 0, 2996, "Europe/Rome" },
{ "rmt", 0, 2996, "Europe/San_Marino" },
{ "rmt", 0, 2996, "Europe/Vatican" },
@@ -1408,90 +1007,31 @@
{ "sast", 0, 7200, "Africa/Maseru" },
{ "sast", 0, 7200, "Africa/Mbabane" },
{ "sast", 0, 7200, "Africa/Windhoek" },
{ "sbt", 0, 39600, "Pacific/Guadalcanal" },
{ "sct", 0, 14400, "Indian/Mahe" },
{ "sdmt", 0, -16800, "America/Santo_Domingo" },
{ "sdt", 1, -36000, "Pacific/Apia" },
{ "set", 0, 3614, "Europe/Stockholm" },
{ "sgt", 0, 28800, "Asia/Singapore" },
{ "sgt", 0, 27000, "Asia/Singapore" },
{ "sjmt", 0, -20173, "America/Costa_Rica" },
{ "smt", 0, -13884, "Atlantic/Stanley" },
{ "smt", 0, -16966, "America/Punta_Arenas" },
{ "smt", 0, -16966, "America/Santiago" },
{ "smt", 0, -16966, "Chile/Continental" },
{ "smt", 0, 24925, "Asia/Kuala_Lumpur" },
{ "smt", 0, 24925, "Asia/Singapore" },
{ "smt", 0, 8160, "Europe/Simferopol" },
{ "srt", 0, -10800, "America/Paramaribo" },
{ "srt", 0, -12600, "America/Paramaribo" },
{ "sst", 0, -39600, "Pacific/Samoa" },
{ "sst", 0, -39600, "Pacific/Apia" },
{ "sst", 0, -39600, "Pacific/Midway" },
{ "sst", 0, -39600, "Pacific/Pago_Pago" },
{ "swat", 0, 5400, "Africa/Windhoek" },
{ "taht", 0, -36000, "Pacific/Tahiti" },
{ "tbmt", 0, 10751, "Asia/Tbilisi" },
{ "tkt", 0, -39600, "Pacific/Fakaofo" },
{ "tkt", 0, 46800, "Pacific/Fakaofo" },
{ "tlt", 0, 32400, "Asia/Dili" },
{ "tlt", 0, 28800, "Asia/Dili" },
{ "tmt", 0, 12344, "Asia/Tehran" },
{ "tmt", 0, 5940, "Europe/Tallinn" },
{ "tost", 1, 50400, "Pacific/Tongatapu" },
{ "tot", 0, 46800, "Pacific/Tongatapu" },
{ "tot", 0, 44400, "Pacific/Tongatapu" },
{ "tvt", 0, 43200, "Pacific/Funafuti" },
{ "uct", 0, 0, "Etc/UCT" },
{ "ulast", 1, 32400, "Asia/Ulaanbaatar" },
{ "ulast", 1, 32400, "Asia/Ulan_Bator" },
{ "ulat", 0, 28800, "Asia/Ulaanbaatar" },
{ "ulat", 0, 25200, "Asia/Ulaanbaatar" },
{ "ulat", 0, 25200, "Asia/Choibalsan" },
{ "ulat", 0, 25200, "Asia/Ulan_Bator" },
{ "ulat", 0, 28800, "Asia/Choibalsan" },
{ "ulat", 0, 28800, "Asia/Ulan_Bator" },
{ "utc", 0, 0, "Etc/Universal" },
{ "utc", 0, 0, "Etc/UTC" },
{ "utc", 0, 0, "Etc/Zulu" },
{ "utc", 0, 0, "UTC" },
{ "utc", 0, 0, "UTC" },
{ "uyhst", 1, -9000, "America/Montevideo" },
{ "uyhst", 1, -10800, "America/Montevideo" },
{ "uyst", 1, -7200, "America/Montevideo" },
{ "uyt", 0, -10800, "America/Montevideo" },
{ "uyt", 0, -12600, "America/Montevideo" },
{ "vet", 0, -16200, "America/Caracas" },
{ "vet", 0, -14400, "America/Caracas" },
{ "vust", 1, 43200, "Pacific/Efate" },
{ "vut", 0, 39600, "Pacific/Efate" },
{ "wakt", 0, 43200, "Pacific/Wake" },
{ "warst", 1, -10800, "America/Mendoza" },
{ "warst", 1, -10800, "America/Argentina/Jujuy" },
{ "warst", 1, -10800, "America/Argentina/Mendoza" },
{ "warst", 1, -10800, "America/Argentina/San_Luis" },
{ "warst", 1, -10800, "America/Jujuy" },
{ "wart", 0, -14400, "America/Mendoza" },
{ "wart", 0, -14400, "America/Argentina/Catamarca" },
{ "wart", 0, -14400, "America/Argentina/ComodRivadavia" },
{ "wart", 0, -14400, "America/Argentina/Cordoba" },
{ "wart", 0, -14400, "America/Argentina/Jujuy" },
{ "wart", 0, -14400, "America/Argentina/La_Rioja" },
{ "wart", 0, -14400, "America/Argentina/Mendoza" },
{ "wart", 0, -14400, "America/Argentina/Rio_Gallegos" },
{ "wart", 0, -14400, "America/Argentina/Salta" },
{ "wart", 0, -14400, "America/Argentina/San_Juan" },
{ "wart", 0, -14400, "America/Argentina/San_Luis" },
{ "wart", 0, -14400, "America/Argentina/Tucuman" },
{ "wart", 0, -14400, "America/Argentina/Ushuaia" },
{ "wart", 0, -14400, "America/Catamarca" },
{ "wart", 0, -14400, "America/Cordoba" },
{ "wart", 0, -14400, "America/Jujuy" },
{ "wart", 0, -14400, "America/Rosario" },
{ "wast", 1, 7200, "Africa/Windhoek" },
{ "wast", 1, 7200, "Africa/Ndjamena" },
{ "wat", 0, 3600, "Africa/Brazzaville" },
{ "wat", 0, -3600, "Africa/Bissau" },
{ "wat", 0, -3600, "Africa/El_Aaiun" },
{ "wat", 0, 3600, "Africa/Bangui" },
{ "wat", 0, 3600, "Africa/Douala" },
{ "wat", 0, 3600, "Africa/Kinshasa" },
@@ -1539,29 +1079,14 @@
{ "wet", 0, 0, "Europe/Luxembourg" },
{ "wet", 0, 0, "Europe/Madrid" },
{ "wet", 0, 0, "Europe/Monaco" },
{ "wft", 0, 43200, "Pacific/Wallis" },
{ "wgst", 1, -7200, "America/Godthab" },
{ "wgst", 1, -7200, "America/Danmarkshavn" },
{ "wgt", 0, -10800, "America/Godthab" },
{ "wgt", 0, -10800, "America/Danmarkshavn" },
{ "wib", 0, 25200, "Asia/Jakarta" },
{ "wib", 0, 25200, "Asia/Pontianak" },
{ "wib", 0, 27000, "Asia/Jakarta" },
{ "wib", 0, 27000, "Asia/Pontianak" },
{ "wib", 0, 28800, "Asia/Jakarta" },
{ "wib", 0, 28800, "Asia/Pontianak" },
{ "wita", 0, 28800, "Asia/Dili" },
{ "wita", 0, 28800, "Asia/Makassar" },
{ "wita", 0, 28800, "Asia/Pontianak" },
{ "wita", 0, 28800, "Asia/Ujung_Pandang" },
{ "wit", 0, 32400, "Asia/Jayapura" },
{ "wmt", 0, 5040, "Europe/Vilnius" },
{ "wmt", 0, 5040, "Europe/Warsaw" },
{ "wsdt", 1, 50400, "Pacific/Apia" },
{ "wsst", 0, -41400, "Pacific/Apia" },
{ "wsst", 0, 46800, "Pacific/Apia" },
{ "xjt", 0, 21600, "Asia/Kashgar" },
{ "xjt", 0, 21600, "Asia/Urumqi" },
{ "yddt", 1, -25200, "America/Dawson" },
{ "yddt", 1, -25200, "America/Whitehorse" },
{ "yddt", 1, -25200, "Canada/Yukon" },
+48 -15
View File
@@ -23,6 +23,7 @@
*/
#include "timelib.h"
#include "timelib_private.h"
/* jan feb mrt apr may jun jul aug sep oct nov dec */
static int month_tab_leap[12] = { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
@@ -32,14 +33,14 @@ static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 24
static int days_in_month_leap[13] = { 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static void do_range_limit_fraction(double *fraction, timelib_sll *seconds)
static void do_range_limit_fraction(timelib_sll *fraction, timelib_sll *seconds)
{
if (*fraction < 0) {
*fraction += 1;
*fraction += 1000000;
*seconds -= 1;
}
if (*fraction > 1) {
*fraction -= 1;
if (*fraction > 1000000) {
*fraction -= 1000000;
*seconds += 1;
}
}
@@ -202,14 +203,47 @@ void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
do_range_limit(0, 12, 12, &rt->m, &rt->y);
}
#define EPOCH_DAY 719468
static void magic_date_calc(timelib_time *time)
{
timelib_sll y, ddd, mi, mm, dd, g;
/* The algorithm doesn't work before the year 1 */
if (time->d < -719498) {
return;
}
g = time->d + EPOCH_DAY - 1;
y = (10000 * g + 14780) / 3652425;
ddd = g - ((365*y) + (y/4) - (y/100) + (y/400));
if (ddd < 0) {
y--;
ddd = g - ((365*y) + (y/4) - (y/100) + (y/400));
}
mi = (100 * ddd + 52) / 3060;
mm = ((mi + 2) % 12) + 1;
y = y + (mi + 2) / 12;
dd = ddd - ((mi * 306 + 5) / 10) + 1;
time->y = y;
time->m = mm;
time->d = dd;
}
void timelib_do_normalize(timelib_time* time)
{
if (time->f != TIMELIB_UNSET) do_range_limit_fraction(&time->f, &time->s);
if (time->us != TIMELIB_UNSET) do_range_limit_fraction(&time->us, &time->s);
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->s, &time->i);
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->i, &time->h);
if (time->s != TIMELIB_UNSET) do_range_limit(0, 24, 24, &time->h, &time->d);
do_range_limit(1, 13, 12, &time->m, &time->y);
/* Short cut if we're doing things against the Epoch */
if (time->y == 1970 && time->m == 1 && time->d != 1) {
magic_date_calc(time);
}
do {} while (do_range_limit_days(&time->y, &time->m, &time->d));
do_range_limit(1, 13, 12, &time->m, &time->y);
}
@@ -222,7 +256,7 @@ static void do_adjust_relative(timelib_time* time)
timelib_do_normalize(time);
if (time->have_relative) {
time->f += time->relative.f;
time->us += time->relative.us;
time->s += time->relative.s;
time->i += time->relative.i;
@@ -399,16 +433,15 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
case TIMELIB_ZONETYPE_OFFSET:
tz->is_localtime = 1;
return tz->z * 60;
return -tz->z;
break;
case TIMELIB_ZONETYPE_ABBR: {
timelib_sll tmp;
tz->is_localtime = 1;
tmp = tz->z;
tmp -= tz->dst * 60;
tmp *= 60;
tmp = -tz->z;
tmp -= tz->dst * 3600;
return tmp;
}
break;
@@ -422,19 +455,19 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
if (tzi) {
timelib_time_offset *before, *after;
timelib_sll tmp;
int in_transistion;
int in_transition;
tz->is_localtime = 1;
before = timelib_get_time_zone_info(tz->sse, tzi);
after = timelib_get_time_zone_info(tz->sse - before->offset, tzi);
timelib_set_timezone(tz, tzi);
in_transistion = (
((tz->sse - after->offset) >= (after->transistion_time + (before->offset - after->offset))) &&
((tz->sse - after->offset) < after->transistion_time)
in_transition = (
((tz->sse - after->offset) >= (after->transition_time + (before->offset - after->offset))) &&
((tz->sse - after->offset) < after->transition_time)
);
if ((before->offset != after->offset) && !in_transistion) {
if ((before->offset != after->offset) && !in_transition) {
tmp = -after->offset;
} else {
tmp = -tz->z;
+18 -47
View File
@@ -23,18 +23,7 @@
*/
#include "timelib.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include "timelib_private.h"
static int month_tab_leap[12] = { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
@@ -59,12 +48,17 @@ void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts)
if (ts >= 0) {
tmp_days = days + 1;
} else {
tmp_days = days;
}
if (tmp_days >= DAYS_PER_LYEAR_PERIOD || tmp_days <= -DAYS_PER_LYEAR_PERIOD) {
cur_year += YEARS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
tmp_days -= DAYS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
}
if (tmp_days > DAYS_PER_LYEAR_PERIOD || tmp_days <= -DAYS_PER_LYEAR_PERIOD) {
cur_year += YEARS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
tmp_days -= DAYS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
}
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
if (ts >= 0) {
while (tmp_days >= DAYS_PER_LYEAR) {
cur_year++;
if (timelib_is_leap(cur_year)) {
@@ -72,33 +66,17 @@ void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts)
} else {
tmp_days -= DAYS_PER_YEAR;
}
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
}
} else {
tmp_days = days;
/* Guess why this might be for, it has to do with a pope ;-). It's also
* only valid for Great Brittain and it's colonies. It needs fixing for
* other locales. *sigh*, why is this crap so complex! */
/*
if (ts <= TIMELIB_LL_CONST(-6857352000)) {
tmp_days -= 11;
}
*/
while (tmp_days <= 0) {
if (tmp_days < -1460970) {
cur_year -= 4000;
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
tmp_days += 1460970;
cur_year--;
if (timelib_is_leap(cur_year)) {
tmp_days += DAYS_PER_LYEAR;
} else {
cur_year--;
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
if (timelib_is_leap(cur_year)) {
tmp_days += DAYS_PER_LYEAR;
} else {
tmp_days += DAYS_PER_YEAR;
}
tmp_days += DAYS_PER_YEAR;
}
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
}
remainder += SECS_PER_DAY;
}
@@ -149,7 +127,7 @@ void timelib_update_from_sse(timelib_time *tm)
switch (tm->zone_type) {
case TIMELIB_ZONETYPE_ABBR:
case TIMELIB_ZONETYPE_OFFSET: {
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + (tm->dst * 3600));
timelib_unixtime2gmt(tm, tm->sse + tm->z + (tm->dst * 3600));
goto cleanup;
}
@@ -187,7 +165,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
int z = tm->z;
signed int dst = tm->dst;
timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
timelib_unixtime2gmt(tm, ts + tm->z + (tm->dst * 3600));
tm->sse = ts;
tm->z = z;
@@ -295,10 +273,3 @@ int timelib_apply_localtime(timelib_time *t, unsigned int localtime)
}
return 0;
}
#if HAVE_GETTIMEOFDAY
void timelib_set_fraction_from_timeval(timelib_time *t, struct timeval tp)
{
t->f = (double) tp.tv_usec / 1000000;
}
#endif
+91 -43
View File
@@ -29,6 +29,7 @@
#include "php_date.h"
#include "zend_interfaces.h"
#include "lib/timelib.h"
#include "lib/timelib_private.h"
#ifndef PHP_WIN32
#include <time.h>
#else
@@ -658,6 +659,7 @@ static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n
zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
void date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot);
static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
static void date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot);
@@ -921,6 +923,7 @@ PHP_MINFO_FUNCTION(date)
php_info_print_table_start();
php_info_print_table_row(2, "date/time support", "enabled");
php_info_print_table_row(2, "timelib version", TIMELIB_ASCII_VERSION);
php_info_print_table_row(2, "\"Olson\" Timezone Database Version", tzdb->version);
php_info_print_table_row(2, "Timezone Database", php_date_global_timezone_db_enabled ? "external" : "internal");
php_info_print_table_row(2, "Default timezone", guess_timezone(tzdb));
@@ -934,6 +937,7 @@ PHP_MINFO_FUNCTION(date)
static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_tzdb *tzdb)
{
timelib_tzinfo *tzi;
int dummy_error_code;
if(!DATEG(tzcache)) {
ALLOC_HASHTABLE(DATEG(tzcache));
@@ -944,14 +948,14 @@ static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_
return tzi;
}
tzi = timelib_parse_tzfile(formal_tzname, tzdb);
tzi = timelib_parse_tzfile(formal_tzname, tzdb, &dummy_error_code);
if (tzi) {
zend_hash_str_add_ptr(DATEG(tzcache), formal_tzname, strlen(formal_tzname), tzi);
}
return tzi;
}
timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib_tzdb *tzdb)
timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib_tzdb *tzdb, int *dummy_error_code)
{
return php_date_parse_tzfile(formal_tzname, tzdb);
}
@@ -1103,13 +1107,13 @@ static zend_string *date_format(char *format, size_t format_len, timelib_time *t
if (localtime) {
if (t->zone_type == TIMELIB_ZONETYPE_ABBR) {
offset = timelib_time_offset_ctor();
offset->offset = (t->z - (t->dst * 60)) * -60;
offset->offset = (t->z + (t->dst * 3600));
offset->leap_secs = 0;
offset->is_dst = t->dst;
offset->abbr = timelib_strdup(t->tz_abbr);
} else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) {
offset = timelib_time_offset_ctor();
offset->offset = (t->z) * -60;
offset->offset = (t->z);
offset->leap_secs = 0;
offset->is_dst = 0;
offset->abbr = timelib_malloc(9); /* GMT±xxxx\0 */
@@ -1174,8 +1178,8 @@ static zend_string *date_format(char *format, size_t format_len, timelib_time *t
case 'H': length = slprintf(buffer, 32, "%02d", (int) t->h); break;
case 'i': length = slprintf(buffer, 32, "%02d", (int) t->i); break;
case 's': length = slprintf(buffer, 32, "%02d", (int) t->s); break;
case 'u': length = slprintf(buffer, 32, "%06d", (int) floor(t->f * 1000000 + 0.5)); break;
case 'v': length = slprintf(buffer, 32, "%03d", (int) floor(t->f * 1000 + 0.5)); break;
case 'u': length = slprintf(buffer, 32, "%06d", (int) floor(t->us)); break;
case 'v': length = slprintf(buffer, 32, "%03d", (int) floor(t->us / 1000)); break;
/* timezone */
case 'I': length = slprintf(buffer, 32, "%d", localtime ? offset->is_dst : 0); break;
@@ -1315,13 +1319,13 @@ PHPAPI int php_idate(char format, time_t ts, int localtime)
if (!localtime) {
if (t->zone_type == TIMELIB_ZONETYPE_ABBR) {
offset = timelib_time_offset_ctor();
offset->offset = (t->z - (t->dst * 60)) * -60;
offset->offset = (t->z + (t->dst * 3600));
offset->leap_secs = 0;
offset->is_dst = t->dst;
offset->abbr = timelib_strdup(t->tz_abbr);
} else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) {
offset = timelib_time_offset_ctor();
offset->offset = (t->z - (t->dst * 60)) * -60;
offset->offset = (t->z + (t->dst * 3600));
offset->leap_secs = 0;
offset->is_dst = t->dst;
offset->abbr = timelib_malloc(9); /* GMT±xxxx\0 */
@@ -1478,7 +1482,7 @@ PHP_FUNCTION(strtotime)
{
zend_string *times;
int error1, error2;
struct timelib_error_container *error;
timelib_error_container *error;
zend_long preset_ts = 0, ts;
timelib_time *t, *now;
timelib_tzinfo *tzi;
@@ -1962,6 +1966,10 @@ static void date_period_it_rewind(zend_object_iterator *iter)
if (iterator->object->current) {
timelib_time_dtor(iterator->object->current);
}
if (!iterator->object->start) {
zend_throw_error(NULL, "DatePeriod has not been initialized correctly");
return;
}
iterator->object->current = timelib_time_clone(iterator->object->start);
date_period_it_invalidate_current(iter);
}
@@ -2142,7 +2150,7 @@ static void date_register_classes(void) /* {{{ */
date_object_handlers_interval.read_property = date_interval_read_property;
date_object_handlers_interval.write_property = date_interval_write_property;
date_object_handlers_interval.get_properties = date_object_get_properties_interval;
date_object_handlers_interval.get_property_ptr_ptr = NULL;
date_object_handlers_interval.get_property_ptr_ptr = date_interval_get_property_ptr_ptr;
date_object_handlers_interval.get_gc = date_object_get_gc_interval;
INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period);
@@ -2281,9 +2289,9 @@ static HashTable *date_object_get_properties(zval *object) /* {{{ */
timelib_sll utc_offset = dateobj->time->z;
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
utc_offset > 0 ? '-' : '+',
abs(utc_offset / 60),
abs((utc_offset % 60)));
utc_offset < 0 ? '-' : '+',
php_date_llabs(utc_offset / 3600),
php_date_llabs(((utc_offset % 3600) / 60)));
ZVAL_NEW_STR(&zv, tmpstr);
}
@@ -2373,9 +2381,9 @@ static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
tzobj->tzi.utc_offset > 0 ? '-' : '+',
abs(tzobj->tzi.utc_offset / 60),
abs((tzobj->tzi.utc_offset % 60)));
tzobj->tzi.utc_offset < 0 ? '-' : '+',
php_date_llabs(tzobj->tzi.utc_offset / 3600),
php_date_llabs(((tzobj->tzi.utc_offset % 3600) / 60)));
ZVAL_NEW_STR(&zv, tmpstr);
}
@@ -2455,7 +2463,7 @@ static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */
PHP_DATE_INTERVAL_ADD_PROPERTY("h", h);
PHP_DATE_INTERVAL_ADD_PROPERTY("i", i);
PHP_DATE_INTERVAL_ADD_PROPERTY("s", s);
ZVAL_DOUBLE(&zv, (double)intervalobj->diff->f);
ZVAL_DOUBLE(&zv, (double)intervalobj->diff->us / 1000000.0);
zend_hash_str_update(props, "f", sizeof("f") - 1, &zv);
PHP_DATE_INTERVAL_ADD_PROPERTY("weekday", weekday);
PHP_DATE_INTERVAL_ADD_PROPERTY("weekday_behavior", weekday_behavior);
@@ -2591,7 +2599,7 @@ static void update_errors_warnings(timelib_error_container *last_errors) /* {{{
static void php_date_set_time_fraction(timelib_time *time, int microseconds)
{
time->f = (double) microseconds / 1000000;
time->us = microseconds;
}
static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *usec)
@@ -3010,7 +3018,7 @@ PHP_FUNCTION(date_get_last_errors)
}
/* }}} */
void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *parsed_time, struct timelib_error_container *error) /* {{{ */
void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *parsed_time, timelib_error_container *error) /* {{{ */
{
zval element;
@@ -3028,10 +3036,10 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
if (parsed_time->f == -99999) {
if (parsed_time->us == -99999) {
add_assoc_bool(return_value, "fraction", 0);
} else {
add_assoc_double(return_value, "fraction", parsed_time->f);
add_assoc_double(return_value, "fraction", (double)parsed_time->us / 1000000.0);
}
zval_from_error_container(return_value, error);
@@ -3090,7 +3098,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
PHP_FUNCTION(date_parse)
{
zend_string *date;
struct timelib_error_container *error;
timelib_error_container *error;
timelib_time *parsed_time;
ZEND_PARSE_PARAMETERS_START(1, 1)
@@ -3108,7 +3116,7 @@ PHP_FUNCTION(date_parse)
PHP_FUNCTION(date_parse_from_format)
{
zend_string *date, *format;
struct timelib_error_container *error;
timelib_error_container *error;
timelib_time *parsed_time;
ZEND_PARSE_PARAMETERS_START(2, 2)
@@ -3165,7 +3173,7 @@ static int php_date_modify(zval *object, char *modify, size_t modify_len) /* {{{
return 0;
}
memcpy(&dateobj->time->relative, &tmp_time->relative, sizeof(struct timelib_rel_time));
memcpy(&dateobj->time->relative, &tmp_time->relative, sizeof(timelib_rel_time));
dateobj->time->have_relative = tmp_time->have_relative;
dateobj->time->sse_uptodate = 0;
@@ -3194,8 +3202,8 @@ static int php_date_modify(zval *object, char *modify, size_t modify_len) /* {{{
}
}
if (tmp_time->f != -99999) {
dateobj->time->f = tmp_time->f;
if (tmp_time->us != -99999) {
dateobj->time->us = tmp_time->us;
}
timelib_time_dtor(tmp_time);
@@ -3484,10 +3492,10 @@ PHP_FUNCTION(date_offset_get)
timelib_time_offset_dtor(offset);
break;
case TIMELIB_ZONETYPE_OFFSET:
RETVAL_LONG(dateobj->time->z * -60);
RETVAL_LONG(dateobj->time->z);
break;
case TIMELIB_ZONETYPE_ABBR:
RETVAL_LONG((dateobj->time->z - (60 * dateobj->time->dst)) * -60);
RETVAL_LONG((dateobj->time->z + (3600 * dateobj->time->dst)));
break;
}
return;
@@ -3506,7 +3514,7 @@ static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long
dateobj->time->h = h;
dateobj->time->i = i;
dateobj->time->s = s;
dateobj->time->f = ((double) ms) / 1000000;
dateobj->time->us = ms;
timelib_update_ts(dateobj->time, NULL);
} /* }}} */
@@ -3903,9 +3911,9 @@ PHP_FUNCTION(timezone_name_get)
timelib_sll utc_offset = tzobj->tzi.utc_offset;
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
utc_offset > 0 ? '-' : '+',
abs(utc_offset / 60),
abs((utc_offset % 60)));
utc_offset < 0 ? '-' : '+',
php_date_llabs(utc_offset / 3600),
php_date_llabs(((utc_offset % 3600) / 60)));
RETURN_NEW_STR(tmpstr);
}
@@ -3969,10 +3977,10 @@ PHP_FUNCTION(timezone_offset_get)
timelib_time_offset_dtor(offset);
break;
case TIMELIB_ZONETYPE_OFFSET:
RETURN_LONG(tzobj->tzi.utc_offset * -60);
RETURN_LONG(tzobj->tzi.utc_offset);
break;
case TIMELIB_ZONETYPE_ABBR:
RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60);
RETURN_LONG(tzobj->tzi.z.utc_offset + (tzobj->tzi.z.dst * 3600));
break;
}
}
@@ -4089,7 +4097,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
timelib_rel_time *p = NULL;
int r = 0;
int retval = 0;
struct timelib_error_container *errors;
timelib_error_container *errors;
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
@@ -4158,7 +4166,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
GET_VALUE_FROM_STRUCT(i, "i");
GET_VALUE_FROM_STRUCT(s, "s");
if (strcmp(Z_STRVAL_P(member), "f") == 0) {
fvalue = obj->diff->f;
fvalue = obj->diff->us / 1000000.0;
break;
}
GET_VALUE_FROM_STRUCT(invert, "invert");
@@ -4229,7 +4237,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
SET_VALUE_FROM_STRUCT(i, "i");
SET_VALUE_FROM_STRUCT(s, "s");
if (strcmp(Z_STRVAL_P(member), "f") == 0) {
obj->diff->f = zval_get_double(value);
obj->diff->us = zval_get_double(value) * 1000000;
break;
}
SET_VALUE_FROM_STRUCT(invert, "invert");
@@ -4243,6 +4251,40 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
}
/* }}} */
/* {{{ date_interval_get_property_ptr_ptr */
static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
{
zval tmp_member, *ret;
if (Z_TYPE_P(member) != IS_STRING) {
tmp_member = *member;
zval_copy_ctor(&tmp_member);
convert_to_string(&tmp_member);
member = &tmp_member;
cache_slot = NULL;
}
if(zend_binary_strcmp("y", sizeof("y") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("m", sizeof("m") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("d", sizeof("d") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
/* Fallback to read_property. */
ret = NULL;
} else {
ret = (zend_get_std_object_handlers())->get_property_ptr_ptr(object, member, type, cache_slot);
}
if (member == &tmp_member) {
zval_dtor(member);
}
return ret;
}
/* }}} */
/* {{{ proto DateInterval::__construct([string interval_spec])
Creates new DateInterval object.
@@ -4311,7 +4353,14 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
PHP_DATE_INTERVAL_READ_PROPERTY("h", h, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("i", i, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("s", s, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY_DOUBLE("f", f, -1)
do {
zval *z_arg = zend_hash_str_find(myht, "f", sizeof("f") - 1);
if (z_arg) {
(*intobj)->diff->us = ((double)zval_get_double(z_arg) * 1000000);
} else {
(*intobj)->diff->us = (double) -1000000;
}
} while (0);
PHP_DATE_INTERVAL_READ_PROPERTY("weekday", weekday, int, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("weekday_behavior", weekday_behavior, int, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("first_last_day_of", first_last_day_of, int, -1)
@@ -4420,8 +4469,8 @@ static zend_string *date_interval_format(char *format, size_t format_len, timeli
case 'S': length = slprintf(buffer, 32, "%02" ZEND_LONG_FMT_SPEC, (zend_long) t->s); break;
case 's': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) t->s); break;
case 'F': length = slprintf(buffer, 32, "%06" ZEND_LONG_FMT_SPEC, (zend_long) (t->f * 1000000)); break;
case 'f': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) (t->f * 1000000)); break;
case 'F': length = slprintf(buffer, 32, "%06" ZEND_LONG_FMT_SPEC, (zend_long) t->us); break;
case 'f': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) t->us); break;
case 'a': {
if ((int) t->days != -99999) {
@@ -4483,7 +4532,7 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
timelib_rel_time *p = NULL;
int r = 0;
int retval = 0;
struct timelib_error_container *errors;
timelib_error_container *errors;
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
@@ -4709,8 +4758,7 @@ PHP_FUNCTION(timezone_identifiers_list)
}
tzdb = DATE_TIMEZONEDB;
item_count = tzdb->index_size;
table = tzdb->index;
table = timelib_timezone_identifiers_list((timelib_tzdb*) tzdb, &item_count);
array_init(return_value);
@@ -52,13 +52,6 @@ Array
[comments] => %s
)
Array
(
[country_code] => %s
[latitude] => %f
[longitude] => %f
[comments] =>
)
Array
(
[country_code] => %s
[latitude] => %f
@@ -29,22 +29,22 @@ string(5) "array"
int(%d)
-- Format a sample entry --
array(17) {
array(12) {
[0]=>
array(3) {
["dst"]=>
bool(true)
bool(false)
["offset"]=>
int(-14400)
int(32400)
["timezone_id"]=>
string(18) "America/Porto_Acre"
string(18) "Australia/Adelaide"
}
[1]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
int(34200)
["timezone_id"]=>
string(18) "Australia/Adelaide"
}
@@ -53,36 +53,36 @@ array(17) {
["dst"]=>
bool(false)
["offset"]=>
int(34200)
int(32400)
["timezone_id"]=>
string(18) "Australia/Adelaide"
string(21) "Australia/Broken_Hill"
}
[3]=>
array(3) {
["dst"]=>
bool(true)
bool(false)
["offset"]=>
int(-14400)
int(32400)
["timezone_id"]=>
string(16) "America/Eirunepe"
string(16) "Australia/Darwin"
}
[4]=>
array(3) {
["dst"]=>
bool(true)
bool(false)
["offset"]=>
int(-14400)
int(32400)
["timezone_id"]=>
string(18) "America/Rio_Branco"
string(15) "Australia/North"
}
[5]=>
array(3) {
["dst"]=>
bool(true)
bool(false)
["offset"]=>
int(-14400)
int(32400)
["timezone_id"]=>
string(11) "Brazil/Acre"
string(15) "Australia/South"
}
[6]=>
array(3) {
@@ -91,81 +91,36 @@ array(17) {
["offset"]=>
int(32400)
["timezone_id"]=>
string(21) "Australia/Broken_Hill"
string(20) "Australia/Yancowinna"
}
[7]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
int(34200)
["timezone_id"]=>
string(16) "Australia/Darwin"
string(21) "Australia/Broken_Hill"
}
[8]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
int(34200)
["timezone_id"]=>
string(15) "Australia/North"
string(16) "Australia/Darwin"
}
[9]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
int(34200)
["timezone_id"]=>
string(15) "Australia/South"
string(15) "Australia/North"
}
[10]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(32400)
["timezone_id"]=>
string(20) "Australia/Yancowinna"
}
[11]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(34200)
["timezone_id"]=>
string(13) "Asia/Jayapura"
}
[12]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(34200)
["timezone_id"]=>
string(21) "Australia/Broken_Hill"
}
[13]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(34200)
["timezone_id"]=>
string(16) "Australia/Darwin"
}
[14]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(34200)
["timezone_id"]=>
string(15) "Australia/North"
}
[15]=>
array(3) {
["dst"]=>
bool(false)
@@ -174,7 +129,7 @@ array(17) {
["timezone_id"]=>
string(15) "Australia/South"
}
[16]=>
[11]=>
array(3) {
["dst"]=>
bool(false)
+1 -1
View File
@@ -42,7 +42,7 @@ array(16) {
["zone_type"]=>
int(2)
["zone"]=>
int(-60)
int(3600)
["is_dst"]=>
bool(false)
["tz_abbr"]=>
+6 -6
View File
@@ -40,20 +40,20 @@ echo "\n";
NULL
NULL
int(-60)
int(3600)
string(1) "A"
int(-60)
int(3600)
string(1) "A"
int(-60)
int(3600)
string(1) "A"
int(-60)
int(3600)
string(1) "A"
int(-60)
int(3600)
string(1) "A"
int(-60)
int(3600)
string(1) "A"
+1 -1
View File
@@ -5,7 +5,7 @@ date.timezone=Asia/Singapore
--FILE--
<?php
print strtotime('2008-05-23 00:00:00 SGT');
print strtotime('2008-05-23 00:00:00 +08');
print "\n";
print strtotime('2008-05-23 00:00:00');
+1 -1
View File
@@ -40,7 +40,7 @@ object(DateInterval)#%d (16) {
["special_amount"]=>
int(-1)
["have_weekday_relative"]=>
int(9)
int(%d)
["have_special_relative"]=>
int(0)
["f"]=>
+3 -3
View File
@@ -7,10 +7,10 @@ date_default_timezone_set('UTC');
$earlyDate1 = DateTime::createFromFormat('U.u', '1.8642')->modify('-5 seconds');
$earlyDate2 = DateTime::createFromFormat('U.u', '1.2768')->modify('-5 seconds');
$earlyDate3 = DateTime::createFromFormat('U.u', '1.2768')->modify('-5 seconds');
// var_dump($earlyDate1, $earlyDate2, $earlyDate3);
var_dump($earlyDate1 == $earlyDate2);
var_dump($earlyDate1 < $earlyDate2);
var_dump($earlyDate2 > $earlyDate1);
var_dump($earlyDate1 > $earlyDate2);
var_dump($earlyDate2 < $earlyDate1);
var_dump($earlyDate2 == $earlyDate3);
--EXPECT--
bool(false)
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #75002 Null Pointer Dereference in timelib_time_clone
--FILE--
<?php
class aaa extends DatePeriod {
public function __construct() { }
}
$start=new DateTime( '2012-08-01' );
foreach (new aaa($start) as $y) {
$a=$key;
}
?>
==DONE==
--EXPECTF--
Fatal error: Uncaught Error: DatePeriod has not been initialized correctly in %sbug75002.php:%d
Stack trace:
#0 {main}
thrown in %sbug75002.php on line %d
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #75222 DateInterval microseconds property always 0
--FILE--
<?php
$dt1 = new \DateTimeImmutable('2017-01-01T00:00:00.000000Z');
$dt2 = new \DateTimeImmutable('2017-01-01T00:00:00.123456Z');
$diff = $dt1->diff($dt2);
//var_dump($diff);
var_dump($diff->f);
var_dump(get_object_vars($diff)['f']);
var_dump($diff->f === get_object_vars($diff)['f']);
?>
--EXPECTF--
float(0.123456)
float(0.123456)
bool(true)
@@ -0,0 +1,16 @@
--TEST--
Test DateInterval props with dimension handling
--FILE--
<?php
class Z extends DateInterval{}
$z = new Z('P2Y4DT6H8M');
$i = 0;
$z->prop[1]=10;
while ($i < 1026) {
$z->prop[$i] = $i;
$i++;
}
?>
==NOCRASH==
--EXPECT--
==NOCRASH==
+2 -2
View File
@@ -104,7 +104,7 @@ array(15) {
["zone_type"]=>
int(1)
["zone"]=>
int(720)
int(-43200)
["is_dst"]=>
bool(false)
}
@@ -228,7 +228,7 @@ array(15) {
["zone_type"]=>
int(1)
["zone"]=>
int(180)
int(-10800)
["is_dst"]=>
bool(false)
}
+9 -9
View File
@@ -10,22 +10,22 @@ echo "Done\n";
--EXPECTF--
array(9) {
["sunrise"]=>
int(1165897782)
int(1165897761)
["sunset"]=>
int(1165934168)
int(1165934160)
["transit"]=>
int(1165915975)
int(1165915961)
["civil_twilight_begin"]=>
int(1165896176)
int(1165896156)
["civil_twilight_end"]=>
int(1165935773)
int(1165935765)
["nautical_twilight_begin"]=>
int(1165894353)
int(1165894334)
["nautical_twilight_end"]=>
int(1165937597)
int(1165937588)
["astronomical_twilight_begin"]=>
int(1165892570)
int(1165892551)
["astronomical_twilight_end"]=>
int(1165939380)
int(1165939371)
}
Done
+9 -9
View File
@@ -11,13 +11,13 @@ foreach ($sun_info as $key => $elem )
echo "Done\n";
?>
--EXPECTF--
2007-04-13 06:12:19 CEST sunrise
2007-04-13 20:31:50 CEST sunset
2007-04-13 13:22:05 CEST transit
2007-04-13 05:28:03 CEST civil_twilight_begin
2007-04-13 21:16:06 CEST civil_twilight_end
2007-04-13 04:30:08 CEST nautical_twilight_begin
2007-04-13 22:14:01 CEST nautical_twilight_end
2007-04-13 03:14:36 CEST astronomical_twilight_begin
2007-04-13 23:29:33 CEST astronomical_twilight_end
2007-04-13 06:13:31 CEST sunrise
2007-04-13 20:30:51 CEST sunset
2007-04-13 13:22:11 CEST transit
2007-04-13 05:29:22 CEST civil_twilight_begin
2007-04-13 21:15:00 CEST civil_twilight_end
2007-04-13 04:31:43 CEST nautical_twilight_begin
2007-04-13 22:12:39 CEST nautical_twilight_end
2007-04-13 03:17:01 CEST astronomical_twilight_begin
2007-04-13 23:27:21 CEST astronomical_twilight_end
Done
+3 -3
View File
@@ -22,7 +22,7 @@ echo "Done\n";
--EXPECTF--
sunrise: 21:00:00
sunset: 21:00:00
transit: 10:04:02
transit: 10:03:48
civil_twilight_begin: 21:00:00
civil_twilight_end: 21:00:00
nautical_twilight_begin: 21:00:00
@@ -32,11 +32,11 @@ astronomical_twilight_end: 21:00:00
sunrise: 21:00:01
sunset: 21:00:01
transit: 08:52:30
transit: 08:52:44
civil_twilight_begin: 21:00:01
civil_twilight_end: 21:00:01
nautical_twilight_begin: 21:00:01
nautical_twilight_end: 21:00:01
astronomical_twilight_begin: 21:00:01
astronomical_twilight_end: 21:00:01
Done
Done
Loaded 100 of 428 files, more files were not shown because too many files have changed in this diff. Show more