mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-25 18:05:42 +00:00
Compare commits
71
Commits
php-5.5.6
...
php-5.4.24
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59c5558e5d | ||
|
|
4b24f8849f | ||
|
|
f156e684ac | ||
|
|
b1df00a7c9 | ||
|
|
c14388d63f | ||
|
|
a056113586 | ||
|
|
97bf254385 | ||
|
|
61199be02f | ||
|
|
7894e397d8 | ||
|
|
50d50c2f04 | ||
|
|
a6fa52028f | ||
|
|
a7c50ccc67 | ||
|
|
bb51d0e4c0 | ||
|
|
20eb8e4d11 | ||
|
|
3624a9ca7a | ||
|
|
2303d0ea22 | ||
|
|
cbcf6e1880 | ||
|
|
68a73ce3c4 | ||
|
|
1b3e2c299d | ||
|
|
cbc98df99e | ||
|
|
3eb2b1ac40 | ||
|
|
c59f3184a3 | ||
|
|
6f739318fd | ||
|
|
8650bbc8dc | ||
|
|
c1224573c7 | ||
|
|
a0955f351c | ||
|
|
ff89066b3d | ||
|
|
8f1fee61e2 | ||
|
|
b1b23abc86 | ||
|
|
71daf3229b | ||
|
|
3e963f8eb4 | ||
|
|
c062c18d42 | ||
|
|
b5f5bff965 | ||
|
|
098d2a5d0f | ||
|
|
86aad97979 | ||
|
|
d1314893fd | ||
|
|
22fa3fbc5f | ||
|
|
6408a1a59e | ||
|
|
edbefd1d5c | ||
|
|
9ed605892d | ||
|
|
2d31eadbbf | ||
|
|
d22cc5c816 | ||
|
|
c1eb219aad | ||
|
|
aab0b2ce3b | ||
|
|
582f6e529e | ||
|
|
5d0c526199 | ||
|
|
324e6a5f82 | ||
|
|
aa26ace21f | ||
|
|
7a0df7be34 | ||
|
|
6e8b2c91c4 | ||
|
|
261c6b31ca | ||
|
|
44a9e6b484 | ||
|
|
fb0c2cf224 | ||
|
|
23ab2575e1 | ||
|
|
504c60dc44 | ||
|
|
16d59aa171 | ||
|
|
12fe4e90be | ||
|
|
63f3ff7b5f | ||
|
|
0aadab0e2e | ||
|
|
74ba88e186 | ||
|
|
1b0e6067d5 | ||
|
|
345032946c | ||
|
|
ce09822269 | ||
|
|
4a1c9be857 | ||
|
|
b902a25cc3 | ||
|
|
0d558afc05 | ||
|
|
050dd59c63 | ||
|
|
101c780500 | ||
|
|
25c08a839a | ||
|
|
823e330c75 | ||
|
|
32873cd0dd |
No files matched your search
+2
-2
@@ -59,8 +59,8 @@ Exceptions:
|
||||
you're calling.
|
||||
|
||||
7. When commenting out code using a #if statement, do NOT use 0 only. Instead
|
||||
use "<svn username here>_0". For example, #if FOO_0, where FOO is your
|
||||
svn user foo. This allows easier tracking of why code was commented out,
|
||||
use "<git username here>_0". For example, #if FOO_0, where FOO is your
|
||||
git user foo. This allows easier tracking of why code was commented out,
|
||||
especially in bundled libraries.
|
||||
|
||||
8. Do not define functions that are not available. For instance, if a
|
||||
|
||||
@@ -1,8 +1,52 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2013, PHP 5.4.23
|
||||
09 Jan 2014, PHP 5.4.24
|
||||
|
||||
- Core:
|
||||
. Added validation of class names in the autoload process. (Dmitry)
|
||||
. Fixed invalid C code in zend_strtod.c. (Lior Kaplan)
|
||||
. Fixed bug #61645 (fopen and O_NONBLOCK). (Mike)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #66060 (Heap buffer over-read in DateInterval). (Remi)
|
||||
. Fixed bug #63391 (Incorrect/inconsistent day of week prior to the year
|
||||
1600). (Derick, T. Carter)
|
||||
. Fixed bug #61599 (Wrong Day of Week). (Derick, T. Carter)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #65196 (Passing DOMDocumentFragment to DOMDocument::saveHTML()
|
||||
Produces invalid Markup). (Mike)
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #65873 (Integer overflow in exif_read_data()). (Stas)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #66229 (128.0.0.0/16 isn't reserved any longer). (Adam)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #64405 (Use freetype-config for determining freetype2 dir(s)).
|
||||
(Adam)
|
||||
|
||||
- PDO_odbc:
|
||||
. Fixed bug #66311 (Stack smashing protection kills PDO/ODBC queries).
|
||||
(michael at orlitzky dot com)
|
||||
|
||||
- SNMP:
|
||||
. Fixed SNMP_ERR_TOOBIG handling for bulk walk operations. (Boris Lytochkin)
|
||||
|
||||
- XSL
|
||||
. Fixed bug #49634 (Segfault throwing an exception in a XSL registered
|
||||
function). (Mike)
|
||||
|
||||
- ZIP:
|
||||
. Fixed Bug #66321 (ZipArchive::open() ze_obj->filename_len not real). (Remi)
|
||||
|
||||
12 Dec 2013, PHP 5.4.23
|
||||
|
||||
- Core:
|
||||
. Fixed bug #66094 (unregister_tick_function tries to cast a Closure to a
|
||||
string). (Laruence)
|
||||
. Fixed bug #65969 (Chain assignment with T_LIST failure). (Dmitry)
|
||||
. Fixed bug #65947 (basename is no more working after fgetcsv in certain
|
||||
situation). (Laruence)
|
||||
|
||||
@@ -13,10 +57,20 @@ PHP NEWS
|
||||
- MySQLi:
|
||||
. Fixed bug #66043 (Segfault calling bind_param() on mysqli). (Laruence)
|
||||
|
||||
- mysqlnd:
|
||||
. Fixed bug #66124 (mysqli under mysqlnd loses precision when bind_param
|
||||
with 'i'). (Andrey)
|
||||
. Fixed bug #66141 (mysqlnd quote function is wrong with NO_BACKSLASH_ESCAPES
|
||||
after failed query). (Andrey)
|
||||
|
||||
- Openssl:
|
||||
. Fixed memory corruption in openssl_x509_parse() (CVE-2013-6420).
|
||||
(Stefan Esser).
|
||||
|
||||
- PDO
|
||||
. Fixed bug 65946 (sql_parser permanently converts values bound to strings)
|
||||
|
||||
?? ??? 2013, PHP 5.4.22
|
||||
14 Nov 2013, PHP 5.4.22
|
||||
|
||||
- Core:
|
||||
. Fixed bug #65911 (scope resolution operator - strange behavior with $this).
|
||||
|
||||
+5
-3
@@ -69,9 +69,11 @@ The next few rules are more of a technical nature::
|
||||
branches) an empty merge should be done.
|
||||
|
||||
2. All news updates intended for public viewing, such as new features,
|
||||
bug fixes, improvements, etc., should go into the NEWS file of the
|
||||
*first* to be released version with the given change. In other words
|
||||
any NEWS file change only needs to done in one branch.
|
||||
bug fixes, improvements, etc., should go into the NEWS file of *any
|
||||
stable release* version with the given change. In other words,
|
||||
news about a bug fix which went into PHP-5.4, PHP-5.5 and master
|
||||
should be noted in both PHP-5.4/NEWS and PHP-5.5/NEWS but
|
||||
not master, which is not a public released version yet.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
|
||||
+78
-68
@@ -8,15 +8,16 @@ General notes and tips
|
||||
1. Do not release on Fridays, Saturdays or Sundays
|
||||
because the sysadmins can not upgrade stuff then.
|
||||
|
||||
2. Package the day before a release. So if the release is to be on Thursday,
|
||||
package on Wednesday.
|
||||
2. Package two days before a release. So if the release is to be on Thursday,
|
||||
package on Tuesday. Think about timezones as well.
|
||||
|
||||
3. Ensure that Windows builds will work before packaging
|
||||
|
||||
4. Follow all steps to the letter. When unclear ask previous RM's (Derick/Ilia)
|
||||
before proceeding. Ideally make sure that for the first releases one of the
|
||||
previous RM's is around to answer questions. For the steps related to the
|
||||
php/QA/bug websites try to have someone from the webmaster team (Bjori) on hand.
|
||||
4. Follow all steps to the letter. When unclear ask previous RM's (David/Julien/
|
||||
Johannes/Stas/Derick/Ilia) before proceeding. Ideally make sure that for the
|
||||
first releases one of the previous RM's is around to answer questions. For the
|
||||
steps related to the 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.
|
||||
|
||||
@@ -50,30 +51,44 @@ Rolling a non stable release (alpha/beta/RC)
|
||||
2. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
3. Checkout the release branch for this release (e.g., PHP-5.4.2).
|
||||
3. Checkout the release branch for this release (e.g., PHP-5.4.2) from the main branch.
|
||||
|
||||
4. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
Do not use abbreviations for alpha and beta.
|
||||
Do not use abbreviations for alpha and beta. Do not use dashes, you should
|
||||
``#define PHP_VERSION "5.4.22RC1"`` and not ``#define PHP_VERSION "5.4.22-RC1"``
|
||||
|
||||
5. Commit these changes to the branch with ``git commit -a``.
|
||||
5. Compile and make test, with and without ZTS, using the right Bison version
|
||||
(for example, for 5.5, Bison 2.4.1 is used)
|
||||
|
||||
6. Tag the repository with the version, e.g.:
|
||||
6. Check ./sapi/cli/php -v output for version matching.
|
||||
|
||||
7. If all is right, commit the changes to the release branch with ``git commit -a``.
|
||||
|
||||
8. Tag the repository release branch with the version, e.g.:
|
||||
``git tag -u YOURKEYID php-5.4.2RC2``
|
||||
|
||||
7. Push the changes to the main repo:
|
||||
9. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and ``NEWS``
|
||||
in the *main* branch (PHP-5.4 for example) to prepare for the **next** version.
|
||||
F.e. if the RC is "5.4.1RC1" then the new one should be "5.4.2-dev" - regardless if we get
|
||||
a new RC or not. This is to make sure ``version_compare()`` can correctly work.
|
||||
Commit the changes to the main branch.
|
||||
|
||||
10. Push the changes to the main repo, the tag, the main branch and the release branch :
|
||||
``git push --tags origin HEAD``
|
||||
``git push origin {main branch}``
|
||||
``git push origin {release branch}``
|
||||
|
||||
8. run: ``./makedist 5.4.2RC2``, this will export the tree, create configure
|
||||
and build two tarballs (one gz and one bz2).
|
||||
11. run: ``PHPROOT=. ./makedist 5.4.2RC2``, this will export the tree, create configure
|
||||
and build three tarballs (gz, bz2 and xz).
|
||||
|
||||
9. Copy those two tarballs to www.php.net, in your homedir there should be a
|
||||
12. Copy those tarballs (scp, rsync) to downloads.php.net, in your homedir there should be a
|
||||
directory "downloads/". Copy them into there, so that the system can generate
|
||||
MD5 sums. If you do not have this directory, talk to Derick.
|
||||
MD5 sums. If you do not have this directory, talk to Derick or Dan.
|
||||
|
||||
10. Now the RC can be found on http://downloads.php.net/yourname,
|
||||
13. Now the RC can be found on http://downloads.php.net/yourname,
|
||||
f.e. http://downloads.php.net/derick/
|
||||
|
||||
11. Once the release has been tagged, contact the PHP Windows development team
|
||||
14. 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 placed into the same directory as the source snapshots.
|
||||
|
||||
@@ -105,9 +120,9 @@ Derick) run the following commands for you:
|
||||
|
||||
Note: Remember to update the MD5 checksum information.
|
||||
|
||||
4. Update ``php.git/include/version.inc`` (x=major version number)
|
||||
4. Update ``web/php.git/include/version.inc`` (x=major version number)
|
||||
|
||||
a. ``$PHP_x_RC`` = "5.4.0RC1"
|
||||
a. ``$PHP_x_RC`` = "5.4.0RC1" (should be set to "false" before)
|
||||
|
||||
b. ``$PHP_x_RC_DATE`` = "06 September 2007"
|
||||
|
||||
@@ -118,67 +133,61 @@ Derick) run the following commands for you:
|
||||
6. 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
|
||||
------------------------
|
||||
|
||||
1. Check windows snapshot builder logs (http://snaps.php.net/win32/snapshot-STABLE.log f.e.)
|
||||
1. Checkout your release branch, you should have created when releasing previous RC
|
||||
and 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``.
|
||||
2. If a CVE commit needs to be merged to the release, then have it commited to
|
||||
the base branches and merged upwards as usual (f.e commit the CVE fix to 5.3,
|
||||
merge to 5.4, 5.5 etc...). Then you can cherry-pick it in your release branch.
|
||||
Don't forget to update NEWS manually in an extra commit then.
|
||||
|
||||
3. **Merge** all related sections in NEWS (f.e. merge the 5.4.1RC1 and 5.4.0 sections)
|
||||
3. Commit those changes
|
||||
|
||||
4. Commit those changes
|
||||
|
||||
5. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
4. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
6. tag the repository with the version f.e. "``git tag -s php-5.4.1``"
|
||||
(of course, you need to change that to the version you're rolling an RC for).
|
||||
When making 5.X release, you need to tag the Zend directory separately!!
|
||||
5. Compile and make test, with and without ZTS, using the right Bison version
|
||||
(for example, for 5.5, Bison 2.4.1 is used)
|
||||
|
||||
7. 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 candidate
|
||||
was "5.4.1RC1" then the new one should be "5.4.1RC2-dev" - regardless if we get
|
||||
a new RC or not. This is to make sure ``version_compare()`` can correctly work.
|
||||
6. Check ./sapi/cli/php -v output for version matching.
|
||||
|
||||
8. Commit those changes
|
||||
7. tag the repository with the version f.e. "``git tag -s php-5.4.1``"
|
||||
|
||||
9. Log in onto the snaps box and go into the correct tree (f.e. the PHP-5.4
|
||||
branch if you're rolling 5.5.x releases).
|
||||
8. Push the tag f.e. "``git push origin php-5.4.1``"
|
||||
|
||||
10. You do not have to update the tree, but of course you can with "``git pull
|
||||
origin <branch>``".
|
||||
9. run: ``PHPROOT=. ./makedist php 5.4.1``, this will export the tag, create configure
|
||||
and build three tarballs (gz, bz2 and xz).
|
||||
Check if the pear files are updated (phar).
|
||||
|
||||
11. run: ``./makedist php 5.4.1``, this will export the tree, create configure
|
||||
and build two tarballs (one gz and one bz2).
|
||||
10. Generate the GPG signature files for the archives.
|
||||
``gpg -u YOUREMAIL --armor --detach-sign php-X.Y.Z.tar.xxx``
|
||||
|
||||
12. Commit those two tarballs to web/php-distributions.git, then update the git
|
||||
submodule reference in web/php.git:
|
||||
git submodule init;
|
||||
11. Commit and push all the tarballs and signature files to web/php-distributions.git,
|
||||
then update the git submodule reference in web/php.git:
|
||||
``git submodule init;
|
||||
git submodule update;
|
||||
cd distributions;
|
||||
git pull origin master;
|
||||
cd ..;
|
||||
git commit distributions;
|
||||
git push;
|
||||
git push;``
|
||||
This is to fetch the last commit id from php-distributions.git and commit this
|
||||
last commit id to web/php.git, then, mirrors will now sync
|
||||
|
||||
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.
|
||||
|
||||
14. Check if the pear files are updated (phar for 5.1+ or run pear/make-pear-bundle.php with 4.4)
|
||||
|
||||
15. When making a final release, also remind the PHP Windows development team
|
||||
(internals-win@lists.php.net) to prepare the installer packages for Win32.
|
||||
12. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created.
|
||||
|
||||
Getting the stable release announced
|
||||
------------------------------------
|
||||
|
||||
1. Run the bumpRelease script for phpweb on your local checkout
|
||||
|
||||
a. ``php bin/bumpRelease 5`` (or ``php bin/bumpRelease 4`` for PHP4)
|
||||
a. ``php bin/bumpRelease 5`` to create the release file (releases/x_y_z.php)
|
||||
The release announcement file should list in detail security fixes and
|
||||
changes in behavior (whether due to a bug fix or not).
|
||||
|
||||
b. In case multiple PHP minor versions are in active development you have
|
||||
to manually copy the old information to include/releases.inc
|
||||
@@ -198,7 +207,13 @@ Getting the stable release announced
|
||||
|
||||
f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
|
||||
|
||||
3. Update the ChangeLog file for the given major version
|
||||
3. Update phpweb/include/releases.php with the old release info
|
||||
(updates the download archives)
|
||||
|
||||
4. Update php-qa/include/release-qa.php and add the next version as an QARELEASE
|
||||
(prepare for next RC)
|
||||
|
||||
5. Update the ChangeLog file for the given major version
|
||||
f.e. ``ChangeLog-5.php`` from the NEWS file
|
||||
|
||||
a. go over the list and put every element on one line
|
||||
@@ -218,19 +233,10 @@ f.e. ``ChangeLog-5.php`` from the NEWS file
|
||||
IV. ``s/Fixed PECL bug #\([0-9]\+\)/<?php peclbugfix(\1); ?>/``
|
||||
|
||||
V. ``s/FR #\([0-9]\+\)/FR <?php bugl(\1); ?>/``
|
||||
|
||||
e. You may want to try php-web/bin/news2html to automate this task
|
||||
|
||||
4. ``cp releases/5_4_0.php releases/5_4_1.php``
|
||||
|
||||
5. ``git add releases/5_4_1.php``
|
||||
|
||||
6. Update the ``releases/*.php`` file with relevant data. The release
|
||||
announcement file should list in detail:
|
||||
|
||||
a. security fixes,
|
||||
|
||||
b. changes in behavior (whether due to a bug fix or not)
|
||||
|
||||
7. Add a short notice to phpweb stating that there is a new release, and
|
||||
6. Add a short notice to phpweb stating that there is a new release, and
|
||||
highlight the major important things (security fixes) and when it is important
|
||||
to upgrade.
|
||||
|
||||
@@ -238,7 +244,11 @@ to upgrade.
|
||||
|
||||
b. Add the content for the news entry
|
||||
|
||||
8. Commit all the changes.
|
||||
7. **Check mirrors have been synced before announcing or pushing news**
|
||||
Try, f.e. http://www.php.net/get/php-5.5.1.tar.bz2/from/a/mirror
|
||||
Try several mirrors, mirrors may update slowly (may take an hour)
|
||||
|
||||
8. Commit all the changes to their respective git repos
|
||||
|
||||
9. Wait an hour or two, then send a mail to php-announce@lists.php.net,
|
||||
php-general@lists.php.net and internals@lists.php.net with a text similar to
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ libZend_la_SOURCES=\
|
||||
zend_ini_parser.y zend_ini_scanner.l \
|
||||
zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \
|
||||
zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \
|
||||
zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
||||
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_qsort.c zend_objects.c zend_object_handlers.c \
|
||||
|
||||
@@ -257,6 +257,10 @@ SOURCE=.\zend_ts_hash.c
|
||||
|
||||
SOURCE=.\zend_variables.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_vm_opcodes.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
||||
@@ -287,6 +287,10 @@ SOURCE=.\zend_ts_hash.c
|
||||
|
||||
SOURCE=.\zend_variables.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_vm_opcodes.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #65969 (Chain assignment with T_LIST failure)
|
||||
--FILE--
|
||||
<?php
|
||||
$obj = new stdClass;
|
||||
list($a,$b) = $obj->prop = [1,2];
|
||||
var_dump($a,$b);
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #66218 zend_register_functions breaks reflection
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_SAPI != "cli") die("skip CLI only test");
|
||||
if (!function_exists("dl")) die("skip need dl");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$tab = get_extension_funcs("standard");
|
||||
$fcts = array("dl");
|
||||
foreach ($fcts as $fct) {
|
||||
if (in_array($fct, $tab)) {
|
||||
echo "$fct Ok\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
dl Ok
|
||||
Done
|
||||
@@ -43,10 +43,6 @@
|
||||
# define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
|
||||
#endif
|
||||
|
||||
#if defined(ZEND_WIN32) && ZEND_DEBUG
|
||||
BOOL WINAPI IsDebuggerPresent(VOID);
|
||||
#endif
|
||||
|
||||
/* true multithread-shared globals */
|
||||
ZEND_API zend_class_entry *zend_standard_class_def = NULL;
|
||||
ZEND_API int (*zend_printf)(const char *format, ...);
|
||||
|
||||
@@ -2452,36 +2452,49 @@ ZEND_FUNCTION(extension_loaded)
|
||||
Returns an array with the names of functions belonging to the named extension */
|
||||
ZEND_FUNCTION(get_extension_funcs)
|
||||
{
|
||||
char *extension_name;
|
||||
int extension_name_len;
|
||||
char *extension_name, *lcname;
|
||||
int extension_name_len, array;
|
||||
zend_module_entry *module;
|
||||
const zend_function_entry *func;
|
||||
|
||||
HashPosition iterator;
|
||||
zend_function *zif;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strncasecmp(extension_name, "zend", sizeof("zend"))) {
|
||||
char *lcname = zend_str_tolower_dup(extension_name, extension_name_len);
|
||||
if (zend_hash_find(&module_registry, lcname,
|
||||
extension_name_len+1, (void**)&module) == FAILURE) {
|
||||
efree(lcname);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(lcname);
|
||||
|
||||
if (!(func = module->functions)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
lcname = zend_str_tolower_dup(extension_name, extension_name_len);
|
||||
} else {
|
||||
func = builtin_functions;
|
||||
lcname = estrdup("core");
|
||||
}
|
||||
if (zend_hash_find(&module_registry, lcname,
|
||||
extension_name_len+1, (void**)&module) == FAILURE) {
|
||||
efree(lcname);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator);
|
||||
if (module->functions) {
|
||||
/* avoid BC break, if functions list is empty, will return an empty array */
|
||||
array_init(return_value);
|
||||
array = 1;
|
||||
} else {
|
||||
array = 0;
|
||||
}
|
||||
while (zend_hash_get_current_data_ex(CG(function_table), (void **) &zif, &iterator) == SUCCESS) {
|
||||
if (zif->common.type==ZEND_INTERNAL_FUNCTION
|
||||
&& zif->internal_function.module == module) {
|
||||
if (!array) {
|
||||
array_init(return_value);
|
||||
array = 1;
|
||||
}
|
||||
add_next_index_string(return_value, zif->common.function_name, 1);
|
||||
}
|
||||
zend_hash_move_forward_ex(CG(function_table), &iterator);
|
||||
}
|
||||
|
||||
while (func->fname) {
|
||||
add_next_index_string(return_value, func->fname, 1);
|
||||
func++;
|
||||
efree(lcname);
|
||||
|
||||
if (!array) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+1
-2
@@ -1248,9 +1248,8 @@ convert_to_array:
|
||||
}
|
||||
}
|
||||
|
||||
static void zend_fetch_dimension_address_read(temp_variable *result, zval **container_ptr, zval *dim, int dim_type, int type TSRMLS_DC)
|
||||
static void zend_fetch_dimension_address_read(temp_variable *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
|
||||
{
|
||||
zval *container = *container_ptr;
|
||||
zval **retval;
|
||||
|
||||
switch (Z_TYPE_P(container)) {
|
||||
|
||||
@@ -1081,6 +1081,14 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Verify class name before passing it to __autoload() */
|
||||
if (strspn(name, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != name_length) {
|
||||
if (!key) {
|
||||
free_alloca(lc_free, use_heap);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (EG(in_autoload) == NULL) {
|
||||
ALLOC_HASHTABLE(EG(in_autoload));
|
||||
zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0);
|
||||
|
||||
@@ -593,13 +593,18 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
"r"(op2)
|
||||
: "rax");
|
||||
#else
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) + Z_LVAL_P(op2);
|
||||
/*
|
||||
* 'result' may alias with op1 or op2, so we need to
|
||||
* ensure that 'result' is not updated until after we
|
||||
* have read the values of op1 and op2.
|
||||
*/
|
||||
|
||||
if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
|
||||
&& (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & LONG_SIGN_MASK))) {
|
||||
&& (Z_LVAL_P(op1) & LONG_SIGN_MASK) != ((Z_LVAL_P(op1) + Z_LVAL_P(op2)) & LONG_SIGN_MASK))) {
|
||||
Z_DVAL_P(result) = (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
} else {
|
||||
Z_LVAL_P(result) = Z_LVAL_P(op1) + Z_LVAL_P(op2);
|
||||
Z_TYPE_P(result) = IS_LONG;
|
||||
}
|
||||
#endif
|
||||
@@ -736,6 +741,7 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o
|
||||
|
||||
static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
#if 0
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
@@ -790,6 +796,7 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return div_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -267,8 +267,7 @@ BEGIN_EXTERN_C()
|
||||
|
||||
#if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) + defined(VAX) + \
|
||||
defined(IBM) != 1
|
||||
Exactly one of IEEE_LITTLE_ENDIAN IEEE_BIG_ENDIAN, VAX, or
|
||||
IBM should be defined.
|
||||
#error "Exactly one of IEEE_LITTLE_ENDIAN IEEE_BIG_ENDIAN, VAX, or IBM should be defined."
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
|
||||
+17
-15
@@ -1166,19 +1166,17 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, VAR|CV, CONST|TMP|VAR|CV)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
OP1_TYPE != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
|
||||
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
|
||||
FREE_OP2();
|
||||
FREE_OP1_VAR_PTR();
|
||||
FREE_OP1();
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -1243,13 +1241,13 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_IS);
|
||||
container = GET_OP1_ZVAL_PTR(BP_VAR_IS);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_IS TSRMLS_CC);
|
||||
FREE_OP2();
|
||||
FREE_OP1_VAR_PTR();
|
||||
FREE_OP1();
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -1258,12 +1256,12 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
|
||||
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
|
||||
|
||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -1271,15 +1269,19 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
FREE_OP2();
|
||||
FREE_OP1_VAR_PTR();
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (OP2_TYPE == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
|
||||
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
|
||||
FREE_OP2();
|
||||
FREE_OP1();
|
||||
}
|
||||
FREE_OP2();
|
||||
FREE_OP1_VAR_PTR();
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
+138
-114
@@ -12874,16 +12874,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
IS_VAR != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
@@ -12951,10 +12949,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC);
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
@@ -12966,12 +12964,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -12979,15 +12977,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_CONST == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
}
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -15048,16 +15050,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
IS_VAR != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
|
||||
zval_dtor(free_op2.var);
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
@@ -15125,10 +15125,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC);
|
||||
zval_dtor(free_op2.var);
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
@@ -15140,12 +15140,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -15153,15 +15153,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_TMP_VAR == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
|
||||
zval_dtor(free_op2.var);
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -17132,16 +17136,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
IS_VAR != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
@@ -17209,10 +17211,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC);
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
@@ -17224,12 +17226,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCO
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -17237,15 +17239,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCO
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_VAR == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
}
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -19007,12 +19013,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_O
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -19020,15 +19026,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_O
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_UNUSED == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
}
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -20257,16 +20267,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
IS_VAR != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
@@ -20334,10 +20342,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC);
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
@@ -20349,12 +20357,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -20362,15 +20370,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_CV == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
}
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -28692,16 +28704,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
IS_CV != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -28768,10 +28778,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -28783,12 +28793,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPC
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -28796,15 +28806,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPC
|
||||
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_CONST == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -30641,16 +30655,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
IS_CV != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
|
||||
zval_dtor(free_op2.var);
|
||||
|
||||
@@ -30717,10 +30729,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC);
|
||||
zval_dtor(free_op2.var);
|
||||
|
||||
@@ -30732,12 +30744,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCOD
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -30745,15 +30757,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCOD
|
||||
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_TMP_VAR == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
zval_dtor(free_op2.var);
|
||||
|
||||
}
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -32594,16 +32610,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
IS_CV != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
|
||||
@@ -32670,10 +32684,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC);
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
|
||||
@@ -32685,12 +32699,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -32698,15 +32712,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD
|
||||
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_VAR == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
|
||||
}
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
|
||||
}
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -34336,12 +34354,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OP
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -34349,15 +34367,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OP
|
||||
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_UNUSED == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -35446,16 +35468,14 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
|
||||
IS_CV != IS_CV &&
|
||||
EX_T(opline->op1.var).var.ptr_ptr) {
|
||||
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
|
||||
if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
|
||||
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -35522,10 +35542,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
zval **container;
|
||||
zval *container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -35537,12 +35557,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
|
||||
}
|
||||
@@ -35550,15 +35570,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE
|
||||
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
|
||||
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
zval *container;
|
||||
|
||||
if (IS_CV == IS_UNUSED) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
|
||||
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
+36
-3
@@ -886,9 +886,16 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
|
||||
out($f,"#undef CHECK_EXCEPTION\n");
|
||||
out($f,"#undef HANDLE_EXCEPTION\n");
|
||||
out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
|
||||
out($f,"#define CHECK_EXCEPTION() if (UNEXPECTED(EG(exception) != NULL)) goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
|
||||
out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
|
||||
out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
|
||||
if (ZEND_VM_SPEC) {
|
||||
out($f,"#define CHECK_EXCEPTION() if (UNEXPECTED(EG(exception) != NULL)) goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
|
||||
out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
|
||||
out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
|
||||
} else {
|
||||
out($f,"#define CHECK_EXCEPTION() if (UNEXPECTED(EG(exception) != NULL)) goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
|
||||
out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
|
||||
out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
|
||||
}
|
||||
|
||||
out($f,"#define LOAD_REGS() do {Ts = EX(Ts); CVs = EX(CVs);} while (0)\n");
|
||||
out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
|
||||
out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
|
||||
@@ -1194,14 +1201,40 @@ function gen_vm($def, $skel) {
|
||||
// Insert header
|
||||
out($f, $GLOBALS['header_text']);
|
||||
|
||||
fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
|
||||
fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n");
|
||||
|
||||
foreach ($opcodes as $code => $dsc) {
|
||||
$code = str_pad((string)$code,$code_len," ",STR_PAD_LEFT);
|
||||
$op = str_pad($dsc["op"],$max_opcode_len);
|
||||
fputs($f,"#define $op $code\n");
|
||||
}
|
||||
|
||||
fputs($f, "\n#endif");
|
||||
fclose($f);
|
||||
echo "zend_vm_opcodes.h generated successfully.\n";
|
||||
|
||||
// zend_vm_opcodes.c
|
||||
$f = fopen("zend_vm_opcodes.c", "w+") or die("ERROR: Cannot create zend_vm_opcodes.c\n");
|
||||
|
||||
// Insert header
|
||||
out($f, $GLOBALS['header_text']);
|
||||
fputs($f,"#include <stdio.h>\n");
|
||||
fputs($f,"#include <zend.h>\n\n");
|
||||
|
||||
fputs($f,"const char *zend_vm_opcodes_map[".($max_opcode + 1)."] = {\n");
|
||||
for ($i = 0; $i <= $max_opcode; $i++) {
|
||||
fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n");
|
||||
}
|
||||
fputs($f, "};\n\n");
|
||||
|
||||
fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n");
|
||||
fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n");
|
||||
fputs($f, "}\n");
|
||||
|
||||
fclose($f);
|
||||
echo "zend_vm_opcodes.c generated successfully.\n";
|
||||
|
||||
// Generate zend_vm_execute.h
|
||||
$f = fopen("zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n");
|
||||
$executor_file = realpath("zend_vm_execute.h");
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.zend.com/license/2_00.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
| Dmitry Stogov <dmitry@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zend.h>
|
||||
|
||||
const char *zend_vm_opcodes_map[159] = {
|
||||
"ZEND_NOP",
|
||||
"ZEND_ADD",
|
||||
"ZEND_SUB",
|
||||
"ZEND_MUL",
|
||||
"ZEND_DIV",
|
||||
"ZEND_MOD",
|
||||
"ZEND_SL",
|
||||
"ZEND_SR",
|
||||
"ZEND_CONCAT",
|
||||
"ZEND_BW_OR",
|
||||
"ZEND_BW_AND",
|
||||
"ZEND_BW_XOR",
|
||||
"ZEND_BW_NOT",
|
||||
"ZEND_BOOL_NOT",
|
||||
"ZEND_BOOL_XOR",
|
||||
"ZEND_IS_IDENTICAL",
|
||||
"ZEND_IS_NOT_IDENTICAL",
|
||||
"ZEND_IS_EQUAL",
|
||||
"ZEND_IS_NOT_EQUAL",
|
||||
"ZEND_IS_SMALLER",
|
||||
"ZEND_IS_SMALLER_OR_EQUAL",
|
||||
"ZEND_CAST",
|
||||
"ZEND_QM_ASSIGN",
|
||||
"ZEND_ASSIGN_ADD",
|
||||
"ZEND_ASSIGN_SUB",
|
||||
"ZEND_ASSIGN_MUL",
|
||||
"ZEND_ASSIGN_DIV",
|
||||
"ZEND_ASSIGN_MOD",
|
||||
"ZEND_ASSIGN_SL",
|
||||
"ZEND_ASSIGN_SR",
|
||||
"ZEND_ASSIGN_CONCAT",
|
||||
"ZEND_ASSIGN_BW_OR",
|
||||
"ZEND_ASSIGN_BW_AND",
|
||||
"ZEND_ASSIGN_BW_XOR",
|
||||
"ZEND_PRE_INC",
|
||||
"ZEND_PRE_DEC",
|
||||
"ZEND_POST_INC",
|
||||
"ZEND_POST_DEC",
|
||||
"ZEND_ASSIGN",
|
||||
"ZEND_ASSIGN_REF",
|
||||
"ZEND_ECHO",
|
||||
"ZEND_PRINT",
|
||||
"ZEND_JMP",
|
||||
"ZEND_JMPZ",
|
||||
"ZEND_JMPNZ",
|
||||
"ZEND_JMPZNZ",
|
||||
"ZEND_JMPZ_EX",
|
||||
"ZEND_JMPNZ_EX",
|
||||
"ZEND_CASE",
|
||||
"ZEND_SWITCH_FREE",
|
||||
"ZEND_BRK",
|
||||
"ZEND_CONT",
|
||||
"ZEND_BOOL",
|
||||
"ZEND_INIT_STRING",
|
||||
"ZEND_ADD_CHAR",
|
||||
"ZEND_ADD_STRING",
|
||||
"ZEND_ADD_VAR",
|
||||
"ZEND_BEGIN_SILENCE",
|
||||
"ZEND_END_SILENCE",
|
||||
"ZEND_INIT_FCALL_BY_NAME",
|
||||
"ZEND_DO_FCALL",
|
||||
"ZEND_DO_FCALL_BY_NAME",
|
||||
"ZEND_RETURN",
|
||||
"ZEND_RECV",
|
||||
"ZEND_RECV_INIT",
|
||||
"ZEND_SEND_VAL",
|
||||
"ZEND_SEND_VAR",
|
||||
"ZEND_SEND_REF",
|
||||
"ZEND_NEW",
|
||||
"ZEND_INIT_NS_FCALL_BY_NAME",
|
||||
"ZEND_FREE",
|
||||
"ZEND_INIT_ARRAY",
|
||||
"ZEND_ADD_ARRAY_ELEMENT",
|
||||
"ZEND_INCLUDE_OR_EVAL",
|
||||
"ZEND_UNSET_VAR",
|
||||
"ZEND_UNSET_DIM",
|
||||
"ZEND_UNSET_OBJ",
|
||||
"ZEND_FE_RESET",
|
||||
"ZEND_FE_FETCH",
|
||||
"ZEND_EXIT",
|
||||
"ZEND_FETCH_R",
|
||||
"ZEND_FETCH_DIM_R",
|
||||
"ZEND_FETCH_OBJ_R",
|
||||
"ZEND_FETCH_W",
|
||||
"ZEND_FETCH_DIM_W",
|
||||
"ZEND_FETCH_OBJ_W",
|
||||
"ZEND_FETCH_RW",
|
||||
"ZEND_FETCH_DIM_RW",
|
||||
"ZEND_FETCH_OBJ_RW",
|
||||
"ZEND_FETCH_IS",
|
||||
"ZEND_FETCH_DIM_IS",
|
||||
"ZEND_FETCH_OBJ_IS",
|
||||
"ZEND_FETCH_FUNC_ARG",
|
||||
"ZEND_FETCH_DIM_FUNC_ARG",
|
||||
"ZEND_FETCH_OBJ_FUNC_ARG",
|
||||
"ZEND_FETCH_UNSET",
|
||||
"ZEND_FETCH_DIM_UNSET",
|
||||
"ZEND_FETCH_OBJ_UNSET",
|
||||
"ZEND_FETCH_DIM_TMP_VAR",
|
||||
"ZEND_FETCH_CONSTANT",
|
||||
"ZEND_GOTO",
|
||||
"ZEND_EXT_STMT",
|
||||
"ZEND_EXT_FCALL_BEGIN",
|
||||
"ZEND_EXT_FCALL_END",
|
||||
"ZEND_EXT_NOP",
|
||||
"ZEND_TICKS",
|
||||
"ZEND_SEND_VAR_NO_REF",
|
||||
"ZEND_CATCH",
|
||||
"ZEND_THROW",
|
||||
"ZEND_FETCH_CLASS",
|
||||
"ZEND_CLONE",
|
||||
"ZEND_RETURN_BY_REF",
|
||||
"ZEND_INIT_METHOD_CALL",
|
||||
"ZEND_INIT_STATIC_METHOD_CALL",
|
||||
"ZEND_ISSET_ISEMPTY_VAR",
|
||||
"ZEND_ISSET_ISEMPTY_DIM_OBJ",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"ZEND_PRE_INC_OBJ",
|
||||
"ZEND_PRE_DEC_OBJ",
|
||||
"ZEND_POST_INC_OBJ",
|
||||
"ZEND_POST_DEC_OBJ",
|
||||
"ZEND_ASSIGN_OBJ",
|
||||
NULL,
|
||||
"ZEND_INSTANCEOF",
|
||||
"ZEND_DECLARE_CLASS",
|
||||
"ZEND_DECLARE_INHERITED_CLASS",
|
||||
"ZEND_DECLARE_FUNCTION",
|
||||
"ZEND_RAISE_ABSTRACT_ERROR",
|
||||
"ZEND_DECLARE_CONST",
|
||||
"ZEND_ADD_INTERFACE",
|
||||
"ZEND_DECLARE_INHERITED_CLASS_DELAYED",
|
||||
"ZEND_VERIFY_ABSTRACT_CLASS",
|
||||
"ZEND_ASSIGN_DIM",
|
||||
"ZEND_ISSET_ISEMPTY_PROP_OBJ",
|
||||
"ZEND_HANDLE_EXCEPTION",
|
||||
"ZEND_USER_OPCODE",
|
||||
NULL,
|
||||
"ZEND_JMP_SET",
|
||||
"ZEND_DECLARE_LAMBDA_FUNCTION",
|
||||
"ZEND_ADD_TRAIT",
|
||||
"ZEND_BIND_TRAITS",
|
||||
"ZEND_SEPARATE",
|
||||
"ZEND_QM_ASSIGN_VAR",
|
||||
"ZEND_JMP_SET_VAR",
|
||||
};
|
||||
|
||||
ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {
|
||||
return zend_vm_opcodes_map[opcode];
|
||||
}
|
||||
@@ -18,6 +18,11 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef ZEND_VM_OPCODES_H
|
||||
#define ZEND_VM_OPCODES_H
|
||||
|
||||
ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
|
||||
|
||||
#define ZEND_NOP 0
|
||||
#define ZEND_ADD 1
|
||||
#define ZEND_SUB 2
|
||||
@@ -159,3 +164,5 @@
|
||||
#define ZEND_SEPARATE 156
|
||||
#define ZEND_QM_ASSIGN_VAR 157
|
||||
#define ZEND_JMP_SET_VAR 158
|
||||
|
||||
#endif
|
||||
+3
-3
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=4
|
||||
PHP_RELEASE_VERSION=23
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=24
|
||||
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`
|
||||
|
||||
@@ -1467,7 +1467,7 @@ PHP_ADD_SOURCES(Zend, \
|
||||
zend_ini_parser.c zend_ini_scanner.c \
|
||||
zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c zend_dtrace.c \
|
||||
zend_execute_API.c zend_highlight.c zend_llist.c \
|
||||
zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
||||
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
|
||||
|
||||
+3
-9
@@ -25,10 +25,7 @@ static int m_table_leap[13] = { -1, 6, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1
|
||||
|
||||
static timelib_sll century_value(timelib_sll j)
|
||||
{
|
||||
timelib_sll i = j - 17;
|
||||
timelib_sll c = (4 - i * 2 + (i + 1) / 4) % 7;
|
||||
|
||||
return c < 0 ? c + 7 : c;
|
||||
return 6 - (j % 4) * 2;
|
||||
}
|
||||
|
||||
static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_sll d, int iso)
|
||||
@@ -36,11 +33,8 @@ static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_
|
||||
timelib_sll c1, y1, m1, dow;
|
||||
|
||||
/* Only valid for Gregorian calendar, commented out as we don't handle
|
||||
* julian calendar. We just return the 'wrong' day of week to be
|
||||
* consistent.
|
||||
if (y < 1753) {
|
||||
return -1;
|
||||
} */
|
||||
* Julian calendar. We just return the 'wrong' day of week to be
|
||||
* consistent. */
|
||||
c1 = century_value(y / 100);
|
||||
y1 = (y % 100);
|
||||
m1 = timelib_is_leap(y) ? m_table_leap[m] : m_table_common[m];
|
||||
|
||||
+98
-5
@@ -25,7 +25,7 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
|
||||
{
|
||||
timelib_rel_time *rt;
|
||||
timelib_time *swp;
|
||||
timelib_sll dst_h_corr = 0, dst_m_corr = 0;
|
||||
timelib_sll dst_corr = 0 ,dst_h_corr = 0, dst_m_corr = 0;
|
||||
timelib_time one_backup, two_backup;
|
||||
|
||||
rt = timelib_rel_time_ctor();
|
||||
@@ -43,8 +43,9 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
|
||||
&& (strcmp(one->tz_info->name, two->tz_info->name) == 0)
|
||||
&& (one->z != two->z))
|
||||
{
|
||||
dst_h_corr = (two->z - one->z) / 3600;
|
||||
dst_m_corr = ((two->z - one->z) % 3600) / 60;
|
||||
dst_corr = two->z - one->z;
|
||||
dst_h_corr = dst_corr / 3600;
|
||||
dst_m_corr = (dst_corr % 3600) / 60;
|
||||
}
|
||||
|
||||
/* Save old TZ info */
|
||||
@@ -57,16 +58,108 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
|
||||
rt->y = two->y - one->y;
|
||||
rt->m = two->m - one->m;
|
||||
rt->d = two->d - one->d;
|
||||
rt->h = two->h - one->h + dst_h_corr;
|
||||
rt->i = two->i - one->i + dst_m_corr;
|
||||
rt->h = two->h - one->h;
|
||||
rt->i = two->i - one->i;
|
||||
rt->s = two->s - one->s;
|
||||
if (one_backup.dst == 0 && two_backup.dst == 1 && two->sse >= one->sse + 86400 - dst_corr) {
|
||||
rt->h += dst_h_corr;
|
||||
rt->i += dst_m_corr;
|
||||
}
|
||||
|
||||
rt->days = abs(floor((one->sse - two->sse - (dst_h_corr * 3600) - (dst_m_corr * 60)) / 86400));
|
||||
|
||||
timelib_do_rel_normalize(rt->invert ? one : two, rt);
|
||||
|
||||
/* We need to do this after normalisation otherwise we can't get "24H" */
|
||||
if (one_backup.dst == 1 && two_backup.dst == 0 && two->sse >= one->sse + 86400) {
|
||||
if (two->sse < one->sse + 86400 - dst_corr) {
|
||||
rt->d--;
|
||||
rt->h = 24;
|
||||
} else {
|
||||
rt->h += dst_h_corr;
|
||||
rt->i += dst_m_corr;
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore old TZ info */
|
||||
memcpy(one, &one_backup, sizeof(one_backup));
|
||||
memcpy(two, &two_backup, sizeof(two_backup));
|
||||
|
||||
return rt;
|
||||
}
|
||||
|
||||
timelib_time *timelib_add(timelib_time *old_time, timelib_rel_time *interval)
|
||||
{
|
||||
int bias = 1;
|
||||
timelib_time *t = timelib_time_clone(old_time);
|
||||
|
||||
if (interval->have_weekday_relative || interval->have_special_relative) {
|
||||
memcpy(&t->relative, interval, sizeof(struct timelib_rel_time));
|
||||
} else {
|
||||
if (interval->invert) {
|
||||
bias = -1;
|
||||
}
|
||||
memset(&t->relative, 0, sizeof(struct timelib_rel_time));
|
||||
t->relative.y = interval->y * bias;
|
||||
t->relative.m = interval->m * bias;
|
||||
t->relative.d = interval->d * bias;
|
||||
t->relative.h = interval->h * bias;
|
||||
t->relative.i = interval->i * bias;
|
||||
t->relative.s = interval->s * bias;
|
||||
}
|
||||
t->have_relative = 1;
|
||||
t->sse_uptodate = 0;
|
||||
|
||||
timelib_update_ts(t, NULL);
|
||||
|
||||
// printf("%lld %lld %d\n", old_time->dst, t->dst, (t->sse - old_time->sse));
|
||||
/* Adjust for backwards DST changeover */
|
||||
if (old_time->dst == 1 && t->dst == 0 && !interval->y && !interval->m && !interval->d) {
|
||||
t->sse -= old_time->z;
|
||||
t->sse += t->z;
|
||||
}
|
||||
|
||||
timelib_update_from_sse(t);
|
||||
t->have_relative = 0;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
timelib_time *timelib_sub(timelib_time *old_time, timelib_rel_time *interval)
|
||||
{
|
||||
int bias = 1;
|
||||
timelib_time *t = timelib_time_clone(old_time);
|
||||
|
||||
if (interval->invert) {
|
||||
bias = -1;
|
||||
}
|
||||
|
||||
memset(&t->relative, 0, sizeof(struct timelib_rel_time));
|
||||
t->relative.y = 0 - (interval->y * bias);
|
||||
t->relative.m = 0 - (interval->m * bias);
|
||||
t->relative.d = 0 - (interval->d * bias);
|
||||
t->relative.h = 0 - (interval->h * bias);
|
||||
t->relative.i = 0 - (interval->i * bias);
|
||||
t->relative.s = 0 - (interval->s * bias);
|
||||
t->have_relative = 1;
|
||||
t->sse_uptodate = 0;
|
||||
|
||||
timelib_update_ts(t, NULL);
|
||||
|
||||
/* Adjust for backwards DST changeover */
|
||||
if (old_time->dst == 1 && t->dst == 0 && !interval->y && !interval->m && !interval->d) {
|
||||
t->sse -= old_time->z;
|
||||
t->sse += t->z;
|
||||
}
|
||||
/* Adjust for forwards DST changeover */
|
||||
if (old_time->dst == 0 && t->dst == 1 && !interval->y && !interval->m && !interval->d ) {
|
||||
t->sse -= old_time->z;
|
||||
t->sse += t->z;
|
||||
}
|
||||
|
||||
timelib_update_from_sse(t);
|
||||
|
||||
t->have_relative = 0;
|
||||
|
||||
return t;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Mon Dec 5 22:02:27 2011 */
|
||||
/* Generated by re2c 0.13.5 on Wed Nov 27 11:10:58 2013 */
|
||||
#line 1 "ext/date/lib/parse_iso_intervals.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -415,7 +415,7 @@ yy6:
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
} while (*ptr);
|
||||
} while (!s->errors->error_count && *ptr);
|
||||
s->have_period = 1;
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PERIOD;
|
||||
|
||||
@@ -383,7 +383,7 @@ isoweek = year4 "-"? "W" weekofyear;
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
} while (*ptr);
|
||||
} while (!s->errors->error_count && *ptr);
|
||||
s->have_period = 1;
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PERIOD;
|
||||
|
||||
@@ -136,5 +136,7 @@ int timelib_astro_rise_set_altitude(timelib_time *time, double lon, double lat,
|
||||
|
||||
/* from interval.c */
|
||||
timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two);
|
||||
timelib_time *timelib_add(timelib_time *t, timelib_rel_time *interval);
|
||||
timelib_time *timelib_sub(timelib_time *t, timelib_rel_time *interval);
|
||||
|
||||
#endif
|
||||
@@ -137,19 +137,16 @@ void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts)
|
||||
void timelib_update_from_sse(timelib_time *tm)
|
||||
{
|
||||
timelib_sll sse;
|
||||
int z = tm->z;
|
||||
signed int dst = tm->dst;
|
||||
|
||||
sse = tm->sse;
|
||||
|
||||
switch (tm->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
case TIMELIB_ZONETYPE_OFFSET: {
|
||||
int z = tm->z;
|
||||
signed int dst = tm->dst;
|
||||
|
||||
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + (tm->dst * 3600));
|
||||
|
||||
tm->z = z;
|
||||
tm->dst = dst;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -171,6 +168,8 @@ cleanup:
|
||||
tm->sse = sse;
|
||||
tm->is_localtime = 1;
|
||||
tm->have_zone = 1;
|
||||
tm->z = z;
|
||||
tm->dst = dst;
|
||||
}
|
||||
|
||||
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
|
||||
|
||||
+19
-43
@@ -752,6 +752,14 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
|
||||
#define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sO"
|
||||
|
||||
/*
|
||||
* This comes from various sources that like to contradict. I'm going with the
|
||||
* format here because of:
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa384321%28v=vs.85%29.aspx
|
||||
* and http://curl.haxx.se/rfc/cookie_spec.html
|
||||
*/
|
||||
#define DATE_FORMAT_COOKIE "l, d-M-Y H:i:s T"
|
||||
|
||||
#define DATE_TZ_ERRMSG \
|
||||
"It is not safe to rely on the system's timezone settings. You are " \
|
||||
"*required* to use the date.timezone setting or the " \
|
||||
@@ -783,7 +791,7 @@ PHP_MINIT_FUNCTION(date)
|
||||
* with the variations that the only legal time zone is GMT
|
||||
* and the separators between the elements of the date must be dashes."
|
||||
*/
|
||||
REGISTER_STRING_CONSTANT("DATE_COOKIE", DATE_FORMAT_RFC850, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_COOKIE", DATE_FORMAT_COOKIE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_ISO8601", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_RFC822", DATE_FORMAT_RFC822, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_STRING_CONSTANT("DATE_RFC850", DATE_FORMAT_RFC850, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -1948,7 +1956,7 @@ static void date_register_classes(TSRMLS_D)
|
||||
zend_declare_class_constant_stringl(date_ce_date, const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
|
||||
|
||||
REGISTER_DATE_CLASS_CONST_STRING("ATOM", DATE_FORMAT_RFC3339);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("COOKIE", DATE_FORMAT_RFC850);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("COOKIE", DATE_FORMAT_COOKIE);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("ISO8601", DATE_FORMAT_ISO8601);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("RFC822", DATE_FORMAT_RFC822);
|
||||
REGISTER_DATE_CLASS_CONST_STRING("RFC850", DATE_FORMAT_RFC850);
|
||||
@@ -2479,6 +2487,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
|
||||
|
||||
timelib_fill_holes(dateobj->time, now, TIMELIB_NO_CLONE);
|
||||
timelib_update_ts(dateobj->time, tzi);
|
||||
timelib_update_from_sse(dateobj->time);
|
||||
|
||||
dateobj->time->have_relative = 0;
|
||||
|
||||
@@ -2880,7 +2889,7 @@ PHP_FUNCTION(date_add)
|
||||
zval *object, *interval;
|
||||
php_date_obj *dateobj;
|
||||
php_interval_obj *intobj;
|
||||
int bias = 1;
|
||||
timelib_time *new_time;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_date, &interval, date_ce_interval) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -2890,27 +2899,9 @@ PHP_FUNCTION(date_add)
|
||||
intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC);
|
||||
DATE_CHECK_INITIALIZED(intobj->initialized, DateInterval);
|
||||
|
||||
|
||||
if (intobj->diff->have_weekday_relative || intobj->diff->have_special_relative) {
|
||||
memcpy(&dateobj->time->relative, intobj->diff, sizeof(struct timelib_rel_time));
|
||||
} else {
|
||||
if (intobj->diff->invert) {
|
||||
bias = -1;
|
||||
}
|
||||
memset(&dateobj->time->relative, 0, sizeof(struct timelib_rel_time));
|
||||
dateobj->time->relative.y = intobj->diff->y * bias;
|
||||
dateobj->time->relative.m = intobj->diff->m * bias;
|
||||
dateobj->time->relative.d = intobj->diff->d * bias;
|
||||
dateobj->time->relative.h = intobj->diff->h * bias;
|
||||
dateobj->time->relative.i = intobj->diff->i * bias;
|
||||
dateobj->time->relative.s = intobj->diff->s * bias;
|
||||
}
|
||||
dateobj->time->have_relative = 1;
|
||||
dateobj->time->sse_uptodate = 0;
|
||||
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
timelib_update_from_sse(dateobj->time);
|
||||
dateobj->time->have_relative = 0;
|
||||
new_time = timelib_add(dateobj->time, intobj->diff);
|
||||
timelib_time_dtor(dateobj->time);
|
||||
dateobj->time = new_time;
|
||||
|
||||
RETURN_ZVAL(object, 1, 0);
|
||||
}
|
||||
@@ -2924,7 +2915,7 @@ PHP_FUNCTION(date_sub)
|
||||
zval *object, *interval;
|
||||
php_date_obj *dateobj;
|
||||
php_interval_obj *intobj;
|
||||
int bias = 1;
|
||||
timelib_time *new_time;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_date, &interval, date_ce_interval) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -2939,24 +2930,9 @@ PHP_FUNCTION(date_sub)
|
||||
return;
|
||||
}
|
||||
|
||||
if (intobj->diff->invert) {
|
||||
bias = -1;
|
||||
}
|
||||
|
||||
memset(&dateobj->time->relative, 0, sizeof(struct timelib_rel_time));
|
||||
dateobj->time->relative.y = 0 - (intobj->diff->y * bias);
|
||||
dateobj->time->relative.m = 0 - (intobj->diff->m * bias);
|
||||
dateobj->time->relative.d = 0 - (intobj->diff->d * bias);
|
||||
dateobj->time->relative.h = 0 - (intobj->diff->h * bias);
|
||||
dateobj->time->relative.i = 0 - (intobj->diff->i * bias);
|
||||
dateobj->time->relative.s = 0 - (intobj->diff->s * bias);
|
||||
dateobj->time->have_relative = 1;
|
||||
dateobj->time->sse_uptodate = 0;
|
||||
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
timelib_update_from_sse(dateobj->time);
|
||||
|
||||
dateobj->time->have_relative = 0;
|
||||
new_time = timelib_sub(dateobj->time, intobj->diff);
|
||||
timelib_time_dtor(dateobj->time);
|
||||
dateobj->time = new_time;
|
||||
|
||||
RETURN_ZVAL(object, 1, 0);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ var_dump( $date->format( DateTime::W3C) ) ;
|
||||
--EXPECT--
|
||||
*** Testing date_format() : basic functionality - formatting coinstants ***
|
||||
string(25) "2005-07-14T22:30:41+01:00"
|
||||
string(32) "Thursday, 14-Jul-05 22:30:41 BST"
|
||||
string(34) "Thursday, 14-Jul-2005 22:30:41 BST"
|
||||
string(24) "2005-07-14T22:30:41+0100"
|
||||
string(29) "Thu, 14 Jul 05 22:30:41 +0100"
|
||||
string(32) "Thursday, 14-Jul-05 22:30:41 BST"
|
||||
|
||||
@@ -160,7 +160,7 @@ array(11) {
|
||||
["ATOM"]=>
|
||||
string(13) "Y-m-d\TH:i:sP"
|
||||
["COOKIE"]=>
|
||||
string(16) "l, d-M-y H:i:s T"
|
||||
string(16) "l, d-M-Y H:i:s T"
|
||||
["ISO8601"]=>
|
||||
string(13) "Y-m-d\TH:i:sO"
|
||||
["RFC822"]=>
|
||||
@@ -180,4 +180,4 @@ array(11) {
|
||||
["W3C"]=>
|
||||
string(13) "Y-m-d\TH:i:sP"
|
||||
}
|
||||
===DONE===
|
||||
===DONE===
|
||||
@@ -11,5 +11,5 @@ echo $a->format(DateTime::COOKIE);
|
||||
echo "\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Thursday, 01-Jan-09 00:00:00 WET
|
||||
Thursday, 01-Jan-09 00:00:00 WET
|
||||
Thursday, 01-Jan-2009 00:00:00 WET
|
||||
Thursday, 01-Jan-2009 00:00:00 WET
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #53879 (DateTime::createFromFormat() fails to parse cookie expiration date)
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
$date = DateTime::createFromFormat(DateTime::COOKIE, "Mon, 21-Jan-2041 15:24:52 GMT");
|
||||
print_r($date);
|
||||
?>
|
||||
--EXPECTF--
|
||||
DateTime Object
|
||||
(
|
||||
[date] => 2041-01-21 15:24:52
|
||||
[timezone_type] => 2
|
||||
[timezone] => GMT
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Test for #63391 (Incorrect/inconsistent day of week prior to the year 1600)
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set('date.timezone', 'UTC');
|
||||
|
||||
print "Date PHP\n";
|
||||
print "---------- ---\n";
|
||||
$dates = array('1599-12-30', '1599-12-31', '1600-01-01', '1600-01-02');
|
||||
foreach ($dates as $date) {
|
||||
echo date_create($date)->format('Y-m-d D'), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Date PHP
|
||||
---------- ---
|
||||
1599-12-30 Thu
|
||||
1599-12-31 Fri
|
||||
1600-01-01 Sat
|
||||
1600-01-02 Sun
|
||||
@@ -41,8 +41,8 @@ Date constants
|
||||
--EXPECT--
|
||||
string(25) "2006-07-01T14:27:30+02:00"
|
||||
string(25) "2006-05-30T14:32:13+02:00"
|
||||
string(33) "Saturday, 01-Jul-06 14:27:30 CEST"
|
||||
string(32) "Tuesday, 30-May-06 14:32:13 CEST"
|
||||
string(35) "Saturday, 01-Jul-2006 14:27:30 CEST"
|
||||
string(34) "Tuesday, 30-May-2006 14:32:13 CEST"
|
||||
string(24) "2006-07-01T14:27:30+0200"
|
||||
string(24) "2006-05-30T14:32:13+0200"
|
||||
string(29) "Sat, 01 Jul 06 14:27:30 +0200"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test for Date/Time construction during a forward DST transition
|
||||
--FILE--
|
||||
<?php
|
||||
date_default_timezone_set('America/New_York');
|
||||
|
||||
$date = new DateTime('2010-03-14 01:30:00');
|
||||
echo $date->format('Y-m-d H:i:s T/e - U') . "\n";
|
||||
|
||||
$date = new DateTime('2010-03-14 02:00:00');
|
||||
echo $date->format('Y-m-d H:i:s T/e - U') . "\n";
|
||||
|
||||
$date = new DateTime('2010-03-14 02:30:00');
|
||||
echo $date->format('Y-m-d H:i:s T/e - U') . "\n";
|
||||
|
||||
$date = new DateTime('2010-03-14 03:00:00');
|
||||
echo $date->format('Y-m-d H:i:s T/e - U') . "\n";
|
||||
|
||||
$date = new DateTime('2010-03-14 03:30:00');
|
||||
echo $date->format('Y-m-d H:i:s T/e - U') . "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
2010-03-14 01:30:00 EST/America/New_York - 1268548200
|
||||
2010-03-14 03:00:00 EDT/America/New_York - 1268550000
|
||||
2010-03-14 03:30:00 EDT/America/New_York - 1268551800
|
||||
2010-03-14 03:00:00 EDT/America/New_York - 1268550000
|
||||
2010-03-14 03:30:00 EDT/America/New_York - 1268551800
|
||||
@@ -45,7 +45,7 @@ string(25) "2008-08-08T08:08:08+00:00"
|
||||
string(%d) "%s"
|
||||
|
||||
--DATE_COOKIE Constant--
|
||||
string(30) "Friday, 08-Aug-08 08:08:08 GMT"
|
||||
string(32) "Friday, 08-Aug-2008 08:08:08 GMT"
|
||||
string(%d) "%s"
|
||||
|
||||
--DATE_RFC822 Constant--
|
||||
@@ -79,4 +79,4 @@ string(%d) "%s"
|
||||
--DATE_W3C Constant--
|
||||
string(25) "2008-08-08T08:08:08+00:00"
|
||||
string(%d) "%s"
|
||||
===DONE===
|
||||
===DONE===
|
||||
@@ -0,0 +1,96 @@
|
||||
--TEST--
|
||||
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, ba)
|
||||
--CREDITS--
|
||||
Daniel Convissor <danielc@php.net>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
$date_format = 'Y-m-d H:i:s T e';
|
||||
$interval_format = 'P%dDT%hH';
|
||||
|
||||
/*
|
||||
* Backward Transitions, add().
|
||||
*/
|
||||
|
||||
$start = new DateTime('2010-11-07 01:59:59');
|
||||
$interval_spec = 'PT1S';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT24H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT23H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT22H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT21H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 01:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 01:30:00');
|
||||
$interval_spec = 'P1DT1H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT25H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 03:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 02:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
echo "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ba1 2010-11-07 01:59:59 EDT America/New_York + PT1S = 2010-11-07 01:00:00 EST America/New_York
|
||||
ba2 2010-11-06 04:30:00 EDT America/New_York + P1D = 2010-11-07 04:30:00 EST America/New_York
|
||||
ba3 2010-11-06 04:30:00 EDT America/New_York + PT24H = 2010-11-07 03:30:00 EST America/New_York
|
||||
ba4 2010-11-06 04:30:00 EDT America/New_York + PT23H = 2010-11-07 02:30:00 EST America/New_York
|
||||
ba5 2010-11-06 04:30:00 EDT America/New_York + PT22H = 2010-11-07 01:30:00 EST America/New_York
|
||||
ba6 2010-11-06 04:30:00 EDT America/New_York + PT21H = 2010-11-07 01:30:00 EDT America/New_York
|
||||
ba7 2010-11-06 01:30:00 EDT America/New_York + P1D = 2010-11-07 01:30:00 EDT America/New_York
|
||||
ba8 2010-11-06 01:30:00 EDT America/New_York + P1DT1H = 2010-11-07 02:30:00 EST America/New_York
|
||||
ba9 2010-11-06 04:30:00 EDT America/New_York + PT25H = 2010-11-07 04:30:00 EST America/New_York
|
||||
ba10 2010-11-06 03:30:00 EDT America/New_York + P1D = 2010-11-07 03:30:00 EST America/New_York
|
||||
ba11 2010-11-06 02:30:00 EDT America/New_York + P1D = 2010-11-07 02:30:00 EST America/New_York
|
||||
@@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bd1)
|
||||
--CREDITS--
|
||||
Daniel Convissor <danielc@php.net>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
$date_format = 'Y-m-d H:i:s T e';
|
||||
$interval_format = 'P%dDT%hH';
|
||||
|
||||
/*
|
||||
* Backward Transitions, diff().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-11-07 05:30:00');
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 04:30:00');
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 03:30:00');
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 02:30:00');
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00');
|
||||
$start = new DateTime('2010-11-06 01:30:00');
|
||||
echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
echo "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bd1 2010-11-07 05:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P1DT1H
|
||||
bd2 2010-11-07 04:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P1DT0H
|
||||
bd3 2010-11-07 03:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT24H
|
||||
bd4 2010-11-07 02:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT23H
|
||||
bd7 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT0H
|
||||
@@ -0,0 +1,56 @@
|
||||
--TEST--
|
||||
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bd2)
|
||||
--CREDITS--
|
||||
Daniel Convissor <danielc@php.net>
|
||||
--XFAIL--
|
||||
Still not quite right
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
$date_format = 'Y-m-d H:i:s T e';
|
||||
$interval_format = 'P%dDT%hH';
|
||||
|
||||
/*
|
||||
* For backward transitions, must create objects with zone type 2
|
||||
* where specifying Daylight or Standard time is required
|
||||
* then converting them to zone type 3.
|
||||
*/
|
||||
|
||||
$tz = new DateTimeZone('America/New_York');
|
||||
|
||||
/*
|
||||
* Backward Transitions, diff().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-11-07 05:30:00');
|
||||
$end->setTimeZone($tz);
|
||||
$start = new DateTime('2010-11-06 04:30:59');
|
||||
echo 'bd0 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format('P%dDT%hH%iM%sS') . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EDT');
|
||||
$end->setTimeZone($tz);
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$start = new DateTime('2010-11-06 01:30:00');
|
||||
echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
echo "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bd0 2010-11-07 01:00:00 EST America/New_York - 2010-11-07 01:59:59 EDT America/New_York = PT0H0M1S
|
||||
bd5 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT22H
|
||||
bd6 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT21H
|
||||
bd8 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT1H
|
||||
@@ -0,0 +1,92 @@
|
||||
--TEST--
|
||||
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bs)
|
||||
--CREDITS--
|
||||
Daniel Convissor <danielc@php.net>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
$tz = new DateTimeZone('America/New_York');
|
||||
$date_format = 'Y-m-d H:i:s T e';
|
||||
$interval_format = 'P%dDT%hH';
|
||||
|
||||
/*
|
||||
* Backward Transitions, sub().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-11-07 01:00:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$interval_spec = 'PT1S';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 04:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 03:30:00');
|
||||
$interval_spec = 'PT24H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 02:30:00');
|
||||
$interval_spec = 'PT23H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$interval_spec = 'PT22H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EDT');
|
||||
$end->setTimeZone($tz);
|
||||
$interval_spec = 'PT21H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$interval_spec = 'P1DT1H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 03:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 02:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bs1 2010-11-07 01:00:00 EST America/New_York - PT1S = 2010-11-07 01:59:59 EDT America/New_York
|
||||
bs2 2010-11-07 04:30:00 EST America/New_York - P1D = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs3 2010-11-07 03:30:00 EST America/New_York - PT24H = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs4 2010-11-07 02:30:00 EST America/New_York - PT23H = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs5 2010-11-07 01:30:00 EST America/New_York - PT22H = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs6 2010-11-07 01:30:00 EDT America/New_York - PT21H = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs7 2010-11-07 01:30:00 EDT America/New_York - P1D = 2010-11-06 01:30:00 EDT America/New_York
|
||||
bs8 2010-11-07 01:30:00 EST America/New_York - P1DT1H = 2010-11-06 00:30:00 EDT America/New_York
|
||||
bs9 2010-11-07 03:30:00 EST America/New_York - P1D = 2010-11-06 03:30:00 EDT America/New_York
|
||||
bs10 2010-11-07 02:30:00 EST America/New_York - P1D = 2010-11-06 02:30:00 EDT America/New_York
|
||||
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, fa)
|
||||
--CREDITS--
|
||||
Daniel Convissor <danielc@php.net>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
$date_format = 'Y-m-d H:i:s T e';
|
||||
$interval_format = 'P%dDT%hH';
|
||||
|
||||
/*
|
||||
* Forward Transitions, add().
|
||||
*/
|
||||
|
||||
$start = new DateTime('2010-03-14 01:59:59');
|
||||
$interval_spec = 'PT1S';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
$interval_spec = 'PT22H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
$interval_spec = 'PT21H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 01:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 02:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
fa1 2010-03-14 01:59:59 EST America/New_York + PT1S = 2010-03-14 03:00:00 EDT America/New_York
|
||||
fa2 2010-03-13 04:30:00 EST America/New_York + P1D = 2010-03-14 04:30:00 EDT America/New_York
|
||||
fa3 2010-03-13 04:30:00 EST America/New_York + PT22H = 2010-03-14 03:30:00 EDT America/New_York
|
||||
fa4 2010-03-13 04:30:00 EST America/New_York + PT21H = 2010-03-14 01:30:00 EST America/New_York
|
||||
fa5 2010-03-13 01:30:00 EST America/New_York + P1D = 2010-03-14 01:30:00 EST America/New_York
|
||||
fa6 2010-03-13 02:30:00 EST America/New_York + P1D = 2010-03-14 03:30:00 EDT America/New_York
|
||||
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, fd)
|
||||
--CREDITS--
|
||||
Daniel Convissor <danielc@php.net>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
$date_format = 'Y-m-d H:i:s T e';
|
||||
$interval_format = 'P%dDT%hH';
|
||||
|
||||
/*
|
||||
* Forward Transitions, diff().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-03-14 03:00:00');
|
||||
$start = new DateTime('2010-03-14 01:59:59');
|
||||
echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 04:30:00');
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 03:30:00');
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 01:30:00');
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 01:30:00');
|
||||
$start = new DateTime('2010-03-13 01:30:00');
|
||||
echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 03:30:00');
|
||||
$start = new DateTime('2010-03-13 03:30:00');
|
||||
echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 03:30:00');
|
||||
$start = new DateTime('2010-03-13 02:30:00');
|
||||
echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
fd1 2010-03-14 03:00:00 EDT America/New_York - 2010-03-14 01:59:59 EST America/New_York = PT0H0M1S
|
||||
fd2 2010-03-14 04:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P1DT0H
|
||||
fd3 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT22H
|
||||
fd4 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT21H
|
||||
fd5 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 01:30:00 EST America/New_York = P1DT0H
|
||||
fd6 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 03:30:00 EST America/New_York = P1DT0H
|
||||
fd7 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 02:30:00 EST America/New_York = P1DT1H
|
||||
@@ -0,0 +1,67 @@
|
||||
--TEST--
|
||||
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, fs)
|
||||
--CREDITS--
|
||||
Daniel Convissor <danielc@php.net>
|
||||
--XFAIL--
|
||||
Still not quite right
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
$date_format = 'Y-m-d H:i:s T e';
|
||||
$interval_format = 'P%dDT%hH';
|
||||
|
||||
/*
|
||||
* Forward Transitions, sub().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-03-14 03:00:00');
|
||||
$interval_spec = 'PT1S';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 04:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 03:30:00');
|
||||
$interval_spec = 'PT22H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 01:30:00');
|
||||
$interval_spec = 'PT21H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 01:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-15 03:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-15 02:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
fs1 2010-03-14 03:00:00 EDT America/New_York - PT1S = 2010-03-14 01:59:59 EST America/New_York
|
||||
fs2 2010-03-14 04:30:00 EDT America/New_York - P1D = 2010-03-13 04:30:00 EST America/New_York
|
||||
fs3 2010-03-14 03:30:00 EDT America/New_York - PT22H = 2010-03-13 04:30:00 EST America/New_York
|
||||
fs4 2010-03-14 01:30:00 EST America/New_York - PT21H = 2010-03-13 04:30:00 EST America/New_York
|
||||
fs5 2010-03-14 01:30:00 EST America/New_York - P1D = 2010-03-13 01:30:00 EST America/New_York
|
||||
fs6 2010-03-15 03:30:00 EDT America/New_York - P1D = 2010-03-14 03:30:00 EDT America/New_York
|
||||
fs7 2010-03-15 02:30:00 EDT America/New_York - P1D = 2010-03-14 03:30:00 EDT America/New_York
|
||||
@@ -1,399 +0,0 @@
|
||||
--TEST--
|
||||
RFC: DateTime and Daylight Saving Time Transitions (zone type 3)
|
||||
--CREDITS--
|
||||
Daniel Convissor <danielc@php.net>
|
||||
--XFAIL--
|
||||
RFC not implemented yet
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
$date_format = 'Y-m-d H:i:s T e';
|
||||
$interval_format = 'P%dDT%hH';
|
||||
|
||||
/*
|
||||
* Forward Transitions, diff().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-03-14 03:00:00');
|
||||
$start = new DateTime('2010-03-14 01:59:59');
|
||||
echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 04:30:00');
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 03:30:00');
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 01:30:00');
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 01:30:00');
|
||||
$start = new DateTime('2010-03-13 01:30:00');
|
||||
echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 03:30:00');
|
||||
$start = new DateTime('2010-03-13 03:30:00');
|
||||
echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 03:30:00');
|
||||
$start = new DateTime('2010-03-13 02:30:00');
|
||||
echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
echo "\n";
|
||||
|
||||
/*
|
||||
* Forward Transitions, add().
|
||||
*/
|
||||
|
||||
$start = new DateTime('2010-03-14 01:59:59');
|
||||
$interval_spec = 'PT1S';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
$interval_spec = 'PT22H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 04:30:00');
|
||||
$interval_spec = 'PT21H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 01:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-03-13 02:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
echo "\n";
|
||||
|
||||
/*
|
||||
* Forward Transitions, sub().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-03-14 03:00:00');
|
||||
$interval_spec = 'PT1S';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 04:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 03:30:00');
|
||||
$interval_spec = 'PT22H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 01:30:00');
|
||||
$interval_spec = 'PT21H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-14 01:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-15 03:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-03-15 02:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
/*
|
||||
* For backward transitions, must create objects with zone type 2
|
||||
* where specifying Daylight or Standard time is required
|
||||
* then converting them to zone type 3.
|
||||
*/
|
||||
|
||||
$tz = new DateTimeZone('America/New_York');
|
||||
|
||||
/*
|
||||
* Backward Transitions, diff().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-11-07 01:00:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$start = new DateTime('2010-11-07 01:59:59');
|
||||
echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 04:30:00');
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 03:30:00');
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 02:30:00');
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EDT');
|
||||
$end->setTimeZone($tz);
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00');
|
||||
$start = new DateTime('2010-11-06 01:30:00');
|
||||
echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$start = new DateTime('2010-11-06 01:30:00');
|
||||
echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
|
||||
. ' = ' . $start->diff($end)->format($interval_format) . "\n";
|
||||
|
||||
echo "\n";
|
||||
|
||||
/*
|
||||
* Backward Transitions, add().
|
||||
*/
|
||||
|
||||
$start = new DateTime('2010-11-07 01:59:59');
|
||||
$interval_spec = 'PT1S';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT24H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT23H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT22H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT21H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 01:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 01:30:00');
|
||||
$interval_spec = 'P1DT1H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 04:30:00');
|
||||
$interval_spec = 'PT25H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 03:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
$start = new DateTime('2010-11-06 02:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = "
|
||||
. $start->add($interval)->format($date_format) . "\n";
|
||||
|
||||
echo "\n";
|
||||
|
||||
/*
|
||||
* Backward Transitions, sub().
|
||||
*/
|
||||
|
||||
$end = new DateTime('2010-11-07 01:00:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$interval_spec = 'PT1S';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 04:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 03:30:00');
|
||||
$interval_spec = 'PT24H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 02:30:00');
|
||||
$interval_spec = 'PT23H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$interval_spec = 'PT22H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EDT');
|
||||
$end->setTimeZone($tz);
|
||||
$interval_spec = 'PT21H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 01:30:00 EST');
|
||||
$end->setTimeZone($tz);
|
||||
$interval_spec = 'P1DT1H';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 03:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
$end = new DateTime('2010-11-07 02:30:00');
|
||||
$interval_spec = 'P1D';
|
||||
$interval = new DateInterval($interval_spec);
|
||||
echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = "
|
||||
. $end->sub($interval)->format($date_format) . "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
fd1 2010-03-14 03:00:00 EDT America/New_York - 2010-03-14 01:59:59 EST America/New_York = PT0H0M1S
|
||||
fd2 2010-03-14 04:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P1DT0H
|
||||
fd3 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT22H
|
||||
fd4 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT21H
|
||||
fd5 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 01:30:00 EST America/New_York = P1DT0H
|
||||
fd6 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 03:30:00 EST America/New_York = P1DT0H
|
||||
fd7 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 02:30:00 EST America/New_York = P1DT1H
|
||||
|
||||
fa1 2010-03-14 01:59:59 EST America/New_York + PT1S = 2010-03-14 03:00:00 EDT America/New_York
|
||||
fa2 2010-03-13 04:30:00 EST America/New_York + P1D = 2010-03-14 04:30:00 EDT America/New_York
|
||||
fa3 2010-03-13 04:30:00 EST America/New_York + PT22H = 2010-03-14 03:30:00 EDT America/New_York
|
||||
fa4 2010-03-13 04:30:00 EST America/New_York + PT21H = 2010-03-14 01:30:00 EST America/New_York
|
||||
fa5 2010-03-13 01:30:00 EST America/New_York + P1D = 2010-03-14 01:30:00 EST America/New_York
|
||||
fa6 2010-03-13 02:30:00 EST America/New_York + P1D = 2010-03-14 03:30:00 EDT America/New_York
|
||||
|
||||
fs1 2010-03-14 03:00:00 EDT America/New_York - PT1S = 2010-03-14 01:59:59 EST America/New_York
|
||||
fs2 2010-03-14 04:30:00 EDT America/New_York - P1D = 2010-03-13 04:30:00 EST America/New_York
|
||||
fs3 2010-03-14 03:30:00 EDT America/New_York - PT22H = 2010-03-13 04:30:00 EST America/New_York
|
||||
fs4 2010-03-14 01:30:00 EST America/New_York - PT21H = 2010-03-13 04:30:00 EST America/New_York
|
||||
fs5 2010-03-14 01:30:00 EST America/New_York - P1D = 2010-03-13 01:30:00 EST America/New_York
|
||||
fs6 2010-03-15 03:30:00 EDT America/New_York - P1D = 2010-03-14 03:30:00 EDT America/New_York
|
||||
fs7 2010-03-15 03:30:00 EDT America/New_York - P1D = 2010-03-14 03:30:00 EDT America/New_York
|
||||
|
||||
bd1 2010-11-07 01:00:00 EST America/New_York - 2010-11-07 01:59:59 EDT America/New_York = PT0H0M1S
|
||||
bd2 2010-11-07 04:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P1DT0H
|
||||
bd3 2010-11-07 03:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT24H
|
||||
bd4 2010-11-07 02:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT23H
|
||||
bd5 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT22H
|
||||
bd6 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT21H
|
||||
bd7 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT0H
|
||||
bd8 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT1H
|
||||
|
||||
ba1 2010-11-07 01:59:59 EDT America/New_York + PT1S = 2010-11-07 01:00:00 EST America/New_York
|
||||
ba2 2010-11-06 04:30:00 EDT America/New_York + P1D = 2010-11-07 04:30:00 EST America/New_York
|
||||
ba3 2010-11-06 04:30:00 EDT America/New_York + PT24H = 2010-11-07 03:30:00 EST America/New_York
|
||||
ba4 2010-11-06 04:30:00 EDT America/New_York + PT23H = 2010-11-07 02:30:00 EST America/New_York
|
||||
ba5 2010-11-06 04:30:00 EDT America/New_York + PT22H = 2010-11-07 01:30:00 EST America/New_York
|
||||
ba6 2010-11-06 04:30:00 EDT America/New_York + PT21H = 2010-11-07 01:30:00 EDT America/New_York
|
||||
ba7 2010-11-06 01:30:00 EDT America/New_York + P1D = 2010-11-07 01:30:00 EDT America/New_York
|
||||
ba8 2010-11-06 01:30:00 EDT America/New_York + P1DT1H = 2010-11-07 01:30:00 EST America/New_York
|
||||
ba9 2010-11-06 04:30:00 EDT America/New_York + PT25H = 2010-11-07 04:30:00 EST America/New_York
|
||||
ba10 2010-11-06 03:30:00 EDT America/New_York + P1D = 2010-11-07 03:30:00 EST America/New_York
|
||||
ba11 2010-11-06 02:30:00 EDT America/New_York + P1D = 2010-11-07 02:30:00 EST America/New_York
|
||||
|
||||
bs1 2010-11-07 01:00:00 EST America/New_York - PT1S = 2010-11-07 01:59:59 EDT America/New_York
|
||||
bs2 2010-11-07 04:30:00 EST America/New_York - P1D = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs3 2010-11-07 03:30:00 EST America/New_York - PT24H = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs4 2010-11-07 02:30:00 EST America/New_York - PT23H = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs5 2010-11-07 01:30:00 EST America/New_York - PT22H = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs6 2010-11-07 01:30:00 EDT America/New_York - PT21H = 2010-11-06 04:30:00 EDT America/New_York
|
||||
bs7 2010-11-07 01:30:00 EDT America/New_York - P1D = 2010-11-06 01:30:00 EDT America/New_York
|
||||
bs8 2010-11-07 01:30:00 EST America/New_York - P1DT1H = 2010-11-06 00:30:00 EDT America/New_York
|
||||
bs9 2010-11-07 03:30:00 EST America/New_York - P1D = 2010-11-06 03:30:00 EDT America/New_York
|
||||
bs10 2010-11-07 02:30:00 EST America/New_York - P1D = 2010-11-06 02:30:00 EDT America/New_York
|
||||
@@ -53,7 +53,7 @@ bool(false)
|
||||
string(31) "Fri, 16 Jun 2006 23:49:12 +0100"
|
||||
bool(false)
|
||||
string(31) "Fri, 16 Jun 2006 02:22:00 +0100"
|
||||
string(31) "Mon, 16 Jun 0222 02:22:00 -0036"
|
||||
string(31) "Sun, 16 Jun 0222 02:22:00 -0036"
|
||||
string(31) "Fri, 16 Jun 2006 02:22:33 +0100"
|
||||
bool(false)
|
||||
string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
|
||||
|
||||
@@ -32,8 +32,8 @@ object(DateTime)#2 (3) {
|
||||
string(6) "+02:00"
|
||||
}
|
||||
|
||||
string(16) "l, d-M-y H:i:s T"
|
||||
string(36) "Tuesday, 08-Jul-08 22:14:12 GMT+0200"
|
||||
string(16) "l, d-M-Y H:i:s T"
|
||||
string(38) "Tuesday, 08-Jul-2008 22:14:12 GMT+0200"
|
||||
object(DateTime)#1 (3) {
|
||||
["date"]=>
|
||||
string(19) "2008-07-08 22:14:12"
|
||||
|
||||
+17
-2
@@ -2296,7 +2296,7 @@ PHP_FUNCTION(dom_document_save_html)
|
||||
xmlBufferPtr buf;
|
||||
dom_object *intern, *nodeobj;
|
||||
xmlChar *mem = NULL;
|
||||
int size, format;
|
||||
int size = 0, format;
|
||||
dom_doc_propsptr doc_props;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
@@ -2324,7 +2324,22 @@ PHP_FUNCTION(dom_document_save_html)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
size = htmlNodeDump(buf, docp, node);
|
||||
if (node->type == XML_DOCUMENT_FRAG_NODE) {
|
||||
int one_size;
|
||||
|
||||
for (node = node->children; node; node = node->next) {
|
||||
one_size = htmlNodeDump(buf, docp, node);
|
||||
|
||||
if (one_size >= 0) {
|
||||
size += one_size;
|
||||
} else {
|
||||
size = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
size = htmlNodeDump(buf, docp, node);
|
||||
}
|
||||
if (size >= 0) {
|
||||
mem = (xmlChar*) xmlBufferContent(buf);
|
||||
if (!mem) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
bug #65196 (Passing DOMDocumentFragment to DOMDocument::saveHTML() Produces invalid Markup)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("dom") or die("skip need ext/dom");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dom = new DOMDocument();
|
||||
|
||||
$frag1 = $dom->createDocumentFragment();
|
||||
var_dump($dom->saveHTML($frag1));
|
||||
|
||||
$frag2 = $dom->createDocumentFragment();
|
||||
$div = $dom->createElement('div');
|
||||
$div->appendChild($dom->createElement('span'));
|
||||
$frag2->appendChild($div);
|
||||
$frag2->appendChild($dom->createElement('div'));
|
||||
$frag2->appendChild($dom->createElement('div'));
|
||||
var_dump($dom->saveHTML($frag2));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
string(46) "<div><span></span></div><div></div><div></div>"
|
||||
===DONE===
|
||||
+6
-1
@@ -2852,7 +2852,12 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
|
||||
/* If its bigger than 4 bytes, the dir entry contains an offset. */
|
||||
value_ptr = offset_base+offset_val;
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry) {
|
||||
/*
|
||||
dir_entry is ImageInfo->file.list[sn].data+2+i*12
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
dir_entry - offset_base is dir_offset+2+i*12
|
||||
*/
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
|
||||
/* It is important to check for IMAGE_FILETYPE_TIFF
|
||||
* JPEG does not use absolute pointers instead its pointers are
|
||||
* relative to the start of the TIFF header in APP1 section. */
|
||||
|
||||
@@ -715,8 +715,6 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
if (
|
||||
(ip[0] == 0) ||
|
||||
(ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) ||
|
||||
(ip[0] == 128 && ip[1] == 0) ||
|
||||
(ip[0] == 191 && ip[1] == 255) ||
|
||||
(ip[0] == 169 && ip[1] == 254) ||
|
||||
(ip[0] == 192 && ip[1] == 0 && ip[2] == 2) ||
|
||||
(ip[0] == 127 && ip[1] == 0 && ip[2] == 0 && ip[3] == 1) ||
|
||||
|
||||
@@ -23,6 +23,6 @@ string(3) "::1"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(9) "128.0.0.1"
|
||||
bool(false)
|
||||
string(9) "128.0.0.1"
|
||||
string(11) "191.255.0.0"
|
||||
string(11) "191.255.0.0"
|
||||
bool(false)
|
||||
+11
-16
@@ -193,30 +193,25 @@ AC_DEFUN([PHP_GD_FREETYPE2],[
|
||||
if test "$PHP_FREETYPE_DIR" != "no"; then
|
||||
|
||||
for i in $PHP_FREETYPE_DIR /usr/local /usr; do
|
||||
if test -f "$i/include/freetype2/freetype/freetype.h"; then
|
||||
if test -f "$i/bin/freetype-config"; then
|
||||
FREETYPE2_DIR=$i
|
||||
FREETYPE2_INC_DIR=$i/include/freetype2
|
||||
FREETYPE2_CONFIG="$i/bin/freetype-config"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$FREETYPE2_DIR"; then
|
||||
AC_MSG_ERROR([freetype.h not found.])
|
||||
AC_MSG_ERROR([freetype-config not found.])
|
||||
fi
|
||||
|
||||
PHP_CHECK_LIBRARY(freetype, FT_New_Face,
|
||||
[
|
||||
PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
|
||||
PHP_ADD_INCLUDE($FREETYPE2_DIR/include)
|
||||
PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
|
||||
AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
|
||||
AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
|
||||
AC_DEFINE(ENABLE_GD_TTF,1,[ ])
|
||||
],[
|
||||
AC_MSG_ERROR([Problem with freetype.(a|so). Please check config.log for more information.])
|
||||
],[
|
||||
-L$FREETYPE2_DIR/$PHP_LIBDIR
|
||||
])
|
||||
FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags`
|
||||
FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs`
|
||||
|
||||
PHP_EVAL_INCLINE($FREETYPE2_CFLAGS)
|
||||
PHP_EVAL_LIBLINE($FREETYPE2_LIBS, GD_SHARED_LIBADD)
|
||||
AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
|
||||
AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
|
||||
AC_DEFINE(ENABLE_GD_TTF,1,[ ])
|
||||
else
|
||||
AC_MSG_RESULT([If configure fails try --with-freetype-dir=<DIR>])
|
||||
fi
|
||||
|
||||
@@ -777,7 +777,7 @@ PHP_FUNCTION(mysqli_poll)
|
||||
MYSQLND **new_r_array = NULL, **new_e_array = NULL, **new_dont_poll_array = NULL;
|
||||
long sec = 0, usec = 0;
|
||||
enum_func_status ret;
|
||||
uint desc_num;
|
||||
int desc_num;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!al|l", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) {
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
--TEST--
|
||||
Bug #66124 (mysqli under mysqlnd loses precision when bind_param with 'i')
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('connect.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$table_drop = "DROP TABLE IF EXISTS `bug66124`";
|
||||
$table_create = "CREATE TABLE `bug66124` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
|
||||
|
||||
$table_insert = "INSERT INTO `bug66124` SET `id`=?";
|
||||
$table_select = "SELECT * FROM `bug66124`";
|
||||
$table_delete = "DELETE FROM `bug66124`";
|
||||
$id = '1311200011005001566';
|
||||
|
||||
|
||||
require_once('connect.inc');
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$link->query($table_drop);
|
||||
$link->query($table_create);
|
||||
|
||||
$stmt = $link->prepare($table_insert);
|
||||
if (!$stmt) {
|
||||
printf("Can't prepare\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "Using 'i':\n";
|
||||
$stmt->bind_param('i', $id);
|
||||
|
||||
if ($stmt->execute()){
|
||||
echo "insert id:{$id}=>{$stmt->insert_id}\n";
|
||||
} else {
|
||||
printf("Can't execute\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
$result = $link->query($table_select);
|
||||
|
||||
if ($result){
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
echo "fetch id:{$row['id']}\n";
|
||||
}
|
||||
} else {
|
||||
printf("Can't select\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
|
||||
$link->query($table_drop);
|
||||
$link->query($table_create);
|
||||
|
||||
|
||||
$stmt = $link->prepare($table_insert);
|
||||
$stmt->bind_param('s', $id);
|
||||
|
||||
echo "Using 's':\n";
|
||||
|
||||
if ($stmt->execute()){
|
||||
echo "insert id:{$id}\n";
|
||||
} else{
|
||||
printf("Can't execute\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$result = $link->query($table_select);
|
||||
|
||||
if ($result){
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
echo "fetch id:{$row['id']}\n";
|
||||
}
|
||||
} else {
|
||||
printf("Can't select\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$link->close();
|
||||
?>
|
||||
done
|
||||
--EXPECTF--
|
||||
Using 'i':
|
||||
insert id:1311200011005001566=>1311200011005001566
|
||||
fetch id:1311200011005001566
|
||||
Using 's':
|
||||
insert id:1311200011005001566
|
||||
fetch id:1311200011005001566
|
||||
done
|
||||
@@ -251,6 +251,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, simple_command_handle_response)(MYSQLND_CONN_D
|
||||
conn->persistent);
|
||||
|
||||
if (!ignore_upsert_status) {
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
conn->upsert_status->warning_count = ok_response->warning_count;
|
||||
conn->upsert_status->server_status = ok_response->server_status;
|
||||
conn->upsert_status->affected_rows = ok_response->affected_rows;
|
||||
@@ -314,6 +315,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, simple_command)(MYSQLND_CONN_DATA * conn, enum
|
||||
|
||||
DBG_ENTER("mysqlnd_conn_data::simple_command");
|
||||
DBG_INF_FMT("command=%s ok_packet=%u silent=%u", mysqlnd_command_to_text[command], ok_packet, silent);
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
|
||||
switch (CONN_GET_STATE(conn)) {
|
||||
case CONN_READY:
|
||||
@@ -328,10 +330,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, simple_command)(MYSQLND_CONN_DATA * conn, enum
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
||||
/* clean UPSERT info */
|
||||
if (!ignore_upsert_status) {
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
}
|
||||
SET_ERROR_AFF_ROWS(conn);
|
||||
SET_EMPTY_ERROR(*conn->error_info);
|
||||
|
||||
@@ -888,6 +886,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
|
||||
conn->max_packet_size = MYSQLND_ASSEMBLED_PACKET_MAX_SIZE;
|
||||
/* todo: check if charset is available */
|
||||
conn->server_capabilities = greet_packet->server_capabilities;
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
conn->upsert_status->warning_count = 0;
|
||||
conn->upsert_status->server_status = greet_packet->server_status;
|
||||
conn->upsert_status->affected_rows = 0;
|
||||
@@ -1064,6 +1063,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const ch
|
||||
enum_func_status ret = FAIL;
|
||||
DBG_ENTER("mysqlnd_conn_data::send_query");
|
||||
DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query);
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
|
||||
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
|
||||
ret = conn->m->simple_command(conn, COM_QUERY, (zend_uchar *) query, query_len,
|
||||
@@ -1074,6 +1074,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const ch
|
||||
}
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
}
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1089,6 +1090,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn TSRMLS_DC
|
||||
DBG_ENTER("mysqlnd_conn_data::reap_query");
|
||||
DBG_INF_FMT("conn=%llu", conn->thread_id);
|
||||
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
|
||||
if (state <= CONN_READY || state == CONN_QUIT_SENT) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection not opened, clear or has been closed");
|
||||
@@ -1099,6 +1101,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn TSRMLS_DC
|
||||
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
}
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1211,7 +1214,7 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds
|
||||
|
||||
/* {{{ _mysqlnd_poll */
|
||||
PHPAPI enum_func_status
|
||||
_mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQLND ***dont_poll, long sec, long usec, uint * desc_num TSRMLS_DC)
|
||||
_mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQLND ***dont_poll, long sec, long usec, int * desc_num TSRMLS_DC)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timeval *tv_p = NULL;
|
||||
@@ -1477,6 +1480,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn,
|
||||
DBG_INF_FMT("conn=%llu", conn->thread_id);
|
||||
|
||||
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
|
||||
DBG_INF_FMT("server_status=%u", conn->upsert_status->server_status);
|
||||
if (conn->upsert_status->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES) {
|
||||
ret = mysqlnd_cset_escape_quotes(conn->charset, newstr, escapestr, escapestr_len TSRMLS_CC);
|
||||
} else {
|
||||
|
||||
@@ -117,7 +117,7 @@ PHPAPI void _mysqlnd_debug(const char *mode TSRMLS_DC);
|
||||
#define mysqlnd_reap_async_query(conn) ((conn)->data)->m->reap_query((conn)->data TSRMLS_CC)
|
||||
#define mysqlnd_unbuffered_skip_result(result) (result)->m.skip_result((result) TSRMLS_CC)
|
||||
|
||||
PHPAPI enum_func_status _mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQLND ***dont_poll, long sec, long usec, uint * desc_num TSRMLS_DC);
|
||||
PHPAPI enum_func_status _mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQLND ***dont_poll, long sec, long usec, int * desc_num TSRMLS_DC);
|
||||
|
||||
#define mysqlnd_use_result(conn) ((conn)->data)->m->use_result((conn)->data TSRMLS_CC)
|
||||
#define mysqlnd_store_result(conn) ((conn)->data)->m->store_result((conn)->data TSRMLS_CC)
|
||||
|
||||
@@ -485,6 +485,7 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
ret = mysqlnd_query_read_result_set_header(stmt->conn, s TSRMLS_CC);
|
||||
if (ret == FAIL) {
|
||||
COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
|
||||
memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status));
|
||||
stmt->upsert_status->affected_rows = conn->upsert_status->affected_rows;
|
||||
if (CONN_GET_STATE(conn) == CONN_QUIT_SENT) {
|
||||
/* close the statement here, the connection has been closed */
|
||||
@@ -913,6 +914,7 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int
|
||||
DBG_INF("EOF");
|
||||
/* Mark the connection as usable again */
|
||||
result->unbuf->eof_reached = TRUE;
|
||||
memset(result->conn->upsert_status, 0, sizeof(*result->conn->upsert_status));
|
||||
result->conn->upsert_status->warning_count = row_packet->warning_count;
|
||||
result->conn->upsert_status->server_status = row_packet->server_status;
|
||||
/*
|
||||
@@ -1022,6 +1024,7 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param, unsigned int fla
|
||||
|
||||
row_packet->skip_extraction = stmt->result_bind? FALSE:TRUE;
|
||||
|
||||
memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status));
|
||||
if (PASS == (ret = PACKET_READ(row_packet, result->conn)) && !row_packet->eof) {
|
||||
unsigned int i, field_count = result->field_count;
|
||||
|
||||
|
||||
@@ -636,9 +636,8 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
occur, and force resend for the next execution.
|
||||
*/
|
||||
for (i = 0; i < stmt->param_count; i++) {
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_NULL &&
|
||||
(stmt->param_bind[i].type == MYSQL_TYPE_LONG || stmt->param_bind[i].type == MYSQL_TYPE_LONGLONG))
|
||||
{
|
||||
short current_type = stmt->param_bind[i].type;
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_NULL && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) {
|
||||
/* always copy the var, because we do many conversions */
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG &&
|
||||
PASS != mysqlnd_stmt_copy_it(&copies, stmt->param_bind[i].zv, stmt->param_count, i TSRMLS_CC))
|
||||
@@ -652,10 +651,31 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
*/
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG) {
|
||||
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv;
|
||||
convert_to_double_ex(&tmp_data);
|
||||
if (Z_DVAL_P(tmp_data) > LONG_MAX || Z_DVAL_P(tmp_data) < LONG_MIN) {
|
||||
/*
|
||||
Because converting to double and back to long can lead
|
||||
to losing precision we need second variable. Conversion to double is to see if
|
||||
value is too big for a long. As said, precision could be lost.
|
||||
*/
|
||||
zval *tmp_data_copy;
|
||||
MAKE_STD_ZVAL(tmp_data_copy);
|
||||
*tmp_data_copy = *tmp_data;
|
||||
Z_SET_REFCOUNT_P(tmp_data_copy, 1);
|
||||
zval_copy_ctor(tmp_data_copy);
|
||||
convert_to_double_ex(&tmp_data_copy);
|
||||
|
||||
/*
|
||||
if it doesn't fit in a long send it as a string.
|
||||
Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX
|
||||
We do transformation here, which will be used later when sending types. The code later relies on this.
|
||||
*/
|
||||
if (Z_DVAL_P(tmp_data_copy) > LONG_MAX || Z_DVAL_P(tmp_data_copy) < LONG_MIN) {
|
||||
stmt->send_types_to_server = resend_types_next_time = 1;
|
||||
convert_to_string_ex(&tmp_data);
|
||||
} else {
|
||||
convert_to_long_ex(&tmp_data);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&tmp_data_copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -698,10 +718,11 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
*/
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG) {
|
||||
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv;
|
||||
|
||||
convert_to_double_ex(&tmp_data);
|
||||
if (Z_DVAL_P(tmp_data) > LONG_MAX || Z_DVAL_P(tmp_data) < LONG_MIN) {
|
||||
convert_to_string_ex(&tmp_data);
|
||||
/*
|
||||
In case of IS_LONG we do nothing, it is ok, in case of string, we just need to set current_type.
|
||||
The actual transformation has been performed several dozens line above.
|
||||
*/
|
||||
if (Z_TYPE_P(tmp_data) == IS_STRING) {
|
||||
current_type = MYSQL_TYPE_VAR_STRING;
|
||||
/*
|
||||
don't change stmt->param_bind[i].type to MYSQL_TYPE_VAR_STRING
|
||||
@@ -709,8 +730,6 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
if the type is however not long, then we will do a goto in the next switch.
|
||||
We want to preserve the original bind type given by the user. Thus, we do these hacks.
|
||||
*/
|
||||
} else {
|
||||
convert_to_long_ex(&tmp_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,6 +426,7 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s
|
||||
DBG_INF("UPSERT");
|
||||
conn->last_query_type = QUERY_UPSERT;
|
||||
conn->field_count = rset_header->field_count;
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
conn->upsert_status->warning_count = rset_header->warning_count;
|
||||
conn->upsert_status->server_status = rset_header->server_status;
|
||||
conn->upsert_status->affected_rows = rset_header->affected_rows;
|
||||
@@ -714,6 +715,7 @@ mysqlnd_fetch_row_unbuffered_c(MYSQLND_RES * result TSRMLS_DC)
|
||||
/* Mark the connection as usable again */
|
||||
DBG_INF_FMT("warnings=%u server_status=%u", row_packet->warning_count, row_packet->server_status);
|
||||
result->unbuf->eof_reached = TRUE;
|
||||
memset(result->conn->upsert_status, 0, sizeof(*result->conn->upsert_status));
|
||||
result->conn->upsert_status->warning_count = row_packet->warning_count;
|
||||
result->conn->upsert_status->server_status = row_packet->server_status;
|
||||
/*
|
||||
@@ -849,6 +851,7 @@ mysqlnd_fetch_row_unbuffered(MYSQLND_RES * result, void *param, unsigned int fla
|
||||
/* Mark the connection as usable again */
|
||||
DBG_INF_FMT("warnings=%u server_status=%u", row_packet->warning_count, row_packet->server_status);
|
||||
result->unbuf->eof_reached = TRUE;
|
||||
memset(result->conn->upsert_status, 0, sizeof(*result->conn->upsert_status));
|
||||
result->conn->upsert_status->warning_count = row_packet->warning_count;
|
||||
result->conn->upsert_status->server_status = row_packet->server_status;
|
||||
/*
|
||||
@@ -1206,6 +1209,7 @@ MYSQLND_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND_CONN_DATA * const c
|
||||
|
||||
/* Finally clean */
|
||||
if (row_packet->eof) {
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
conn->upsert_status->warning_count = row_packet->warning_count;
|
||||
conn->upsert_status->server_status = row_packet->server_status;
|
||||
}
|
||||
|
||||
@@ -763,6 +763,7 @@ php_mysqlnd_ok_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
|
||||
packet->error, sizeof(packet->error),
|
||||
&packet->error_no, packet->sqlstate
|
||||
TSRMLS_CC);
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
DBG_RETURN(PASS);
|
||||
}
|
||||
/* Everything was fine! */
|
||||
@@ -1005,6 +1006,7 @@ php_mysqlnd_rset_header_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
|
||||
packet->error_info.error, sizeof(packet->error_info.error),
|
||||
&packet->error_info.error_no, packet->error_info.sqlstate
|
||||
TSRMLS_CC);
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
DBG_RETURN(PASS);
|
||||
}
|
||||
|
||||
|
||||
+14
-4
@@ -645,18 +645,28 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */
|
||||
char * thestr;
|
||||
long gmadjust = 0;
|
||||
|
||||
if (timestr->length < 13) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "extension author too lazy to parse %s correctly", timestr->data);
|
||||
if (ASN1_STRING_type(timestr) != V_ASN1_UTCTIME) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "illegal ASN1 data type for timestamp");
|
||||
return (time_t)-1;
|
||||
}
|
||||
|
||||
strbuf = estrdup((char *)timestr->data);
|
||||
if (ASN1_STRING_length(timestr) != strlen(ASN1_STRING_data(timestr))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "illegal length in timestamp");
|
||||
return (time_t)-1;
|
||||
}
|
||||
|
||||
if (ASN1_STRING_length(timestr) < 13) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to parse time string %s correctly", timestr->data);
|
||||
return (time_t)-1;
|
||||
}
|
||||
|
||||
strbuf = estrdup((char *)ASN1_STRING_data(timestr));
|
||||
|
||||
memset(&thetime, 0, sizeof(thetime));
|
||||
|
||||
/* we work backwards so that we can use atoi more easily */
|
||||
|
||||
thestr = strbuf + timestr->length - 3;
|
||||
thestr = strbuf + ASN1_STRING_length(timestr) - 3;
|
||||
|
||||
thetime.tm_sec = atoi(thestr);
|
||||
*thestr = '\0';
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEpDCCA4ygAwIBAgIJAJzu8r6u6eBcMA0GCSqGSIb3DQEBBQUAMIHDMQswCQYD
|
||||
VQQGEwJERTEcMBoGA1UECAwTTm9yZHJoZWluLVdlc3RmYWxlbjEQMA4GA1UEBwwH
|
||||
S8ODwrZsbjEUMBIGA1UECgwLU2VrdGlvbkVpbnMxHzAdBgNVBAsMFk1hbGljaW91
|
||||
cyBDZXJ0IFNlY3Rpb24xITAfBgNVBAMMGG1hbGljaW91cy5zZWt0aW9uZWlucy5k
|
||||
ZTEqMCgGCSqGSIb3DQEJARYbc3RlZmFuLmVzc2VyQHNla3Rpb25laW5zLmRlMHUY
|
||||
ZDE5NzAwMTAxMDAwMDAwWgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAXDTE0MTEyODExMzkzNVowgcMxCzAJBgNVBAYTAkRFMRwwGgYDVQQIDBNO
|
||||
b3JkcmhlaW4tV2VzdGZhbGVuMRAwDgYDVQQHDAdLw4PCtmxuMRQwEgYDVQQKDAtT
|
||||
ZWt0aW9uRWluczEfMB0GA1UECwwWTWFsaWNpb3VzIENlcnQgU2VjdGlvbjEhMB8G
|
||||
A1UEAwwYbWFsaWNpb3VzLnNla3Rpb25laW5zLmRlMSowKAYJKoZIhvcNAQkBFhtz
|
||||
dGVmYW4uZXNzZXJAc2VrdGlvbmVpbnMuZGUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
|
||||
DwAwggEKAoIBAQDDAf3hl7JY0XcFniyEJpSSDqn0OqBr6QP65usJPRt/8PaDoqBu
|
||||
wEYT/Na+6fsgPjC0uK9DZgWg2tHWWoanSblAMoz5PH6Z+S4SHRZ7e2dDIjPjdhjh
|
||||
0mLg2UMO5yp0V797Ggs9lNt6JRfH81MN2obXWs4NtztLMuD6egqpr8dDbr34aOs8
|
||||
pkdui5UawTZksy5pLPHq5cMhFGm06v65CLo0V2Pd9+KAokPrPcN5KLKebz7mLpk6
|
||||
SMeEXOKP4idEqxyQ7O7fBuHMedsQhu+prY3si3BUyKfQtP5CZnX2bp0wKHxX12DX
|
||||
1nfFIt9DbGvHTcyOuN+nZLPBm3vWxntyIIvVAgMBAAGjQjBAMAkGA1UdEwQCMAAw
|
||||
EQYJYIZIAYb4QgEBBAQDAgeAMAsGA1UdDwQEAwIFoDATBgNVHSUEDDAKBggrBgEF
|
||||
BQcDAjANBgkqhkiG9w0BAQUFAAOCAQEAG0fZYYCTbdj1XYc+1SnoaPR+vI8C8CaD
|
||||
8+0UYhdnyU4gga0BAcDrY9e94eEAu6ZqycF6FjLqXXdAboppWocr6T6GD1x33Ckl
|
||||
VArzG/KxQohGD2JeqkhIMlDomxHO7ka39+Oa8i2vWLVyjU8AZvWMAruHa4EENyG7
|
||||
lW2AagaFKFCr9TnXTfrdxGVEbv7KVQ6bdhg5p5SjpWH1+Mq03uR3ZXPBYdyV8319
|
||||
o0lVj1KFI2DCL/liWisJRoof+1cR35Ctd0wYBcpB6TZslMcOPl76dwKwJgeJo2Qg
|
||||
Zsfmc2vC1/qOlNuNq/0TzzkVGv8ETT3CgaU+UXe4XOVvkccebJn2dg==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
CVE-2013-6420
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$crt = substr(__FILE__, 0, -4).'.crt';
|
||||
$info = openssl_x509_parse("file://$crt");
|
||||
var_dump($info['issuer']['emailAddress'], $info["validFrom_time_t"]);
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
%s openssl_x509_parse(): illegal ASN1 data type for timestamp in %s%ecve-2013-6420.php on line 3
|
||||
string(27) "stefan.esser@sektioneins.de"
|
||||
int(-1)
|
||||
Done
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #66141 (mysqlnd quote function is wrong with NO_BACKSLASH_ESCAPES after failed query)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
|
||||
$db = MySQLPDOTest::factory();
|
||||
|
||||
$input = 'Something\', 1 as one, 2 as two FROM dual; -- f';
|
||||
|
||||
$quotedInput0 = $db->quote($input);
|
||||
|
||||
$db->query('set session sql_mode="NO_BACKSLASH_ESCAPES"');
|
||||
|
||||
// injection text from some user input
|
||||
|
||||
$quotedInput1 = $db->quote($input);
|
||||
|
||||
$db->query('something that throws an exception');
|
||||
|
||||
$quotedInput2 = $db->quote($input);
|
||||
|
||||
var_dump($quotedInput0);
|
||||
var_dump($quotedInput1);
|
||||
var_dump($quotedInput2);
|
||||
?>
|
||||
done
|
||||
--EXPECTF--
|
||||
Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'something that throws an exception' at line %d in %s on line %d
|
||||
string(50) "'Something\', 1 as one, 2 as two FROM dual; -- f'"
|
||||
string(50) "'Something'', 1 as one, 2 as two FROM dual; -- f'"
|
||||
string(50) "'Something'', 1 as one, 2 as two FROM dual; -- f'"
|
||||
done
|
||||
@@ -472,7 +472,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
|
||||
if (P->outbuf) {
|
||||
unsigned long ulen;
|
||||
char *srcbuf;
|
||||
unsigned long srclen;
|
||||
unsigned long srclen = 0;
|
||||
|
||||
switch (P->len) {
|
||||
case SQL_NULL_DATA:
|
||||
@@ -551,7 +551,8 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
|
||||
struct pdo_column_data *col = &stmt->columns[colno];
|
||||
RETCODE rc;
|
||||
SWORD colnamelen;
|
||||
SDWORD colsize, displaysize;
|
||||
SDWORD colsize;
|
||||
SQLLEN displaysize;
|
||||
|
||||
rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname,
|
||||
sizeof(S->cols[colno].colname)-1, &colnamelen,
|
||||
|
||||
@@ -1105,29 +1105,26 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde
|
||||
string_free(&str_constants);
|
||||
}
|
||||
|
||||
if (module->functions && module->functions->fname) {
|
||||
{
|
||||
HashPosition iterator;
|
||||
zend_function *fptr;
|
||||
const zend_function_entry *func = module->functions;
|
||||
int first = 1;
|
||||
|
||||
string_printf(str, "\n - Functions {\n");
|
||||
|
||||
/* Is there a better way of doing this? */
|
||||
while (func->fname) {
|
||||
int fname_len = strlen(func->fname);
|
||||
char *lc_name = zend_str_tolower_dup(func->fname, fname_len);
|
||||
|
||||
if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal error: Cannot find extension function %s in global function table", func->fname);
|
||||
func++;
|
||||
efree(lc_name);
|
||||
continue;
|
||||
zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator);
|
||||
while (zend_hash_get_current_data_ex(CG(function_table), (void **) &fptr, &iterator) == SUCCESS) {
|
||||
if (fptr->common.type==ZEND_INTERNAL_FUNCTION
|
||||
&& fptr->internal_function.module == module) {
|
||||
if (first) {
|
||||
string_printf(str, "\n - Functions {\n");
|
||||
first = 0;
|
||||
}
|
||||
_function_string(str, fptr, NULL, " " TSRMLS_CC);
|
||||
}
|
||||
|
||||
_function_string(str, fptr, NULL, " " TSRMLS_CC);
|
||||
efree(lc_name);
|
||||
func++;
|
||||
zend_hash_move_forward_ex(CG(function_table), &iterator);
|
||||
}
|
||||
if (!first) {
|
||||
string_printf(str, "%s }\n", indent);
|
||||
}
|
||||
string_printf(str, "%s }\n", indent);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -5242,6 +5239,9 @@ ZEND_METHOD(reflection_extension, getFunctions)
|
||||
{
|
||||
reflection_object *intern;
|
||||
zend_module_entry *module;
|
||||
HashPosition iterator;
|
||||
zval *function;
|
||||
zend_function *fptr;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@@ -5249,29 +5249,15 @@ ZEND_METHOD(reflection_extension, getFunctions)
|
||||
GET_REFLECTION_OBJECT_PTR(module);
|
||||
|
||||
array_init(return_value);
|
||||
if (module->functions) {
|
||||
zval *function;
|
||||
zend_function *fptr;
|
||||
const zend_function_entry *func = module->functions;
|
||||
|
||||
/* Is there a better way of doing this? */
|
||||
while (func->fname) {
|
||||
int fname_len = strlen(func->fname);
|
||||
char *lc_name = zend_str_tolower_dup(func->fname, fname_len);
|
||||
|
||||
if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal error: Cannot find extension function %s in global function table", func->fname);
|
||||
func++;
|
||||
efree(lc_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator);
|
||||
while (zend_hash_get_current_data_ex(CG(function_table), (void **) &fptr, &iterator) == SUCCESS) {
|
||||
if (fptr->common.type==ZEND_INTERNAL_FUNCTION
|
||||
&& fptr->internal_function.module == module) {
|
||||
ALLOC_ZVAL(function);
|
||||
reflection_function_factory(fptr, NULL, function TSRMLS_CC);
|
||||
add_assoc_zval_ex(return_value, func->fname, fname_len+1, function);
|
||||
func++;
|
||||
efree(lc_name);
|
||||
add_assoc_zval(return_value, fptr->common.function_name, function);
|
||||
}
|
||||
zend_hash_move_forward_ex(CG(function_table), &iterator);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
ReflectionExtension::getFunctions() ##6218 zend_register_functions breaks reflection
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('reflection')) print 'skip missing reflection extension';
|
||||
if (PHP_SAPI != "cli") die("skip CLI only test");
|
||||
if (!function_exists("dl")) die("skip need dl");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$r = new ReflectionExtension('standard');
|
||||
$t = $r->getFunctions();
|
||||
var_dump($t['dl']);
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
object(ReflectionFunction)#%d (1) {
|
||||
["name"]=>
|
||||
string(2) "dl"
|
||||
}
|
||||
Done
|
||||
+7
-1
@@ -533,7 +533,7 @@ static void php_snmp_error(zval *object, const char *docref TSRMLS_DC, int type,
|
||||
}
|
||||
|
||||
if (object && (snmp_object->exceptions_enabled & type)) {
|
||||
zend_throw_exception_ex(php_snmp_exception_ce, type, snmp_object->snmp_errstr TSRMLS_CC);
|
||||
zend_throw_exception_ex(php_snmp_exception_ce, type TSRMLS_CC, snmp_object->snmp_errstr);
|
||||
} else {
|
||||
va_start(args, format);
|
||||
php_verror(docref, "", E_WARNING, format, args TSRMLS_CC);
|
||||
@@ -896,6 +896,12 @@ retry:
|
||||
keepwalking = 1;
|
||||
}
|
||||
} else {
|
||||
if (st & SNMP_CMD_WALK && response->errstat == SNMP_ERR_TOOBIG && objid_query->max_repetitions > 1) { /* Answer will not fit into single packet */
|
||||
objid_query->max_repetitions /= 2;
|
||||
snmp_free_pdu(response);
|
||||
keepwalking = 1;
|
||||
continue;
|
||||
}
|
||||
if (!(st & SNMP_CMD_WALK) || response->errstat != SNMP_ERR_NOSUCHNAME || Z_TYPE_P(return_value) == IS_BOOL) {
|
||||
for ( count=1, vars = response->variables;
|
||||
vars && count != response->errindex;
|
||||
|
||||
@@ -16,8 +16,8 @@ var_dump(class_implements(new fs));
|
||||
var_dump(class_implements('fs'));
|
||||
|
||||
echo "\n--- testing autoload ---\n";
|
||||
var_dump(class_implements('non-existent'));
|
||||
var_dump(class_implements('non-existent2', false));
|
||||
var_dump(class_implements('non_existent'));
|
||||
var_dump(class_implements('non_existent2', false));
|
||||
|
||||
|
||||
function __autoload($classname) {
|
||||
@@ -35,11 +35,11 @@ array(0) {
|
||||
}
|
||||
|
||||
--- testing autoload ---
|
||||
attempting to autoload non-existent
|
||||
attempting to autoload non_existent
|
||||
|
||||
Warning: class_implements(): Class non-existent does not exist and could not be loaded in %s on line %d
|
||||
Warning: class_implements(): Class non_existent does not exist and could not be loaded in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: class_implements(): Class non-existent2 does not exist in %s on line %d
|
||||
Warning: class_implements(): Class non_existent2 does not exist in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -16,8 +16,8 @@ var_dump(class_uses(new fs));
|
||||
var_dump(class_uses('fs'));
|
||||
|
||||
echo "\n--- testing autoload ---\n";
|
||||
var_dump(class_uses('non-existent'));
|
||||
var_dump(class_uses('non-existent2', false));
|
||||
var_dump(class_uses('non_existent'));
|
||||
var_dump(class_uses('non_existent2', false));
|
||||
|
||||
|
||||
function __autoload($classname) {
|
||||
@@ -35,11 +35,11 @@ array(0) {
|
||||
}
|
||||
|
||||
--- testing autoload ---
|
||||
attempting to autoload non-existent
|
||||
attempting to autoload non_existent
|
||||
|
||||
Warning: class_uses(): Class non-existent does not exist and could not be loaded in %s on line %d
|
||||
Warning: class_uses(): Class non_existent does not exist and could not be loaded in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: class_uses(): Class non-existent2 does not exist in %s on line %d
|
||||
Warning: class_uses(): Class non_existent2 does not exist in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -5724,7 +5724,7 @@ PHP_FUNCTION(unregister_tick_function)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(function) != IS_ARRAY) {
|
||||
if (Z_TYPE_P(function) != IS_ARRAY && Z_TYPE_P(function) != IS_OBJECT) {
|
||||
convert_to_string(function);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,15 +100,12 @@ In __autoload(12345)
|
||||
bool(false)
|
||||
|
||||
Arg value -2345
|
||||
In __autoload(-2345)
|
||||
bool(false)
|
||||
|
||||
Arg value 10.5
|
||||
In __autoload(10.5)
|
||||
bool(false)
|
||||
|
||||
Arg value -10.5
|
||||
In __autoload(-10.5)
|
||||
bool(false)
|
||||
|
||||
Arg value 101234567000
|
||||
@@ -116,11 +113,9 @@ In __autoload(101234567000)
|
||||
bool(false)
|
||||
|
||||
Arg value 1.07654321E-9
|
||||
In __autoload(1.07654321E-9)
|
||||
bool(false)
|
||||
|
||||
Arg value 0.5
|
||||
In __autoload(0.5)
|
||||
bool(false)
|
||||
Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d)
|
||||
|
||||
|
||||
@@ -100,15 +100,12 @@ In __autoload(12345)
|
||||
bool(false)
|
||||
|
||||
Arg value -2345
|
||||
In __autoload(-2345)
|
||||
bool(false)
|
||||
|
||||
Arg value 10.5
|
||||
In __autoload(10.5)
|
||||
bool(false)
|
||||
|
||||
Arg value -10.5
|
||||
In __autoload(-10.5)
|
||||
bool(false)
|
||||
|
||||
Arg value 101234567000
|
||||
@@ -116,11 +113,9 @@ In __autoload(101234567000)
|
||||
bool(false)
|
||||
|
||||
Arg value 1.07654321E-9
|
||||
In __autoload(1.07654321E-9)
|
||||
bool(false)
|
||||
|
||||
Arg value 0.5
|
||||
In __autoload(0.5)
|
||||
bool(false)
|
||||
Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d)
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #66094 (unregister_tick_function tries to cast a Closure to a string)
|
||||
--FILE--
|
||||
<?php
|
||||
declare(ticks=1);
|
||||
register_tick_function($closure = function () { echo "Tick!\n"; });
|
||||
unregister_tick_function($closure);
|
||||
echo "done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Tick!
|
||||
done
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test var_export() function with locale
|
||||
--INI--
|
||||
precision=14
|
||||
serialize_precision=17
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!setlocale(LC_ALL, "german", "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8")) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test var_export() function with valid float values
|
||||
--INI--
|
||||
precision=14
|
||||
serialize_precision=17
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : mixed var_export(mixed var [, bool return])
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Test var_export() function with valid arrays
|
||||
--INI--
|
||||
serialize_precision=17
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : mixed var_export(mixed var [, bool return])
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
Test unserialize(): error is indistinguishable from deserialized boolean
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string serialize(mixed variable)
|
||||
* Description: Returns a string representation of variable (which can later be unserialized)
|
||||
* Source code: ext/standard/var.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
/* Prototype : proto mixed unserialize(string variable_representation)
|
||||
* Description: Takes a string representation of variable and recreates it
|
||||
* Source code: ext/standard/var.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing unserialize() error/boolean distinction ***\n";
|
||||
|
||||
$garbage = "obvious non-serialized data";
|
||||
$serialized_false = serialize(false);
|
||||
|
||||
var_dump($serialized_false);
|
||||
|
||||
$deserialized_garbage = unserialize($garbage);
|
||||
var_dump($deserialized_garbage);
|
||||
|
||||
$deserialized_false = unserialize($serialized_false);
|
||||
var_dump($deserialized_false);
|
||||
|
||||
echo "unserialize error and deserialized false are identical? " . (bool) ($deserialized_false == $deserialized_garbage) . "\n";
|
||||
|
||||
// candidate safe idiom for determining whether data is serialized
|
||||
function isSerialized($str) {
|
||||
return ($str == serialize(false) || @unserialize($str) !== false);
|
||||
}
|
||||
|
||||
// Test unserialize error idiom
|
||||
var_dump(isSerialized($garbage));
|
||||
var_dump(isSerialized($serialized_false));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing unserialize() error/boolean distinction ***
|
||||
string(4) "b:0;"
|
||||
|
||||
Notice: unserialize(): Error at offset 0 of 27 bytes in %s%eserialization_error_002.php on line 20
|
||||
bool(false)
|
||||
bool(false)
|
||||
unserialize error and deserialized false are identical? 1
|
||||
bool(false)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -0,0 +1,105 @@
|
||||
--TEST--
|
||||
bug #49634 (Segfault throwing an exception in a XSL registered function)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("xsl") or die("skip need ext/xsl");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$sXml = <<<XML
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<root>
|
||||
test
|
||||
</root>
|
||||
XML;
|
||||
|
||||
$cDIR = __DIR__;
|
||||
$sXsl = <<<XSL
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:ext="http://php.net/xsl"
|
||||
xsl:extension-element-prefixes="ext"
|
||||
exclude-result-prefixes="ext">
|
||||
<xsl:output encoding="UTF-8" indent="yes" method="xml" />
|
||||
<xsl:template match="/">
|
||||
<xsl:value-of select="ext:function('testFunction', document('$cDIR/bug49634.xml')/root)"/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
XSL;
|
||||
|
||||
function testFunction($a)
|
||||
{
|
||||
throw new Exception('Test exception.');
|
||||
}
|
||||
|
||||
$domXml = new DOMDocument;
|
||||
$domXml->loadXML($sXml);
|
||||
$domXsl = new DOMDocument;
|
||||
$domXsl->loadXML($sXsl);
|
||||
|
||||
for ($i = 0; $i < 10; $i++)
|
||||
{
|
||||
$xsltProcessor = new XSLTProcessor();
|
||||
$xsltProcessor->registerPHPFunctions(array('testFunction'));
|
||||
$xsltProcessor->importStyleSheet($domXsl);
|
||||
try {
|
||||
@$xsltProcessor->transformToDoc($domXml);
|
||||
} catch (Exception $e) {
|
||||
echo $e,"\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
exception 'Exception' with message 'Test exception.' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: testFunction(Array)
|
||||
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
|
||||
#2 {main}
|
||||
===DONE===
|
||||
@@ -0,0 +1 @@
|
||||
<root/>
|
||||
@@ -279,7 +279,10 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
|
||||
node->type = XML_NAMESPACE_DECL;
|
||||
node->parent = nsparent;
|
||||
node->ns = curns;
|
||||
} else {
|
||||
node = xmlDocCopyNodeList(domintern->document->ptr, node);
|
||||
}
|
||||
|
||||
child = php_dom_create_object(node, &ret, child, domintern TSRMLS_CC);
|
||||
add_next_index_zval(args[i], child);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1537,7 +1537,7 @@ static ZIPARCHIVE_METHOD(open)
|
||||
RETURN_LONG((long)err);
|
||||
}
|
||||
ze_obj->filename = estrdup(resolved_path);
|
||||
ze_obj->filename_len = filename_len;
|
||||
ze_obj->filename_len = strlen(resolved_path);
|
||||
ze_obj->za = intern;
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_MAJOR_VERSION 5
|
||||
#define PHP_MINOR_VERSION 4
|
||||
#define PHP_RELEASE_VERSION 23
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "5.4.23-dev"
|
||||
#define PHP_VERSION_ID 50423
|
||||
#define PHP_RELEASE_VERSION 24
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "5.4.24"
|
||||
#define PHP_VERSION_ID 50424
|
||||
@@ -78,11 +78,7 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags)
|
||||
/* unknown mode */
|
||||
return FAILURE;
|
||||
}
|
||||
#if defined(O_NONBLOCK)
|
||||
if (strchr(mode, 'n')) {
|
||||
flags |= O_NONBLOCK;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strchr(mode, '+')) {
|
||||
flags |= O_RDWR;
|
||||
} else if (flags) {
|
||||
@@ -91,6 +87,12 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags)
|
||||
flags |= O_RDONLY;
|
||||
}
|
||||
|
||||
#if defined(O_NONBLOCK)
|
||||
if (strchr(mode, 'n')) {
|
||||
flags |= O_NONBLOCK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_O_TEXT) && defined(O_BINARY)
|
||||
if (strchr(mode, 't')) {
|
||||
flags |= _O_TEXT;
|
||||
|
||||
@@ -1088,6 +1088,7 @@ function system_with_timeout($commandline, $env = null, $stdin = null)
|
||||
fwrite($pipes[0], $stdin);
|
||||
}
|
||||
fclose($pipes[0]);
|
||||
unset($pipes[0]);
|
||||
|
||||
$timeout = $leak_check ? 300 : (isset($env['TEST_TIMEOUT']) ? $env['TEST_TIMEOUT'] : 60);
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Validation of class names in the autoload process
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
echo "$name\n";
|
||||
}
|
||||
$a = "../BUG";
|
||||
$x = new $a;
|
||||
echo "BUG\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class '../BUG' not found in %sautoload_021.php on line 6
|
||||
@@ -2,6 +2,7 @@
|
||||
Bug #24640 (var_export and var_dump can't output large float)
|
||||
--INI--
|
||||
precision=12
|
||||
serialize_precision=17
|
||||
--FILE--
|
||||
<?php
|
||||
function test($v)
|
||||
|
||||
@@ -352,7 +352,7 @@ ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
|
||||
zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \
|
||||
zend_constants.c zend_dynamic_array.c zend_exceptions.c \
|
||||
zend_execute_API.c zend_highlight.c \
|
||||
zend_llist.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
|
||||
zend_llist.c zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
|
||||
zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
|
||||
zend_hash.c zend_list.c zend_indent.c zend_builtin_functions.c \
|
||||
zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \
|
||||
|
||||
Reference in new issue
Block a user