mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-10 10:40:50 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de528a07da |
No files matched your search
+1
-1
@@ -337,7 +337,7 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: curl
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>, Ilia Alshanetsky <iliaa@php.net>, Pierrick Charron <pierrick@php.net>
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>,Ilia Alshanetsky <iliaa@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
|
||||
@@ -1,291 +1,5 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
22 Dec 2011, PHP 5.3.9RC4
|
||||
|
||||
- Core:
|
||||
. Added max_input_vars directive to prevent attacks based on hash collisions
|
||||
(Dmitry).
|
||||
|
||||
- OpenSSL:
|
||||
. Fix segfault with older versions of OpenSSL. (Scott)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #60455 (stream_get_line misbehaves if EOF is not detected together
|
||||
with the last read). (Gustavo)
|
||||
|
||||
08 Dec 2011, PHP 5.3.9RC3
|
||||
|
||||
- Filter:
|
||||
. Fixed Bug #55478 (FILTER_VALIDATE_EMAIL fails with internationalized
|
||||
domain name addresses containing >1 -). (Ilia)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #60439 (curl_copy_handle segfault when used with
|
||||
CURLOPT_PROGRESSFUNCTION). (Pierrick)
|
||||
|
||||
|
||||
- Date:
|
||||
. Fixed bug #54851 (DateTime::createFromFormat() doesn't interpret "D").
|
||||
(Derick)
|
||||
. Fixed bug #53502 (strtotime with timezone memory leak). (Derick)
|
||||
. Fixed bug #52062 (large timestamps with DateTime::getTimestamp and
|
||||
DateTime::setTimestamp). (Derick)
|
||||
. Fixed bug #51994 (date_parse_from_format is parsing invalid date using 'yz'
|
||||
format). (Derick)
|
||||
. Fixed bug #52113 (Seg fault while creating (by unserialization)
|
||||
DatePeriod). (Derick)
|
||||
|
||||
- SOAP
|
||||
. Fixed bug #54911 (Access to a undefined member in inherit SoapClient may
|
||||
cause Segmentation Fault). (Dmitry)
|
||||
|
||||
24 Nov 2011, PHP 5.3.9RC2
|
||||
|
||||
- Core:
|
||||
. Fixed bug #60138 (GC crash with referenced array in RecursiveArrayIterator)
|
||||
(Dmitry).
|
||||
. Fixed bug #60099 (__halt_compiler() works in braced namespaces). (Felipe)
|
||||
. Fixed bug #55874 (GCC does not provide __sync_fetch_and_add on some archs).
|
||||
(klightspeed at netspace dot net dot au)
|
||||
. Fixed bug #52624 (tempnam() by-pass open_basedir with nonnexistent
|
||||
directory). (Felipe)
|
||||
. Fixed invalid free in call_user_method() function. (Felipe)
|
||||
|
||||
- Zend Engine:
|
||||
. Fixed bug #43200 (Interface implementation / inheritence not possible in
|
||||
abstract classes). (Felipe)
|
||||
|
||||
- PHP-FPM SAPI:
|
||||
. Fixed bug #60179 (php_flag and php_value does not work properly). (fat)
|
||||
. Enhance error log when the primary script can't be open. FR #60199. (fat)
|
||||
. Added .phar to default authorized extensions. (fat)
|
||||
|
||||
- BCmath:
|
||||
. Fixed bug #60377 (bcscale related crashes on 64bits platforms). (shm)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #60373 (Startup errors with log_errors on cause segfault).
|
||||
(Derick)
|
||||
. Fixed bug #60236 (TLA timezone dates are not converted properly from
|
||||
timestamp). (Derick)
|
||||
. Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with
|
||||
time zone type 2). (Derick)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #60150 (Integer overflow during the parsing of invalid exif
|
||||
header). (Stas, flolechaud at gmail dot com)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed possible memory leak in finfo_open(). (Felipe)
|
||||
. Fixed memory leak when calling the Finfo constructor twice. (Felipe)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #60192 (SegFault when Collator not constructed
|
||||
properly). (Florian)
|
||||
. Fixed memory leak in several Intl locale functions. (Felipe)
|
||||
|
||||
- Gd:
|
||||
. Fixed bug #60160 (imagefill() doesn't work correctly
|
||||
for small images). (Florian)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed possible crash in mb_ereg_search_init() using empty pattern. (Felipe)
|
||||
|
||||
- MS SQL:
|
||||
. Fixed bug #60267 (Compile failure with freetds 0.91). (Felipe)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #60279 (Fixed NULL pointer dereference in
|
||||
stream_socket_enable_crypto, case when ssl_handle of session_stream is not
|
||||
initialized.) (shm)
|
||||
|
||||
- Oracle Database extension (OCI8):
|
||||
. Fixed bug #59985 (show normal warning text for OCI_NO_DATA).
|
||||
(Chris Jones)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #60261 (NULL pointer dereference in phar). (Felipe)
|
||||
. Fixed bug #60164 (Stubs of a specific length break phar_open_from_fp
|
||||
scanning for __HALT_COMPILER). (Ralph Schindler)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #60244 (pg_fetch_* functions do not validate that row param
|
||||
is >0). (Ilia)
|
||||
|
||||
- SOAP
|
||||
. Fixed bug #48216 (PHP Fatal error: SOAP-ERROR: Parsing WSDL:
|
||||
Extra content at the end of the doc, when server uses chunked transfer
|
||||
encoding with spaces after chunk size). (Dmitry)
|
||||
. Fixed bug #44686 (SOAP-ERROR: Parsing WSDL with references). (Dmitry)
|
||||
|
||||
- Tidy:
|
||||
. Fixed bug #54682 (Tidy::diagnose() NULL pointer dereference).
|
||||
(Maksymilian Arciemowicz, Felipe)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #60367 (Reflection and Late Static Binding). (Laruence)
|
||||
|
||||
03 Nov 2011, PHP 5.3.9RC1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #60139 (Anonymous functions create cycles not detected by the
|
||||
GC). (Dmitry)
|
||||
. Fixed bug #60120 (proc_open's streams may hang with stdin/out/err when
|
||||
the data exceeds or is equal to 2048 bytes). (Pierre, Pascal Borreli)
|
||||
. Fixed bug #60019 (Function time_nanosleep() is undefined on OS X). (Ilia)
|
||||
. Fixed bug #55798 (serialize followed by unserialize with numeric object
|
||||
prop. gives integer prop). (Gustavo)
|
||||
. Fixed bug #55749 (TOCTOU issue in getenv() on Windows builds). (Pierre)
|
||||
. Fixed bug #55707 (undefined reference to `__sync_fetch_and_add_4' on Linux
|
||||
parisc). (Felipe)
|
||||
. Fixed bug #55674 (fgetcsv & str_getcsv skip empty fields in some
|
||||
tab-separated records). (Laruence)
|
||||
. Fixed bug #55649 (Undefined function Bug()). (Laruence)
|
||||
. Fixed bug #55622 (memory corruption in parse_ini_string). (Pierre)
|
||||
. Fixed bug #55576 (Cannot conditionally move uploaded file without race
|
||||
condition). (Gustavo)
|
||||
. Fixed bug #55510: $_FILES 'name' missing first character after upload.
|
||||
(Arpad)
|
||||
. Fixed bug #55509 (segfault on x86_64 using more than 2G memory). (Laruence)
|
||||
. Fixed bug #55504 (Content-Type header is not parsed correctly on
|
||||
HTTP POST request). (Hannes)
|
||||
. Fixed bug #55475 (is_a() triggers autoloader, new optional 3rd argument to
|
||||
is_a and is_subclass_of). (alan_k)
|
||||
. Fixed bug #52461 (Incomplete doctype and missing xmlns).
|
||||
(virsacer at web dot de, Pierre)
|
||||
. Fixed bug #55366 (keys lost when using substr_replace an array). (Arpad)
|
||||
. Fixed bug #55273 (base64_decode() with strict rejects whitespace after
|
||||
pad). (Ilia)
|
||||
. Fixed bug #50982 (incorrect assumption of PAGE_SIZE size). (Dmitry)
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #55797 (Integer overflow in SdnToGregorian leads to segfault (in
|
||||
optimized builds). (Gustavo)
|
||||
|
||||
- Curl:
|
||||
. Fixed bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed
|
||||
before calling curl_exec). (Hannes)
|
||||
. Fixed issues were curl_copy_handle() would sometimes lose copied
|
||||
preferences. (Hannes)
|
||||
|
||||
- DateTime:
|
||||
. Fixed bug #48476 (cloning extended DateTime class without calling
|
||||
parent::__constr crashed PHP). (Hannes)
|
||||
|
||||
- Json:
|
||||
. Fixed bug #55543 (json_encode() with JSON_NUMERIC_CHECK fails on objects
|
||||
with numeric string properties). (Ilia, dchurch at sciencelogic dot com)
|
||||
|
||||
- MySQL:
|
||||
. Fixed bug #55550 (mysql.trace_mode miscounts result sets). (Johannes)
|
||||
|
||||
- MySQLi extension:
|
||||
. Fixed bug #55859 (mysqli->stat property access gives error). (Andrey)
|
||||
. Fixed bug #55582 (mysqli_num_rows() returns always 0 for unbuffered, when
|
||||
mysqlnd is used). (Andrey)
|
||||
. Fixed bug #55703 (PHP crash when calling mysqli_fetch_fields).
|
||||
(eran at zend dot com, Laruence)
|
||||
|
||||
- mysqlnd
|
||||
. Fixed bug #55609 (mysqlnd cannot be built shared). (Johannes)
|
||||
. Fixed bug #55067 (MySQL doesn't support compression - wrong config option).
|
||||
(Andrey)
|
||||
|
||||
- Oracle Database extension (OCI8):
|
||||
. Increased maximum Oracle error message buffer length for new 11.2.0.3 size.
|
||||
(Chris Jones)
|
||||
. Improve internal initalization failure error messages. (Chris Jones)
|
||||
|
||||
- PDO
|
||||
. Fixed bug #55776 (PDORow to session bug). (Johannes)
|
||||
|
||||
- PDO MySQL driver:
|
||||
. Fixed bug #60155 (pdo_mysql.default_socket ignored). (Johannes)
|
||||
. Fixed bug #55870 (PDO ignores all SSL parameters when used with mysql
|
||||
native driver). (Pierre)
|
||||
. Fixed bug #54158 (MYSQLND+PDO MySQL requires #define
|
||||
MYSQL_OPT_LOCAL_INFILE). (Andrey)
|
||||
|
||||
- PDO OCI driver:
|
||||
. Fixed bug #55768 (PDO_OCI can't resume Oracle session after it's been
|
||||
killed). (mikhail dot v dot gavrilov at gmail dot com, Chris Jones, Tony)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #52013 (Unable to decompress files in a compressed phar). (Hannes)
|
||||
. Fixed bug #53872 (internal corruption of phar). (Hannes)
|
||||
|
||||
- PHP-FPM SAPI:
|
||||
. Fixed bug #55526 (Heartbeat causes a lot of unnecessary events). (fat)
|
||||
. Fixed bug #55533 (The -d parameter doesn't work). (fat)
|
||||
. Implemented FR #52569 (Add the "ondemand" process-manager
|
||||
to allow zero children). (fat)
|
||||
. Fixed bug #55486 (status show BIG processes number). (fat)
|
||||
. Fixed bug #55577 (status.html does not install). (fat)
|
||||
. Backported from 5.4 branch (Dropped restriction of not setting the same
|
||||
value multiple times, the last one holds).
|
||||
(giovanni at giacobbi dot net, fat)
|
||||
. Backported FR #55166 from 5.4 branch (Added process.max to control
|
||||
the number of process FPM can fork). (fat)
|
||||
. Backported FR #55181 from 5.4 branch (Enhance security by limiting access
|
||||
to user defined extensions). (fat)
|
||||
. Backported FR #54098 from 5.4 branch (Lowered process manager
|
||||
default value). (fat)
|
||||
. Backported FR #52052 from 5.4 branch (Added partial syslog support). (fat)
|
||||
. Implemented FR #54577 (Enhanced status page with full status and details
|
||||
about each processes. Also provide a web page (status.html) for
|
||||
real-time FPM status. (fat)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #55267 (session_regenerate_id fails after header sent). (Hannes)
|
||||
|
||||
- NSAPI SAPI:
|
||||
. Don't set $_SERVER['HTTPS'] on unsecure connection (bug #55403). (Uwe
|
||||
Schindler)
|
||||
|
||||
- SimpleXML:
|
||||
. Reverted the SimpleXML->query() behaviour to returning empty arrays
|
||||
instead of false when no nodes are found as it was since 5.3.3
|
||||
(bug #48601). (chregu, rrichards)
|
||||
|
||||
- Sockets:
|
||||
. Fixed bug #60048 (sa_len a #define on IRIX). (china at thewrittenword dot
|
||||
com)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #60082 (Crash in ArrayObject() when using recursive references).
|
||||
(Tony)
|
||||
. Fixed bug #55807 (Wrong value for splFileObject::SKIP_EMPTY).
|
||||
(jgotti at modedemploi dot fr, Hannes)
|
||||
. Fixed bug #54304 (RegexIterator::accept() doesn't work with scalar values).
|
||||
(Hannes)
|
||||
|
||||
- XSL:
|
||||
. Added xsl.security_prefs ini option to define forbidden operations within
|
||||
XSLT stylesheets, default is not to enable write operations. This option
|
||||
won't be in 5.4, since there's a new method. Fixes Bug #54446. (Chregu,
|
||||
Nicolas Gregoire)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #60094 (C++ comment fails in c89). (Laruence)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #60183 (out of sync ftp responses). (bram at ebskamp dot me,
|
||||
rasmus)
|
||||
|
||||
- SAPI:
|
||||
. Fixed bug #60205 (possible integer overflow in content_length). (Laruence)
|
||||
|
||||
|
||||
23 Aug 2011, PHP 5.3.8
|
||||
|
||||
- Core:
|
||||
. Fixed bug #55439 (crypt() returns only the salt for MD5). (Stas)
|
||||
|
||||
- OpenSSL:
|
||||
. Reverted a change in timeout handling restoring PHP 5.3.6 behavior,
|
||||
as the new behavior caused mysqlnd SSL connections to hang (#55283).
|
||||
(Pierre, Andrey, Johannes)
|
||||
|
||||
18 Aug 2011, PHP 5.3.7
|
||||
- Upgraded bundled SQLite to version 3.7.7.1. (Scott)
|
||||
- Upgraded bundled PCRE to version 8.12. (Scott)
|
||||
@@ -399,7 +113,7 @@ PHP NEWS
|
||||
exception and fatal error). (Hannes)
|
||||
|
||||
- DBA extension:
|
||||
. Supress warning on non-existent file open with Berkeley DB 5.2. (Chris Jones)
|
||||
. Supress warning on non-existent file open with Berkeley DB 5.2 (Chris Jones)
|
||||
. Fixed bug #54242 (dba_insert returns true if key already exists). (Felipe)
|
||||
|
||||
- Exif extesion:
|
||||
@@ -446,6 +160,10 @@ PHP NEWS
|
||||
. Fixed bug #55169 (mcrypt_create_iv always fails to gather sufficient random
|
||||
data on Windows). (Pierre)
|
||||
|
||||
- MySQL Improved extension:
|
||||
. Fixed Bug #54221 (mysqli::get_warnings segfault when used in multi queries).
|
||||
(Andrey)
|
||||
|
||||
- mysqlnd
|
||||
. Fixed crash when using more than 28,000 bound parameters. Workaround is to
|
||||
set mysqlnd.net_cmd_buffer_size to at least 9000. (Andrey)
|
||||
@@ -455,8 +173,6 @@ PHP NEWS
|
||||
- MySQLi extension:
|
||||
. Fixed bug #55283 (SSL options set by mysqli_ssl_set ignored for MySQLi
|
||||
persistent connections). (Andrey)
|
||||
. Fixed Bug #54221 (mysqli::get_warnings segfault when used in multi queries).
|
||||
(Andrey)
|
||||
|
||||
- OpenSSL extension:
|
||||
. openssl_encrypt()/openssl_decrypt() truncated keys of variable length
|
||||
@@ -468,7 +184,7 @@ PHP NEWS
|
||||
|
||||
- Oracle Database extension (OCI8):
|
||||
. Added oci_client_version() returning the runtime Oracle client library
|
||||
version. (Chris Jones)
|
||||
version (Chris Jones)
|
||||
|
||||
. PCRE extension:
|
||||
. Increased the backtrack limit from 100000 to 1000000 (Rasmus)
|
||||
|
||||
+25
-28
@@ -20,18 +20,12 @@ php/QA/bug websites try to have someone from the webmaster team (Bjori) on hand.
|
||||
|
||||
5. Verify the tags to be extra sure everything was tagged properly.
|
||||
|
||||
6. Moving extensions from/to PECL requires write acces to the destination.
|
||||
Most developers should have this.
|
||||
6. Moving extensions from/to PECL requires root level access to the CVS server.
|
||||
Contact systems@php.net to get this taken care of.
|
||||
|
||||
Moving extensions from php-src to PECL
|
||||
- Checkout the pecl directory, most likely you want a sparse-root checkout
|
||||
svn co --depth=empty https://svn.php.net/repository/pecl
|
||||
- Create an directory for the extension incl. branch and tag structure,
|
||||
no trunk at this point and commit this to svn
|
||||
cd pecl; mkdir foo foo/tags foo/branches; svn add foo; svn commit
|
||||
- Move the extension from php-src to the new location
|
||||
svn mv https://svn.php.net/repository/php/php-src/trunk/ext/foo \
|
||||
https://svn.php.net/repository/pecl/foo/trunk
|
||||
- Filesystem: cp -r php-src/ext/foo pecl/foo
|
||||
- cvs rm php-src/ext/foo
|
||||
|
||||
If the extension is still usable or not dead, in cooperation with the extension
|
||||
maintainers if any:
|
||||
@@ -39,24 +33,26 @@ maintainers if any:
|
||||
- create the package.xml, commit
|
||||
- release the package
|
||||
|
||||
For Moving extensions from PECL to php-src the svn mv has to be tone the other
|
||||
way round.
|
||||
Moving extensions from PECL to php-src
|
||||
- Filesystem: cp -r pecl/foo php-src/ext/foo
|
||||
OR depending on the wishes from the PECL extension maintainer.
|
||||
- Filesystem: ln -s pecl/foo php-src/ext/foo
|
||||
|
||||
Rolling a non stable release (alpha/beta/RC)
|
||||
--------------------------------------------
|
||||
|
||||
1. Check windows snapshot builder logs (http://windows.php.net/downloads/snaps/ the last revision)
|
||||
1. Check windows snapshot builder logs (http://snaps.php.net/win32/snapshot-STABLE.log f.e.)
|
||||
|
||||
2. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
3. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
2. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
Do not use abbreviations for alpha and beta.
|
||||
|
||||
4. Commit those changes and note the revision id.
|
||||
3. Commit those changes
|
||||
|
||||
5. tag the repository with the version. To do the tag in a fast way do a svn copy on the server using full URLs. You should use the revision id from the above commit to prevent mistakes in case there was a commit in between. f.e. "``svn cp https://svn.php.net/repository/php/php-src/branches/PHP_5_3@308399 https://svn.php.net/repository/php/php-src/tags/php_5_3_6RC1``"
|
||||
(of course, you need to change that to the version you're rolling an RC for). Mail php-internals to announce the tag so tests/validation/check can be done prior to package it. It is especially important for RCs.
|
||||
4. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
5. tag the repository with the version f.e. "``cvs tag php_4_4_1RC1``"
|
||||
(of course, you need to change that to the version you're rolling an RC for).
|
||||
|
||||
6. Bump up the version numbers in ``main/php_version.h``, ``configure.in``
|
||||
and possibly ``NEWS`` again, to the **next** version. F.e. if the release
|
||||
@@ -69,7 +65,7 @@ correctly work.
|
||||
8. Log in onto the snaps box and go into the correct tree (f.e. the PHP_4_4
|
||||
branch if you're rolling 4.4.x releases).
|
||||
|
||||
9. You do not have to update the tree, but of course you can with "``svn up``".
|
||||
9. You do not have to update the tree, but of course you can with "``cvs up -dP``".
|
||||
|
||||
10. run: ``./makedist php 4.4.1RC1``, this will export the tree, create configure
|
||||
and build two tarballs (one gz and one bz2).
|
||||
@@ -113,21 +109,22 @@ Derick) run the following commands for you:
|
||||
|
||||
Note: Remember to update the MD5 checksum information.
|
||||
|
||||
4. Update ``web/php/trunk/include/version.inc`` (x=major version number)
|
||||
1. Update in ``php-bugs/trunk/include/functions.inc`` the ``show_version_option``
|
||||
function to include the new RC and commit.
|
||||
|
||||
2. Update ``phpweb/include/version.inc`` (x=major version number)
|
||||
|
||||
a. ``$PHP_x_RC`` = "5.3.0RC1"
|
||||
|
||||
b. ``$PHP_x_RC_DATE`` = "06 September 2007"
|
||||
|
||||
5. Commit those changes:
|
||||
3. Commit those changes:
|
||||
|
||||
a. ``svn commit web/qa/trunk web/php-bugs/trunk web/php/trunk``
|
||||
a. ``cvs commit include/version.inc include/releases.inc``
|
||||
|
||||
6. For the first RC, write the doc team (phpdoc@lists.php.net) about updating the
|
||||
4. For the first RC, write the doc team (phpdoc@lists.php.net) about updating the
|
||||
INSTALL and win32/install.txt files which are generated from the PHP manual sources.
|
||||
|
||||
7. Publish the announce on www.php.net as well (for all releases, alpha, RCs or other)
|
||||
|
||||
Rolling a stable release
|
||||
------------------------
|
||||
|
||||
@@ -165,7 +162,7 @@ and build two tarballs (one gz and one bz2).
|
||||
|
||||
13. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created. Once
|
||||
those are made, they should be committed to SVN too.
|
||||
those are made, they should be committed to CVS too.
|
||||
|
||||
14. Check if the pear files are updated (phar for 5.1+ or run pear/make-pear-bundle.php with 4.4)
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ Having said that, here are the organizational rules::
|
||||
To do so use "make test".
|
||||
|
||||
7. For development use the --enable-maintainer-zts switch to ensure your
|
||||
code handles TSRM correctly and doesn't break for those who need that.
|
||||
code handles TSRM correctly and doesn't break for thos who need that.
|
||||
|
||||
Currently we have the following branches in use::
|
||||
|
||||
|
||||
@@ -153,20 +153,6 @@ UPGRADE NOTES - PHP 5.3
|
||||
|
||||
- SplObjectStorage now has ArrayAccess support. It is also now possible to
|
||||
store associative information with objects in SplObjectStorage.
|
||||
|
||||
=====================
|
||||
4.1 New in PHP 5.3.9
|
||||
=====================
|
||||
|
||||
- Write operations within XSLT (for example with the extension sax:output) are
|
||||
disabled by default. You can define what is forbidden with the INI option
|
||||
xsl.security_prefs. This option will be marked as deprecated in 5.4 again.
|
||||
Use the method XsltProcess::setSecurityPrefs($options) there.
|
||||
|
||||
- the following new directives were added
|
||||
|
||||
- max_input_vars - specifies how many GET/POST/COOKIE input variables may be
|
||||
accepted. default value 1000.
|
||||
|
||||
=============
|
||||
5. Deprecated
|
||||
@@ -348,9 +334,6 @@ UPGRADE NOTES - PHP 5.3
|
||||
|
||||
- A new directive, request_order, controls the behavior of $_REQUEST
|
||||
independently of variables_order.
|
||||
- A new directive, called windows.show_crt_warning, has been introduced.
|
||||
This directive shows the CRT warnings when enabled. These warnings were
|
||||
displayed by default until now. It is disabled by default.
|
||||
|
||||
- New INI directives:
|
||||
- mail.add_x_header
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #31683 (changes to $name in __get($name) override future parameters)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43200 (Interface implementation / inheritence not possible in abstract classes)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface a {
|
||||
function foo();
|
||||
function bar();
|
||||
}
|
||||
interface b {
|
||||
function foo();
|
||||
}
|
||||
|
||||
abstract class c {
|
||||
function bar() { }
|
||||
}
|
||||
|
||||
class x extends c implements a, b {
|
||||
function foo() { }
|
||||
}
|
||||
|
||||
ReflectionClass::export('x');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Class [ <user> class x extends c implements a, b ] {
|
||||
@@ %s 15-17
|
||||
|
||||
- Constants [0] {
|
||||
}
|
||||
|
||||
- Static properties [0] {
|
||||
}
|
||||
|
||||
- Static methods [0] {
|
||||
}
|
||||
|
||||
- Properties [0] {
|
||||
}
|
||||
|
||||
- Methods [2] {
|
||||
Method [ <user, prototype b> public method foo ] {
|
||||
@@ %s 16 - 16
|
||||
}
|
||||
|
||||
Method [ <user, inherits c, prototype a> public method bar ] {
|
||||
@@ %s 12 - 12
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43200.2 (Interface implementation / inheritence not possible in abstract classes)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface A {
|
||||
function foo();
|
||||
}
|
||||
|
||||
abstract class B implements A {
|
||||
abstract public function foo();
|
||||
}
|
||||
|
||||
class C extends B {
|
||||
public function foo() {
|
||||
echo 'works';
|
||||
}
|
||||
}
|
||||
|
||||
$o = new C();
|
||||
$o->foo();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
works
|
||||
@@ -18,9 +18,9 @@ var_dump(
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Parse error: %s in %s(%d) : runtime-created function on line 1
|
||||
Parse error: syntax error, unexpected '}' in %s(%d) : runtime-created function on line 1
|
||||
|
||||
Parse error: %s %s(%d) : runtime-created function on line 1
|
||||
Parse error: syntax error, unexpected $end in %s(%d) : runtime-created function on line 1
|
||||
bool(false)
|
||||
int(2)
|
||||
bool(false)
|
||||
|
||||
@@ -11,7 +11,7 @@ echo "ok\n";
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: Attempt to modify property of non-object in %sbug54262.php on line 4
|
||||
Warning: Attempt to modify property of non-object in %s/Zend/tests/bug54262.php on line 4
|
||||
|
||||
Warning: Cannot use a scalar value as an array in %sbug54262.php on line 5
|
||||
ok
|
||||
Warning: Cannot use a scalar value as an array in %s/Zend/tests/bug54262.php on line 5
|
||||
ok
|
||||
@@ -1,65 +0,0 @@
|
||||
--TEST--
|
||||
Bug #55509 (segfault on x86_64 using more than 2G memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_INT_SIZE == 4) {
|
||||
die('skip Not for 32-bits OS');
|
||||
}
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
// check the available memory
|
||||
if (PHP_OS == 'Linux') {
|
||||
$lines = file('/proc/meminfo');
|
||||
$infos = array();
|
||||
foreach ($lines as $line) {
|
||||
$tmp = explode(":", $line);
|
||||
$index = strtolower($tmp[0]);
|
||||
$value = (int)ltrim($tmp[1], " ")*1024;
|
||||
$infos[$index] = $value;
|
||||
}
|
||||
$freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
|
||||
if ($freeMemory < 2100*1024*1024) {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
}
|
||||
elseif (PHP_OS == 'FreeBSD') {
|
||||
$lines = explode("\n",`sysctl -a`);
|
||||
$infos = array();
|
||||
foreach ($lines as $line) {
|
||||
if(!$line){
|
||||
continue;
|
||||
}
|
||||
$tmp = explode(":", $line);
|
||||
$index = strtolower($tmp[0]);
|
||||
$value = trim($tmp[1], " ");
|
||||
$infos[$index] = $value;
|
||||
}
|
||||
$freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])
|
||||
+($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])
|
||||
+($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);
|
||||
if ($freeMemory < 2100*1024*1024) {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
memory_limit=2100M
|
||||
--FILE--
|
||||
<?php
|
||||
$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "1\n";
|
||||
$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "2\n";
|
||||
$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "3\n";
|
||||
$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "4\n";
|
||||
$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "5\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
|
||||
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Bug #60099 (__halt_compiler() works in braced namespaces)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace foo {
|
||||
__halt_compiler();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: __HALT_COMPILER() can only be used from the outermost scope in %s on line %d
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #60138 (GC crash with referenced array in RecursiveArrayIterator)
|
||||
--FILE--
|
||||
<?php
|
||||
$tree = array(array("f"));
|
||||
$category =& $tree[0];
|
||||
|
||||
$iterator = new RecursiveIteratorIterator(
|
||||
new RecursiveArrayIterator($tree),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
foreach($iterator as $file);
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #60139 (Anonymous functions create cycles not detected by the GC)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public $x;
|
||||
|
||||
public function __construct() {
|
||||
$this->x = function() {};
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public $x;
|
||||
|
||||
public function __construct() {
|
||||
$self = $this;
|
||||
$this->x = function() use ($self) {};
|
||||
}
|
||||
}
|
||||
|
||||
gc_collect_cycles();
|
||||
new Foo;
|
||||
var_dump(gc_collect_cycles());
|
||||
new Bar;
|
||||
var_dump(gc_collect_cycles());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(2)
|
||||
@@ -17,4 +17,4 @@ interface a extends d, w { }
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot make non static method c::B() static in class d in %s on line %d
|
||||
Fatal error: Can't inherit abstract function c::B() (previously declared abstract in d) in %s on line %d
|
||||
@@ -14,8 +14,6 @@ interface b {
|
||||
interface c extends a, b {
|
||||
}
|
||||
|
||||
echo "done!\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
done!
|
||||
Fatal error: Can't inherit abstract function b::b() (previously declared abstract in a) in %s on line %d
|
||||
@@ -14,8 +14,6 @@ interface Itest2 {
|
||||
interface Itest3 extends Itest, Itest2 {
|
||||
}
|
||||
|
||||
echo "done!\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
done!
|
||||
Fatal error: Can't inherit abstract function Itest2::a() (previously declared abstract in Itest) in %s on line %d
|
||||
+1
-1
@@ -510,7 +510,7 @@ static unsigned int _zend_mm_cookie = 0;
|
||||
#define ZEND_MM_IS_GUARD_BLOCK(b) (((b)->info._size & ZEND_MM_TYPE_MASK) == ZEND_MM_GUARD_BLOCK)
|
||||
|
||||
#define ZEND_MM_NEXT_BLOCK(b) ZEND_MM_BLOCK_AT(b, ZEND_MM_BLOCK_SIZE(b))
|
||||
#define ZEND_MM_PREV_BLOCK(b) ZEND_MM_BLOCK_AT(b, -(ssize_t)((b)->info._prev & ~ZEND_MM_TYPE_MASK))
|
||||
#define ZEND_MM_PREV_BLOCK(b) ZEND_MM_BLOCK_AT(b, -(int)((b)->info._prev & ~ZEND_MM_TYPE_MASK))
|
||||
|
||||
#define ZEND_MM_PREV_BLOCK_IS_FREE(b) (!((b)->info._prev & ZEND_MM_USED_BLOCK))
|
||||
|
||||
|
||||
@@ -816,19 +816,13 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
int class_name_len;
|
||||
zend_class_entry *instance_ce;
|
||||
zend_class_entry **ce;
|
||||
zend_bool allow_string = only_subclass;
|
||||
zend_bool retval;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &obj, &class_name, &class_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
allow_string - is_a default is no, is_subclass_of is yes.
|
||||
if it's allowed, then the autoloader will be called if the class does not exist.
|
||||
default behaviour is different, as 'is_a' usage is normally to test mixed return values
|
||||
*/
|
||||
|
||||
if (allow_string && Z_TYPE_P(obj) == IS_STRING) {
|
||||
|
||||
if (Z_TYPE_P(obj) == IS_STRING) {
|
||||
zend_class_entry **the_ce;
|
||||
if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -854,7 +848,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
}
|
||||
|
||||
|
||||
/* {{{ proto bool is_subclass_of(mixed object_or_string, string class_name [, bool allow_string=true])
|
||||
/* {{{ proto bool is_subclass_of(object object, string class_name)
|
||||
Returns true if the object has this class as one of its parents */
|
||||
ZEND_FUNCTION(is_subclass_of)
|
||||
{
|
||||
@@ -863,8 +857,8 @@ ZEND_FUNCTION(is_subclass_of)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool is_a(mixed object_or_string, string class_name [, bool allow_string=false])
|
||||
Returns true if the first argument is an object and is this class or has this class as one of its parents, */
|
||||
/* {{{ proto bool is_a(object object, string class_name)
|
||||
Returns true if the object is of this class or has this class as one of its parents */
|
||||
ZEND_FUNCTION(is_a)
|
||||
{
|
||||
is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
||||
|
||||
@@ -280,18 +280,6 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static HashTable *zend_closure_get_properties(zval *obj TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
|
||||
|
||||
if (GC_G(gc_active)) {
|
||||
return (closure->func.type == ZEND_USER_FUNCTION) ? closure->func.op_array.static_variables : NULL;
|
||||
}
|
||||
|
||||
return closure->std.properties;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto Closure::__construct()
|
||||
Private constructor preventing instantiation */
|
||||
ZEND_METHOD(Closure, __construct)
|
||||
@@ -328,7 +316,6 @@ void zend_register_closure_ce(TSRMLS_D) /* {{{ */
|
||||
closure_handlers.clone_obj = NULL;
|
||||
closure_handlers.get_debug_info = zend_closure_get_debug_info;
|
||||
closure_handlers.get_closure = zend_closure_get_closure;
|
||||
closure_handlers.get_properties = zend_closure_get_properties;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+1
-13
@@ -2628,8 +2628,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
|
||||
return 1; /* method doesn't exist in child, copy from parent */
|
||||
}
|
||||
|
||||
if ((parent->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0
|
||||
&& parent->common.fn_flags & ZEND_ACC_ABSTRACT
|
||||
if (parent->common.fn_flags & ZEND_ACC_ABSTRACT
|
||||
&& parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope)
|
||||
&& child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) {
|
||||
zend_error(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)",
|
||||
@@ -3758,11 +3757,6 @@ void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */
|
||||
char *name, *cfilename;
|
||||
char haltoff[] = "__COMPILER_HALT_OFFSET__";
|
||||
int len, clen;
|
||||
|
||||
if (CG(has_bracketed_namespaces) && CG(in_namespace)) {
|
||||
zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope");
|
||||
}
|
||||
|
||||
cfilename = zend_get_compiled_filename(TSRMLS_C);
|
||||
clen = strlen(cfilename);
|
||||
zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, cfilename, clen, 0);
|
||||
@@ -5190,12 +5184,6 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC
|
||||
efree(CG(current_import));
|
||||
CG(current_import) = NULL;
|
||||
}
|
||||
|
||||
if (CG(doc_comment)) {
|
||||
efree(CG(doc_comment));
|
||||
CG(doc_comment) = NULL;
|
||||
CG(doc_comment_len) = 0;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -865,11 +865,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
&& (EX(function_state).function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) == 0
|
||||
&& !ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i + 1)
|
||||
&& PZVAL_IS_REF(*fci->params[i])) {
|
||||
ALLOC_ZVAL(param);
|
||||
*param = **(fci->params[i]);
|
||||
INIT_PZVAL(param);
|
||||
zval_copy_ctor(param);
|
||||
} else if (ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i + 1)
|
||||
SEPARATE_ZVAL(fci->params[i]);
|
||||
}
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i + 1)
|
||||
&& !PZVAL_IS_REF(*fci->params[i])) {
|
||||
|
||||
if (Z_REFCOUNT_PP(fci->params[i]) > 1) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Fri Aug 26 18:01:17 2011 */
|
||||
/* Generated by re2c 0.13.5 on Sun Aug 1 12:07:43 2010 */
|
||||
#line 1 "Zend/zend_ini_scanner.l"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Fri Aug 26 18:01:17 2011 */
|
||||
/* Generated by re2c 0.13.5 on Sun Aug 1 12:07:43 2010 */
|
||||
#line 3 "Zend/zend_ini_scanner_defs.h"
|
||||
|
||||
enum YYCONDTYPE {
|
||||
|
||||
+5
-21
@@ -27,24 +27,10 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#if HAVE_MMAP
|
||||
# if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# if defined(_SC_PAGESIZE)
|
||||
# define REAL_PAGE_SIZE sysconf(_SC_PAGESIZE);
|
||||
# elif defined(_SC_PAGE_SIZE)
|
||||
# define REAL_PAGE_SIZE sysconf(_SC_PAGE_SIZE);
|
||||
# endif
|
||||
# endif
|
||||
# if HAVE_SYS_MMAN_H
|
||||
# include <sys/mman.h>
|
||||
# endif
|
||||
# ifndef REAL_PAGE_SIZE
|
||||
# ifdef PAGE_SIZE
|
||||
# define REAL_PAGE_SIZE PAGE_SIZE
|
||||
# else
|
||||
# define REAL_PAGE_SIZE 4096
|
||||
# endif
|
||||
#if HAVE_SYS_MMAN_H
|
||||
# include <sys/mman.h>
|
||||
# ifndef PAGE_SIZE
|
||||
# define PAGE_SIZE 4096
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -229,11 +215,9 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t
|
||||
|
||||
if (old_type == ZEND_HANDLE_FP && !file_handle->handle.stream.isatty && size) {
|
||||
#if HAVE_MMAP
|
||||
size_t page_size = REAL_PAGE_SIZE;
|
||||
|
||||
if (file_handle->handle.fp &&
|
||||
size != 0 &&
|
||||
((size - 1) % page_size) <= page_size - ZEND_MMAP_AHEAD) {
|
||||
((size - 1) % PAGE_SIZE) <= PAGE_SIZE - ZEND_MMAP_AHEAD) {
|
||||
/* *buf[size] is zeroed automatically by the kernel */
|
||||
*buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0);
|
||||
if (*buf != MAP_FAILED) {
|
||||
|
||||
@@ -445,12 +445,6 @@ static MUTEX_T pow5mult_mutex;
|
||||
|
||||
#endif /* ZTS */
|
||||
|
||||
#ifdef DEBUG
|
||||
static void Bug(const char *message) {
|
||||
fprintf(stderr, "%s\n", message);
|
||||
}
|
||||
#endif
|
||||
|
||||
ZEND_API int zend_startup_strtod(void) /* {{{ */
|
||||
{
|
||||
#ifdef ZTS
|
||||
|
||||
+1
-1
@@ -2256,7 +2256,7 @@ AC_DEFUN([PHP_SETUP_KERBEROS],[
|
||||
KERBEROS_LIBS=`$KRB5_CONFIG --libs gssapi`
|
||||
KERBEROS_CFLAGS=`$KRB5_CONFIG --cflags gssapi`
|
||||
|
||||
if test -n "$KERBEROS_LIBS"; then
|
||||
if test -n "$KERBEROS_LIBS" && test -n "$KERBEROS_CFLAGS"; then
|
||||
found_kerberos=yes
|
||||
PHP_EVAL_LIBLINE($KERBEROS_LIBS, $1)
|
||||
PHP_EVAL_INCLINE($KERBEROS_CFLAGS)
|
||||
|
||||
+2
-10
@@ -41,8 +41,8 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=3
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION="RC4"
|
||||
PHP_RELEASE_VERSION=7
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
@@ -608,7 +608,6 @@ utime \
|
||||
vsnprintf \
|
||||
vasprintf \
|
||||
asprintf \
|
||||
nanosleep \
|
||||
)
|
||||
|
||||
dnl Some systems (like OpenSolaris) do not have nanosleep in libc
|
||||
@@ -661,13 +660,6 @@ if test "$ac_cv_func_getaddrinfo" = yes; then
|
||||
AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
|
||||
fi
|
||||
|
||||
dnl Check for the __sync_fetch_and_add builtin
|
||||
AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
|
||||
[AC_TRY_LINK([],[int x;__sync_fetch_and_add(&x,1);],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)])
|
||||
if test "$ac_cv_func_sync_fetch_and_add" = yes; then
|
||||
AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function])
|
||||
fi
|
||||
|
||||
AC_REPLACE_FUNCS(strlcat strlcpy getopt)
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_FUNC_ALLOCA
|
||||
|
||||
+1
-1
@@ -560,7 +560,7 @@ PHP_FUNCTION(bcscale)
|
||||
return;
|
||||
}
|
||||
|
||||
BCG(bc_precision) = ((int)new_scale < 0) ? 0 : new_scale;
|
||||
BCG(bc_precision) = (new_scale < 0) ? 0 : new_scale;
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
bcscale related problem on 64bits platforms
|
||||
--SKIPIF--
|
||||
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$var48 = bcscale(634314234334311);
|
||||
$var67 = bcsqrt(false);
|
||||
$var414 = bcadd(false,null,10);
|
||||
die('ALIVE');
|
||||
?>
|
||||
--EXPECTF--
|
||||
ALIVE
|
||||
+12
-10
@@ -127,7 +127,6 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "sdncal.h"
|
||||
#include <limits.h>
|
||||
|
||||
#define GREGOR_SDN_OFFSET 32045
|
||||
#define DAYS_PER_5_MONTHS 153
|
||||
@@ -147,12 +146,21 @@ void SdnToGregorian(
|
||||
long int temp;
|
||||
int dayOfYear;
|
||||
|
||||
if (sdn <= 0 ||
|
||||
sdn > (LONG_MAX - 4 * GREGOR_SDN_OFFSET) / 4) {
|
||||
goto fail;
|
||||
if (sdn <= 0) {
|
||||
*pYear = 0;
|
||||
*pMonth = 0;
|
||||
*pDay = 0;
|
||||
return;
|
||||
}
|
||||
temp = (sdn + GREGOR_SDN_OFFSET) * 4 - 1;
|
||||
|
||||
if (temp < 0) {
|
||||
*pYear = 0;
|
||||
*pMonth = 0;
|
||||
*pDay = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Calculate the century (year/100). */
|
||||
century = temp / DAYS_PER_400_YEARS;
|
||||
|
||||
@@ -182,12 +190,6 @@ void SdnToGregorian(
|
||||
*pYear = year;
|
||||
*pMonth = month;
|
||||
*pDay = day;
|
||||
return;
|
||||
|
||||
fail:
|
||||
*pYear = 0;
|
||||
*pMonth = 0;
|
||||
*pDay = 0;
|
||||
}
|
||||
|
||||
long int GregorianToSdn(
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
--TEST--
|
||||
Bug #53574 (Integer overflow in SdnToJulian; leads to segfault)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if (PHP_INT_SIZE == 4) {
|
||||
die("skip this test is for 64bit platform only");
|
||||
}
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$x = 3315881921229094912;
|
||||
if (PHP_INT_MAX == 0x7FFFFFFF) {
|
||||
$x = 882858043;
|
||||
} else {
|
||||
$x = 3315881921229094912;
|
||||
}
|
||||
|
||||
var_dump(cal_from_jd($x, CAL_JULIAN));
|
||||
--EXPECT--
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53574 (Integer overflow in SdnToJulian; leads to segfault)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if (PHP_INT_SIZE != 4) {
|
||||
die("skip this test is for 32bit platform only");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$x = 882858043;
|
||||
|
||||
var_dump(cal_from_jd($x, CAL_JULIAN));
|
||||
--EXPECT--
|
||||
array(9) {
|
||||
["date"]=>
|
||||
string(5) "0/0/0"
|
||||
["month"]=>
|
||||
int(0)
|
||||
["day"]=>
|
||||
int(0)
|
||||
["year"]=>
|
||||
int(0)
|
||||
["dow"]=>
|
||||
int(5)
|
||||
["abbrevdayname"]=>
|
||||
string(3) "Fri"
|
||||
["dayname"]=>
|
||||
string(6) "Friday"
|
||||
["abbrevmonth"]=>
|
||||
string(0) ""
|
||||
["monthname"]=>
|
||||
string(0) ""
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Bug #55797: Integer overflow in SdnToGregorian leads to segfault (in optimized builds)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if (PHP_INT_SIZE != 4) {
|
||||
die("skip this test is for 32bit platform only");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$x = 882858030;
|
||||
|
||||
var_dump(cal_from_jd($x, CAL_GREGORIAN));
|
||||
--EXPECTF--
|
||||
array(9) {
|
||||
["date"]=>
|
||||
string(5) "0/0/0"
|
||||
["month"]=>
|
||||
int(0)
|
||||
["day"]=>
|
||||
int(0)
|
||||
["year"]=>
|
||||
int(0)
|
||||
["dow"]=>
|
||||
int(%d)
|
||||
["abbrevdayname"]=>
|
||||
string(%d) "%s"
|
||||
["dayname"]=>
|
||||
string(%d) "%s"
|
||||
["abbrevmonth"]=>
|
||||
string(0) ""
|
||||
["monthname"]=>
|
||||
string(0) ""
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Bug #55797: Integer overflow in SdnToGregorian leads to segfault (in optimized builds)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if (PHP_INT_SIZE == 4) {
|
||||
die("skip this test is for 64bit platform only");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$x = 9223372036854743639;
|
||||
|
||||
var_dump(cal_from_jd($x, CAL_GREGORIAN));
|
||||
--EXPECTF--
|
||||
array(9) {
|
||||
["date"]=>
|
||||
string(5) "0/0/0"
|
||||
["month"]=>
|
||||
int(0)
|
||||
["day"]=>
|
||||
int(0)
|
||||
["year"]=>
|
||||
int(0)
|
||||
["dow"]=>
|
||||
int(%d)
|
||||
["abbrevdayname"]=>
|
||||
string(%d) "%s"
|
||||
["dayname"]=>
|
||||
string(%d) "%s"
|
||||
["abbrevmonth"]=>
|
||||
string(0) ""
|
||||
["monthname"]=>
|
||||
string(0) ""
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ date.timezone=UTC
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
putenv('TZ=UTC');
|
||||
echo date("Y-m-d", easter_date(2000))."\n";
|
||||
echo date("Y-m-d", easter_date(2001))."\n";
|
||||
echo date("Y-m-d", easter_date(2002))."\n";
|
||||
|
||||
@@ -14,37 +14,30 @@ $jd_days = Array(
|
||||
);
|
||||
|
||||
foreach ($jd_days as $jd_day) {
|
||||
echo "=== ", $jd_day, "\n";
|
||||
var_dump(jdmonthname($jd_day,0));
|
||||
var_dump(jdmonthname($jd_day,1));
|
||||
var_dump(jdmonthname($jd_day,2));
|
||||
var_dump(jdmonthname($jd_day,3));
|
||||
var_dump(jdmonthname($jd_day,4));
|
||||
var_dump(jdmonthname($jd_day,5));
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
=== 2453396
|
||||
string(3) "Jan"
|
||||
string(7) "January"
|
||||
string(3) "Jan"
|
||||
string(7) "January"
|
||||
string(6) "Shevat"
|
||||
string(0) ""
|
||||
|
||||
=== 2440588
|
||||
string(3) "Jan"
|
||||
string(7) "January"
|
||||
string(3) "Dec"
|
||||
string(8) "December"
|
||||
string(5) "Tevet"
|
||||
string(0) ""
|
||||
|
||||
=== -1
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
@@ -52,8 +45,6 @@ string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
=== Array
|
||||
|
||||
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
@@ -71,13 +62,10 @@ bool(false)
|
||||
|
||||
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
=== 10000000
|
||||
string(3) "Dec"
|
||||
string(8) "December"
|
||||
string(3) "Jul"
|
||||
string(4) "July"
|
||||
string(6) "Tishri"
|
||||
string(0) ""
|
||||
|
||||
Done
|
||||
@@ -4,12 +4,11 @@ unixtojd()
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
putenv('TZ=UTC');
|
||||
echo unixtojd(40000). "\n";
|
||||
echo unixtojd(1000000000). "\n";
|
||||
echo unixtojd(1152459009). "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
2440588
|
||||
2452162
|
||||
2452161
|
||||
2453926
|
||||
+28
-115
@@ -150,7 +150,6 @@ static struct gcry_thread_cbs php_curl_gnutls_tsl = {
|
||||
static void _php_curl_close_ex(php_curl *ch TSRMLS_DC);
|
||||
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
|
||||
|
||||
#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
|
||||
|
||||
#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), (long) v);
|
||||
@@ -198,79 +197,13 @@ static int php_curl_option_url(php_curl *ch, const char *url, const int len) /*
|
||||
#else
|
||||
copystr = estrndup(url, len);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_URL, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
zend_llist_add_element(&ch->to_free.str, ©str);
|
||||
#endif
|
||||
|
||||
return (error == CURLE_OK ? 1 : 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
php_stream *stream;
|
||||
if (!ch || !ch->handlers) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ch->handlers->std_err) {
|
||||
stream = (php_stream *) zend_fetch_resource(&ch->handlers->std_err TSRMLS_CC, -1, NULL, NULL, 2, php_file_le_stream(), php_file_le_pstream());
|
||||
if (stream == NULL) {
|
||||
if (reporterror) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_STDERR resource has gone away, resetting to stderr");
|
||||
}
|
||||
zval_ptr_dtor(&ch->handlers->std_err);
|
||||
ch->handlers->std_err = NULL;
|
||||
|
||||
curl_easy_setopt(ch->cp, CURLOPT_STDERR, stderr);
|
||||
}
|
||||
}
|
||||
if (ch->handlers->read && ch->handlers->read->stream) {
|
||||
stream = (php_stream *) zend_fetch_resource(&ch->handlers->read->stream TSRMLS_CC, -1, NULL, NULL, 2, php_file_le_stream(), php_file_le_pstream());
|
||||
if (stream == NULL) {
|
||||
if (reporterror) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_INFILE resource has gone away, resetting to default");
|
||||
}
|
||||
zval_ptr_dtor(&ch->handlers->read->stream);
|
||||
ch->handlers->read->fd = 0;
|
||||
ch->handlers->read->fp = 0;
|
||||
ch->handlers->read->stream = NULL;
|
||||
|
||||
curl_easy_setopt(ch->cp, CURLOPT_INFILE, (void *) ch);
|
||||
}
|
||||
}
|
||||
if (ch->handlers->write_header && ch->handlers->write_header->stream) {
|
||||
stream = (php_stream *) zend_fetch_resource(&ch->handlers->write_header->stream TSRMLS_CC, -1, NULL, NULL, 2, php_file_le_stream(), php_file_le_pstream());
|
||||
if (stream == NULL) {
|
||||
if (reporterror) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_WRITEHEADER resource has gone away, resetting to default");
|
||||
}
|
||||
zval_ptr_dtor(&ch->handlers->write_header->stream);
|
||||
ch->handlers->write_header->fp = 0;
|
||||
ch->handlers->write_header->stream = NULL;
|
||||
|
||||
ch->handlers->write_header->method = PHP_CURL_IGNORE;
|
||||
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
|
||||
}
|
||||
}
|
||||
if (ch->handlers->write && ch->handlers->write->stream) {
|
||||
stream = (php_stream *) zend_fetch_resource(&ch->handlers->write->stream TSRMLS_CC, -1, NULL, NULL, 2, php_file_le_stream(), php_file_le_pstream());
|
||||
if (stream == NULL) {
|
||||
if (reporterror) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FILE resource has gone away, resetting to default");
|
||||
}
|
||||
zval_ptr_dtor(&ch->handlers->write->stream);
|
||||
ch->handlers->write->fp = 0;
|
||||
ch->handlers->write->stream = NULL;
|
||||
|
||||
ch->handlers->write->method = PHP_CURL_STDOUT;
|
||||
ch->handlers->write->type = PHP_CURL_ASCII;
|
||||
curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ arginfo */
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_version, 0, 0, 0)
|
||||
ZEND_ARG_INFO(0, version)
|
||||
@@ -404,6 +337,7 @@ PHP_INI_BEGIN()
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
/* }}} */
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
PHP_MINFO_FUNCTION(curl)
|
||||
@@ -1412,7 +1346,6 @@ PHP_FUNCTION(curl_version)
|
||||
static void alloc_curl_handle(php_curl **ch)
|
||||
{
|
||||
*ch = emalloc(sizeof(php_curl));
|
||||
(*ch)->to_free = ecalloc(1, sizeof(struct _php_curl_free));
|
||||
(*ch)->handlers = ecalloc(1, sizeof(php_curl_handlers));
|
||||
(*ch)->handlers->write = ecalloc(1, sizeof(php_curl_write));
|
||||
(*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write));
|
||||
@@ -1423,13 +1356,10 @@ static void alloc_curl_handle(php_curl **ch)
|
||||
(*ch)->header.str_len = 0;
|
||||
|
||||
memset(&(*ch)->err, 0, sizeof((*ch)->err));
|
||||
(*ch)->handlers->write->stream = NULL;
|
||||
(*ch)->handlers->write_header->stream = NULL;
|
||||
(*ch)->handlers->read->stream = NULL;
|
||||
|
||||
zend_llist_init(&(*ch)->to_free->str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
|
||||
zend_llist_init(&(*ch)->to_free->slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
|
||||
zend_llist_init(&(*ch)->to_free->post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
|
||||
zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
|
||||
zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
|
||||
zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1464,7 +1394,6 @@ static void split_certinfo(char *string, zval *hash)
|
||||
efree(org);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ create_certinfo
|
||||
*/
|
||||
@@ -1608,7 +1537,6 @@ PHP_FUNCTION(curl_copy_handle)
|
||||
|
||||
dupch->cp = cp;
|
||||
dupch->uses = 0;
|
||||
ch->uses++;
|
||||
if (ch->handlers->write->stream) {
|
||||
Z_ADDREF_P(dupch->handlers->write->stream);
|
||||
dupch->handlers->write->stream = ch->handlers->write->stream;
|
||||
@@ -1649,21 +1577,18 @@ PHP_FUNCTION(curl_copy_handle)
|
||||
zval_add_ref(&ch->handlers->write_header->func_name);
|
||||
dupch->handlers->write_header->func_name = ch->handlers->write_header->func_name;
|
||||
}
|
||||
|
||||
if (ch->handlers->progress->func_name) {
|
||||
zval_add_ref(&ch->handlers->progress->func_name);
|
||||
dupch->handlers->progress->func_name = ch->handlers->progress->func_name;
|
||||
}
|
||||
dupch->handlers->progress->method = ch->handlers->progress->method;
|
||||
|
||||
curl_easy_setopt(dupch->cp, CURLOPT_ERRORBUFFER, dupch->err.str);
|
||||
curl_easy_setopt(dupch->cp, CURLOPT_FILE, (void *) dupch);
|
||||
curl_easy_setopt(dupch->cp, CURLOPT_INFILE, (void *) dupch);
|
||||
curl_easy_setopt(dupch->cp, CURLOPT_WRITEHEADER, (void *) dupch);
|
||||
curl_easy_setopt(dupch->cp, CURLOPT_PROGRESSDATA, (void *) dupch);
|
||||
|
||||
efree(dupch->to_free);
|
||||
dupch->to_free = ch->to_free;
|
||||
zend_llist_copy(&dupch->to_free.str, &ch->to_free.str);
|
||||
/* Don't try to free copied strings, they're free'd when the original handle is destroyed */
|
||||
dupch->to_free.str.dtor = NULL;
|
||||
|
||||
zend_llist_copy(&dupch->to_free.slist, &ch->to_free.slist);
|
||||
zend_llist_copy(&dupch->to_free.post, &ch->to_free.post);
|
||||
|
||||
/* Keep track of cloned copies to avoid invoking curl destructors for every clone */
|
||||
Z_ADDREF_P(ch->clone);
|
||||
@@ -1857,7 +1782,7 @@ string_copy:
|
||||
#endif
|
||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
zend_llist_add_element(&ch->to_free.str, ©str);
|
||||
} else {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
/* Strings passed to libcurl as ’char *’ arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
|
||||
@@ -1897,9 +1822,6 @@ string_copy:
|
||||
switch (option) {
|
||||
case CURLOPT_FILE:
|
||||
if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') {
|
||||
if (ch->handlers->write->stream) {
|
||||
Z_DELREF_P(ch->handlers->write->stream);
|
||||
}
|
||||
Z_ADDREF_PP(zvalue);
|
||||
ch->handlers->write->fp = fp;
|
||||
ch->handlers->write->method = PHP_CURL_FILE;
|
||||
@@ -1912,9 +1834,6 @@ string_copy:
|
||||
break;
|
||||
case CURLOPT_WRITEHEADER:
|
||||
if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') {
|
||||
if (ch->handlers->write_header->stream) {
|
||||
Z_DELREF_P(ch->handlers->write_header->stream);
|
||||
}
|
||||
Z_ADDREF_PP(zvalue);
|
||||
ch->handlers->write_header->fp = fp;
|
||||
ch->handlers->write_header->method = PHP_CURL_FILE;
|
||||
@@ -1926,9 +1845,6 @@ string_copy:
|
||||
}
|
||||
break;
|
||||
case CURLOPT_INFILE:
|
||||
if (ch->handlers->read->stream) {
|
||||
Z_DELREF_P(ch->handlers->read->stream);
|
||||
}
|
||||
Z_ADDREF_PP(zvalue);
|
||||
ch->handlers->read->fp = fp;
|
||||
ch->handlers->read->fd = Z_LVAL_PP(zvalue);
|
||||
@@ -2098,7 +2014,7 @@ string_copy:
|
||||
return 1;
|
||||
}
|
||||
|
||||
zend_llist_add_element(&ch->to_free->post, &first);
|
||||
zend_llist_add_element(&ch->to_free.post, &first);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
|
||||
|
||||
} else {
|
||||
@@ -2112,7 +2028,7 @@ string_copy:
|
||||
|
||||
convert_to_string_ex(zvalue);
|
||||
post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
zend_llist_add_element(&ch->to_free->str, &post);
|
||||
zend_llist_add_element(&ch->to_free.str, &post);
|
||||
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
|
||||
@@ -2148,7 +2064,7 @@ string_copy:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
zend_llist_add_element(&ch->to_free->slist, &slist);
|
||||
zend_llist_add_element(&ch->to_free.slist, &slist);
|
||||
|
||||
error = curl_easy_setopt(ch->cp, option, slist);
|
||||
|
||||
@@ -2178,7 +2094,7 @@ string_copy:
|
||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||
|
||||
error = curl_easy_setopt(ch->cp, option, copystr);
|
||||
zend_llist_add_element(&ch->to_free->str, ©str);
|
||||
zend_llist_add_element(&ch->to_free.str, ©str);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -2295,8 +2211,6 @@ PHP_FUNCTION(curl_exec)
|
||||
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
|
||||
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
|
||||
_php_curl_cleanup_handle(ch);
|
||||
|
||||
error = curl_easy_perform(ch->cp);
|
||||
@@ -2309,14 +2223,6 @@ PHP_FUNCTION(curl_exec)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ch->handlers->std_err) {
|
||||
php_stream *stream;
|
||||
stream = (php_stream*)zend_fetch_resource(&ch->handlers->std_err TSRMLS_CC, -1, NULL, NULL, 2, php_file_le_stream(), php_file_le_pstream());
|
||||
if (stream) {
|
||||
php_stream_flush(stream);
|
||||
}
|
||||
}
|
||||
|
||||
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
|
||||
smart_str_0(&ch->handlers->write->buf);
|
||||
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
|
||||
@@ -2594,18 +2500,25 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
|
||||
fprintf(stderr, "DTOR CALLED, ch = %x\n", ch);
|
||||
#endif
|
||||
|
||||
_php_curl_verify_handlers(ch, 0 TSRMLS_CC);
|
||||
/* Prevent crash inside cURL if passed file has already been closed */
|
||||
if (ch->handlers->std_err && Z_REFCOUNT_P(ch->handlers->std_err) <= 0) {
|
||||
curl_easy_setopt(ch->cp, CURLOPT_STDERR, stderr);
|
||||
}
|
||||
|
||||
curl_easy_cleanup(ch->cp);
|
||||
zend_llist_clean(&ch->to_free.str);
|
||||
|
||||
/* cURL destructors should be invoked only by last curl handle */
|
||||
if (Z_REFCOUNT_P(ch->clone) <= 1) {
|
||||
zend_llist_clean(&ch->to_free->str);
|
||||
zend_llist_clean(&ch->to_free->slist);
|
||||
zend_llist_clean(&ch->to_free->post);
|
||||
efree(ch->to_free);
|
||||
zend_llist_clean(&ch->to_free.slist);
|
||||
zend_llist_clean(&ch->to_free.post);
|
||||
FREE_ZVAL(ch->clone);
|
||||
} else {
|
||||
Z_DELREF_P(ch->clone);
|
||||
ch->to_free.slist.dtor = NULL;
|
||||
ch->to_free.post.dtor = NULL;
|
||||
zend_llist_clean(&ch->to_free.slist);
|
||||
zend_llist_clean(&ch->to_free.post);
|
||||
}
|
||||
|
||||
if (ch->handlers->write->buf.len > 0) {
|
||||
|
||||
@@ -211,19 +211,6 @@ PHP_FUNCTION(curl_multi_exec)
|
||||
|
||||
ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
|
||||
|
||||
{
|
||||
zend_llist_position pos;
|
||||
php_curl *ch;
|
||||
zval *pz_ch;
|
||||
|
||||
for(pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
|
||||
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
|
||||
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, &pz_ch, -1, le_curl_name, le_curl);
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
convert_to_long_ex(&z_still_running);
|
||||
still_running = Z_LVAL_P(z_still_running);
|
||||
result = curl_multi_perform(mh->multi, &still_running);
|
||||
@@ -337,17 +324,6 @@ void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
php_curlm *mh = (php_curlm *) rsrc->ptr;
|
||||
if (mh) {
|
||||
zend_llist_position pos;
|
||||
php_curl *ch;
|
||||
zval *pz_ch;
|
||||
|
||||
for(pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
|
||||
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
|
||||
|
||||
ch = (php_curl *) zend_fetch_resource(&pz_ch TSRMLS_CC, -1, le_curl_name, NULL, 1, le_curl);
|
||||
_php_curl_verify_handlers(ch, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
curl_multi_cleanup(mh->multi);
|
||||
zend_llist_clean(&mh->easyh);
|
||||
efree(mh);
|
||||
|
||||
+1
-2
@@ -131,7 +131,7 @@ struct _php_curl_free {
|
||||
|
||||
typedef struct {
|
||||
struct _php_curl_error err;
|
||||
struct _php_curl_free *to_free;
|
||||
struct _php_curl_free to_free;
|
||||
struct _php_curl_send_headers header;
|
||||
void ***thread_ctx;
|
||||
CURL *cp;
|
||||
@@ -150,7 +150,6 @@ typedef struct {
|
||||
|
||||
void _php_curl_cleanup_handle(php_curl *);
|
||||
void _php_curl_multi_cleanup_list(void *data);
|
||||
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC);
|
||||
|
||||
/* streams support */
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27023 (CURLOPT_POSTFIELDS does not parse content types for files)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=file");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
$params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt;type=text/plain');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
$params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt;filename=foo.txt');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
$params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt;type=text/plain;filename=foo.txt');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
$params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt;filename=foo.txt;type=text/plain');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
|
||||
curl_close($ch);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "curl_testdata1.txt|application/octet-stream"
|
||||
string(%d) "curl_testdata1.txt|text/plain"
|
||||
string(%d) "foo.txt|application/octet-stream"
|
||||
string(%d) "foo.txt|text/plain"
|
||||
string(%d) "foo.txt|text/plain"
|
||||
@@ -18,19 +18,16 @@ $ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_STDERR, $fp);
|
||||
curl_setopt($ch, CURLOPT_URL, getenv('PHP_CURL_HTTP_REMOTE_SERVER'));
|
||||
curl_setopt($ch, CURLOPT_URL, "");
|
||||
|
||||
fclose($fp); // <-- premature close of $fp caused a crash!
|
||||
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
echo "Ok\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203.php on line %d
|
||||
%A
|
||||
--EXPECT--
|
||||
Ok
|
||||
@@ -1,90 +0,0 @@
|
||||
--TEST--
|
||||
Variation of bug #48203 with curl_multi_exec (Crash when file pointers passed to curl are closed before calling curl_multi_exec)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function checkForClosedFilePointer($curl_option, $description) {
|
||||
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
|
||||
|
||||
$ch1 = curl_init();
|
||||
$ch2 = curl_init();
|
||||
|
||||
$options = array(
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
$curl_option => $fp,
|
||||
CURLOPT_URL => getenv("PHP_CURL_HTTP_REMOTE_SERVER")
|
||||
);
|
||||
|
||||
// we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly
|
||||
if (CURLOPT_STDERR == $curl_option) {
|
||||
$options[CURLOPT_VERBOSE] = 1;
|
||||
}
|
||||
|
||||
if (CURLOPT_INFILE == $curl_option) {
|
||||
$options[CURLOPT_UPLOAD] = 1;
|
||||
}
|
||||
|
||||
curl_setopt_array($ch1, $options);
|
||||
curl_setopt_array($ch2, $options);
|
||||
|
||||
fclose($fp); // <-- premature close of $fp caused a crash!
|
||||
|
||||
$mh = curl_multi_init();
|
||||
|
||||
curl_multi_add_handle($mh, $ch1);
|
||||
curl_multi_add_handle($mh, $ch2);
|
||||
|
||||
$active = 0;
|
||||
do {
|
||||
curl_multi_exec($mh, $active);
|
||||
} while ($active > 0);
|
||||
|
||||
curl_multi_remove_handle($mh, $ch1);
|
||||
curl_multi_remove_handle($mh, $ch2);
|
||||
curl_multi_close($mh);
|
||||
|
||||
echo "Ok for $description\n";
|
||||
}
|
||||
|
||||
$options_to_check = array(
|
||||
"CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE"
|
||||
);
|
||||
|
||||
foreach($options_to_check as $option) {
|
||||
checkForClosedFilePointer(constant($option), $option);
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
|
||||
--EXPECTF--
|
||||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203_multi.php on line 36
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203_multi.php on line 36
|
||||
%A
|
||||
Ok for CURLOPT_STDERR
|
||||
%A
|
||||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
Ok for CURLOPT_WRITEHEADER
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
%A
|
||||
Ok for CURLOPT_FILE
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
Ok for CURLOPT_INFILE
|
||||
@@ -1,72 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function checkForClosedFilePointer($host, $curl_option, $description) {
|
||||
$fp = fopen(dirname(__FILE__) . '/bug54798.tmp', 'w+');
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
// we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly
|
||||
if (CURLOPT_STDERR == $curl_option) {
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
}
|
||||
|
||||
if (CURLOPT_INFILE == $curl_option) {
|
||||
curl_setopt($ch, CURLOPT_UPLOAD, 1);
|
||||
}
|
||||
|
||||
curl_setopt($ch, $curl_option, $fp);
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $host);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
fclose($fp); // <-- premature close of $fp caused a crash!
|
||||
|
||||
curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
echo "Ok for $description\n";
|
||||
}
|
||||
|
||||
$options_to_check = array(
|
||||
"CURLOPT_STDERR",
|
||||
"CURLOPT_WRITEHEADER",
|
||||
"CURLOPT_FILE",
|
||||
"CURLOPT_INFILE"
|
||||
);
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
foreach($options_to_check as $option) {
|
||||
checkForClosedFilePointer($host, constant($option), $option);
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug54798.tmp'); ?>
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug54798.php on line %d
|
||||
* About to connect() %a
|
||||
* Closing connection #%d
|
||||
Ok for CURLOPT_STDERR
|
||||
|
||||
Warning: curl_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug54798.php on line 24
|
||||
Ok for CURLOPT_WRITEHEADER
|
||||
|
||||
Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug54798.php on line 24
|
||||
%a
|
||||
Ok for CURLOPT_FILE
|
||||
|
||||
Warning: curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug54798.php on line %d
|
||||
Ok for CURLOPT_INFILE
|
||||
@@ -4,7 +4,7 @@ Test CURLOPT_READDATA without a callback function
|
||||
Mattijs Hoitink mattijshoitink@gmail.com
|
||||
#Testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -3,13 +3,7 @@ Test curl_error() & curl_errno() function with problematic host
|
||||
--CREDITS--
|
||||
TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) print "skip";
|
||||
$addr = "www.".uniqid().".".uniqid();
|
||||
if (gethostbyname($addr) != $addr) {
|
||||
print "skip catch all dns";
|
||||
}
|
||||
?>
|
||||
<?php if (!extension_loaded("curl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -3,13 +3,7 @@ Test curl_error() & curl_errno() function with problematic proxy
|
||||
--CREDITS--
|
||||
TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) print "skip";
|
||||
$addr = "www.".uniqid().".".uniqid();
|
||||
if (gethostbyname($addr) != $addr) {
|
||||
print "skip catch all dns";
|
||||
}
|
||||
?>
|
||||
<?php if (!extension_loaded("curl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Test curl_opt() function with COOKIE
|
||||
--CREDITS--
|
||||
TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -35,4 +35,4 @@ TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
|
||||
*** Testing curl with cookie ***
|
||||
string(3) "bar"
|
||||
===DONE===
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Test curl_copy_handle() with simple get
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -39,4 +39,4 @@ string(106) "array(2) {
|
||||
array(0) {
|
||||
}
|
||||
"
|
||||
===DONE===
|
||||
===DONE===
|
||||
@@ -4,7 +4,7 @@ Test curl_copy_handle() with simple POST
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
@@ -29,6 +29,8 @@ Rick Buitenman <rick@meritos.nl>
|
||||
var_dump( $curl_content );
|
||||
?>
|
||||
===DONE===
|
||||
--XFAIL--
|
||||
This test fails, the copy seems to be missing the CURLOPT_POSTFIELDS after the original is closed
|
||||
--EXPECTF--
|
||||
*** Testing curl copy handle with simple POST ***
|
||||
string(163) "array(1) {
|
||||
|
||||
@@ -4,7 +4,7 @@ Test curl_copy_handle() after exec()
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -41,4 +41,4 @@ string(106) "array(2) {
|
||||
array(0) {
|
||||
}
|
||||
"
|
||||
===DONE===
|
||||
===DONE===
|
||||
@@ -4,7 +4,7 @@ Test curl_copy_handle() after exec() with POST
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -32,6 +32,8 @@ Rick Buitenman <rick@meritos.nl>
|
||||
var_dump( $curl_content_copy );
|
||||
?>
|
||||
===DONE===
|
||||
--XFAIL--
|
||||
This test fails, the output of the copy seems to be corrupted if the original is closed after exec()
|
||||
--EXPECTF--
|
||||
*** Test curl_copy_handle() after exec() with POST ***
|
||||
string(163) "array(1) {
|
||||
|
||||
@@ -4,7 +4,7 @@ Test curl_copy_handle() with User Agent
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test curl_copy_handle() with simple POST
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Test curl_copy_handle() with CURLOPT_PROGRESSFUNCTION
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
|
||||
$url = "{$host}/get.php";
|
||||
$ch = curl_init($url);
|
||||
|
||||
curl_setopt($ch, CURLOPT_NOPROGRESS, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function() { });
|
||||
$ch2 = curl_copy_handle($ch);
|
||||
echo curl_exec($ch), PHP_EOL;
|
||||
unset($ch);
|
||||
echo curl_exec($ch2);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Hello World!
|
||||
Hello World!
|
||||
Hello World!
|
||||
Hello World!
|
||||
@@ -4,15 +4,7 @@ curl_error() function - basic test for curl_error using a fake url
|
||||
Mattijs Hoitink mattijshoitink@gmail.com
|
||||
#Testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php
|
||||
|
||||
if (!extension_loaded("curl")) die("skip\n");
|
||||
|
||||
$url = "fakeURL";
|
||||
$ip = gethostbyname($url);
|
||||
if ($ip != $url) die("skip 'fakeURL' resolves to $ip\n");
|
||||
|
||||
?>
|
||||
<?php if (!extension_loaded("curl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
@@ -29,13 +21,13 @@ echo "== Testing curl_error with a fake URL ==\n";
|
||||
|
||||
// cURL handler
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
ob_start(); // start output buffering
|
||||
curl_exec($ch);
|
||||
var_dump(curl_error($ch));
|
||||
echo "Error: " . curl_error($ch);
|
||||
curl_close($ch);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
== Testing curl_error with a fake URL ==
|
||||
string(%d) "%sfakeURL%s"
|
||||
Error: Couldn't resolve host 'fakeURL'
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Memory corruption error if fp of just created file is closed before curl_close.
|
||||
--CREDITS--
|
||||
Alexey Shein <confik@gmail.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$ch = curl_init(getenv('PHP_CURL_HTTP_REMOTE_SERVER'));
|
||||
|
||||
$temp_file = dirname(__FILE__) . '/curl_file_deleted_before_curl_close.tmp';
|
||||
if (file_exists($temp_file)) {
|
||||
unlink($temp_file); // file should not exist before test
|
||||
}
|
||||
|
||||
$handle = fopen($temp_file, 'w');
|
||||
|
||||
curl_setopt($ch, CURLOPT_STDERR, $handle);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
curl_exec($ch);
|
||||
|
||||
fclose($handle); // causes glibc memory error
|
||||
|
||||
//unlink($temp_file); // uncomment to test segfault (file not found on iowrite.c)
|
||||
|
||||
curl_close($ch);
|
||||
echo "Closed correctly\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/curl_file_deleted_before_curl_close.tmp');
|
||||
?>
|
||||
--EXPECTF--
|
||||
* Closing connection #%d
|
||||
Closed correctly
|
||||
@@ -5,10 +5,7 @@ Rein Velt (rein@velt.org)
|
||||
#TestFest Utrecht 20090509
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('curl')) print 'skip need ext/curl';
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
if (!extension_loaded('curl')) print 'skip';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -19,8 +16,7 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
$ch2=curl_init();
|
||||
|
||||
//SET URL AND OTHER OPTIONS
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=getpost&get_param=Hello%20World");
|
||||
curl_setopt($ch1, CURLOPT_URL, "http://php.net/robots.txt");
|
||||
curl_setopt($ch2, CURLOPT_URL, "file://".dirname(__FILE__). DIRECTORY_SEPARATOR . "curl_testdata2.txt");
|
||||
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
|
||||
@@ -50,13 +46,19 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
echo $results2;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
["test"]=>
|
||||
string(7) "getpost"
|
||||
["get_param"]=>
|
||||
string(11) "Hello World"
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
--EXPECT--
|
||||
User-agent: *
|
||||
Disallow: /backend/
|
||||
Disallow: /distributions/
|
||||
Disallow: /stats/
|
||||
Disallow: /source.php
|
||||
Disallow: /search.php
|
||||
Disallow: /mod.php
|
||||
Disallow: /manual/add-note.php
|
||||
|
||||
Disallow: /harming/humans
|
||||
Disallow: /ignoring/human/orders
|
||||
Disallow: /harm/to/self
|
||||
|
||||
CURL2
|
||||
|
||||
@@ -46,7 +46,6 @@ $returnContent = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
var_dump($returnContent);
|
||||
isset($tempname) and is_file($tempname) and @unlink($tempname);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -4,7 +4,7 @@ curl_setopt basic tests with CURLOPT_STDERR.
|
||||
Paul Sohier
|
||||
#phptestfest utrecht
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -26,7 +26,7 @@ $curl_content = curl_exec($ch);
|
||||
|
||||
fclose($handle);
|
||||
unset($handle);
|
||||
var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file)));
|
||||
var_dump( file_get_contents($temp_file) );
|
||||
@unlink($temp_file);
|
||||
|
||||
ob_start(); // start output buffering
|
||||
@@ -38,7 +38,7 @@ ob_end_clean();
|
||||
|
||||
fclose($handle);
|
||||
unset($handle);
|
||||
var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file)));
|
||||
var_dump( file_get_contents($temp_file) );
|
||||
@unlink($temp_file);
|
||||
|
||||
curl_close($ch);
|
||||
@@ -48,5 +48,3 @@ curl_close($ch);
|
||||
*** Testing curl_setopt with CURLOPT_STDERR
|
||||
string(%d) "%S"
|
||||
string(%d) "%S"
|
||||
* Closing connection #%d
|
||||
|
||||
@@ -4,7 +4,7 @@ curl_setopt() call with CURLOPT_HTTPHEADER
|
||||
Paul Sohier
|
||||
#phptestfest utrecht
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ curl_setopt() call with CURLOPT_RETURNTRANSFER
|
||||
Paul Sohier
|
||||
#phptestfest utrecht
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -2,12 +2,9 @@
|
||||
Test curl_version() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
die('skip - curl extension not available in this build');
|
||||
}
|
||||
if (!getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
echo "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
Test curl_version() function : usage variations - test values for $ascii argument
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
echo "skip - curl extension not available in this build";
|
||||
}
|
||||
if (!getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
echo "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable";
|
||||
if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
die('skip - curl extension not available in this build');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
@@ -6,14 +6,7 @@ Dutch UG, TestFest 2009, Utrecht
|
||||
--DESCRIPTION--
|
||||
Hit the host identified by PHP_CURL_HTTP_REMOTE_SERVER and determine that the headers are sent to the callback specified for CURLOPT_HEADERFUNCTION. Different test servers specified for PHP_CURL_HTTP_REMOTE_SERVER might return different sets of headers. Just test for HTTP/1.1 200 OK.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
echo "skip - curl extension not available in this build";
|
||||
}
|
||||
if (!getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
echo "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable";
|
||||
}
|
||||
?>
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
$test = isset($_GET['test']) ? $_GET['test'] : null;
|
||||
switch($test) {
|
||||
switch($_GET['test']) {
|
||||
case 'post':
|
||||
var_dump($_POST);
|
||||
break;
|
||||
@@ -26,11 +25,6 @@
|
||||
case 'contenttype':
|
||||
header('Content-Type: text/plain;charset=utf-8');
|
||||
break;
|
||||
case 'file':
|
||||
if (isset($_FILES['file'])) {
|
||||
echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
echo "Hello World!\n";
|
||||
echo "Hello World!";
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "timelib.h"
|
||||
#include <math.h>
|
||||
|
||||
timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
|
||||
{
|
||||
|
||||
+153
-219
File diff suppressed because it is too large.
Load diff
+56
-122
@@ -119,8 +119,8 @@ typedef unsigned char uchar;
|
||||
#define TIMELIB_DEINIT timelib_string_free(str)
|
||||
#define TIMELIB_ADJUST_RELATIVE_WEEKDAY() if (in->time.have_weekday_relative && (in.rel.d > 0)) { in.rel.d -= 7; }
|
||||
|
||||
#define TIMELIB_PROCESS_YEAR(x, l) { \
|
||||
if (((x) == TIMELIB_UNSET) || ((l) >= 4)) { \
|
||||
#define TIMELIB_PROCESS_YEAR(x) { \
|
||||
if ((x) == TIMELIB_UNSET) { \
|
||||
/* (x) = 0; */ \
|
||||
} else if ((x) < 100) { \
|
||||
if ((x) < 70) { \
|
||||
@@ -438,7 +438,7 @@ static char *timelib_string(Scanner *s)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static timelib_sll timelib_get_nr_ex(char **ptr, int max_length, int *scanned_length)
|
||||
static timelib_sll timelib_get_nr(char **ptr, int max_length)
|
||||
{
|
||||
char *begin, *end, *str;
|
||||
timelib_sll tmp_nr = TIMELIB_UNSET;
|
||||
@@ -456,9 +456,6 @@ static timelib_sll timelib_get_nr_ex(char **ptr, int max_length, int *scanned_le
|
||||
++len;
|
||||
}
|
||||
end = *ptr;
|
||||
if (scanned_length) {
|
||||
*scanned_length = end - begin;
|
||||
}
|
||||
str = calloc(1, end - begin + 1);
|
||||
memcpy(str, begin, end - begin);
|
||||
tmp_nr = strtoll(str, NULL, 10);
|
||||
@@ -466,11 +463,6 @@ static timelib_sll timelib_get_nr_ex(char **ptr, int max_length, int *scanned_le
|
||||
return tmp_nr;
|
||||
}
|
||||
|
||||
static timelib_sll timelib_get_nr(char **ptr, int max_length)
|
||||
{
|
||||
return timelib_get_nr_ex(ptr, max_length, NULL);
|
||||
}
|
||||
|
||||
static void timelib_skip_day_suffix(char **ptr)
|
||||
{
|
||||
if (isspace(**ptr)) {
|
||||
@@ -783,7 +775,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
return value;
|
||||
}
|
||||
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
|
||||
{
|
||||
timelib_tzinfo *res;
|
||||
long retval = 0;
|
||||
@@ -832,7 +824,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
#endif
|
||||
/* If we have a TimeZone identifier to start with, use it */
|
||||
if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) {
|
||||
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
|
||||
if ((res = timelib_parse_tzfile(tz_abbr, tzdb)) != NULL) {
|
||||
t->tz_info = res;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
found++;
|
||||
@@ -861,7 +853,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
|
||||
} \
|
||||
}
|
||||
|
||||
static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
static int scan(Scanner *s)
|
||||
{
|
||||
uchar *cursor = s->cur;
|
||||
char *str, *ptr = NULL;
|
||||
@@ -1194,7 +1186,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1235,7 +1227,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = 0;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb);
|
||||
break;
|
||||
case 1:
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
@@ -1260,7 +1252,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1271,15 +1263,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
americanshort | american
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == '/') {
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AMERICAN;
|
||||
@@ -1299,57 +1290,53 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
iso8601date2
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("iso8601date2");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
s->time->m = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
|
||||
gnudateshorter
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshorter");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
s->time->m = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->d = 1;
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
|
||||
gnudateshort
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
s->time->m = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
|
||||
datefull
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datefull");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
timelib_skip_day_suffix((char **) &ptr);
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL;
|
||||
}
|
||||
@@ -1368,56 +1355,52 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
pointeddate2
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pointed date YY");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->m = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 2);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
|
||||
datenoday
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
s->time->d = 1;
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
|
||||
datenodayrev
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
s->time->d = 1;
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
|
||||
datetextual | datenoyear
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
@@ -1462,7 +1445,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
if (*ptr) { /* timezone is optional */
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1474,14 +1457,13 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
pgydotd
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 3);
|
||||
s->time->m = 1;
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_YEARDAY;
|
||||
}
|
||||
@@ -1526,28 +1508,26 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
pgtextshort
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
|
||||
pgtextreverse
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
|
||||
s->time->y = timelib_get_nr((char **) &ptr, 4);
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
@@ -1565,7 +1545,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1678,7 +1658,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TZ();
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1731,7 +1711,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
}
|
||||
@@ -1777,7 +1757,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
/*!max:re2c */
|
||||
|
||||
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, const timelib_tzdb *tzdb)
|
||||
{
|
||||
Scanner in;
|
||||
int t;
|
||||
@@ -1832,7 +1812,7 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container
|
||||
in.time->zone_type = 0;
|
||||
|
||||
do {
|
||||
t = scan(&in, tz_get_wrapper);
|
||||
t = scan(&in);
|
||||
#ifdef DEBUG_PARSER
|
||||
printf("%d\n", t);
|
||||
#endif
|
||||
@@ -1887,7 +1867,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time)
|
||||
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
|
||||
}
|
||||
|
||||
timelib_time *timelib_parse_from_format(char *format, char *string, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
timelib_time *timelib_parse_from_format(char *format, char *string, int len, timelib_error_container **errors, const timelib_tzdb *tzdb)
|
||||
{
|
||||
char *fptr = format;
|
||||
char *ptr = string;
|
||||
@@ -1895,7 +1875,6 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
timelib_sll tmp;
|
||||
Scanner in;
|
||||
Scanner *s = ∈
|
||||
int allow_extra = 0;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = malloc(sizeof(struct timelib_error_container));
|
||||
@@ -1924,19 +1903,8 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
switch (*fptr) {
|
||||
case 'D': /* three letter day */
|
||||
case 'l': /* full day */
|
||||
{
|
||||
const timelib_relunit* tmprel = 0;
|
||||
|
||||
tmprel = timelib_lookup_relunit((char **) &ptr);
|
||||
if (!tmprel) {
|
||||
add_pbf_error(s, "A textual day could not be found", string, begin);
|
||||
break;
|
||||
} else {
|
||||
in.time->have_relative = 1;
|
||||
in.time->relative.have_weekday_relative = 1;
|
||||
in.time->relative.weekday = tmprel->multiplier;
|
||||
in.time->relative.weekday_behavior = 1;
|
||||
}
|
||||
if (!timelib_lookup_relunit((char **) &ptr)) {
|
||||
add_pbf_error(s, "A textual day could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
case 'd': /* two digit day, with leading zero */
|
||||
@@ -1949,14 +1917,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
case 'S': /* day suffix, ignored, nor checked */
|
||||
timelib_skip_day_suffix((char **) &ptr);
|
||||
break;
|
||||
case 'z': /* day of year - resets month (0 based) - also initializes everything else to !TIMELIB_UNSET */
|
||||
case 'z': /* day of year - resets month (0 based) */
|
||||
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);
|
||||
} else {
|
||||
s->time->m = 1;
|
||||
s->time->d = tmp + 1;
|
||||
timelib_do_normalize(s->time);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1977,14 +1944,11 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
}
|
||||
break;
|
||||
case 'y': /* two digit year */
|
||||
{
|
||||
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);
|
||||
}
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->y = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A two digit year could not be found", string, begin);
|
||||
}
|
||||
TIMELIB_PROCESS_YEAR(s->time->y);
|
||||
break;
|
||||
case 'Y': /* four digit year */
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
@@ -2020,31 +1984,15 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
}
|
||||
break;
|
||||
case 'i': /* two digit minute, with leading zero */
|
||||
{
|
||||
int length;
|
||||
timelib_sll min;
|
||||
|
||||
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);
|
||||
} else {
|
||||
s->time->i = min;
|
||||
}
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->i = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A two digit minute could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
case 's': /* two digit second, with leading zero */
|
||||
{
|
||||
int length;
|
||||
timelib_sll sec;
|
||||
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (sec == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two second minute could not be found", string, begin);
|
||||
} else {
|
||||
s->time->s = sec;
|
||||
}
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->s = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A two digit second could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
case 'u': /* up to six digit millisecond */
|
||||
@@ -2085,7 +2033,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
case 'O': /* timezone */
|
||||
{
|
||||
int tz_not_found;
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
|
||||
if (tz_not_found) {
|
||||
add_pbf_error(s, "The timezone could not be found in the database", string, begin);
|
||||
}
|
||||
@@ -2140,10 +2088,6 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
timelib_eat_until_separator((char **) &ptr);
|
||||
break;
|
||||
|
||||
case '+': /* allow extra chars in the format */
|
||||
allow_extra = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (*fptr != *ptr) {
|
||||
add_pbf_error(s, "The format separator does not match", string, begin);
|
||||
@@ -2153,20 +2097,11 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
fptr++;
|
||||
}
|
||||
if (*ptr) {
|
||||
if (allow_extra) {
|
||||
add_pbf_warning(s, "Trailing data", string, ptr);
|
||||
} else {
|
||||
add_pbf_error(s, "Trailing data", string, ptr);
|
||||
}
|
||||
}
|
||||
/* ignore trailing +'s */
|
||||
while (*fptr == '+') {
|
||||
fptr++;
|
||||
add_pbf_error(s, "Trailing data", string, ptr);
|
||||
}
|
||||
if (*fptr) {
|
||||
/* Trailing | and ! specifiers are valid. */
|
||||
int done = 0;
|
||||
while (*fptr && !done) {
|
||||
while (*fptr) {
|
||||
switch (*fptr++) {
|
||||
case '!': /* reset all fields to default */
|
||||
timelib_time_reset_fields(s->time);
|
||||
@@ -2178,7 +2113,6 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
|
||||
default:
|
||||
add_pbf_error(s, "Data missing", string, ptr);
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Mon Dec 5 22:02:31 2011 */
|
||||
/* Generated by re2c 0.13.5 on Sat Nov 13 14:57:59 2010 */
|
||||
#line 1 "ext/date/lib/parse_iso_intervals.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -396,7 +396,7 @@ yy6:
|
||||
break;
|
||||
}
|
||||
|
||||
nr = timelib_get_unsigned_nr((char **) &ptr, 12);
|
||||
nr = timelib_get_unsigned_nr((char **) &ptr, 9);
|
||||
switch (*ptr) {
|
||||
case 'Y': s->period->y = nr; break;
|
||||
case 'W': s->period->d = nr * 7; break;
|
||||
|
||||
@@ -364,7 +364,7 @@ isoweek = year4 "-"? "W" weekofyear;
|
||||
break;
|
||||
}
|
||||
|
||||
nr = timelib_get_unsigned_nr((char **) &ptr, 12);
|
||||
nr = timelib_get_unsigned_nr((char **) &ptr, 9);
|
||||
switch (*ptr) {
|
||||
case 'Y': s->period->y = nr; break;
|
||||
case 'W': s->period->d = nr * 7; break;
|
||||
|
||||
@@ -26,14 +26,12 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#define TIMELIB_VERSION 201102
|
||||
#define TIMELIB_VERSION 201101
|
||||
|
||||
#define TIMELIB_NONE 0x00
|
||||
#define TIMELIB_OVERRIDE_TIME 0x01
|
||||
#define TIMELIB_NO_CLONE 0x02
|
||||
|
||||
#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
|
||||
@@ -54,9 +52,6 @@
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
|
||||
/* Function pointers */
|
||||
typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(char *tzname, const timelib_tzdb *tzdb);
|
||||
|
||||
/* From dow.c */
|
||||
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
|
||||
timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
|
||||
@@ -68,8 +63,8 @@ int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
|
||||
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
|
||||
|
||||
/* From parse_date.re */
|
||||
timelib_time *timelib_strtotime(char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
|
||||
timelib_time *timelib_parse_from_format(char *format, char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
|
||||
timelib_time *timelib_strtotime(char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb);
|
||||
timelib_time *timelib_parse_from_format(char *format, char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb);
|
||||
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
|
||||
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst);
|
||||
const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
|
||||
@@ -83,7 +78,6 @@ void timelib_strtointerval(char *s, int len,
|
||||
|
||||
/* From tm2unixtime.c */
|
||||
void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
|
||||
void timelib_do_normalize(timelib_time *base);
|
||||
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt);
|
||||
|
||||
/* From unixtime2tm.c */
|
||||
|
||||
+753
-769
File diff suppressed because it is too large.
Load diff
@@ -179,11 +179,11 @@ void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
|
||||
do {} while (do_range_limit(0, 12, 12, &rt->m, &rt->y));
|
||||
}
|
||||
|
||||
void timelib_do_normalize(timelib_time* time)
|
||||
static void do_normalize(timelib_time* time)
|
||||
{
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->s, &time->i));
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 60, 60, &time->i, &time->h));
|
||||
if (time->s != TIMELIB_UNSET) do {} while (do_range_limit(0, 24, 24, &time->h, &time->d));
|
||||
do {} while (do_range_limit(0, 60, 60, &time->s, &time->i));
|
||||
do {} while (do_range_limit(0, 60, 60, &time->i, &time->h));
|
||||
do {} while (do_range_limit(0, 24, 24, &time->h, &time->d));
|
||||
do {} while (do_range_limit(1, 13, 12, &time->m, &time->y));
|
||||
|
||||
do {} while (do_range_limit_days(&time->y, &time->m, &time->d));
|
||||
@@ -195,7 +195,7 @@ static void do_adjust_relative(timelib_time* time)
|
||||
if (time->relative.have_weekday_relative) {
|
||||
do_adjust_for_weekday(time);
|
||||
}
|
||||
timelib_do_normalize(time);
|
||||
do_normalize(time);
|
||||
|
||||
if (time->have_relative) {
|
||||
time->s += time->relative.s;
|
||||
@@ -215,7 +215,7 @@ static void do_adjust_relative(timelib_time* time)
|
||||
time->m++;
|
||||
break;
|
||||
}
|
||||
timelib_do_normalize(time);
|
||||
do_normalize(time);
|
||||
}
|
||||
|
||||
static void do_adjust_special_weekday(timelib_time* time)
|
||||
@@ -280,7 +280,7 @@ static void do_adjust_special(timelib_time* time)
|
||||
break;
|
||||
}
|
||||
}
|
||||
timelib_do_normalize(time);
|
||||
do_normalize(time);
|
||||
memset(&(time->relative.special), 0, sizeof(time->relative.special));
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ static void do_adjust_special_early(timelib_time* time)
|
||||
break;
|
||||
}
|
||||
}
|
||||
timelib_do_normalize(time);
|
||||
do_normalize(time);
|
||||
}
|
||||
|
||||
static timelib_sll do_years(timelib_sll year)
|
||||
|
||||
@@ -146,7 +146,7 @@ void timelib_update_from_sse(timelib_time *tm)
|
||||
int z = tm->z;
|
||||
signed int dst = tm->dst;
|
||||
|
||||
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + (tm->dst * 3600));
|
||||
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60));
|
||||
|
||||
tm->z = z;
|
||||
tm->dst = dst;
|
||||
@@ -184,7 +184,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 * 60));
|
||||
|
||||
tm->z = z;
|
||||
tm->dst = dst;
|
||||
|
||||
+11
-90
@@ -463,8 +463,6 @@ const zend_function_entry date_funcs_timezone[] = {
|
||||
|
||||
const zend_function_entry date_funcs_interval[] = {
|
||||
PHP_ME(DateInterval, __construct, arginfo_date_interval_construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DateInterval, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DateInterval, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(format, date_interval_format, arginfo_date_method_interval_format, 0)
|
||||
PHP_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, arginfo_date_interval_create_from_date_string, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_FE_END
|
||||
@@ -834,12 +832,6 @@ static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_
|
||||
}
|
||||
return tzi;
|
||||
}
|
||||
|
||||
timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib_tzdb *tzdb)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
return php_date_parse_tzfile(formal_tzname, tzdb TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Helper functions */
|
||||
@@ -1375,7 +1367,7 @@ PHPAPI signed long php_parse_date(char *string, signed long *now)
|
||||
int error2;
|
||||
signed long retval;
|
||||
|
||||
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB);
|
||||
if (error->error_count) {
|
||||
timelib_error_container_dtor(error);
|
||||
return -1;
|
||||
@@ -1412,7 +1404,7 @@ PHP_FUNCTION(strtotime)
|
||||
|
||||
initial_ts = emalloc(25);
|
||||
snprintf(initial_ts, 24, "@%ld UTC", preset_ts);
|
||||
t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); /* we ignore the error here, as this should never fail */
|
||||
t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */
|
||||
timelib_update_ts(t, tzi);
|
||||
now->tz_info = tzi;
|
||||
now->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
@@ -1434,7 +1426,7 @@ PHP_FUNCTION(strtotime)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
t = timelib_strtotime(times, time_len, &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
t = timelib_strtotime(times, time_len, &error, DATE_TIMEZONEDB);
|
||||
error1 = error->error_count;
|
||||
timelib_error_container_dtor(error);
|
||||
timelib_fill_holes(t, now, TIMELIB_NO_CLONE);
|
||||
@@ -2055,9 +2047,6 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
zend_object_value new_ov = date_object_new_date_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->time) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
/* this should probably moved to a new `timelib_time *timelime_time_clone(timelib_time *)` */
|
||||
new_obj->time = timelib_time_ctor();
|
||||
@@ -2179,10 +2168,6 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->initialized) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
new_obj->type = old_obj->type;
|
||||
new_obj->initialized = 1;
|
||||
switch (new_obj->type) {
|
||||
@@ -2403,9 +2388,9 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
|
||||
timelib_time_dtor(dateobj->time);
|
||||
}
|
||||
if (format) {
|
||||
dateobj->time = timelib_parse_from_format(format, time_str_len ? time_str : "", time_str_len ? time_str_len : 0, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
dateobj->time = timelib_parse_from_format(format, time_str_len ? time_str : "", time_str_len ? time_str_len : 0, &err, DATE_TIMEZONEDB);
|
||||
} else {
|
||||
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, &err, DATE_TIMEZONEDB);
|
||||
}
|
||||
|
||||
/* update last errors and warnings */
|
||||
@@ -2739,7 +2724,7 @@ PHP_FUNCTION(date_parse)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
parsed_time = timelib_strtotime(date, date_len, &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
parsed_time = timelib_strtotime(date, date_len, &error, DATE_TIMEZONEDB);
|
||||
php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2758,7 +2743,7 @@ PHP_FUNCTION(date_parse_from_format)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
parsed_time = timelib_parse_from_format(format, date, date_len, &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
parsed_time = timelib_parse_from_format(format, date, date_len, &error, DATE_TIMEZONEDB);
|
||||
php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2800,7 +2785,7 @@ PHP_FUNCTION(date_modify)
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
|
||||
|
||||
tmp_time = timelib_strtotime(modify, modify_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
tmp_time = timelib_strtotime(modify, modify_len, &err, DATE_TIMEZONEDB);
|
||||
|
||||
/* update last errors and warnings */
|
||||
update_errors_warnings(err TSRMLS_CC);
|
||||
@@ -3621,70 +3606,6 @@ PHP_METHOD(DateInterval, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static long php_date_long_from_hash_element(HashTable *myht, char *element, size_t size)
|
||||
{
|
||||
zval **z_arg = NULL;
|
||||
|
||||
if (zend_hash_find(myht, element, size + 1, (void**) &z_arg) == SUCCESS) {
|
||||
convert_to_long(*z_arg);
|
||||
return Z_LVAL_PP(z_arg);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int php_date_interval_initialize_from_hash(zval **return_value, php_interval_obj **intobj, HashTable *myht TSRMLS_DC)
|
||||
{
|
||||
(*intobj)->diff = timelib_rel_time_ctor();
|
||||
|
||||
(*intobj)->diff->y = php_date_long_from_hash_element(myht, "y", 1);
|
||||
(*intobj)->diff->m = php_date_long_from_hash_element(myht, "m", 1);
|
||||
(*intobj)->diff->d = php_date_long_from_hash_element(myht, "d", 1);
|
||||
(*intobj)->diff->h = php_date_long_from_hash_element(myht, "h", 1);
|
||||
(*intobj)->diff->i = php_date_long_from_hash_element(myht, "i", 1);
|
||||
(*intobj)->diff->s = php_date_long_from_hash_element(myht, "s", 1);
|
||||
(*intobj)->diff->invert = php_date_long_from_hash_element(myht, "invert", 6);
|
||||
(*intobj)->diff->days = php_date_long_from_hash_element(myht, "days", 4);
|
||||
(*intobj)->initialized = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* {{{ proto DateInterval::__set_state()
|
||||
*/
|
||||
PHP_METHOD(DateInterval, __set_state)
|
||||
{
|
||||
php_interval_obj *intobj;
|
||||
zval *array;
|
||||
HashTable *myht;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
myht = HASH_OF(array);
|
||||
|
||||
php_date_instantiate(date_ce_interval, return_value TSRMLS_CC);
|
||||
intobj = (php_interval_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
php_date_interval_initialize_from_hash(&return_value, &intobj, myht TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DateInterval::__wakeup()
|
||||
*/
|
||||
PHP_METHOD(DateInterval, __wakeup)
|
||||
{
|
||||
zval *object = getThis();
|
||||
php_interval_obj *intobj;
|
||||
HashTable *myht;
|
||||
|
||||
intobj = (php_interval_obj *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
myht = Z_OBJPROP_P(object);
|
||||
|
||||
php_date_interval_initialize_from_hash(&return_value, &intobj, myht TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
/* {{{ proto DateInterval date_interval_create_from_date_string(string time)
|
||||
Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string
|
||||
*/
|
||||
@@ -3702,7 +3623,7 @@ PHP_FUNCTION(date_interval_create_from_date_string)
|
||||
|
||||
php_date_instantiate(date_ce_interval, return_value TSRMLS_CC);
|
||||
|
||||
time = timelib_strtotime(time_str, time_str_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
time = timelib_strtotime(time_str, time_str_len, &err, DATE_TIMEZONEDB);
|
||||
diobj = (php_interval_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
diobj->diff = timelib_rel_time_clone(&time->relative);
|
||||
diobj->initialized = 1;
|
||||
@@ -3740,8 +3661,8 @@ static char *date_interval_format(char *format, int format_len, timelib_rel_time
|
||||
case 'I': length = slprintf(buffer, 32, "%02d", (int) t->i); break;
|
||||
case 'i': length = slprintf(buffer, 32, "%d", (int) t->i); break;
|
||||
|
||||
case 'S': length = slprintf(buffer, 32, "%02ld", (long) t->s); break;
|
||||
case 's': length = slprintf(buffer, 32, "%ld", (long) t->s); break;
|
||||
case 'S': length = slprintf(buffer, 32, "%02d", (int) t->s); break;
|
||||
case 's': length = slprintf(buffer, 32, "%d", (int) t->s); break;
|
||||
|
||||
case 'a': {
|
||||
if ((int) t->days != -99999) {
|
||||
|
||||
@@ -82,8 +82,6 @@ PHP_FUNCTION(timezone_abbreviations_list);
|
||||
PHP_FUNCTION(timezone_version_get);
|
||||
|
||||
PHP_METHOD(DateInterval, __construct);
|
||||
PHP_METHOD(DateInterval, __wakeup);
|
||||
PHP_METHOD(DateInterval, __set_state);
|
||||
PHP_FUNCTION(date_interval_format);
|
||||
PHP_FUNCTION(date_interval_create_from_date_string);
|
||||
|
||||
|
||||
@@ -8,7 +8,10 @@ date.timezone=UTC
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!method_exists('DateInterval', 'format')) die("skip: method doesn't exist");
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
|
||||
?>
|
||||
--XFAIL--
|
||||
Windows VC6 libs' floor()/ceil() choke on floats
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ examine_diff('2007-02-07', '2000-02-07', 'P+7Y0M0DT0H0M0S', 2557);
|
||||
echo "test_years_positive__7_by_1_day: ";
|
||||
examine_diff('2007-02-08', '2000-02-07', 'P+7Y0M1DT0H0M0S', 2558);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_years_positive__6_shy_1_day: ";
|
||||
examine_diff('2007-02-06', '2000-02-07', 'P+6Y11M30DT0H0M0S', 2556);
|
||||
|
||||
@@ -49,7 +48,6 @@ examine_diff('2000-02-07', '2007-02-07', 'P-7Y0M0DT0H0M0S', 2557);
|
||||
echo "test_years_negative__7_by_1_day: ";
|
||||
examine_diff('2000-02-07', '2007-02-08', 'P-7Y0M1DT0H0M0S', 2558);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_years_negative__6_shy_1_day: ";
|
||||
examine_diff('2000-02-07', '2007-02-06', 'P-6Y11M28DT0H0M0S', 2556);
|
||||
|
||||
|
||||
@@ -71,19 +71,15 @@ examine_diff('2010-03-01', '2010-01-01', 'P+0Y2M0DT0H0M0S', 59);
|
||||
echo "test_bug_49081__20: ";
|
||||
examine_diff('2010-03-01', '2010-01-31', 'P+0Y0M29DT0H0M0S', 29);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081__21: ";
|
||||
examine_diff('2010-03-27', '2010-01-31', 'P+0Y1M24DT0H0M0S', 55);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081__22: ";
|
||||
examine_diff('2010-03-28', '2010-01-31', 'P+0Y1M25DT0H0M0S', 56);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081__23: ";
|
||||
examine_diff('2010-03-29', '2010-01-31', 'P+0Y1M26DT0H0M0S', 57);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081__24: ";
|
||||
examine_diff('2010-03-30', '2010-01-31', 'P+0Y1M27DT0H0M0S', 58);
|
||||
|
||||
@@ -172,23 +168,18 @@ examine_diff('2010-01-27', '2010-02-28', 'P-0Y1M1DT0H0M0S', 32);
|
||||
echo "test_bug_49081_negative__19: ";
|
||||
examine_diff('2010-01-01', '2010-03-01', 'P-0Y2M0DT0H0M0S', 59);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081_negative__20: ";
|
||||
examine_diff('2010-01-31', '2010-03-01', 'P-0Y1M1DT0H0M0S', 29);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081_negative__21: ";
|
||||
examine_diff('2010-01-31', '2010-03-27', 'P-0Y1M27DT0H0M0S', 55);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081_negative__22: ";
|
||||
examine_diff('2010-01-31', '2010-03-28', 'P-0Y1M28DT0H0M0S', 56);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081_negative__23: ";
|
||||
examine_diff('2010-01-31', '2010-03-29', 'P-0Y1M29DT0H0M0S', 57);
|
||||
|
||||
// NOTE: sub() produces different answer.
|
||||
echo "test_bug_49081_negative__24: ";
|
||||
examine_diff('2010-01-31', '2010-03-30', 'P-0Y1M30DT0H0M0S', 58);
|
||||
|
||||
|
||||
@@ -99,11 +99,11 @@ $start = new DateTime('2010-03-15 18:57:55 EDT'); // sp post, zt2
|
||||
examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
|
||||
|
||||
echo "test_time_spring_type2_stsec_type2_dtsec: ";
|
||||
$end = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2
|
||||
$start = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2
|
||||
$end = new DateTime('2010-03-15 03:00:00 EDT'); // dtsec, zt2
|
||||
$start = new DateTime('2010-03-13 01:59:59 EST'); // stsec, zt2
|
||||
examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
|
||||
|
||||
echo "test_time_spring_type2_dtsec_type2_stsec: ";
|
||||
$end = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2
|
||||
$start = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2
|
||||
$end = new DateTime('2010-03-15 01:59:59 EST'); // stsec, zt2
|
||||
$start = new DateTime('2010-03-13 03:00:00 EDT'); // dtsec, zt2
|
||||
examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
|
||||
@@ -99,11 +99,11 @@ $start = new DateTime('2010-03-15 18:57:55 EDT'); // sp post, zt2
|
||||
examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
|
||||
|
||||
echo "test_time_spring_type2_stsec_type3_dtsec: ";
|
||||
$end = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3
|
||||
$start = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2
|
||||
$end = new DateTime('2010-03-15 03:00:00'); // dtsec, zt3
|
||||
$start = new DateTime('2010-03-13 01:59:59 EST'); // stsec, zt2
|
||||
examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
|
||||
|
||||
echo "test_time_spring_type2_dtsec_type3_stsec: ";
|
||||
$end = new DateTime('2010-03-14 01:59:59'); // stsec, zt3
|
||||
$start = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2
|
||||
$end = new DateTime('2010-03-15 01:59:59'); // stsec, zt3
|
||||
$start = new DateTime('2010-03-13 03:00:00 EDT'); // dtsec, zt2
|
||||
examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
|
||||
@@ -99,11 +99,11 @@ $start = new DateTime('2010-03-15 18:57:55'); // sp post, zt3
|
||||
examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
|
||||
|
||||
echo "test_time_spring_type3_stsec_type2_dtsec: ";
|
||||
$end = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2
|
||||
$start = new DateTime('2010-03-14 01:59:59'); // stsec, zt3
|
||||
$end = new DateTime('2010-03-15 03:00:00 EDT'); // dtsec, zt2
|
||||
$start = new DateTime('2010-03-13 01:59:59'); // stsec, zt3
|
||||
examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
|
||||
|
||||
echo "test_time_spring_type3_dtsec_type2_stsec: ";
|
||||
$end = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2
|
||||
$start = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3
|
||||
$end = new DateTime('2010-03-15 01:59:59 EST'); // stsec, zt2
|
||||
$start = new DateTime('2010-03-13 03:00:00'); // dtsec, zt3
|
||||
examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
|
||||
@@ -99,11 +99,11 @@ $start = new DateTime('2010-03-15 18:57:55'); // sp post, zt3
|
||||
examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
|
||||
|
||||
echo "test_time_spring_type3_stsec_type3_dtsec: ";
|
||||
$end = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3
|
||||
$start = new DateTime('2010-03-14 01:59:59'); // stsec, zt3
|
||||
$end = new DateTime('2010-03-15 03:00:00'); // dtsec, zt3
|
||||
$start = new DateTime('2010-03-13 01:59:59'); // stsec, zt3
|
||||
examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
|
||||
|
||||
echo "test_time_spring_type3_dtsec_type3_stsec: ";
|
||||
$end = new DateTime('2010-03-14 01:59:59'); // stsec, zt3
|
||||
$start = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3
|
||||
$end = new DateTime('2010-03-15 01:59:59'); // stsec, zt3
|
||||
$start = new DateTime('2010-03-13 03:00:00'); // dtsec, zt3
|
||||
examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
|
||||
@@ -27,5 +27,5 @@ test_time_spring_type2_post_type2_prev: DAYS: **2**
|
||||
test_time_spring_type2_post_type2_st: DAYS: **1**
|
||||
test_time_spring_type2_post_type2_dt: DAYS: **1**
|
||||
test_time_spring_type2_post_type2_post: DAYS: **0**
|
||||
test_time_spring_type2_stsec_type2_dtsec: DAYS: **0**
|
||||
test_time_spring_type2_stsec_type2_dtsec: DAYS: **0**
|
||||
test_time_spring_type2_dtsec_type2_stsec: DAYS: **0**
|
||||
@@ -27,5 +27,5 @@ test_time_spring_type2_post_type3_prev: DAYS: **2**
|
||||
test_time_spring_type2_post_type3_st: DAYS: **1**
|
||||
test_time_spring_type2_post_type3_dt: DAYS: **1**
|
||||
test_time_spring_type2_post_type3_post: DAYS: **0**
|
||||
test_time_spring_type2_stsec_type3_dtsec: DAYS: **0**
|
||||
test_time_spring_type2_stsec_type3_dtsec: DAYS: **0**
|
||||
test_time_spring_type2_dtsec_type3_stsec: DAYS: **0**
|
||||
@@ -27,5 +27,5 @@ test_time_spring_type3_post_type2_prev: DAYS: **2**
|
||||
test_time_spring_type3_post_type2_st: DAYS: **1**
|
||||
test_time_spring_type3_post_type2_dt: DAYS: **1**
|
||||
test_time_spring_type3_post_type2_post: DAYS: **0**
|
||||
test_time_spring_type3_stsec_type2_dtsec: DAYS: **0**
|
||||
test_time_spring_type3_stsec_type2_dtsec: DAYS: **0**
|
||||
test_time_spring_type3_dtsec_type2_stsec: DAYS: **0**
|
||||
@@ -27,5 +27,5 @@ test_time_spring_type3_post_type3_prev: DAYS: **2**
|
||||
test_time_spring_type3_post_type3_st: DAYS: **1**
|
||||
test_time_spring_type3_post_type3_dt: DAYS: **1**
|
||||
test_time_spring_type3_post_type3_post: DAYS: **0**
|
||||
test_time_spring_type3_stsec_type3_dtsec: DAYS: **0**
|
||||
test_time_spring_type3_stsec_type3_dtsec: DAYS: **0**
|
||||
test_time_spring_type3_dtsec_type3_stsec: DAYS: **0**
|
||||
@@ -14,7 +14,7 @@ require 'DateTime_data-dates.inc';
|
||||
test__7: SUB: 2009-01-14 00:00:00 EST - P+0Y0M7DT0H0M0S = **2009-01-07 00:00:00 EST**
|
||||
test_years_positive__7_by_0_day: SUB: 2007-02-07 00:00:00 EST - P+7Y0M0DT0H0M0S = **2000-02-07 00:00:00 EST**
|
||||
test_years_positive__7_by_1_day: SUB: 2007-02-08 00:00:00 EST - P+7Y0M1DT0H0M0S = **2000-02-07 00:00:00 EST**
|
||||
test_years_positive__6_shy_1_day: SUB: 2007-02-06 00:00:00 EST - P+6Y11M30DT0H0M0S = **2000-02-05 00:00:00 EST**
|
||||
test_years_positive__6_shy_1_day: SUB: 2007-02-06 00:00:00 EST - P+6Y11M30DT0H0M0S = **2000-02-07 00:00:00 EST**
|
||||
test_years_positive__7_by_1_month: SUB: 2007-03-07 00:00:00 EST - P+7Y1M0DT0H0M0S = **2000-02-07 00:00:00 EST**
|
||||
test_years_positive__6_shy_1_month: SUB: 2007-01-07 00:00:00 EST - P+6Y11M0DT0H0M0S = **2000-02-07 00:00:00 EST**
|
||||
test_years_positive__7_by_1_month_split_newyear: SUB: 2007-01-07 00:00:00 EST - P+7Y1M0DT0H0M0S = **1999-12-07 00:00:00 EST**
|
||||
@@ -22,7 +22,7 @@ test_years_positive__6_shy_1_month_split_newyear: SUB: 2006-12-07 00:00:00 EST -
|
||||
test_negative__7: SUB: 2009-01-07 00:00:00 EST - P-0Y0M7DT0H0M0S = **2009-01-14 00:00:00 EST**
|
||||
test_years_negative__7_by_0_day: SUB: 2000-02-07 00:00:00 EST - P-7Y0M0DT0H0M0S = **2007-02-07 00:00:00 EST**
|
||||
test_years_negative__7_by_1_day: SUB: 2000-02-07 00:00:00 EST - P-7Y0M1DT0H0M0S = **2007-02-08 00:00:00 EST**
|
||||
test_years_negative__6_shy_1_day: SUB: 2000-02-07 00:00:00 EST - P-6Y11M28DT0H0M0S = **2007-02-04 00:00:00 EST**
|
||||
test_years_negative__6_shy_1_day: SUB: 2000-02-07 00:00:00 EST - P-6Y11M28DT0H0M0S = **2007-02-06 00:00:00 EST**
|
||||
test_years_negative__7_by_1_month: SUB: 2000-02-07 00:00:00 EST - P-7Y1M0DT0H0M0S = **2007-03-07 00:00:00 EST**
|
||||
test_years_negative__6_shy_1_month: SUB: 2000-02-07 00:00:00 EST - P-6Y11M0DT0H0M0S = **2007-01-07 00:00:00 EST**
|
||||
test_years_negative__7_by_1_month_split_newyear: SUB: 1999-12-07 00:00:00 EST - P-7Y1M0DT0H0M0S = **2007-01-07 00:00:00 EST**
|
||||
|
||||
@@ -31,10 +31,10 @@ test_bug_49081__17: SUB: 2010-02-28 00:00:00 EST - P+0Y1M0DT0H0M0S = **2010-01-2
|
||||
test_bug_49081__18: SUB: 2010-02-28 00:00:00 EST - P+0Y1M1DT0H0M0S = **2010-01-27 00:00:00 EST**
|
||||
test_bug_49081__19: SUB: 2010-03-01 00:00:00 EST - P+0Y2M0DT0H0M0S = **2010-01-01 00:00:00 EST**
|
||||
test_bug_49081__20: SUB: 2010-03-01 00:00:00 EST - P+0Y0M29DT0H0M0S = **2010-01-31 00:00:00 EST**
|
||||
test_bug_49081__21: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M24DT0H0M0S = **2010-02-03 00:00:00 EST**
|
||||
test_bug_49081__22: SUB: 2010-03-28 00:00:00 EDT - P+0Y1M25DT0H0M0S = **2010-02-03 00:00:00 EST**
|
||||
test_bug_49081__23: SUB: 2010-03-29 00:00:00 EDT - P+0Y1M26DT0H0M0S = **2010-02-03 00:00:00 EST**
|
||||
test_bug_49081__24: SUB: 2010-03-30 00:00:00 EDT - P+0Y1M27DT0H0M0S = **2010-02-03 00:00:00 EST**
|
||||
test_bug_49081__21: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M24DT0H0M0S = **2010-01-31 00:00:00 EST**
|
||||
test_bug_49081__22: SUB: 2010-03-28 00:00:00 EDT - P+0Y1M25DT0H0M0S = **2010-01-31 00:00:00 EST**
|
||||
test_bug_49081__23: SUB: 2010-03-29 00:00:00 EDT - P+0Y1M26DT0H0M0S = **2010-01-31 00:00:00 EST**
|
||||
test_bug_49081__24: SUB: 2010-03-30 00:00:00 EDT - P+0Y1M27DT0H0M0S = **2010-01-31 00:00:00 EST**
|
||||
test_bug_49081__25: SUB: 2010-03-31 00:00:00 EDT - P+0Y2M0DT0H0M0S = **2010-01-31 00:00:00 EST**
|
||||
test_bug_49081__26: SUB: 2010-03-31 00:00:00 EDT - P+0Y2M1DT0H0M0S = **2010-01-30 00:00:00 EST**
|
||||
test_bug_49081__27: SUB: 2009-01-31 00:00:00 EST - P+0Y0M30DT0H0M0S = **2009-01-01 00:00:00 EST**
|
||||
@@ -62,11 +62,11 @@ test_bug_49081_negative__16: SUB: 2010-01-29 00:00:00 EST - P-0Y0M30DT0H0M0S = *
|
||||
test_bug_49081_negative__17: SUB: 2010-01-28 00:00:00 EST - P-0Y1M0DT0H0M0S = **2010-02-28 00:00:00 EST**
|
||||
test_bug_49081_negative__18: SUB: 2010-01-27 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-02-28 00:00:00 EST**
|
||||
test_bug_49081_negative__19: SUB: 2010-01-01 00:00:00 EST - P-0Y2M0DT0H0M0S = **2010-03-01 00:00:00 EST**
|
||||
test_bug_49081_negative__20: SUB: 2010-01-31 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-04 00:00:00 EST**
|
||||
test_bug_49081_negative__21: SUB: 2010-01-31 00:00:00 EST - P-0Y1M27DT0H0M0S = **2010-03-30 00:00:00 EDT**
|
||||
test_bug_49081_negative__22: SUB: 2010-01-31 00:00:00 EST - P-0Y1M28DT0H0M0S = **2010-03-31 00:00:00 EDT**
|
||||
test_bug_49081_negative__23: SUB: 2010-01-31 00:00:00 EST - P-0Y1M29DT0H0M0S = **2010-04-01 00:00:00 EDT**
|
||||
test_bug_49081_negative__24: SUB: 2010-01-31 00:00:00 EST - P-0Y1M30DT0H0M0S = **2010-04-02 00:00:00 EDT**
|
||||
test_bug_49081_negative__20: SUB: 2010-01-31 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-01 00:00:00 EST**
|
||||
test_bug_49081_negative__21: SUB: 2010-01-31 00:00:00 EST - P-0Y1M27DT0H0M0S = **2010-03-27 00:00:00 EDT**
|
||||
test_bug_49081_negative__22: SUB: 2010-01-31 00:00:00 EST - P-0Y1M28DT0H0M0S = **2010-03-28 00:00:00 EDT**
|
||||
test_bug_49081_negative__23: SUB: 2010-01-31 00:00:00 EST - P-0Y1M29DT0H0M0S = **2010-03-29 00:00:00 EDT**
|
||||
test_bug_49081_negative__24: SUB: 2010-01-31 00:00:00 EST - P-0Y1M30DT0H0M0S = **2010-03-30 00:00:00 EDT**
|
||||
test_bug_49081_negative__25: SUB: 2010-01-31 00:00:00 EST - P-0Y2M0DT0H0M0S = **2010-03-31 00:00:00 EDT**
|
||||
test_bug_49081_negative__26: SUB: 2010-01-30 00:00:00 EST - P-0Y2M1DT0H0M0S = **2010-03-31 00:00:00 EDT**
|
||||
test_bug_49081_negative__27: SUB: 2009-01-01 00:00:00 EST - P-0Y0M30DT0H0M0S = **2009-01-31 00:00:00 EST**
|
||||
|
||||
@@ -4,9 +4,6 @@ Bug #13142 (strtotime handling of "M d H:i:s Y" format)
|
||||
date.timezone=US/Eastern
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
die("skip. set TZ env is not supported at runtime.");
|
||||
}
|
||||
if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') {
|
||||
die("skip unable to change TZ enviroment variable\n");
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
--TEST--
|
||||
Bug #27780 (strtotime(+1 xxx) returns a wrong date/time)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
die("skip. Not the same TZ on windows.");
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
$timezones = array (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--TEST--
|
||||
Bug #28088 (strtotime() cannot convert 00 hours")
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
putenv("TZ=GMT");
|
||||
|
||||
echo "The following line rightly shows the correct date time:\n";
|
||||
echo gmdate("m/d/y Hi", strtotime("04/04/04 2345")), "\n";
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
--TEST--
|
||||
Bug #32555 (strtotime("tomorrow") can return false)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die('skip strftime uses system TZ');
|
||||
?>
|
||||
--INI--
|
||||
date.timezone=US/Eastern
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$stamp = 1112427000;
|
||||
print strftime('%c %Z',strtotime('now',$stamp)) ."\n";
|
||||
print strftime('%c %Z',strtotime('tomorrow',$stamp)) ."\n";
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Bug #33415 [2] (Possibly invalid non-one-hour DST or timezone shifts)
|
||||
--FILE--
|
||||
<?php
|
||||
date_default_timezone_set('Africa/Bujumbura');
|
||||
|
||||
print "TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to
|
||||
have a DST or timezone transition.\n";
|
||||
putenv("TZ=Africa/Bujumbura");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
|
||||
@@ -13,7 +13,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Wednesday 00:00:00\n\n";
|
||||
|
||||
print "TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes\n";
|
||||
date_default_timezone_set('Asia/Thimbu');
|
||||
putenv("TZ=Asia/Thimbu");
|
||||
$tStamp = mktime (17, 17, 17, 1, 6476, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
|
||||
@@ -22,7 +22,7 @@ print "wanted=Thursday 00:30:00\n\n";
|
||||
|
||||
print "TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not
|
||||
appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Indian/Cocos');
|
||||
putenv("TZ=Indian/Cocos");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
|
||||
@@ -31,7 +31,7 @@ print "wanted=Thursday 00:00:00\n\n";
|
||||
|
||||
print "TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does
|
||||
not appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Africa/Lubumbashi');
|
||||
putenv("TZ=Africa/Lubumbashi");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Saturday", $tStamp);
|
||||
@@ -39,7 +39,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Saturday 00:00:00\n\n";
|
||||
|
||||
print "TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes\n";
|
||||
date_default_timezone_set('Asia/Kashgar');
|
||||
putenv("TZ=Asia/Kashgar");
|
||||
$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
|
||||
@@ -48,7 +48,7 @@ print "wanted=Thursday 03:00:00\n\n";
|
||||
|
||||
print "TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does
|
||||
not appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Indian/Christmas');
|
||||
putenv("TZ=Indian/Christmas");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
|
||||
@@ -56,7 +56,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Sunday 00:00:00\n\n";
|
||||
|
||||
print "TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes\n";
|
||||
date_default_timezone_set('America/Santo_Domingo');
|
||||
putenv("TZ=America/Santo_Domingo");
|
||||
$tStamp = mktime (17, 17, 17, 1, 291, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
|
||||
@@ -65,7 +65,7 @@ print "wanted=Sunday 00:30:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Truk - Is it OK for this to be 10 AM? Note: does not
|
||||
appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Pacific/Truk');
|
||||
putenv("TZ=Pacific/Truk");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
|
||||
@@ -74,7 +74,7 @@ print "wanted=Tuesday 00:00:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Ponape - Is it OK for this to be 11 AM? Note: does
|
||||
not appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Pacific/Ponape');
|
||||
putenv("TZ=Pacific/Ponape");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Monday", $tStamp);
|
||||
@@ -82,7 +82,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Monday 00:00:00\n\n";
|
||||
|
||||
print "TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes\n";
|
||||
date_default_timezone_set('America/Scoresbysund');
|
||||
putenv("TZ=America/Scoresbysund");
|
||||
$tStamp = mktime (17, 17, 17, 1, 4099, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
|
||||
@@ -90,7 +90,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Sunday 02:00:00\n\n";
|
||||
|
||||
print "TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes\n";
|
||||
date_default_timezone_set('America/Guyana');
|
||||
putenv("TZ=America/Guyana");
|
||||
$tStamp = mktime (17, 17, 17, 1, 2031, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
|
||||
@@ -98,7 +98,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Thursday 00:45:00\n\n";
|
||||
|
||||
print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes\n";
|
||||
date_default_timezone_set('Asia/Tehran');
|
||||
putenv("TZ=Asia/Tehran");
|
||||
$tStamp = mktime (17, 17, 17, 1, 2855, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
|
||||
@@ -107,7 +107,7 @@ print "wanted=Tuesday 00:30:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
|
||||
not appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Pacific/Tarawa');
|
||||
putenv("TZ=Pacific/Tarawa");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Monday", $tStamp);
|
||||
@@ -115,7 +115,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Monday 00:00:00\n\n";
|
||||
|
||||
print "TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes\n";
|
||||
date_default_timezone_set('Africa/Monrovia');
|
||||
putenv("TZ=Africa/Monrovia");
|
||||
$tStamp = mktime (17, 17, 17, 1, 845, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Monday", $tStamp);
|
||||
@@ -123,7 +123,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Monday 00:44:30\n\n";
|
||||
|
||||
print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n";
|
||||
date_default_timezone_set('Asia/Katmandu');
|
||||
putenv("TZ=Asia/Katmandu");
|
||||
$tStamp = mktime (17, 17, 17, 1, 5838, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
|
||||
@@ -131,7 +131,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Wednesday 00:15:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n";
|
||||
date_default_timezone_set('Pacific/Nauru');
|
||||
putenv("TZ=Pacific/Nauru");
|
||||
$tStamp = mktime (17, 17, 17, 1, 3401, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
|
||||
@@ -139,7 +139,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Tuesday 00:30:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes\n";
|
||||
date_default_timezone_set('Pacific/Niue');
|
||||
putenv("TZ=Pacific/Niue");
|
||||
$tStamp = mktime (17, 17, 17, 1, 3189, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
|
||||
@@ -148,7 +148,7 @@ print "wanted=Sunday 00:30:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
|
||||
or timezone transition.\n";
|
||||
date_default_timezone_set('Pacific/Port_Moresby');
|
||||
putenv("TZ=Pacific/Port_Moresby");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
|
||||
@@ -156,7 +156,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Thursday 00:00:00\n\n";
|
||||
|
||||
print "TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes\n";
|
||||
date_default_timezone_set('America/Miquelon');
|
||||
putenv("TZ=America/Miquelon");
|
||||
$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
|
||||
@@ -165,7 +165,7 @@ print "wanted=Thursday 01:00:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
|
||||
timezone transition.\n";
|
||||
date_default_timezone_set('Pacific/Palau');
|
||||
putenv("TZ=Pacific/Palau");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Saturday", $tStamp);
|
||||
@@ -174,7 +174,7 @@ print "wanted=Saturday 00:00:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Funafuti - Is it OK for this to be midday? Note: does
|
||||
not appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Pacific/Funafuti');
|
||||
putenv("TZ=Pacific/Funafuti");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
|
||||
@@ -183,7 +183,7 @@ print "wanted=Wednesday 00:00:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Wake - Is it OK for this to be midday? Note: does not
|
||||
appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Pacific/Wake');
|
||||
putenv("TZ=Pacific/Wake");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
|
||||
@@ -192,7 +192,7 @@ print "wanted=Tuesday 00:00:00\n\n";
|
||||
|
||||
print "TZ=Pacific/Wallis - Is it OK for this to be midday? Note: does
|
||||
not appear to have a DST or timezone transition.\n";
|
||||
date_default_timezone_set('Pacific/Wallis');
|
||||
putenv("TZ=Pacific/Wallis");
|
||||
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
|
||||
@@ -200,7 +200,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Tuesday 00:00:00\n\n";
|
||||
|
||||
print "TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes\n";
|
||||
date_default_timezone_set('America/Paramaribo');
|
||||
putenv("TZ=America/Paramaribo");
|
||||
$tStamp = mktime (17, 17, 17, 1, 5381, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Monday", $tStamp);
|
||||
|
||||
@@ -3,10 +3,6 @@ Bug #33532 (Different output for strftime() and date())
|
||||
--INI--
|
||||
error_reporting=2047
|
||||
date.timezone=UTC
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(PHP_OS == 'Darwin' || defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip strftime uses system TZ on Darwin and Windows");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -22,7 +18,6 @@ print "datestr " . date ("H:i:s A F j Y T", $tStamp) . "\n";
|
||||
|
||||
print "\nSetting TZ\n";
|
||||
date_default_timezone_set('Australia/Sydney');
|
||||
putenv("TZ=Australia/Sydney");
|
||||
$input = "10:00:00 AM July 1 2005";
|
||||
print "input " . $input . "\n";
|
||||
$tStamp = strtotime($input);
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Bug #48476 (cloning extended DateTime class without calling parent::__constr crashed PHP)
|
||||
--FILE--
|
||||
<?php
|
||||
class MyDateTime extends DateTime {
|
||||
public function __construct() { }
|
||||
}
|
||||
class MyDateTimeZone extends DateTimeZone {
|
||||
public function __construct() { }
|
||||
}
|
||||
|
||||
$o = new MyDateTime;
|
||||
var_dump($o->format("d"));
|
||||
$x = clone $o;
|
||||
|
||||
var_dump($x->format("d"));
|
||||
|
||||
clone $o;
|
||||
|
||||
|
||||
var_dump(timezone_location_get(clone new MyDateTimezone));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 10
|
||||
bool(false)
|
||||
|
||||
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 13
|
||||
bool(false)
|
||||
|
||||
Warning: timezone_location_get(): The DateTimeZone object has not been correctly initialized by its constructor in %sbug48476.php on line 18
|
||||
bool(false)
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--TEST--
|
||||
Bug #48678 (DateInterval segfaults when unserialising)
|
||||
Bug #48678 DateInterval segfaults when unserialising
|
||||
--FILE--
|
||||
<?php
|
||||
$x = new DateInterval("P3Y6M4DT12H30M5S");
|
||||
$x = new dateinterval("P3Y6M4DT12H30M5S");
|
||||
print_r($x);
|
||||
$y = unserialize(serialize($x));
|
||||
print_r($y);
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
DateInterval Object
|
||||
(
|
||||
[y] => 3
|
||||
@@ -16,7 +16,7 @@ DateInterval Object
|
||||
[i] => 30
|
||||
[s] => 5
|
||||
[invert] => 0
|
||||
[days] =>%s
|
||||
[days] =>
|
||||
)
|
||||
DateInterval Object
|
||||
(
|
||||
@@ -27,5 +27,5 @@ DateInterval Object
|
||||
[i] => 30
|
||||
[s] => 5
|
||||
[invert] => 0
|
||||
[days] =>%s
|
||||
[days] =>
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #50392 (date_create_from_format enforces 6 digits for 'u' format character)
|
||||
Bug #50392 date_create_from_format enforces 6 digits for 'u' format character
|
||||
--FILE--
|
||||
<?php
|
||||
date_default_timezone_set('Europe/Bratislava');
|
||||
|
||||
Loaded 100 of 644 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user