Compare commits

..
461 changed files with 29116 additions and 114840 deletions

No files matched your search

-3
View File
@@ -20,9 +20,6 @@
*.tar.gz
*.tar.bz2
*.tar.xz
*.tar.gz.asc
*.tar.bz2.asc
*.tar.xz.asc
.FBCIndex
.FBCLockFolder
.deps
+6 -18
View File
@@ -1,25 +1,8 @@
language: c
sudo: false
addons:
apt:
packages:
- locales
- language-pack-de
- re2c
- libgmp-dev
- libicu-dev
- libmcrypt-dev
- libtidy-dev
notifications:
email:
on_failure: change
irc:
template:
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} - Change view : %{compare_url} - Build details : %{build_url}"
channels:
- "irc.efnet.org#php.pecl"
on_success: change
on_failure: always
cache:
- apt
@@ -37,6 +20,11 @@ env:
- ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
before_install:
- sudo cp ./travis/de /var/lib/locales/supported.d/de
- sudo dpkg-reconfigure locales
- ./travis/install.sh
before_script:
# Compile PHP
- ./travis/compile.sh
+10 -438
View File
@@ -1,428 +1,5 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
28 Apr 2016, PHP 5.5.35
- BCMath:
. Fix bug #72093 (bcpowmod accepts negative scale and corrupts _one_
definition). (Stas)
- Exif:
. Fix bug #72094 (Out of bounds heap read access in exif header
processing). (Stas)
- GD:
. Fix bug #71912 (libgd: signedness vulnerability). (Stas)
- Intl:
. Fix bug #72061 (Out-of-bounds reads in zif_grapheme_stripos with negative
offset). (Stas)
- XML:
. Fix bug #72099 (xml_parse_into_struct segmentation fault). (Stas)
31 Mar 2016, PHP 5.5.34
- Fileinfo:
. Fixed bug #71527 (Buffer over-write in finfo_open with malformed magic
file). (Anatol)
- Mbstring:
. Fixed bug #71906 (AddressSanitizer: negative-size-param (-1) in
mbfl_strcut). (Stas)
- ODBC
. Fixed bug #71860 (Invalid memory write in phar on filename with \0 in
name). (Stas)
- SNMP:
. Fixed bug #71704 (php_snmp_error() Format String Vulnerability).
(andrew at jmpesp dot org)
- Standard
. Fixed bug #71798 (Integer Overflow in php_raw_url_encode).
(taoguangchen at icloud dot com, Stas)
03 Mar 2016, PHP 5.5.33
- Phar:
. Fixed bug #71498 (Out-of-Bound Read in phar_parse_zipfile()). (Stas)
- WDDX:
. Fixed bug #71587 (Use-After-Free / Double-Free in WDDX Deserialize). (Stas)
04 Feb 2016, PHP 5.5.32
- Core:
. Fixed bug #71039 (exec functions ignore length but look for NULL termination).
(Anatol)
. Fixed bug #71323 (Output of stream_get_meta_data can be falsified by its
input). (Leo Gaspard)
. Fixed bug #71459 (Integer overflow in iptcembed()). (Stas)
- GD:
. Improved the fix for bug #70976. (Remi)
- PCRE:
. Upgraded pcrelib to 8.38.
- Phar:
. Fixed bug #71354 (Heap corruption in tar/zip/phar parser). (Stas)
. Fixed bug #71391 (NULL Pointer Dereference in phar_tar_setupmetadata()).
(Stas)
. Fixed bug #71488 (Stack overflow when decompressing tar archives). (Stas)
- WDDX:
. Fixed bug #71335 (Type Confusion in WDDX Packet Deserialization). (Stas)
07 Jan 2015, PHP 5.5.31
- FPM:
. Fixed bug #70755 (fpm_log.c memory leak and buffer overflow). (Stas)
- GD:
. Fixed bug #70976 (Memory Read via gdImageRotateInterpolated Array Index
Out of Bounds). (emmanuel dot law at gmail dot com).
- WDDX:
. Fixed bug #70661 (Use After Free Vulnerability in WDDX Packet Deserialization).
(taoguangchen at icloud dot com)
. Fixed bug #70741 (Session WDDX Packet Deserialization Type Confusion
Vulnerability). (taoguangchen at icloud dot com)
- XMLRPC:
. Fixed bug #70728 (Type Confusion Vulnerability in PHP_to_XMLRPC_worker()).
(Julien)
01 Oct 2015, PHP 5.5.30
- Phar:
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()). (Stas)
. Fixed bug #70433 (Uninitialized pointer in phar_make_dirstream when zip
entry filename is "/"). (Stas)
03 Sep 2015, PHP 5.5.29
- Core:
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()). (Stas)
. Fixed bug #70219 (Use after free vulnerability in session deserializer).
(taoguangchen at icloud dot com)
- EXIF:
. Fixed bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte
value of 32 bytes). (Stas)
- hash:
. Fixed bug #70312 (HAVAL gives wrong hashes in specific cases). (letsgolee
at naver dot com)
- PCRE:
. Fixed bug #70345 (Multiple vulnerabilities related to PCRE functions).
(Anatol Belski)
- SOAP:
. Fixed bug #70388 (SOAP serialize_function_call() type confusion / RCE).
(Stas)
- SPL:
. Fixed bug #70365 (Use-after-free vulnerability in unserialize() with
SplObjectStorage). (taoguangchen at icloud dot com)
. Fixed bug #70366 (Use-after-free vulnerability in unserialize() with
SplDoublyLinkedList). (taoguangchen at icloud dot com)
- XSLT:
. Fixed bug #69782 (NULL pointer dereference). (Stas)
- ZIP:
. Fixed bug #70350 (ZipArchive::extractTo allows for directory traversal when
creating directories). (neal at fb dot com)
06 Aug 2015, PHP 5.5.28
- Core:
. Fixed bug #69793 (Remotely triggerable stack exhaustion via recursive
method calls). (Stas)
. Fixed bug #69892 (Different arrays compare indentical due to integer key
truncation). (Nikita)
. Fixed bug #70002 (TS issues with temporary dir handling). (Anatol)
. Fixed bug #70121 (unserialize() could lead to unexpected methods execution
/ NULL pointer deref). (Stas)
- OpenSSL:
. Fixed bug #70014 (openssl_random_pseudo_bytes() is not cryptographically
secure). (Stas)
- Phar:
. Improved fix for bug #69441. (Anatol Belski)
. Fixed bug #70019 (Files extracted from archive may be placed outside of
destination directory). (Anatol Belski)
- SOAP:
. Fixed bug #70081 (SoapClient info leak / null pointer dereference via
multiple type confusions). (Stas)
- SPL:
. Fixed bug #70068 (Dangling pointer in the unserialization of ArrayObject
items). (sean.heelan)
. Fixed bug #70166 (Use After Free Vulnerability in unserialize() with
SPLArrayObject). (taoguangchen at icloud dot com)
. Fixed bug #70168 (Use After Free Vulnerability in unserialize() with
SplObjectStorage). (taoguangchen at icloud dot com)
. Fixed bug #70169 (Use After Free Vulnerability in unserialize() with
SplDoublyLinkedList). (taoguangchen at icloud dot com)
9 Jul 2015, PHP 5.5.27
- Core:
. Fixed bug #69768 (escapeshell*() doesn't cater to !). (cmb)
. Fixed bug #69703 (Use __builtin_clzl on PowerPC).
(dja at axtens dot net, Kalle)
. Fixed bug #69732 (can induce segmentation fault with basic php code).
(Dmitry)
. Fixed bug #69642 (Windows 10 reported as Windows 8).
(Christian Wenz, Anatol Belski)
. Fixed bug #69551 (parse_ini_file() and parse_ini_string() segmentation
fault). (Christoph M. Becker)
. Fixed bug #69781 (phpinfo() reports Professional Editions of Windows
7/8/8.1/10 as "Business"). (Christian Wenz)
. Fixed bug #69835 (phpinfo() does not report many Windows SKUs).
(Christian Wenz)
. Fixed bug #69892 (Different arrays compare indentical due to integer key
truncation). (Nikita)
. Fixed bug #69874 (Can't set empty additional_headers for mail()), regression
from fix to bug #68776. (Yasuo)
- GD:
. Fixed bug #61221 (imagegammacorrect function loses alpha channel). (cmb)
- Mysqlnd:
. Fixed bug #69669 (mysqlnd is vulnerable to BACKRONYM) (CVE-2015-3152).
(Andrey)
- PCRE:
. Fixed Bug #53823 (preg_replace: * qualifier on unicode replace garbles the
string). (cmb)
. Fixed bug #69864 (Segfault in preg_replace_callback) (cmb, ab)
- PDO_pgsql:
. Fixed bug #69752 (PDOStatement::execute() leaks memory with DML
Statements when closeCuror() is u). (Philip Hofstetter)
. Fixed bug #69362 (PDO-pgsql fails to connect if password contains a
leading single quote). (Matteo)
. Fixed bug #69344 (PDO PgSQL Incorrect binding numeric array with gaps).
(Matteo)
- Phar:
. Fixed bug #69958 (Segfault in Phar::convertToData on invalid file).
(CVE-2015-5589) (Stas)
. Fixed bug #69923 (Buffer overflow and stack smashing error in
phar_fix_filepath). (CVE-2015-5590) (Stas)
- SimpleXML:
. Refactored the fix for bug #66084 (simplexml_load_string() mangles empty
node name). (Christoph Michael Becker)
- SPL:
. Fixed bug #69737 (Segfault when SplMinHeap::compare produces fatal error).
(Stas)
. Fixed bug #67805 (SplFileObject setMaxLineLength). (Willian Gustavo Veiga).
11 Jun 2015, PHP 5.5.26
- Core:
. Fixed bug #69566 (Conditional jump or move depends on uninitialised value
in extension trait). (jbboehr at gmail dot com)
. Fixed bug #66048 (temp. directory is cached during multiple requests).
(Julien)
. Fixed bug #69628 (complex GLOB_BRACE fails on Windows).
(Christoph M. Becker)
. Improved fix for bug #69545 (Integer overflow in ftp_genlist() resulting in
heap overflow). (CVE-2015-4643) (Max Spelsberg)
. Fixed bug #69646 (OS command injection vulnerability in escapeshellarg).
(CVE-2015-4642) (Anatol Belski)
. Fixed bug #69719 (Incorrect handling of paths with NULs). (Stas)
- GD:
. Fixed bug #69479 (GD fails to build with newer libvpx). (Remi)
- Iconv:
. Fixed bug #48147 (iconv with //IGNORE cuts the string). (Stas)
- Litespeed SAPI:
. Fixed bug #68812 (Unchecked return value). (George Wang)
- Mail:
. Fixed bug #68776 (mail() does not have mail header injection prevention for
additional headers). (Yasuo)
- MCrypt:
. Added file descriptor caching to mcrypt_create_iv() (Leigh)
- PCRE:
. Upgraded pcrelib to 8.37. (CVE-2015-2325, CVE-2015-2326)
- Phar:
. Fixed bug #69680 (phar symlink in binary directory broken).
(Matteo Bernardini, Remi)
- Postgres:
. Fixed bug #69667 (segfault in php_pgsql_meta_data). (CVE-2015-4644) (Remi)
- Opcache
. Fixed bug #69549 (Memory leak with opcache.optimization_level=0xFFFFFFFF).
(Laruence, Dmitry)
- Sqlite3:
. Upgrade bundled sqlite to 3.8.10.2. (CVE-2015-3414, CVE-2015-3415,
CVE-2015-3416) (Kaplan)
14 May 2015, PHP 5.5.25
- Core:
. Fixed bug #69364 (PHP Multipart/form-data remote dos Vulnerability).
(CVE-2015-4024) (Stas)
. Fixed bug #69403 (str_repeat() sign mismatch based memory corruption).
(Stas)
. Fixed bug #69418 (CVE-2006-7243 fix regressions in 5.4+). (CVE-2015-4025)
(Stas)
. Fixed bug #69522 (heap buffer overflow in unpack()). (Stas)
. Fixed bug #69467 (Wrong checked for the interface by using Trait).
(Laruence)
. Fixed bug #69420 (Invalid read in zend_std_get_method). (Laruence)
. Fixed bug #60022 ("use statement [...] has no effect" depends on leading
backslash). (Nikita)
. Fixed bug #67314 (Segmentation fault in gc_remove_zval_from_buffer).
(Dmitry)
. Fixed bug #68652 (segmentation fault in destructor). (Dmitry)
. Fixed bug #69419 (Returning compatible sub generator produces a warning).
(Nikita)
. Fixed bug #69472 (php_sys_readlink ignores misc errors from
GetFinalPathNameByHandleA). (Jan Starke)
- FTP:
. Fixed bug #69545 (Integer overflow in ftp_genlist() resulting in heap
overflow). (CVE-2015-4022) (Stas)
- ODBC:
. Fixed bug #69354 (Incorrect use of SQLColAttributes with ODBC 3.0).
(Anatol)
. Fixed bug #69474 (ODBC: Query with same field name from two tables returns
incorrect result). (Anatol)
. Fixed bug #69381 (out of memory with sage odbc driver). (Frederic Marchall,
Anatol Belski)
- OpenSSL:
. Fixed bug #69402 (Reading empty SSL stream hangs until timeout).
(Daniel Lowrey)
- PCNTL:
. Fixed bug #68598 (pcntl_exec() should not allow null char). (CVE-2015-4026)
(Stas)
- Phar:
. Fixed bug #69453 (Memory Corruption in phar_parse_tarfile when entry
filename starts with null). (CVE-2015-4021) (Stas)
16 Apr 2015, PHP 5.5.24
- Apache2handler:
. Fixed bug #69218 (potential remote code execution with apache 2.4
apache2handler). (Gerrit Venema)
- Core:
. Fixed bug #66609 (php crashes with __get() and ++ operator in some cases).
(Dmitry, Laruence)
. Fixed bug #67626 (User exceptions not properly handled in streams).
(Julian)
. Fixed bug #68021 (get_browser() browser_name_regex returns non-utf-8
characters). (Tjerk)
. Fixed bug #68917 (parse_url fails on some partial urls). (Wei Dai)
. Fixed bug #69134 (Per Directory Values overrides PHP_INI_SYSTEM
configuration options). (Anatol Belski)
. Additional fix for bug #69152 (Type confusion vulnerability in
exception::getTraceAsString). (Stas)
. Fixed bug #69212 (Leaking VIA_HANDLER func when exception thrown in
__call/... arg passing). (Nikita)
. Fixed bug #69221 (Segmentation fault when using a generator in combination
with an Iterator). (Nikita)
. Fixed bug #69337 (php_stream_url_wrap_http_ex() type-confusion
vulnerability). (Stas)
. Fixed bug #69353 (Missing null byte checks for paths in various PHP
extensions). (Stas)
- cURL:
. Implemented FR#69278 (HTTP2 support). (Masaki Kagaya)
. Fixed bug #68739 (Missing break / control flow). (Laruence)
. Fixed bug #69316 (Use-after-free in php_curl related to
CURLOPT_FILE/_INFILE/_WRITEHEADER). (Laruence)
- Date:
. Export date_get_immutable_ce so that it can be used by extensions. (Derick
Rethans)
. Fixed bug #69336 (Issues with "last day of <monthname>"). (Derick Rethans)
- Enchant:
. Fixed bug #65406 (Enchant broker plugins are in the wrong place in windows
builds). (Anatol)
- Ereg:
. Fixed bug #68740 (NULL Pointer Dereference). (Laruence)
- Fileinfo:
. Fixed bug #68819 (Fileinfo on specific file causes spurious OOM and/or
segfault). (Anatol Belski)
- Filter:
. Fixed bug #69202 (FILTER_FLAG_STRIP_BACKTICK ignored unless other
flags are used). (Jeff Welch)
. Fixed bug #69203 (FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127). (Jeff
Welch)
- Mbstring:
. Fixed bug #68846 (False detection of CJK Unified Ideographs Extension E).
(Masaki Kagaya)
- ODBC:
. Fixed bug #69354 (Incorrect use of SQLColAttributes with ODBC 3.0).
(Anatol)
- OPCache:
. Fixed bug #69281 (opcache_is_script_cached no longer works). (danack)
. Fixed bug #68677 (Use After Free). (CVE-2015-1351) (Laruence)
- OpenSSL:
. Fixed bug #67403 (Add signatureType to openssl_x509_parse).
. Add a check for RAND_egd to allow compiling against LibreSSL (Leigh)
- Phar:
. Fixed bug #64343 (PharData::extractTo fails for tarball created by BSD tar).
(Mike)
. Fixed bug #64931 (phar_add_file is too restrictive on filename). (Mike)
. Fixed bug #65467 (Call to undefined method cli_arg_typ_string). (Mike)
. Fixed bug #67761 (Phar::mapPhar fails for Phars inside a path containing
".tar"). (Mike)
. Fixed bug #69324 (Buffer Over-read in unserialize when parsing Phar). (Stas)
. Fixed bug #69441 (Buffer Overflow when parsing tar/zip/phar in
phar_set_inode). (Stas)
- Postgres:
. Fixed bug #68741 (Null pointer dereference). (CVE-2015-1352) (Laruence)
- SOAP:
. Fixed bug #69152 (Type Confusion Infoleak Vulnerability in unserialize()
with SoapFault). (Dmitry)
. Fixed bug #69293 (NEW segfault when using SoapClient::__setSoapHeader
(bisected, regression)). (thomas at shadowweb dot org, Laruence)
- SPL:
. Fixed bug #69227 (Use after free in zval_scan caused by
spl_object_storage_get_gc). (adam dot scarr at 99designs dot com)
- Sqlite3:
. Fixed bug #68760 (SQLITE segfaults if custom collator throws an exception).
(Dan Ackroyd)
. Fixed bug #69287 (Upgrade bundled sqlite to 3.8.8.3). (Anatol)
. Fixed bug #66550 (SQLite prepared statement use-after-free). (Sean Heelan)
19 Mar 2015, PHP 5.5.23
- Core:
@@ -441,12 +18,10 @@ PHP NEWS
. Fixed bug #68166 (Exception with invalid character causes segv). (Rasmus)
. Fixed bug #69141 (Missing arguments in reflection info for some builtin
functions). (kostyantyn dot lysyy at oracle dot com)
. Fixed bug #68976 (Use After Free Vulnerability in unserialize()).
(CVE-2015-2787) (Stas)
. Fixed bug #68976 (Use After Free Vulnerability in unserialize()). (Stas)
. Fixed bug #69134 (Per Directory Values overrides PHP_INI_SYSTEM
configuration options). (Anatol Belski)
. Fixed bug #69207 (move_uploaded_file allows nulls in path). (CVE-2015-2348)
(Stas)
. Fixed bug #69207 (move_uploaded_file allows nulls in path). (Stas)
- CGI:
. Fixed bug #69015 (php-cgi's getopt does not see $argv). (Laruence)
@@ -461,7 +36,7 @@ PHP NEWS
by libcurl. (Linus Unneback)
- Ereg:
. Fixed bug #69248 (heap overflow vulnerability in regcomp.c). (CVE-2015-2305) (Stas)
. Fixed bug #69248 (heap overflow vulnerability in regcomp.c). (Stas)
- FPM:
. Fixed bug #68822 (request time is reset too early). (honghu069 at 163 dot com)
@@ -487,8 +62,7 @@ PHP NEWS
- SOAP:
. Fixed bug #69085 (SoapClient's __call() type confusion through
unserialize()). (CVE-2015-4147, CVE-2015-4148)
(andrea dot palazzo at truel dot it, Laruence)
unserialize()). (andrea dot palazzo at truel dot it, Laruence)
- SPL:
. Fixed bug #69108 ("Segmentation fault" when (de)serializing
@@ -498,7 +72,7 @@ PHP NEWS
- ZIP:
. Fixed bug #69253 (ZIP Integer Overflow leads to writing past heap
boundary). (CVE-2015-2331) (Stas)
boundary) (CVE-2015-2331). (Stas)
19 Feb 2015, PHP 5.5.22
@@ -521,7 +95,7 @@ PHP NEWS
- Enchant:
. Fixed bug #68552 (heap buffer overflow in enchant_broker_request_dict()).
(CVE-2014-9705) (Antony)
(Antony)
- Fileinfo:
. Fixed bug #68827 (Double free with disabled ZMM). (Joshua Rogers)
@@ -540,8 +114,7 @@ PHP NEWS
named pipes). (steffenb198 at aol dot com)
- Phar:
. Fixed bug #68901 (use after free). (CVE-2015-2301)
(bugreports at internot dot info)
. Fixed bug #68901 (use after free). (bugreports at internot dot info)
- Pgsql:
. Fixed Bug #65199 'pg_copy_from() modifies input array variable). (Yasuo)
@@ -602,7 +175,7 @@ PHP NEWS
CURLOPT_RETURNTRANSFER isn't set). (Jille Timmermans)
- EXIF:
. Fixed bug #68799 (Free called on uninitialized pointer). (CVE-2015-0232)
. Fixed bug #68799 (Free called on unitialized pointer). (CVE-2015-0232)
(Stas)
- Fileinfo:
@@ -610,15 +183,14 @@ PHP NEWS
(Joshua Rogers, Anatol Belski)
. Removed readelf.c and related code from libmagic sources
(Remi, Anatol)
. Fixed bug #68735 (fileinfo out-of-bounds memory access). (CVE-2014-9652)
. Fixed bug #68735 (fileinfo out-of-bounds memory access).
(Anatol)
- FPM:
. Fixed bug #68751 (listen.allowed_clients is broken). (Remi)
- GD:
. Fixed bug #68601 (buffer read overflow in gd_gif_in.c). (CVE-2014-9709)
(Jan Bee, Remi)
. Fixed bug #68601 (buffer read overflow in gd_gif_in.c). (Jan Bee, Remi)
- Mbstring:
. Fixed bug #68504 (--with-libmbfl configure option not present on Windows).
+6 -6
View File
@@ -12,7 +12,7 @@ Collaboration is a Good Thing(tm), and Git lets us do this. Thus, following
some basic rules with regards to Git usage will::
a. Make everybody happier, especially those responsible for maintaining
PHP itself.
Git itself.
b. Keep the changes consistently well documented and easily trackable.
@@ -48,11 +48,11 @@ Currently we have the following branches in use::
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.5 Is used to release the PHP 5.5.x series. This is an old
stable version and is open for security fixes only.
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.4 Is used to release the PHP 5.4.x series. This is an old
stable version and is open for security fixes only.
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.3 This branch is closed.
@@ -67,7 +67,7 @@ Currently we have the following branches in use::
The next few rules are more of a technical nature::
1. All changes should first go to the lowest branch (i.e. 5.6) and then
1. All changes should first go to the lowest branch (i.e. 5.4) and then
get merged up to all other branches. If a change is not needed for
later branches (i.e. fixes for features which where dropped from later
branches) an empty merge should be done.
+4 -14
View File
@@ -213,14 +213,12 @@ Getting the stable release announced
c. ``$PHP_X_MD5`` array and update all the md5 sums
d. ``$PHP_X_SHA256`` array and update all the SHA256 sums
d. set ``$PHP_X_RC`` to false!
e. set ``$PHP_X_RC`` to false!
f. Make sure there are no outdated "notes" or edited "date" keys in the
e. Make sure there are no outdated "notes" or edited "date" keys in the
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
g. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
3. Create the release file (releases/x_y_z.php)
Usually we use the same content as for point 6, but included in php template
@@ -269,9 +267,6 @@ to upgrade.
9. Wait an hour or two, then send a mail to php-announce@lists.php.net,
php-general@lists.php.net and internals@lists.php.net with a text similar to
http://news.php.net/php.internals/17222.
Please make sure that the mail to php-announce@ is its own completely seperate email.
This is to make sure that repiles to the announcement on php-general@ or internals@
will not accidentally hit the php-announce@ mailinglist.
Re-releasing the same version (or -pl)
--------------------------------------
@@ -288,9 +283,7 @@ Re-releasing the same version (or -pl)
d. ``$PHP_X_MD5`` array and update all the md5 sums
e. ``$PHP_X_SHA256`` array and update all the SHA256 sums
f. Make sure there are no outdated "notes" or edited "date" keys in the
e. Make sure there are no outdated "notes" or edited "date" keys in the
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
3. Add a short notice to phpweb stating that there is a new release, and
@@ -307,6 +300,3 @@ to upgrade.
5. Wait an hour or two, then send a mail to php-announce@lists.php.net,
php-general@lists.php.net and internals@lists.php.net with a text similar to
the news entry.
Please make sure that the mail to php-announce@ is its own completely seperate email.
This is to make sure that repiles to the announcement on php-general@ or internals@
will not accidentally hit the php-announce@ mailinglist.
+1 -1
View File
@@ -251,7 +251,7 @@ CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){
}
dwRet = pGetFinalPathNameByHandle(hFile, target, MAXPATHLEN, VOLUME_NAME_DOS);
if(dwRet >= MAXPATHLEN || dwRet == 0) {
if(dwRet >= MAXPATHLEN) {
return -1;
}
-1
View File
@@ -408,7 +408,6 @@ None
- cURL:
- Added CURLOPT_SAFE_UPLOAD to be used with curl_setopt().
- Added CURL_WRAPPERS_ENABLED to reflect --with-curlwrappers.
- Added CURL_HTTP_VERSION_2_0 and CURL_VERSION_HTTP2 in 5.5.24+.
- GD
- Added constants for imageflip:
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #43201 (Crash on using uninitialized vals and __get/__set)
Bug #43201 (Crash on using unitialized vals and __get/__set)
--FILE--
<?php
class Foo {
+5 -3
View File
@@ -1,5 +1,7 @@
--TEST--
Bug #63336 (invalid E_NOTICE error occur)
--XFAIL--
Bug is not fixed yet
--FILE--
<?php
error_reporting(E_ALL | E_NOTICE );
@@ -16,7 +18,7 @@ class Child extends Base {
public function bar($var, $more=self::DUMMY) { return true; }
}
?>
--EXPECTF--
Strict Standards: Declaration of Child::foo() should be compatible with Base::foo($var = TEST, $more = NULL) in %sbug63336.php on line %d
--EXPECT--
Strict Standards: Declaration of Child::foo() should be compatible with Base::foo($var = '123', $more = NULL) in %sbug63336.php on line %d
Strict Standards: Declaration of Child::bar() should be compatible with Base::bar($more = self::DUMMY) in %sbug63336.php on line %d
Strict Standards: Declaration of Child::bar() should be compatible with Base::bar($var, $more = 'XXX') in %sbug63336.php on line %d
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Bug #66609 (php crashes with __get() and ++ operator in some cases)
--FILE--
<?php
$bar = new Bar;
$foo = new Foo;
class Bar {
public function __get($x) {
global $foo;
return $foo->foo;
}
}
class Foo {
public function __get($x) {
global $bar;
return $bar->bar;
}
}
$foo->blah += 1; //crash
++$foo->blah; //crash
$foo->blah++; //crash
$foo->blah--; //crash
--$foo->blah; //crash
echo "okey";
?>
--EXPECTF--
Notice: Undefined property: Bar::$bar in %sbug66609.php on line %d
okey
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #67314 (Segmentation fault in gc_remove_zval_from_buffer)
--FILE--
<?php
function crash()
{
$notDefined[$i] = 'test';
}
function error_handler() { return false; }
set_error_handler('error_handler');
crash();
echo "made it once\n";
crash();
echo "ok\n";
--EXPECTF--
Notice: Undefined variable: i in %sbug67314.php on line 4
made it once
Notice: Undefined variable: i in %sbug67314.php on line 4
ok
+1 -1
View File
@@ -2,7 +2,7 @@
bug67436: Autoloader isn't called if user defined error handler is present
--INI--
error_reporting=-1
error_reporting=
--FILE--
<?php
-40
View File
@@ -1,40 +0,0 @@
--TEST--
Bug #68652 (segmentation fault in destructor)
--FILE--
<?php
class Foo {
private static $instance;
public static function getInstance() {
if (isset(self::$instance)) {
return self::$instance;
}
return self::$instance = new self();
}
public function __destruct() {
Bar::getInstance();
}
}
class Bar {
private static $instance;
public static function getInstance() {
if (isset(self::$instance)) {
return self::$instance;
}
return self::$instance = new self();
}
public function __destruct() {
Foo::getInstance();
}
}
$foo = new Foo();
?>
--EXPECTF--
Fatal error: Access to undeclared static property: Bar::$instance in %sbug68652.php on line %d
-43
View File
@@ -1,43 +0,0 @@
--TEST--
Bug #69212: Leaking VIA_HANDLER func when exception thrown in __call/... arg passing
--FILE--
<?php
class Test {
public static function __callStatic($method, $args) {}
public function __call($method, $args) {}
}
function do_throw() { throw new Exception; }
try {
Test::foo(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
(new Test)->bar(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
$f = function () {};
$f->__invoke(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
$t = new Test;
$f->__invoke($t->bar(Test::foo(do_throw())));
} catch (Exception $e) {
echo "Caught!\n";
}
?>
--EXPECT--
Caught!
Caught!
Caught!
Caught!
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #69221: Segmentation fault when using a generator in combination with an Iterator
--FILE--
<?php
function gen() {
yield 1;
};
$gen1 = gen();
$gen2 = (object) $gen1;
foreach ($gen1 as $v1) {
foreach ($gen2 as $v2) {
break 2;
}
}
unset($gen1);
foreach ($gen2 as $v) { var_dump($v); }
?>
--EXPECTF--
int(1)
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #69221: Segmentation fault when using a generator in combination with an Iterator (2)
--FILE--
<?php
$gen = function() {
yield 1;
};
$iter = new IteratorIterator($gen());
$ngen = $iter->getInnerIterator();
var_dump(iterator_to_array($ngen, false));
?>
--EXPECT--
array(1) {
[0]=>
int(1)
}
-30
View File
@@ -1,30 +0,0 @@
--TEST--
Bug #69420 (Invalid read in zend_std_get_method)
--FILE--
<?php
trait T {
protected function test() {
echo "okey";
}
}
class A {
protected function test() {
}
}
class B extends A {
use T;
public function foo() {
$this->test();
}
}
$b = new B();
$b->foo();
?>
--EXPECT--
okey
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Bug #69467 (Wrong checked for the interface by using Trait)
--FILE--
<?php
interface Baz {
public function bad();
}
trait Bar{
protected function bad(){}
}
class Foo implements Baz{
use Bar;
}
$test = new Foo();
var_dump($test instanceof Baz);
?>
--EXPECTF--
Fatal error: Access level to Bar::bad() must be public (as in class Baz) in %sbug69467.php on line %d
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #69551 - parse_ini_file() and parse_ini_string() segmentation fault
--FILE--
<?php
$ini = <<<INI
[Network.eth0]
SubnetMask = "
"
INI;
$settings = parse_ini_string($ini, false, INI_SCANNER_RAW);
var_dump($settings);
?>
--EXPECTF--
Warning: syntax error, unexpected '"' in Unknown on line %d
in %s on line %d
bool(false)
-30
View File
@@ -1,30 +0,0 @@
--TEST--
Bug #69732 (can induce segmentation fault with basic php code)
--FILE--
<?php
class wpq {
private $unreferenced;
public function __get($name) {
return $this->$name . "XXX";
}
}
function ret_assoc() {
$x = "XXX";
return array('foo' => 'bar', $x);
}
$wpq = new wpq;
$wpq->interesting =& ret_assoc();
$x = $wpq->interesting;
printf("%s\n", $x);
--EXPECTF--
Notice: Undefined property: wpq::$interesting in %sbug69732.php on line 6
Notice: Indirect modification of overloaded property wpq::$interesting has no effect in %sbug69732.php on line 16
Strict Standards: Only variables should be assigned by reference in %sbug69732.php on line 16
Notice: Undefined property: wpq::$interesting in %sbug69732.php on line 6
XXX
-10
View File
@@ -1,10 +0,0 @@
--TEST--
Bug #69892: Different arrays compare indentical due to integer key truncation
--SKIPIF--
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
--FILE--
<?php
var_dump([0 => 0] === [0x100000000 => 0]);
?>
--EXPECT--
bool(false)
-9
View File
@@ -1,9 +0,0 @@
--TEST--
Bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
--FILE--
<?php
unserialize('O:12:"DateInterval":1:{s:4:"days";O:9:"Exception":7:{s:10:"'."\0".'*'."\0".'message";s:1:"x";s:17:"'."\0".'Exception'."\0".'string";s:1:"A";s:7:"'."\0".'*'."\0".'code";i:0;s:7:"'."\0".'*'."\0".'file";s:1:"a";s:7:"'."\0".'*'."\0".'line";i:1337;s:16:"'."\0".'Exception'."\0".'trace";a:0:{}s:19:"'."\0".'Exception'."\0".'previous";O:8:"stdClass":0:{}}}');
?>
OK
--EXPECT--
OK
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #69419: Returning compatible sub generator produces a warning
--FILE--
<?php
function & genRefInner() {
$var = 1;
yield $var;
}
function & genRefOuter() {
return genRefInner();
}
foreach(genRefOuter() as $i) {
var_dump($i);
}
?>
--EXPECTF--
Notice: Only variable references should be returned by reference in %s on line %d
int(1)
-2
View File
@@ -3,8 +3,6 @@
--FILE--
<?php
use A;
use \B;
--EXPECTF--
Warning: The use statement with non-compound name 'A' has no effect in %sns_033.php on line 2
Warning: The use statement with non-compound name 'B' has no effect in %sns_033.php on line 3
+13 -13
View File
@@ -678,7 +678,7 @@ static inline unsigned int zend_mm_high_bit(size_t _size)
__asm {
bsr eax, _size
}
#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__) || defined(__powerpc__))
#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
return (8 * SIZEOF_SIZE_T - 1) - __builtin_clzl(_size);
#else
unsigned int n = 0;
@@ -706,7 +706,7 @@ static inline unsigned int zend_mm_low_bit(size_t _size)
__asm {
bsf eax, _size
}
#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__) || defined(__powerpc__))
#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
return __builtin_ctzl(_size);
#else
static const int offset[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
@@ -984,7 +984,7 @@ static void zend_mm_random(unsigned char *buf, size_t size) /* {{{ */
int has_context = 0;
if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) {
/* Could mean that the key container does not exist, let try
/* Could mean that the key container does not exist, let try
again by asking for a new one */
if (GetLastError() == NTE_BAD_KEYSET) {
if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
@@ -1348,7 +1348,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE
}
if (!silent) {
TSRMLS_FETCH();
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
zend_debug_alloc_output("---------------------------------------\n");
zend_debug_alloc_output("%s(%d) : Block "PTR_FMT" status:\n" ZEND_FILE_LINE_RELAY_CC, ptr);
@@ -2175,7 +2175,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
#if ZEND_MM_CACHE
if (ZEND_MM_SMALL_SIZE(true_size)) {
size_t index = ZEND_MM_BUCKET_INDEX(true_size);
if (heap->cache[index] != NULL) {
zend_mm_free_block *best_fit;
zend_mm_free_block **cache;
@@ -2188,7 +2188,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
heap->cache[index] = best_fit->prev_free_block;
ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
ptr = ZEND_MM_DATA_OF(best_fit);
#if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
@@ -2470,7 +2470,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
: "%0"(res),
"rm"(size),
"rm"(offset));
if (UNEXPECTED(overflow)) {
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
return 0;
@@ -2619,7 +2619,7 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
size_t length;
int length;
char *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
@@ -2627,13 +2627,13 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
HANDLE_BLOCK_INTERRUPTIONS();
length = strlen(s);
p = (char *) _emalloc(safe_address(length, 1, 1) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
length = strlen(s)+1;
p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
if (UNEXPECTED(p == NULL)) {
HANDLE_UNBLOCK_INTERRUPTIONS();
return p;
}
memcpy(p, s, length+1);
memcpy(p, s, length);
HANDLE_UNBLOCK_INTERRUPTIONS();
return p;
}
@@ -2647,7 +2647,7 @@ ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_
HANDLE_BLOCK_INTERRUPTIONS();
p = (char *) _emalloc(safe_address(length, 1, 1) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
if (UNEXPECTED(p == NULL)) {
HANDLE_UNBLOCK_INTERRUPTIONS();
return p;
@@ -2668,7 +2668,7 @@ ZEND_API char *zend_strndup(const char *s, uint length)
HANDLE_BLOCK_INTERRUPTIONS();
p = (char *) malloc(safe_address(length, 1, 1));
p = (char *) malloc(length+1);
if (UNEXPECTED(p == NULL)) {
HANDLE_UNBLOCK_INTERRUPTIONS();
return p;
+4 -6
View File
@@ -3912,8 +3912,7 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const
}
zend_hash_quick_update(*overriden, arKey, nKeyLength, h, fn, sizeof(zend_function), (void**)&fn);
return;
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT &&
(existing_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0) {
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the trait method is compatible with previosly declared abstract method */
if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
@@ -3943,7 +3942,6 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const
/* inherited members are overridden by members inserted by traits */
/* check whether the trait method fulfills the inheritance requirements */
do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
fn->common.prototype = NULL;
}
}
@@ -3962,7 +3960,7 @@ static int zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce TSRML
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
}
if (fn->type == ZEND_USER_FUNCTION && fn->op_array.static_variables) {
if (fn->op_array.static_variables) {
ce->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
}
}
@@ -7016,7 +7014,7 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC
}
/* }}} */
void zend_do_use(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
{
char *lcname;
zval *name, *ns, tmp;
@@ -7044,7 +7042,7 @@ void zend_do_use(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
} else {
*name = *ns;
zval_copy_ctor(name);
warn = !CG(current_namespace);
warn = !is_global && !CG(current_namespace);
}
}
+1 -1
View File
@@ -635,7 +635,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
void zend_do_begin_namespace(const znode *name, zend_bool with_brackets TSRMLS_DC);
void zend_do_end_namespace(TSRMLS_D);
void zend_verify_namespace(TSRMLS_D);
void zend_do_use(znode *name, znode *new_name TSRMLS_DC);
void zend_do_use(znode *name, znode *new_name, int is_global TSRMLS_DC);
void zend_do_end_compilation(TSRMLS_D);
void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static TSRMLS_DC);
+9 -42
View File
@@ -41,7 +41,7 @@ void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
if (exception == add_previous || !add_previous || !exception) {
return;
}
if (Z_TYPE_P(add_previous) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
if (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
zend_error(E_ERROR, "Cannot set non exception as previous exception");
return;
}
@@ -218,33 +218,6 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
/* {{{ proto Exception::__wakeup()
Exception unserialize checks */
#define CHECK_EXC_TYPE(name, type) \
value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
if(value && Z_TYPE_P(value) != type) { \
zval *tmp; \
MAKE_STD_ZVAL(tmp); \
ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
zval_ptr_dtor(&tmp); \
}
ZEND_METHOD(exception, __wakeup)
{
zval *value;
zval *object = getThis();
HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
CHECK_EXC_TYPE("message", IS_STRING);
CHECK_EXC_TYPE("string", IS_STRING);
CHECK_EXC_TYPE("code", IS_LONG);
CHECK_EXC_TYPE("file", IS_STRING);
CHECK_EXC_TYPE("line", IS_LONG);
CHECK_EXC_TYPE("trace", IS_ARRAY);
CHECK_EXC_TYPE("previous", IS_OBJECT);
}
/* }}} */
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -613,15 +586,11 @@ ZEND_METHOD(exception, getTraceAsString)
int res_len = 0, *len = &res_len, num = 0;
DEFAULT_0_PARAMS;
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
if (Z_TYPE_P(trace) != IS_ARRAY) {
RETURN_FALSE;
}
res = estrdup("");
str = &res;
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num);
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
@@ -629,8 +598,8 @@ ZEND_METHOD(exception, getTraceAsString)
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
efree(s_tmp);
res[res_len] = '\0';
RETURN_STRINGL(res, res_len, 0);
res[res_len] = '\0';
RETURN_STRINGL(res, res_len, 0);
}
/* }}} */
@@ -667,15 +636,15 @@ ZEND_METHOD(exception, __toString)
int len = 0;
zend_fcall_info fci;
zval fname;
DEFAULT_0_PARAMS;
str = estrndup("", 0);
exception = getThis();
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1);
while (exception && Z_TYPE_P(exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(exception), default_exception_ce TSRMLS_CC)) {
while (exception && Z_TYPE_P(exception) == IS_OBJECT) {
prev_str = str;
_default_exception_get_entry(exception, "message", sizeof("message")-1, &message TSRMLS_CC);
_default_exception_get_entry(exception, "file", sizeof("file")-1, &file TSRMLS_CC);
@@ -685,7 +654,6 @@ ZEND_METHOD(exception, __toString)
convert_to_string(&file);
convert_to_long(&line);
trace = NULL;
fci.size = sizeof(fci);
fci.function_table = &Z_OBJCE_P(exception)->function_table;
fci.function_name = &fname;
@@ -698,7 +666,7 @@ ZEND_METHOD(exception, __toString)
zend_call_function(&fci, NULL TSRMLS_CC);
if (trace && Z_TYPE_P(trace) != IS_STRING) {
if (Z_TYPE_P(trace) != IS_STRING) {
zval_ptr_dtor(&trace);
trace = NULL;
}
@@ -755,7 +723,6 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
-4
View File
@@ -1690,10 +1690,6 @@ ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
ex->symbol_table = EG(active_symbol_table);
for (i = 0; i < ex->op_array->last_var; i++) {
if (*EX_CV_NUM(ex, i)) {
if (UNEXPECTED(**EX_CV_NUM(ex, i) == &EG(uninitialized_zval))) {
Z_DELREF(EG(uninitialized_zval));
ALLOC_INIT_ZVAL(**EX_CV_NUM(ex, i));
}
zend_hash_quick_update(EG(active_symbol_table),
ex->op_array->vars[i].name,
ex->op_array->vars[i].name_len + 1,
+7 -2
View File
@@ -147,6 +147,8 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
GC_BENCH_INC(zval_possible_root);
if (GC_ZVAL_GET_COLOR(zv) != GC_PURPLE) {
GC_ZVAL_SET_PURPLE(zv);
if (!GC_ZVAL_ADDRESS(zv)) {
gc_root_buffer *newRoot = GC_G(unused);
@@ -157,6 +159,7 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
GC_G(first_unused)++;
} else {
if (!GC_G(gc_enabled)) {
GC_ZVAL_SET_BLACK(zv);
return;
}
zv->refcount__gc++;
@@ -166,10 +169,10 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
if (!newRoot) {
return;
}
GC_ZVAL_SET_PURPLE(zv);
GC_G(unused) = newRoot->prev;
}
GC_ZVAL_SET_PURPLE(zv);
newRoot->next = GC_G(roots).next;
newRoot->prev = &GC_G(roots);
GC_G(roots).next->prev = newRoot;
@@ -200,6 +203,7 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC)
obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zv)].bucket.obj;
if (GC_GET_COLOR(obj->buffered) != GC_PURPLE) {
GC_SET_PURPLE(obj->buffered);
if (!GC_ADDRESS(obj->buffered)) {
gc_root_buffer *newRoot = GC_G(unused);
@@ -210,6 +214,7 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC)
GC_G(first_unused)++;
} else {
if (!GC_G(gc_enabled)) {
GC_ZVAL_SET_BLACK(zv);
return;
}
zv->refcount__gc++;
@@ -220,10 +225,10 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC)
return;
}
obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zv)].bucket.obj;
GC_SET_PURPLE(obj->buffered);
GC_G(unused) = newRoot->prev;
}
GC_SET_PURPLE(obj->buffered);
newRoot->next = GC_G(roots).next;
newRoot->prev = &GC_G(roots);
GC_G(roots).next->prev = newRoot;
+4 -4
View File
@@ -605,9 +605,9 @@ ZEND_METHOD(Generator, __wakeup)
static void zend_generator_iterator_dtor(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
{
zend_generator_iterator *iter = (zend_generator_iterator *) iterator;
zval *object = ((zend_generator_iterator *) iterator)->object;
zend_objects_store_del_ref_by_handle(iter->handle TSRMLS_CC);
zval_ptr_dtor(&object);
}
/* }}} */
@@ -699,8 +699,8 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob
/* We have to keep a reference to the generator object zval around,
* otherwise the generator may be destroyed during iteration. */
iterator->handle = Z_OBJ_HANDLE_P(object);
zend_objects_store_add_ref_by_handle(iterator->handle TSRMLS_CC);
Z_ADDREF_P(object);
iterator->object = object;
return (zend_object_iterator *) iterator;
}
+3 -3
View File
@@ -28,9 +28,9 @@ extern ZEND_API zend_class_entry *zend_ce_generator;
typedef struct _zend_generator_iterator {
zend_object_iterator intern;
/* The generator object handle has to be stored, because the
* iterator is holding a ref to it, which has to be dtored. */
zend_object_handle handle;
/* The generator object zval has to be stored, because the iterator is
* holding a ref to it, which has to be dtored. */
zval *object;
} zend_generator_iterator;
typedef struct _zend_generator {
+3 -2
View File
@@ -1534,10 +1534,11 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
}
if (ordered) {
if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
if (p1->h != p2->h) {
result = p1->h - p2->h;
if (result!=0) {
HASH_UNPROTECT_RECURSION(ht1);
HASH_UNPROTECT_RECURSION(ht2);
return p1->h > p2->h ? 1 : -1;
return result;
}
} else { /* string indices */
result = p1->nKeyLength - p2->nKeyLength;
+1 -1
View File
@@ -1926,7 +1926,7 @@ end_raw_value_chars:
}
/* Eat leading and trailing double quotes */
if (yyleng > 1 && yytext[0] == '"' && yytext[yyleng - 1] == '"') {
if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
SCNG(yy_text)++;
yyleng = yyleng - 2;
} else if (sc) {
+1 -1
View File
@@ -472,7 +472,7 @@ end_raw_value_chars:
}
/* Eat leading and trailing double quotes */
if (yyleng > 1 && yytext[0] == '"' && yytext[yyleng - 1] == '"') {
if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
SCNG(yy_text)++;
yyleng = yyleng - 2;
} else if (sc) {
+4 -4
View File
@@ -249,10 +249,10 @@ use_declarations:
;
use_declaration:
namespace_name { zend_do_use(&$1, NULL TSRMLS_CC); }
| namespace_name T_AS T_STRING { zend_do_use(&$1, &$3 TSRMLS_CC); }
| T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL TSRMLS_CC); }
| T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4 TSRMLS_CC); }
namespace_name { zend_do_use(&$1, NULL, 0 TSRMLS_CC); }
| namespace_name T_AS T_STRING { zend_do_use(&$1, &$3, 0 TSRMLS_CC); }
| T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL, 1 TSRMLS_CC); }
| T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4, 1 TSRMLS_CC); }
;
constant_declaration:
+7 -7
View File
@@ -162,16 +162,16 @@ static inline void cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
zend_hash_apply(&ce->function_table, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
}
if (ce->static_members_table) {
zval **static_members = ce->static_members_table;
int count = ce->default_static_members_count;
int i;
ce->default_static_members_count = 0;
ce->default_static_members_table = ce->static_members_table = NULL;
for (i = 0; i < count; i++) {
zval_ptr_dtor(&static_members[i]);
for (i = 0; i < ce->default_static_members_count; i++) {
if (ce->static_members_table[i]) {
zval *p = ce->static_members_table[i];
ce->static_members_table[i] = NULL;
zval_ptr_dtor(&p);
}
}
efree(static_members);
ce->static_members_table = NULL;
}
}
+2 -7
View File
@@ -1319,19 +1319,14 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{
zend_error(E_ERROR, "String size overflow");
}
Z_STRVAL_P(result) = safe_erealloc(Z_STRVAL_P(result), res_len, 1, 1);
Z_STRVAL_P(result) = erealloc(Z_STRVAL_P(result), res_len+1);
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(result), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
Z_STRVAL_P(result)[res_len]=0;
Z_STRLEN_P(result) = res_len;
} else {
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
char *buf;
if (Z_STRLEN_P(op1) < 0 || Z_STRLEN_P(op2) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) {
zend_error(E_ERROR, "String size overflow");
}
buf = (char *) safe_emalloc(length, 1, 1);
char *buf = (char *) emalloc(length + 1);
memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
+11 -24
View File
@@ -380,7 +380,6 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -423,7 +422,6 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (IS_OP2_TMP_FREE()) {
@@ -642,10 +640,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -662,7 +657,6 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -747,10 +741,9 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -769,7 +762,6 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -1762,9 +1754,7 @@ ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV)
}
}
if (OP1_TYPE == IS_VAR && OP1_FREE) {
zval_ptr_dtor(&value);
}
FREE_OP1_VAR_PTR();
/* zend_assign_to_variable() always takes care of op2, never free it! */
FREE_OP2_IF_VAR();
@@ -1998,12 +1988,13 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EX_T(opline->result.var).var.ptr = NULL;
}
} else if (fbc->type == ZEND_USER_FUNCTION) {
temp_variable *ret = &EX_T(opline->result.var);
EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_symbol_table) = NULL;
EG(active_op_array) = &fbc->op_array;
EG(return_value_ptr_ptr) = NULL;
if (RETURN_VALUE_USED(opline)) {
temp_variable *ret = &EX_T(opline->result.var);
ret->var.ptr = NULL;
EG(return_value_ptr_ptr) = &ret->var.ptr;
ret->var.ptr_ptr = &ret->var.ptr;
@@ -2012,8 +2003,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
if (RETURN_VALUE_USED(opline)) {
ret->var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
ret->var.fcall_returned_reference = 0;
EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
}
} else if (EXPECTED(zend_execute_ex == execute_ex)) {
if (EXPECTED(EG(exception) == NULL)) {
@@ -5044,10 +5034,6 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
}
zval_ptr_dtor(&call->object);
}
if (call->fbc->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
efree((char *) call->fbc->common.function_name);
efree(call->fbc);
}
call--;
} while (call >= EX(call_slots));
EX(call) = NULL;
@@ -5193,6 +5179,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
{
USE_OPLINE
zend_function *op_array;
int closure_is_static, closure_is_being_defined_inside_static_context;
SAVE_OPLINE();
@@ -5201,9 +5188,9 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
}
if (UNEXPECTED((op_array->common.fn_flags & ZEND_ACC_STATIC) ||
(EX(prev_execute_data) &&
EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC))) {
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC;
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC;
if (closure_is_static || closure_is_being_defined_inside_static_context) {
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC);
} else {
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);
+47 -176
View File
@@ -559,12 +559,13 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
EX_T(opline->result.var).var.ptr = NULL;
}
} else if (fbc->type == ZEND_USER_FUNCTION) {
temp_variable *ret = &EX_T(opline->result.var);
EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_symbol_table) = NULL;
EG(active_op_array) = &fbc->op_array;
EG(return_value_ptr_ptr) = NULL;
if (RETURN_VALUE_USED(opline)) {
temp_variable *ret = &EX_T(opline->result.var);
ret->var.ptr = NULL;
EG(return_value_ptr_ptr) = &ret->var.ptr;
ret->var.ptr_ptr = &ret->var.ptr;
@@ -573,8 +574,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
if (RETURN_VALUE_USED(opline)) {
ret->var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
ret->var.fcall_returned_reference = 0;
EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
}
} else if (EXPECTED(zend_execute_ex == execute_ex)) {
if (EXPECTED(EG(exception) == NULL)) {
@@ -1022,10 +1022,6 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
}
zval_ptr_dtor(&call->object);
}
if (call->fbc->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
efree((char *) call->fbc->common.function_name);
efree(call->fbc);
}
call--;
} while (call >= EX(call_slots));
EX(call) = NULL;
@@ -6494,6 +6490,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
{
USE_OPLINE
zend_function *op_array;
int closure_is_static, closure_is_being_defined_inside_static_context;
SAVE_OPLINE();
@@ -6502,9 +6499,9 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
}
if (UNEXPECTED((op_array->common.fn_flags & ZEND_ACC_STATIC) ||
(EX(prev_execute_data) &&
EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC))) {
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC;
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC;
if (closure_is_static || closure_is_being_defined_inside_static_context) {
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC);
} else {
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);
@@ -14159,7 +14156,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -14202,7 +14198,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -14420,10 +14415,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -14440,7 +14432,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -14525,10 +14516,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -14547,7 +14537,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -15307,9 +15296,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER
}
}
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
zval_ptr_dtor(&value);
}
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
/* zend_assign_to_variable() always takes care of op2, never free it! */
@@ -16678,7 +16665,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -16721,7 +16707,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (1) {
@@ -16940,10 +16925,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -16960,7 +16942,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -17045,10 +17026,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -17067,7 +17047,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -17664,9 +17643,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
}
}
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
zval_ptr_dtor(&value);
}
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
/* zend_assign_to_variable() always takes care of op2, never free it! */
@@ -18777,7 +18754,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -18820,7 +18796,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -19039,10 +19014,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -19059,7 +19031,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -19144,10 +19115,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -19166,7 +19136,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -19927,9 +19896,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
}
}
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
zval_ptr_dtor(&value);
}
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
/* zend_assign_to_variable() always takes care of op2, never free it! */
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
@@ -20983,7 +20950,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -21026,7 +20992,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -22417,7 +22382,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -22460,7 +22424,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -22678,10 +22641,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -22698,7 +22658,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -22783,10 +22742,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -22805,7 +22763,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -23401,9 +23358,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
}
}
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
zval_ptr_dtor(&value);
}
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
/* zend_assign_to_variable() always takes care of op2, never free it! */
@@ -24377,7 +24332,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -24420,7 +24374,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -24637,10 +24590,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -24657,7 +24607,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -24742,10 +24691,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -24764,7 +24712,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -25799,7 +25746,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -25842,7 +25788,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (1) {
@@ -26060,10 +26005,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -26080,7 +26022,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -26165,10 +26106,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -26187,7 +26127,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -27125,7 +27064,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -27168,7 +27106,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -27386,10 +27323,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -27406,7 +27340,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -27491,10 +27424,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -27513,7 +27445,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -28452,7 +28383,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -28495,7 +28425,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -28880,7 +28809,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -28923,7 +28851,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -29140,10 +29067,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -29160,7 +29084,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -29245,10 +29168,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -29267,7 +29189,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -31694,7 +31615,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -31737,7 +31657,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -31954,10 +31873,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -31974,7 +31890,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -32059,10 +31974,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -32081,7 +31995,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -32836,10 +32749,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_
}
}
if (IS_CV == IS_VAR && 0) {
zval_ptr_dtor(&value);
}
/* zend_assign_to_variable() always takes care of op2, never free it! */
CHECK_EXCEPTION();
@@ -33980,7 +33889,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -34023,7 +33931,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (1) {
@@ -34241,10 +34148,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -34261,7 +34165,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -34346,10 +34249,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -34368,7 +34270,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -34960,10 +34861,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
}
}
if (IS_CV == IS_VAR && 0) {
zval_ptr_dtor(&value);
}
/* zend_assign_to_variable() always takes care of op2, never free it! */
CHECK_EXCEPTION();
@@ -35943,7 +35840,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -35986,7 +35882,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -36204,10 +36099,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -36224,7 +36116,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -36309,10 +36200,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -36331,7 +36221,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -37087,10 +36976,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
}
}
if (IS_CV == IS_VAR && 0) {
zval_ptr_dtor(&value);
}
/* zend_assign_to_variable() always takes care of op2, never free it! */
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
@@ -38012,7 +37897,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -38055,7 +37939,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -39298,7 +39181,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
if (!have_get_ptr) {
zval *z = NULL;
Z_ADDREF_P(object);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -39341,7 +39223,6 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
EX_T(opline->result.var).var.ptr_ptr = NULL;
}
}
zval_ptr_dtor(&object);
}
if (0) {
@@ -39558,10 +39439,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -39578,7 +39456,6 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
incdec_op(z);
*retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
SELECTIVE_PZVAL_LOCK(*retval, opline);
zval_ptr_dtor(&z);
} else {
@@ -39663,10 +39540,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z, *z_copy;
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval *z_copy;
Z_ADDREF_P(object);
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -39685,7 +39561,6 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
incdec_op(z_copy);
Z_ADDREF_P(z);
Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(&z);
} else {
@@ -40276,10 +40151,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
}
if (IS_CV == IS_VAR && 0) {
zval_ptr_dtor(&value);
}
/* zend_assign_to_variable() always takes care of op2, never free it! */
CHECK_EXCEPTION();
+1 -1
View File
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=5
PHP_RELEASE_VERSION=35
PHP_RELEASE_VERSION=23
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`
+19 -41
View File
@@ -201,21 +201,6 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC)
}
/* }}} */
/* {{{ split_bc_num
Convert to bc_num detecting scale */
static bc_num split_bc_num(bc_num num) {
bc_num newnum;
if (num->n_refs >= 1) {
return num;
}
newnum = _bc_new_num_ex(0, 0, 0);
*newnum = *num;
newnum->n_refs = 1;
num->n_refs--;
return newnum;
}
/* }}} */
/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
Returns the sum of two arbitrary precision numbers */
PHP_FUNCTION(bcadd)
@@ -229,7 +214,7 @@ PHP_FUNCTION(bcadd)
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
if (argc == 3) {
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
}
@@ -240,12 +225,11 @@ PHP_FUNCTION(bcadd)
php_str2num(&first, left TSRMLS_CC);
php_str2num(&second, right TSRMLS_CC);
bc_add (first, second, &result, scale);
if (result->n_scale > scale) {
result = split_bc_num(result);
result->n_scale = scale;
}
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -269,7 +253,7 @@ PHP_FUNCTION(bcsub)
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
if (argc == 3) {
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
}
@@ -282,7 +266,6 @@ PHP_FUNCTION(bcsub)
bc_sub (first, second, &result, scale);
if (result->n_scale > scale) {
result = split_bc_num(result);
result->n_scale = scale;
}
@@ -309,11 +292,11 @@ PHP_FUNCTION(bcmul)
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
if (argc == 3) {
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
}
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
@@ -322,7 +305,6 @@ PHP_FUNCTION(bcmul)
bc_multiply (first, second, &result, scale TSRMLS_CC);
if (result->n_scale > scale) {
result = split_bc_num(result);
result->n_scale = scale;
}
@@ -349,11 +331,11 @@ PHP_FUNCTION(bcdiv)
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
if (argc == 3) {
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
}
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
@@ -363,7 +345,6 @@ PHP_FUNCTION(bcdiv)
switch (bc_divide(first, second, &result, scale TSRMLS_CC)) {
case 0: /* OK */
if (result->n_scale > scale) {
result = split_bc_num(result);
result->n_scale = scale;
}
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -393,13 +374,13 @@ PHP_FUNCTION(bcmod)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &left, &left_len, &right, &right_len) == FAILURE) {
return;
}
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
bc_str2num(&first, left, 0 TSRMLS_CC);
bc_str2num(&second, right, 0 TSRMLS_CC);
switch (bc_modulo(first, second, &result, 0 TSRMLS_CC)) {
case 0:
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -410,7 +391,7 @@ PHP_FUNCTION(bcmod)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
break;
}
bc_free_num(&first);
bc_free_num(&second);
bc_free_num(&result);
@@ -443,9 +424,8 @@ PHP_FUNCTION(bcpowmod)
scale_int = (int) ((int)scale < 0) ? 0 : scale;
if (bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC) != -1) {
if (result->n_scale > scale_int) {
result = split_bc_num(result);
result->n_scale = scale_int;
if (result->n_scale > scale) {
result->n_scale = scale;
}
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
@@ -453,7 +433,7 @@ PHP_FUNCTION(bcpowmod)
} else {
RETVAL_FALSE;
}
bc_free_num(&first);
bc_free_num(&second);
bc_free_num(&mod);
@@ -475,7 +455,7 @@ PHP_FUNCTION(bcpow)
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
if (argc == 3) {
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
}
@@ -488,7 +468,6 @@ PHP_FUNCTION(bcpow)
bc_raise (first, second, &result, scale TSRMLS_CC);
if (result->n_scale > scale) {
result = split_bc_num(result);
result->n_scale = scale;
}
@@ -515,17 +494,16 @@ PHP_FUNCTION(bcsqrt)
if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) {
return;
}
if (argc == 2) {
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
}
bc_init_num(&result TSRMLS_CC);
php_str2num(&result, left TSRMLS_CC);
if (bc_sqrt (&result, scale TSRMLS_CC) != 0) {
if (result->n_scale > scale) {
result = split_bc_num(result);
result->n_scale = scale;
}
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -553,7 +531,7 @@ PHP_FUNCTION(bccomp)
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
if (argc == 3) {
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
}
@@ -577,7 +555,7 @@ PHP_FUNCTION(bccomp)
PHP_FUNCTION(bcscale)
{
long new_scale;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_scale) == FAILURE) {
return;
}
-13
View File
@@ -1,13 +0,0 @@
--TEST--
Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition
--SKIPIF--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--FILE--
<?php
var_dump(bcpowmod(1, "A", 128, -200));
var_dump(bcpowmod(1, 1.2, 1, 1));
?>
--EXPECTF--
string(1) "1"
bc math warning: non-zero scale in exponent
string(3) "0.0"
-12
View File
@@ -858,9 +858,6 @@ PHP_MINIT_FUNCTION(curl)
/* Curl Http Version constants (CURLOPT_HTTP_VERSION) */
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_0);
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_1);
#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_2_0);
#endif
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_NONE);
/* Curl Lock constants */
@@ -890,9 +887,6 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_VERSION_KERBEROS4);
REGISTER_CURL_CONSTANT(CURL_VERSION_LIBZ);
REGISTER_CURL_CONSTANT(CURL_VERSION_SSL);
#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
REGISTER_CURL_CONSTANT(CURL_VERSION_HTTP2);
#endif
#if LIBCURL_VERSION_NUM >= 0x070a06 /* Available since 7.10.6 */
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
@@ -1354,7 +1348,6 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION");
length = -1;
} else if (retval_ptr) {
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
convert_to_long_ex(&retval_ptr);
}
@@ -1420,7 +1413,6 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION");
} else if (retval_ptr) {
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
convert_to_long_ex(&retval_ptr);
}
@@ -1499,7 +1491,6 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
} else if (retval_ptr) {
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
convert_to_long_ex(&retval_ptr);
}
@@ -1577,7 +1568,6 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
length = CURL_READFUNC_ABORT;
#endif
} else if (retval_ptr) {
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
if (Z_TYPE_P(retval_ptr) == IS_STRING) {
length = MIN((int) (size * nmemb), Z_STRLEN_P(retval_ptr));
memcpy(data, Z_STRVAL_P(retval_ptr), length);
@@ -1652,7 +1642,6 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION");
length = -1;
} else if (retval_ptr) {
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
convert_to_long_ex(&retval_ptr);
}
@@ -2856,7 +2845,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC)
curl_easy_setopt(ch->cp, CURLOPT_SHARE, sh->share);
}
}
break;
#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
case CURLOPT_FNMATCH_FUNCTION:
-45
View File
@@ -1,45 +0,0 @@
--TEST--
Bug #69316: Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEADER
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
function hdr_callback($ch, $data) {
// close the stream, causing the FILE structure to be free()'d
if($GLOBALS['f_file']) {
fclose($GLOBALS['f_file']); $GLOBALS['f_file'] = 0;
// cause an allocation of approx the same size as a FILE structure, size varies a bit depending on platform/libc
$FILE_size = (PHP_INT_SIZE == 4 ? 0x160 : 0x238);
curl_setopt($ch, CURLOPT_COOKIE, str_repeat("a", $FILE_size - 1));
}
return strlen($data);
}
include 'server.inc';
$host = curl_cli_server_start();
$temp_file = dirname(__FILE__) . '/body.tmp';
$url = "{$host}/get.php?test=getpost";
$ch = curl_init();
$f_file = fopen($temp_file, "w") or die("failed to open file\n");
curl_setopt($ch, CURLOPT_BUFFERSIZE, 10);
curl_setopt($ch, CURLOPT_HEADERFUNCTION, "hdr_callback");
curl_setopt($ch, CURLOPT_FILE, $f_file);
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
curl_close($ch);
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/body.tmp');
?>
--EXPECTF--
Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
array(1) {
["test"]=>
string(7) "getpost"
}
array(0) {
}
===DONE===
+27 -27
View File
@@ -115,7 +115,7 @@ static double astro_GMST0(double d)
/* time, imposing no runtime or code overhead. */
sidtim0 = astro_revolution((180.0 + 356.0470 + 282.9404) + (0.9856002585 + 4.70935E-5) * d);
return sidtim0;
}
}
/* This function computes the Sun's position at any instant */
@@ -177,32 +177,32 @@ static void astro_sun_RA_dec(double d, double *RA, double *dec, double *r)
/**
* Note: timestamp = unixtimestamp (NEEDS to be 00:00:00 UT)
* Eastern longitude positive, Western longitude negative
* Northern latitude positive, Southern latitude negative
* The longitude value IS critical in this function!
* altit = the altitude which the Sun should cross
* Set to -35/60 degrees for rise/set, -6 degrees
* for civil, -12 degrees for nautical and -18
* degrees for astronomical twilight.
* upper_limb: non-zero -> upper limb, zero -> center
* Set to non-zero (e.g. 1) when computing rise/set
* times, and to zero when computing start/end of
* twilight.
* *rise = where to store the rise time
* *set = where to store the set time
* Both times are relative to the specified altitude,
* and thus this function can be used to compute
* various twilight times, as well as rise/set times
* Return value: 0 = sun rises/sets this day, times stored at
* *trise and *tset.
* +1 = sun above the specified "horizon" 24 hours.
* *trise set to time when the sun is at south,
* minus 12 hours while *tset is set to the south
* time plus 12 hours. "Day" length = 24 hours
* -1 = sun is below the specified "horizon" 24 hours
* "Day" length = 0 hours, *trise and *tset are
* both set to the time when the sun is at south.
*
* Eastern longitude positive, Western longitude negative
* Northern latitude positive, Southern latitude negative
* The longitude value IS critical in this function!
* altit = the altitude which the Sun should cross
* Set to -35/60 degrees for rise/set, -6 degrees
* for civil, -12 degrees for nautical and -18
* degrees for astronomical twilight.
* upper_limb: non-zero -> upper limb, zero -> center
* Set to non-zero (e.g. 1) when computing rise/set
* times, and to zero when computing start/end of
* twilight.
* *rise = where to store the rise time
* *set = where to store the set time
* Both times are relative to the specified altitude,
* and thus this function can be used to compute
* various twilight times, as well as rise/set times
* Return value: 0 = sun rises/sets this day, times stored at
* *trise and *tset.
* +1 = sun above the specified "horizon" 24 hours.
* *trise set to time when the sun is at south,
* minus 12 hours while *tset is set to the south
* time plus 12 hours. "Day" length = 24 hours
* -1 = sun is below the specified "horizon" 24 hours
* "Day" length = 0 hours, *trise and *tset are
* both set to the time when the sun is at south.
*
*/
int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set, timelib_sll *ts_transit)
{
+1 -1
View File
@@ -136,7 +136,7 @@ void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d)
{
timelib_sll dow, day;
/* Figure out the dayofweek for y-1-1 */
dow = timelib_day_of_week(y, 1, 1);
/* then use that to figure out the offset for day 1 of week 1 */
+3 -3
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Tue Mar 31 16:32:03 2015 */
/* Generated by re2c 0.13.5 on Mon Aug 18 18:28:27 2014 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@@ -19864,9 +19864,9 @@ yy1315:
/* skip "last day of" or "first day of" */
if (*ptr == 'l' || *ptr == 'L') {
s->time->relative.first_last_day_of = TIMELIB_SPECIAL_LAST_DAY_OF_MONTH;
s->time->relative.first_last_day_of = 2;
} else {
s->time->relative.first_last_day_of = TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH;
s->time->relative.first_last_day_of = 1;
}
TIMELIB_DEINIT;
+12 -12
View File
@@ -677,7 +677,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
if (strcasecmp("utc", word) == 0 || strcasecmp("gmt", word) == 0) {
return timelib_timezone_utc;
}
for (tp = timelib_timezone_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
if (!first_found) {
@@ -808,7 +808,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
{
uchar *cursor = s->cur;
char *str, *ptr = NULL;
std:
s->tok = cursor;
s->len = 0;
@@ -1030,9 +1030,9 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
/* skip "last day of" or "first day of" */
if (*ptr == 'l' || *ptr == 'L') {
s->time->relative.first_last_day_of = TIMELIB_SPECIAL_LAST_DAY_OF_MONTH;
s->time->relative.first_last_day_of = 2;
} else {
s->time->relative.first_last_day_of = TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH;
s->time->relative.first_last_day_of = 1;
}
TIMELIB_DEINIT;
@@ -1437,7 +1437,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
w = timelib_get_nr((char **) &ptr, 2);
d = timelib_get_nr((char **) &ptr, 1);
@@ -1456,7 +1456,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
w = timelib_get_nr((char **) &ptr, 2);
d = 1;
@@ -1560,7 +1560,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
if (s->time->relative.weekday_behavior != 2) {
s->time->relative.weekday_behavior = 1;
}
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
@@ -1877,7 +1877,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
add_pbf_error(s, "A textual day could not be found", string, begin);
break;
} else {
in.time->have_relative = 1;
in.time->have_relative = 1;
in.time->relative.have_weekday_relative = 1;
in.time->relative.weekday = tmprel->multiplier;
in.time->relative.weekday_behavior = 1;
@@ -2148,13 +2148,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
/* do funky checking whether the parsed time was valid time */
if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
s->time->s != TIMELIB_UNSET &&
s->time->s != TIMELIB_UNSET &&
!timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
add_pbf_warning(s, "The parsed time was invalid", string, ptr);
}
/* do funky checking whether the parsed date was valid date */
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
!timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
add_pbf_warning(s, "The parsed date was invalid", string, ptr);
}
@@ -2227,7 +2227,7 @@ int main(void)
printf ("%04d-%02d-%02d %02d:%02d:%02d.%-5d %+04d %1d",
time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
if (time.have_relative) {
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s);
}
if (time.have_weekday_relative) {
@@ -2236,7 +2236,7 @@ int main(void)
if (time.have_weeknr_day) {
printf(" / %dW%d", time.relative.weeknr_day.weeknr, time.relative.weeknr_day.dayofweek);
}
return 0;
return 0;
}
#endif
+6 -6
View File
@@ -242,7 +242,7 @@ static int scan(Scanner *s)
{
uchar *cursor = s->cur;
char *str, *ptr = NULL;
std:
s->tok = cursor;
s->len = 0;
@@ -336,11 +336,11 @@ isoweek = year4 "-"? "W" weekofyear;
case 'D': s->period->d = nr; break;
case 'H': s->period->h = nr; break;
case 'S': s->period->s = nr; break;
case 'M':
case 'M':
if (in_time) {
s->period->i = nr;
} else {
s->period->m = nr;
s->period->m = nr;
}
break;
default:
@@ -398,9 +398,9 @@ isoweek = year4 "-"? "W" weekofyear;
/*!max:re2c */
void timelib_strtointerval(char *s, int len,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
void timelib_strtointerval(char *s, int len,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
struct timelib_error_container **errors)
{
Scanner in;
+71 -138
View File
@@ -36,7 +36,7 @@
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
# if defined(__LITTLE_ENDIAN__)
# undef WORDS_BIGENDIAN
# else
# else
# if defined(__BIG_ENDIAN__)
# define WORDS_BIGENDIAN
# endif
@@ -49,14 +49,11 @@
#define timelib_conv_int(l) ((l & 0x000000ff) << 24) + ((l & 0x0000ff00) << 8) + ((l & 0x00ff0000) >> 8) + ((l & 0xff000000) >> 24)
#endif
static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
{
uint32_t version;
/* read ID */
version = (*tzf)[3] - '0';
/* skip ID */
*tzf += 4;
/* read BC flag */
tz->bc = (**tzf == '\1');
*tzf += 1;
@@ -66,10 +63,8 @@ static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
tz->location.country_code[2] = '\0';
*tzf += 2;
/* skip rest of preamble */
/* skip read of preamble */
*tzf += 13;
return version;
}
static void read_header(const unsigned char **tzf, timelib_tzinfo *tz)
@@ -77,88 +72,65 @@ static void read_header(const unsigned char **tzf, timelib_tzinfo *tz)
uint32_t buffer[6];
memcpy(&buffer, *tzf, sizeof(buffer));
tz->bit32.ttisgmtcnt = timelib_conv_int(buffer[0]);
tz->bit32.ttisstdcnt = timelib_conv_int(buffer[1]);
tz->bit32.leapcnt = timelib_conv_int(buffer[2]);
tz->bit32.timecnt = timelib_conv_int(buffer[3]);
tz->bit32.typecnt = timelib_conv_int(buffer[4]);
tz->bit32.charcnt = timelib_conv_int(buffer[5]);
tz->ttisgmtcnt = timelib_conv_int(buffer[0]);
tz->ttisstdcnt = timelib_conv_int(buffer[1]);
tz->leapcnt = timelib_conv_int(buffer[2]);
tz->timecnt = timelib_conv_int(buffer[3]);
tz->typecnt = timelib_conv_int(buffer[4]);
tz->charcnt = timelib_conv_int(buffer[5]);
*tzf += sizeof(buffer);
}
static void skip_64bit_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
{
if (tz->bit64.timecnt) {
*tzf += (sizeof(int64_t) * tz->bit64.timecnt);
*tzf += (sizeof(unsigned char) * tz->bit64.timecnt);
}
}
static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
{
int32_t *buffer = NULL;
uint32_t i;
unsigned char *cbuffer = NULL;
if (tz->bit32.timecnt) {
buffer = (int32_t*) malloc(tz->bit32.timecnt * sizeof(int32_t));
if (tz->timecnt) {
buffer = (int32_t*) malloc(tz->timecnt * sizeof(int32_t));
if (!buffer) {
return;
}
memcpy(buffer, *tzf, sizeof(int32_t) * tz->bit32.timecnt);
*tzf += (sizeof(int32_t) * tz->bit32.timecnt);
for (i = 0; i < tz->bit32.timecnt; i++) {
memcpy(buffer, *tzf, sizeof(int32_t) * tz->timecnt);
*tzf += (sizeof(int32_t) * tz->timecnt);
for (i = 0; i < tz->timecnt; i++) {
buffer[i] = timelib_conv_int(buffer[i]);
}
cbuffer = (unsigned char*) malloc(tz->bit32.timecnt * sizeof(unsigned char));
cbuffer = (unsigned char*) malloc(tz->timecnt * sizeof(unsigned char));
if (!cbuffer) {
free(buffer);
return;
}
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit32.timecnt);
*tzf += sizeof(unsigned char) * tz->bit32.timecnt;
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->timecnt);
*tzf += sizeof(unsigned char) * tz->timecnt;
}
tz->trans = buffer;
tz->trans_idx = cbuffer;
}
static void skip_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
{
*tzf += sizeof(unsigned char) * 6 * tz->bit64.typecnt;
*tzf += sizeof(char) * tz->bit64.charcnt;
if (tz->bit64.leapcnt) {
*tzf += sizeof(int64_t) * tz->bit64.leapcnt * 2;
}
if (tz->bit64.ttisstdcnt) {
*tzf += sizeof(unsigned char) * tz->bit64.ttisstdcnt;
}
if (tz->bit64.ttisgmtcnt) {
*tzf += sizeof(unsigned char) * tz->bit64.ttisgmtcnt;
}
}
static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
{
unsigned char *buffer;
int32_t *leap_buffer;
unsigned int i, j;
buffer = (unsigned char*) malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
buffer = (unsigned char*) malloc(tz->typecnt * sizeof(unsigned char) * 6);
if (!buffer) {
return;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit32.typecnt);
*tzf += sizeof(unsigned char) * 6 * tz->bit32.typecnt;
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->typecnt);
*tzf += sizeof(unsigned char) * 6 * tz->typecnt;
tz->type = (ttinfo*) malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
tz->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
if (!tz->type) {
free(buffer);
return;
}
for (i = 0; i < tz->bit32.typecnt; i++) {
for (i = 0; i < tz->typecnt; i++) {
j = i * 6;
tz->type[i].offset = (buffer[j] * 16777216) + (buffer[j + 1] * 65536) + (buffer[j + 2] * 256) + buffer[j + 3];
tz->type[i].isdst = buffer[j + 4];
@@ -166,74 +138,62 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
}
free(buffer);
tz->timezone_abbr = (char*) malloc(tz->bit32.charcnt);
tz->timezone_abbr = (char*) malloc(tz->charcnt);
if (!tz->timezone_abbr) {
return;
}
memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit32.charcnt);
*tzf += sizeof(char) * tz->bit32.charcnt;
memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->charcnt);
*tzf += sizeof(char) * tz->charcnt;
if (tz->bit32.leapcnt) {
leap_buffer = (int32_t *) malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
if (tz->leapcnt) {
leap_buffer = (int32_t *) malloc(tz->leapcnt * 2 * sizeof(int32_t));
if (!leap_buffer) {
return;
}
memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->bit32.leapcnt * 2);
*tzf += sizeof(int32_t) * tz->bit32.leapcnt * 2;
memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->leapcnt * 2);
*tzf += sizeof(int32_t) * tz->leapcnt * 2;
tz->leap_times = (tlinfo*) malloc(tz->bit32.leapcnt * sizeof(tlinfo));
tz->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
if (!tz->leap_times) {
free(leap_buffer);
return;
}
for (i = 0; i < tz->bit32.leapcnt; i++) {
for (i = 0; i < tz->leapcnt; i++) {
tz->leap_times[i].trans = timelib_conv_int(leap_buffer[i * 2]);
tz->leap_times[i].offset = timelib_conv_int(leap_buffer[i * 2 + 1]);
}
free(leap_buffer);
}
if (tz->bit32.ttisstdcnt) {
buffer = (unsigned char*) malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
if (tz->ttisstdcnt) {
buffer = (unsigned char*) malloc(tz->ttisstdcnt * sizeof(unsigned char));
if (!buffer) {
return;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisstdcnt);
*tzf += sizeof(unsigned char) * tz->bit32.ttisstdcnt;
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->ttisstdcnt);
*tzf += sizeof(unsigned char) * tz->ttisstdcnt;
for (i = 0; i < tz->bit32.ttisstdcnt; i++) {
for (i = 0; i < tz->ttisstdcnt; i++) {
tz->type[i].isstdcnt = buffer[i];
}
free(buffer);
}
if (tz->bit32.ttisgmtcnt) {
buffer = (unsigned char*) malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
if (tz->ttisgmtcnt) {
buffer = (unsigned char*) malloc(tz->ttisgmtcnt * sizeof(unsigned char));
if (!buffer) {
return;
}
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisgmtcnt);
*tzf += sizeof(unsigned char) * tz->bit32.ttisgmtcnt;
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->ttisgmtcnt);
*tzf += sizeof(unsigned char) * tz->ttisgmtcnt;
for (i = 0; i < tz->bit32.ttisgmtcnt; i++) {
for (i = 0; i < tz->ttisgmtcnt; i++) {
tz->type[i].isgmtcnt = buffer[i];
}
free(buffer);
}
}
static void skip_posix_string(const unsigned char **tzf, timelib_tzinfo *tz)
{
int n_count = 0;
do {
if (*tzf[0] == '\n') {
n_count++;
}
(*tzf)++;
} while (n_count < 2);
}
static void read_location(const unsigned char **tzf, timelib_tzinfo *tz)
{
uint32_t buffer[3];
@@ -261,12 +221,12 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
printf("Geo Location: %f,%f\n", tz->location.latitude, tz->location.longitude);
printf("Comments:\n%s\n", tz->location.comments);
printf("BC: %s\n", tz->bc ? "" : "yes");
printf("UTC/Local count: %lu\n", (unsigned long) tz->bit32.ttisgmtcnt);
printf("Std/Wall count: %lu\n", (unsigned long) tz->bit32.ttisstdcnt);
printf("Leap.sec. count: %lu\n", (unsigned long) tz->bit32.leapcnt);
printf("Trans. count: %lu\n", (unsigned long) tz->bit32.timecnt);
printf("Local types count: %lu\n", (unsigned long) tz->bit32.typecnt);
printf("Zone Abbr. count: %lu\n", (unsigned long) tz->bit32.charcnt);
printf("UTC/Local count: %lu\n", (unsigned long) tz->ttisgmtcnt);
printf("Std/Wall count: %lu\n", (unsigned long) tz->ttisstdcnt);
printf("Leap.sec. count: %lu\n", (unsigned long) tz->leapcnt);
printf("Trans. count: %lu\n", (unsigned long) tz->timecnt);
printf("Local types count: %lu\n", (unsigned long) tz->typecnt);
printf("Zone Abbr. count: %lu\n", (unsigned long) tz->charcnt);
printf ("%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
"", "", 0,
@@ -277,7 +237,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
tz->type[0].isstdcnt,
tz->type[0].isgmtcnt
);
for (i = 0; i < tz->bit32.timecnt; i++) {
for (i = 0; i < tz->timecnt; i++) {
printf ("%08X (%12d) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
tz->trans[i], tz->trans[i], tz->trans_idx[i],
(long int) tz->type[tz->trans_idx[i]].offset,
@@ -288,7 +248,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
tz->type[tz->trans_idx[i]].isgmtcnt
);
}
for (i = 0; i < tz->bit32.leapcnt; i++) {
for (i = 0; i < tz->leapcnt; i++) {
printf ("%08X (%12ld) = %d\n",
tz->leap_times[i].trans,
(long) tz->leap_times[i].trans,
@@ -307,7 +267,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
cur_locale = strdup(tmp);
}
setlocale(LC_CTYPE, "C");
#endif
#endif
do {
int mid = ((unsigned)left + right) >> 1;
@@ -322,7 +282,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
#ifdef HAVE_SETLOCALE
setlocale(LC_CTYPE, cur_locale);
if (cur_locale) free(cur_locale);
#endif
#endif
return 1;
}
@@ -331,7 +291,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
#ifdef HAVE_SETLOCALE
setlocale(LC_CTYPE, cur_locale);
if (cur_locale) free(cur_locale);
#endif
#endif
return 0;
}
@@ -352,45 +312,18 @@ int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
return (seek_to_tz_position(&tzf, timezone, tzdb));
}
static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
{
*tzf += 20;
}
static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
{
uint32_t buffer[6];
memcpy(&buffer, *tzf, sizeof(buffer));
tz->bit64.ttisgmtcnt = timelib_conv_int(buffer[0]);
tz->bit64.ttisstdcnt = timelib_conv_int(buffer[1]);
tz->bit64.leapcnt = timelib_conv_int(buffer[2]);
tz->bit64.timecnt = timelib_conv_int(buffer[3]);
tz->bit64.typecnt = timelib_conv_int(buffer[4]);
tz->bit64.charcnt = timelib_conv_int(buffer[5]);
*tzf += sizeof(buffer);
}
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
{
const unsigned char *tzf;
timelib_tzinfo *tmp;
int version;
if (seek_to_tz_position(&tzf, timezone, tzdb)) {
tmp = timelib_tzinfo_ctor(timezone);
version = read_preamble(&tzf, tmp);
read_preamble(&tzf, tmp);
read_header(&tzf, tmp);
read_transistions(&tzf, tmp);
read_types(&tzf, tmp);
if (version == 2) {
skip_64bit_preamble(&tzf, tmp);
read_64bit_header(&tzf, tmp);
skip_64bit_transistions(&tzf, tmp);
skip_64bit_types(&tzf, tmp);
skip_posix_string(&tzf, tmp);
}
read_location(&tzf, tmp);
} else {
tmp = NULL;
@@ -403,18 +336,18 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
{
uint32_t i;
/* If there is no transition time, we pick the first one, if that doesn't
/* If there is no transistion time, we pick the first one, if that doesn't
* exist we return NULL */
if (!tz->bit32.timecnt || !tz->trans) {
if (!tz->timecnt || !tz->trans) {
*transition_time = 0;
if (tz->bit32.typecnt == 1) {
if (tz->typecnt == 1) {
return &(tz->type[0]);
}
return NULL;
}
/* If the TS is lower than the first transition time, then we scan over
* all the transition times to find the first non-DST one, or the first
/* If the TS is lower than the first transistion time, then we scan over
* all the transistion times to find the first non-DST one, or the first
* one in case there are only DST entries. Not sure which smartass came up
* with this idea in the first though :) */
if (ts < tz->trans[0]) {
@@ -422,10 +355,10 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
*transition_time = 0;
j = 0;
while (j < tz->bit32.timecnt && tz->type[j].isdst) {
while (j < tz->timecnt && tz->type[j].isdst) {
++j;
}
if (j == tz->bit32.timecnt) {
if (j == tz->timecnt) {
j = 0;
}
return &(tz->type[j]);
@@ -433,25 +366,25 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
/* In all other cases we loop through the available transtion times to find
* the correct entry */
for (i = 0; i < tz->bit32.timecnt; i++) {
for (i = 0; i < tz->timecnt; i++) {
if (ts < tz->trans[i]) {
*transition_time = tz->trans[i - 1];
return &(tz->type[tz->trans_idx[i - 1]]);
}
}
*transition_time = tz->trans[tz->bit32.timecnt - 1];
return &(tz->type[tz->trans_idx[tz->bit32.timecnt - 1]]);
*transition_time = tz->trans[tz->timecnt - 1];
return &(tz->type[tz->trans_idx[tz->timecnt - 1]]);
}
static tlinfo* fetch_leaptime_offset(timelib_tzinfo *tz, timelib_sll ts)
{
int i;
if (!tz->bit32.leapcnt || !tz->leap_times) {
if (!tz->leapcnt || !tz->leap_times) {
return NULL;
}
for (i = tz->bit32.leapcnt - 1; i > 0; i--) {
for (i = tz->leapcnt - 1; i > 0; i--) {
if (ts > tz->leap_times[i].trans) {
return &(tz->leap_times[i]);
}
@@ -463,7 +396,7 @@ int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz)
{
ttinfo *to;
timelib_sll dummy;
if ((to = fetch_timezone_offset(tz, ts, &dummy))) {
return to->isdst;
}
@@ -506,12 +439,12 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
{
timelib_time_offset *gmt_offset;
timelib_sll retval;
switch (t->zone_type) {
case TIMELIB_ZONETYPE_ABBR:
case TIMELIB_ZONETYPE_OFFSET:
return (t->z + t->dst) * -60;
case TIMELIB_ZONETYPE_ID:
gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
retval = gmt_offset->offset;
+19 -19
View File
@@ -116,26 +116,26 @@ timelib_tzinfo* timelib_tzinfo_ctor(char *name)
timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
{
timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
tmp->bit32.leapcnt = tz->bit32.leapcnt;
tmp->bit32.timecnt = tz->bit32.timecnt;
tmp->bit32.typecnt = tz->bit32.typecnt;
tmp->bit32.charcnt = tz->bit32.charcnt;
tmp->ttisgmtcnt = tz->ttisgmtcnt;
tmp->ttisstdcnt = tz->ttisstdcnt;
tmp->leapcnt = tz->leapcnt;
tmp->timecnt = tz->timecnt;
tmp->typecnt = tz->typecnt;
tmp->charcnt = tz->charcnt;
tmp->trans = (int32_t *) malloc(tz->timecnt * sizeof(int32_t));
tmp->trans_idx = (unsigned char*) malloc(tz->timecnt * sizeof(unsigned char));
memcpy(tmp->trans, tz->trans, tz->timecnt * sizeof(int32_t));
memcpy(tmp->trans_idx, tz->trans_idx, tz->timecnt * sizeof(unsigned char));
tmp->trans = (int32_t *) malloc(tz->bit32.timecnt * sizeof(int32_t));
tmp->trans_idx = (unsigned char*) malloc(tz->bit32.timecnt * sizeof(unsigned char));
memcpy(tmp->trans, tz->trans, tz->bit32.timecnt * sizeof(int32_t));
memcpy(tmp->trans_idx, tz->trans_idx, tz->bit32.timecnt * sizeof(unsigned char));
tmp->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
memcpy(tmp->type, tz->type, tz->typecnt * sizeof(struct ttinfo));
tmp->type = (ttinfo*) malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(struct ttinfo));
tmp->timezone_abbr = (char*) malloc(tz->charcnt);
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->charcnt);
tmp->timezone_abbr = (char*) malloc(tz->bit32.charcnt);
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
tmp->leap_times = (tlinfo*) malloc(tz->bit32.leapcnt * sizeof(tlinfo));
memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
tmp->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
memcpy(tmp->leap_times, tz->leap_times, tz->leapcnt * sizeof(tlinfo));
return tmp;
}
@@ -236,7 +236,7 @@ void timelib_dump_date(timelib_time *d, int options)
if ((options & 1) == 1) {
if (d->have_relative) {
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
if (d->relative.first_last_day_of != 0) {
switch (d->relative.first_last_day_of) {
@@ -271,7 +271,7 @@ void timelib_dump_date(timelib_time *d, int options)
void timelib_dump_rel_time(timelib_rel_time *d)
{
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS (days: %lld)%s",
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS (days: %lld)%s",
d->y, d->m, d->d, d->h, d->i, d->s, d->days, d->invert ? " inverted" : "");
if (d->first_last_day_of != 0) {
switch (d->first_last_day_of) {
+2 -5
View File
@@ -38,9 +38,6 @@
#define TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH 0x02
#define TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH 0x03
#define TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH 0x01
#define TIMELIB_SPECIAL_LAST_DAY_OF_MONTH 0x02
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
#endif
@@ -80,8 +77,8 @@ long timelib_parse_tz_cor(char**);
/* From parse_iso_intervals.re */
void timelib_strtointerval(char *s, int len,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
struct timelib_error_container **errors);
+6 -16
View File
@@ -104,22 +104,12 @@ typedef struct tlocinfo
typedef struct timelib_tzinfo
{
char *name;
struct {
uint32_t ttisgmtcnt;
uint32_t ttisstdcnt;
uint32_t leapcnt;
uint32_t timecnt;
uint32_t typecnt;
uint32_t charcnt;
} bit32;
struct {
uint64_t ttisgmtcnt;
uint64_t ttisstdcnt;
uint64_t leapcnt;
uint64_t timecnt;
uint64_t typecnt;
uint64_t charcnt;
} bit64;
uint32_t ttisgmtcnt;
uint32_t ttisstdcnt;
uint32_t leapcnt;
uint32_t timecnt;
uint32_t typecnt;
uint32_t charcnt;
int32_t *trans;
unsigned char *trans_idx;
+16456 -43595
View File
File diff suppressed because it is too large. Load diff
+6 -17
View File
@@ -106,7 +106,7 @@ static int do_range_limit_days(timelib_sll *y, timelib_sll *m, timelib_sll *d)
timelib_sll days_this_month;
timelib_sll last_month, last_year;
timelib_sll days_last_month;
/* can jump an entire leap year period quickly */
if (*d >= DAYS_PER_LYEAR_PERIOD || *d <= -DAYS_PER_LYEAR_PERIOD) {
*y += YEARS_PER_LYEAR_PERIOD * (*d / DAYS_PER_LYEAR_PERIOD);
@@ -205,17 +205,15 @@ static void do_adjust_relative(timelib_time* time)
time->m += time->relative.m;
time->y += time->relative.y;
}
switch (time->relative.first_last_day_of) {
case TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH: /* first */
case 1: /* first */
time->d = 1;
break;
case TIMELIB_SPECIAL_LAST_DAY_OF_MONTH: /* last */
case 2: /* last */
time->d = 0;
time->m++;
break;
}
timelib_do_normalize(time);
}
@@ -298,15 +296,6 @@ static void do_adjust_special_early(timelib_time* time)
break;
}
}
switch (time->relative.first_last_day_of) {
case TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH: /* first */
time->d = 1;
break;
case TIMELIB_SPECIAL_LAST_DAY_OF_MONTH: /* last */
time->d = 0;
time->m++;
break;
}
timelib_do_normalize(time);
}
@@ -396,7 +385,7 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
timelib_time_offset *before, *after;
timelib_sll tmp;
int in_transistion;
tz->is_localtime = 1;
before = timelib_get_time_zone_info(tz->sse, tzi);
after = timelib_get_time_zone_info(tz->sse - before->offset, tzi);
@@ -406,7 +395,7 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
((tz->sse - after->offset) >= (after->transistion_time + (before->offset - after->offset))) &&
((tz->sse - after->offset) < after->transistion_time)
);
if ((before->offset != after->offset) && !in_transistion) {
tmp = -after->offset;
} else {
@@ -464,7 +453,7 @@ int main(void)
printf ("%04d-%02d-%02d %02d:%02d:%02d.%-5d %+04d %1d",
time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
if (time.have_relative) {
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s);
}
if (time.have_weekday_relative) {
+5 -5
View File
@@ -141,7 +141,7 @@ void timelib_update_from_sse(timelib_time *tm)
signed int dst = tm->dst;
sse = tm->sse;
switch (tm->zone_type) {
case TIMELIB_ZONETYPE_ABBR:
case TIMELIB_ZONETYPE_OFFSET: {
@@ -152,11 +152,11 @@ void timelib_update_from_sse(timelib_time *tm)
case TIMELIB_ZONETYPE_ID: {
timelib_time_offset *gmt_offset;
gmt_offset = timelib_get_time_zone_info(tm->sse, tm->tz_info);
timelib_unixtime2gmt(tm, tm->sse + gmt_offset->offset);
timelib_time_offset_dtor(gmt_offset);
goto cleanup;
}
@@ -182,7 +182,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
case TIMELIB_ZONETYPE_OFFSET: {
int z = tm->z;
signed int dst = tm->dst;
timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
tm->z = z;
@@ -195,7 +195,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
timelib_unixtime2gmt(tm, ts + gmt_offset->offset);
/* we need to reset the sse here as unixtime2gmt modifies it */
tm->sse = ts;
tm->sse = ts;
tm->dst = gmt_offset->is_dst;
tm->z = gmt_offset->offset;
tm->tz_info = tz;
+68 -78
View File
@@ -593,7 +593,7 @@ static zend_object_handlers date_object_handlers_period;
#define DATE_SET_CONTEXT \
zval *object; \
object = getThis(); \
#define DATE_FETCH_OBJECT \
php_date_obj *obj; \
DATE_SET_CONTEXT; \
@@ -762,7 +762,7 @@ PHP_RSHUTDOWN_FUNCTION(date)
* RFC2822, Section 3.3: http://www.ietf.org/rfc/rfc2822.txt
* FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
* CFWS = *([FWS] comment) (([FWS] comment) / FWS)
*
*
* date-time = [ day-of-week "," ] date FWS time [CFWS]
* day-of-week = ([FWS] day-name)
* day-name = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"
@@ -784,19 +784,19 @@ PHP_RSHUTDOWN_FUNCTION(date)
* date-fullyear = 4DIGIT
* date-month = 2DIGIT ; 01-12
* date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
*
*
* time-hour = 2DIGIT ; 00-23
* time-minute = 2DIGIT ; 00-59
* time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules
*
*
* time-secfrac = "." 1*DIGIT
* time-numoffset = ("+" / "-") time-hour ":" time-minute
* time-offset = "Z" / time-numoffset
*
*
* partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
* full-date = date-fullyear "-" date-month "-" date-mday
* full-time = partial-time time-offset
*
*
* date-time = full-date "T" full-time
*/
#define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP"
@@ -877,10 +877,6 @@ PHP_MSHUTDOWN_FUNCTION(date)
timelib_error_container_dtor(DATEG(last_errors));
}
#ifndef ZTS
DATEG(default_timezone) = NULL;
#endif
return SUCCESS;
}
/* }}} */
@@ -889,7 +885,7 @@ PHP_MSHUTDOWN_FUNCTION(date)
PHP_MINFO_FUNCTION(date)
{
const timelib_tzdb *tzdb = DATE_TIMEZONEDB;
php_info_print_table_start();
php_info_print_table_row(2, "date/time support", "enabled");
php_info_print_table_row(2, "\"Olson\" Timezone Database Version", tzdb->version);
@@ -1041,8 +1037,8 @@ char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
if (day_of_week < 0) {
return "Unknown";
}
return day_full_names[day_of_week];
}
return day_full_names[day_of_week];
}
char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
@@ -1050,8 +1046,8 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
if (day_of_week < 0) {
return "Unknown";
}
return day_short_names[day_of_week];
}
return day_short_names[day_of_week];
}
/* }}} */
@@ -1083,7 +1079,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
offset->leap_secs = 0;
offset->is_dst = 0;
offset->abbr = malloc(9); /* GMT�xxxx\0 */
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
localtime ? abs(offset->offset / 3600) : 0,
localtime ? abs((offset->offset % 3600) / 60) : 0 );
@@ -1129,7 +1125,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break;
case 'A': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "PM" : "AM"); break;
case 'B': {
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
while (retval < 0) {
retval += 1000;
}
@@ -1229,7 +1225,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
}
string = php_format_date(format, format_len, ts, localtime TSRMLS_CC);
RETVAL_STRING(string, 0);
}
/* }}} */
@@ -1253,7 +1249,7 @@ PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localt
}
string = date_format(format, format_len, t, localtime);
timelib_time_dtor(t);
return string;
}
@@ -1294,7 +1290,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
offset->leap_secs = 0;
offset->is_dst = t->dst;
offset->abbr = malloc(9); /* GMT�xxxx\0 */
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
!localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
!localtime ? abs(offset->offset / 3600) : 0,
!localtime ? abs((offset->offset % 3600) / 60) : 0 );
@@ -1326,7 +1322,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
/* Swatch Beat a.k.a. Internet Time */
case 'B':
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
while (retval < 0) {
retval += 1000;
}
@@ -1378,7 +1374,7 @@ PHP_FUNCTION(idate)
char *format;
int format_len;
long ts = 0;
int ret;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
RETURN_FALSE;
@@ -1406,7 +1402,7 @@ PHP_FUNCTION(idate)
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
{
const timelib_tzdb *builtin = timelib_builtin_db();
if (php_version_compare(tzdb->version, builtin->version) > 0) {
php_date_global_timezone_db = tzdb;
php_date_global_timezone_db_enabled = 1;
@@ -1477,7 +1473,7 @@ PHP_FUNCTION(strtotime)
}
if (!time_len) {
timelib_time_dtor(now);
timelib_time_dtor(now);
RETURN_FALSE;
}
@@ -1926,7 +1922,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data
if (it_time->tz_info) {
newdateobj->time->tz_info = it_time->tz_info;
}
*data = &iterator->current;
}
/* }}} */
@@ -2120,13 +2116,13 @@ static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_
if (ptr) {
*ptr = intern;
}
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
retval.handlers = &date_object_handlers_date;
return retval;
}
@@ -2140,12 +2136,12 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
php_date_obj *new_obj = NULL;
php_date_obj *old_obj = (php_date_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
zend_object_value new_ov = date_object_new_date_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
if (!old_obj->time) {
return new_ov;
}
/* this should probably moved to a new `timelib_time *timelime_time_clone(timelib_time *)` */
new_obj->time = timelib_time_ctor();
*new_obj->time = *old_obj->time;
@@ -2155,7 +2151,7 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
if (old_obj->time->tz_info) {
new_obj->time->tz_info = old_obj->time->tz_info;
}
return new_ov;
}
@@ -2272,10 +2268,10 @@ static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *cl
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
retval.handlers = &date_object_handlers_timezone;
return retval;
}
@@ -2289,12 +2285,12 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
php_timezone_obj *new_obj = NULL;
php_timezone_obj *old_obj = (php_timezone_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
if (!old_obj->initialized) {
return new_ov;
}
new_obj->type = old_obj->type;
new_obj->initialized = 1;
switch (new_obj->type) {
@@ -2310,7 +2306,7 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
new_obj->tzi.z.abbr = strdup(old_obj->tzi.z.abbr);
break;
}
return new_ov;
}
@@ -2371,10 +2367,10 @@ static inline zend_object_value date_object_new_interval_ex(zend_class_entry *cl
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_interval, NULL TSRMLS_CC);
retval.handlers = &date_object_handlers_interval;
return retval;
}
@@ -2388,7 +2384,7 @@ static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC)
php_interval_obj *new_obj = NULL;
php_interval_obj *old_obj = (php_interval_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
zend_object_value new_ov = date_object_new_interval_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
/** FIX ME ADD CLONE STUFF **/
@@ -2460,10 +2456,10 @@ static inline zend_object_value date_object_new_period_ex(zend_class_entry *clas
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_period, NULL TSRMLS_CC);
retval.handlers = &date_object_handlers_period;
return retval;
}
@@ -2477,7 +2473,7 @@ static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC)
php_period_obj *new_obj = NULL;
php_period_obj *old_obj = (php_period_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
zend_object_value new_ov = date_object_new_period_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
/** FIX ME ADD CLONE STUFF **/
@@ -2563,7 +2559,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
char *new_abbr = NULL;
timelib_sll new_offset;
if (dateobj->time) {
timelib_time_dtor(dateobj->time);
}
@@ -2942,7 +2938,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(hour, h);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
if (parsed_time->f == -99999) {
add_assoc_bool(return_value, "fraction", 0);
} else {
@@ -2993,7 +2989,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
add_assoc_long(element, "weekdays", parsed_time->relative.special.amount);
}
if (parsed_time->relative.first_last_day_of) {
add_assoc_bool(element, parsed_time->relative.first_last_day_of == TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH ? "first_day_of_month" : "last_day_of_month", 1);
add_assoc_bool(element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1);
}
add_assoc_zval(return_value, "relative", element);
}
@@ -3009,7 +3005,7 @@ PHP_FUNCTION(date_parse)
int date_len;
struct timelib_error_container *error;
timelib_time *parsed_time;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) {
RETURN_FALSE;
}
@@ -3028,7 +3024,7 @@ PHP_FUNCTION(date_parse_from_format)
int date_len, format_len;
struct timelib_error_container *error;
timelib_time *parsed_time;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &format, &format_len, &date, &date_len) == FAILURE) {
RETURN_FALSE;
}
@@ -3512,7 +3508,7 @@ static void php_date_isodate_set(zval *object, long y, long w, long d, zval *ret
memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
dateobj->time->have_relative = 1;
timelib_update_ts(dateobj->time, NULL);
}
@@ -3701,7 +3697,7 @@ PHP_METHOD(DateTimeZone, __construct)
int tz_len;
php_timezone_obj *tzobj;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
tzobj = zend_object_store_get_object(getThis() TSRMLS_CC);
@@ -3902,7 +3898,7 @@ PHP_FUNCTION(timezone_transitions_get)
add_assoc_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); \
add_next_index_zval(return_value, element);
#define add_last() add(tzobj->tzi.tz->bit32.timecnt - 1, timestamp_begin)
#define add_last() add(tzobj->tzi.tz->timecnt - 1, timestamp_begin)
array_init(return_value);
@@ -3913,7 +3909,7 @@ PHP_FUNCTION(timezone_transitions_get)
} else {
begin = 0;
found = 0;
if (tzobj->tzi.tz->bit32.timecnt > 0) {
if (tzobj->tzi.tz->timecnt > 0) {
do {
if (tzobj->tzi.tz->trans[begin] > timestamp_begin) {
if (begin > 0) {
@@ -3925,18 +3921,18 @@ PHP_FUNCTION(timezone_transitions_get)
break;
}
begin++;
} while (begin < tzobj->tzi.tz->bit32.timecnt);
} while (begin < tzobj->tzi.tz->timecnt);
}
}
if (!found) {
if (tzobj->tzi.tz->bit32.timecnt > 0) {
if (tzobj->tzi.tz->timecnt > 0) {
add_last();
} else {
add_nominal();
}
} else {
for (i = begin; i < tzobj->tzi.tz->bit32.timecnt; ++i) {
for (i = begin; i < tzobj->tzi.tz->timecnt; ++i) {
if (tzobj->tzi.tz->trans[i] < timestamp_end) {
add(i, tzobj->tzi.tz->trans[i]);
}
@@ -3979,7 +3975,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
struct timelib_error_container *errors;
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
if (errors->error_count > 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
retval = FAILURE;
@@ -4138,7 +4134,7 @@ PHP_METHOD(DateInterval, __construct)
php_interval_obj *diobj;
timelib_rel_time *reltime;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &interval_string, &interval_string_length) == SUCCESS) {
if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) {
@@ -4161,7 +4157,8 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
#define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \
do { \
zval **z_arg = NULL; \
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS && Z_TYPE_PP(z_arg) == IS_LONG) { \
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
convert_to_long(*z_arg); \
(*intobj)->diff->member = (itype)Z_LVAL_PP(z_arg); \
} else { \
(*intobj)->diff->member = (itype)def; \
@@ -4172,15 +4169,8 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
do { \
zval **z_arg = NULL; \
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
if (Z_TYPE_PP(z_arg) == IS_STRING) { \
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
} else if (Z_TYPE_PP(z_arg) == IS_LONG || Z_TYPE_PP(z_arg) == IS_BOOL) { \
(*intobj)->diff->member = (timelib_sll)Z_LVAL_PP(z_arg); \
} else if (Z_TYPE_PP(z_arg) == IS_DOUBLE) { \
(*intobj)->diff->member = (timelib_sll)Z_DVAL_PP(z_arg); \
} else { \
(*intobj)->diff->member = -1LL; \
} \
convert_to_string(*z_arg); \
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
} else { \
(*intobj)->diff->member = -1LL; \
} \
@@ -4358,7 +4348,7 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
struct timelib_error_container *errors;
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
if (errors->error_count > 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
retval = FAILURE;
@@ -4387,7 +4377,7 @@ PHP_METHOD(DatePeriod, __construct)
int isostr_len = 0;
timelib_time *clone;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) {
@@ -4502,7 +4492,7 @@ PHP_FUNCTION(timezone_identifiers_list)
tzdb = DATE_TIMEZONEDB;
item_count = tzdb->index_size;
table = tzdb->index;
array_init(return_value);
for (i = 0; i < item_count; ++i) {
@@ -4536,7 +4526,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
{
const timelib_tz_lookup_table *table, *entry;
zval *element, **abbr_array_pp, *abbr_array;
table = timelib_timezone_abbreviations_list();
array_init(return_value);
entry = table;
@@ -4612,11 +4602,11 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
timelib_time *t;
timelib_tzinfo *tzi;
char *retstr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
RETURN_FALSE;
}
switch (ZEND_NUM_ARGS()) {
case 1:
retformat = SUNFUNCS_RET_STRING;
@@ -4660,7 +4650,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
timelib_unixtime2local(t, time);
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude, 1, &h_rise, &h_set, &rise, &set, &transit);
timelib_time_dtor(t);
if (rs != 0) {
RETURN_FALSE;
}
@@ -4714,7 +4704,7 @@ PHP_FUNCTION(date_sun_info)
timelib_sll rise, set, transit;
int dummy;
double ddummy;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) {
RETURN_FALSE;
}
@@ -4728,7 +4718,7 @@ PHP_FUNCTION(date_sun_info)
/* Setup */
t2 = timelib_time_ctor();
array_init(return_value);
/* Get sun up/down and transit */
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
switch (rs) {
@@ -4872,7 +4862,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC)
ZVAL_NULL(zv);
}
zend_hash_update(props, "interval", sizeof("interval"), &zv, sizeof(zv), NULL);
/* converted to larger type (int->long); must check when unserializing */
MAKE_STD_ZVAL(zv);
ZVAL_LONG(zv, (long) period_obj->recurrences);
@@ -4955,7 +4945,7 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
}
period_obj->initialized = 1;
return 1;
}
@@ -4972,7 +4962,7 @@ PHP_METHOD(DatePeriod, __set_state)
}
myht = Z_ARRVAL_P(array);
object_init_ex(return_value, date_ce_period);
period_obj = zend_object_store_get_object(return_value TSRMLS_CC);
if (!php_date_period_initialize_from_hash(period_obj, myht TSRMLS_CC)) {
-1
View File
@@ -193,7 +193,6 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D);
/* Grabbing CE's so that other exts can use the date objects too */
PHPAPI zend_class_entry *php_date_get_date_ce(void);
PHPAPI zend_class_entry *php_date_get_immutable_ce(void);
PHPAPI zend_class_entry *php_date_get_timezone_ce(void);
/* Functions for creating DateTime objects, and initializing them from a string */
@@ -16,7 +16,7 @@ date_default_timezone_set("Europe/London");
// Create a DateTimeZone object
$tz = new DateTimeZone("Europe/London");
$tran = $tz->getTransitions(-306972000, -37241999);
$tran = $tz->getTransitions();
if (!is_array($tran)) {
echo "TEST FAILED: Expected an array\n";
@@ -25,14 +25,14 @@ if (!is_array($tran)) {
echo "\n-- Total number of transitions: " . count($tran). " --\n";
echo "\n-- Format a sample entry for Spring 1963 --\n";
var_dump( $tran[6] );
var_dump( $tran[97] );
?>
===DONE===
--EXPECT--
*** Testing DateTimeZone::getTransitions() : basic functionality ***
-- Total number of transitions: 18 --
-- Total number of transitions: 243 --
-- Format a sample entry for Spring 1963 --
array(5) {
+3 -3
View File
@@ -10,6 +10,6 @@ define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
require 'DateTime_data-massive.inc';
?>
--EXPECTF--
test_massive_positive: ADD: -333333-01-01 16:18:02 %s + P+666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 %s**
test_massive_negative: ADD: 333333-01-01 16:18:02 %s + P-666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 %s**
--EXPECT--
test_massive_positive: ADD: -333333-01-01 16:18:02 EST + P+666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 EST**
test_massive_negative: ADD: 333333-01-01 16:18:02 EST + P-666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 EST**
+3 -3
View File
@@ -10,6 +10,6 @@ define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
require 'DateTime_data-massive.inc';
?>
--EXPECTF--
test_massive_positive: DIFF: 333333-01-01 16:18:02 %s - -333333-01-01 16:18:02 %s = **P+666666Y0M0DT0H%s**
test_massive_negative: DIFF: -333333-01-01 16:18:02 %s - 333333-01-01 16:18:02 %s = **P-666666Y0M0DT0H%s**
--EXPECT--
test_massive_positive: DIFF: 333333-01-01 16:18:02 EST - -333333-01-01 16:18:02 EST = **P+666666Y0M0DT0H0M0S**
test_massive_negative: DIFF: -333333-01-01 16:18:02 EST - 333333-01-01 16:18:02 EST = **P-666666Y0M0DT0H0M0S**
+3 -3
View File
@@ -10,6 +10,6 @@ define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
require 'DateTime_data-massive.inc';
?>
--EXPECTF--
test_massive_positive: SUB: 333333-01-01 16:18:02 %s - P+666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 %s**
test_massive_negative: SUB: -333333-01-01 16:18:02 %s - P-666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 %s**
--EXPECT--
test_massive_positive: SUB: 333333-01-01 16:18:02 EST - P+666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 EST**
test_massive_negative: SUB: -333333-01-01 16:18:02 EST - P-666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 EST**
+1 -1
View File
@@ -46,7 +46,7 @@ array(12) {
bool(false)
object(DateTime)#1 (3) {
["date"]=>
string(27) "-0001-11-30 00:00:00.000000"
string(20) "-0001-11-30 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
+3 -3
View File
@@ -20,10 +20,10 @@ array(5) {
["time"]=>
string(%d) "%s"
["offset"]=>
int(%s)
int(3600)
["isdst"]=>
bool(%s)
bool(true)
["abbr"]=>
string(%d) "%s"
string(3) "BST"
}
10000002008-02-28T12:00:00+0000
+6 -6
View File
@@ -14,17 +14,17 @@ var_dump($di);
--EXPECTF--
object(DateInterval)#%d (15) {
["y"]=>
int(-1)
int(2)
["m"]=>
int(-1)
int(0)
["d"]=>
int(-1)
int(0)
["h"]=>
int(-1)
int(6)
["i"]=>
int(-1)
int(8)
["s"]=>
int(-1)
int(0)
["weekday"]=>
int(10)
["weekday_behavior"]=>
+6 -6
View File
@@ -14,17 +14,17 @@ var_dump($di);
--EXPECTF--
object(DateInterval)#%d (15) {
["y"]=>
int(-1)
int(2)
["m"]=>
int(-1)
int(0)
["d"]=>
int(-1)
int(0)
["h"]=>
int(-1)
int(6)
["i"]=>
int(-1)
int(8)
["s"]=>
int(-1)
int(0)
["weekday"]=>
int(10)
["weekday_behavior"]=>
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #69336 (Issues with "last day of <monthname>")
--INI--
date.timezone=UTC
--FILE--
<?php
var_dump(date('d.m.Y',strtotime('last day of april')));
var_dump(date('d.m.Y',strtotime('last tuesday of march 2015')));
var_dump(date('d.m.Y',strtotime('last wednesday of march 2015')));
var_dump(date('d.m.Y',strtotime('last wednesday of april 2015')));
var_dump(date('d.m.Y',strtotime('last wednesday of march 2014')));
var_dump(date('d.m.Y',strtotime('last wednesday of april 2014')));
?>
--EXPECTF--
string(10) "30.04.%d"
string(10) "31.03.2015"
string(10) "25.03.2015"
string(10) "29.04.2015"
string(10) "26.03.2014"
string(10) "30.04.2014"
+4 -4
View File
@@ -27,7 +27,7 @@ var_dump( getdate($timestamp) );
-- Testing getdate\(\) function by passing float 12.3456789000e10 value to timestamp --
array\(11\) {
\["seconds"\]=>
int\((.+)\)
int\((36|0)\)
\["minutes"\]=>
int\((43|0)\)
\["hours"\]=>
@@ -53,7 +53,7 @@ array\(11\) {
-- Testing getdate\(\) function by passing float -12.3456789000e10 value to timestamp --
array\(11\) {
\["seconds"\]=>
int\((.+)\)
int\((44|12|20)\)
\["minutes"\]=>
int\((39|23)\)
\["hours"\]=>
@@ -61,7 +61,7 @@ array\(11\) {
\["mday"\]=>
int\((9|14|23)\)
\["wday"\]=>
int\((0|6)\)
int\(0\)
\["mon"\]=>
int\((10|12)\)
\["year"\]=>
@@ -69,7 +69,7 @@ array\(11\) {
\["yday"\]=>
int\((282|347|295)\)
\["weekday"\]=>
string\((6|8)\) "(Sunday|Saturday)"
string\(6\) "Sunday"
\["month"\]=>
string\((7|8)\) "(October|December)"
\[0\]=>
+2 -2
View File
@@ -87,7 +87,7 @@ array\(9\) {
\[5\]=>
int\((104|1|-3843)\)
\[6\]=>
int\((5|6)\)
int\(6\)
\[7\]=>
int\((281|346|294)\)
\[8\]=>
@@ -107,7 +107,7 @@ array\(9\) {
\["tm_year"\]=>
int\((104|1|-3843)\)
\["tm_wday"\]=>
int\((5|6)\)
int\(6\)
\["tm_yday"\]=>
int\((281|346|294)\)
\["tm_isdst"\]=>
+11 -11
View File
@@ -24,7 +24,7 @@ foreach ($tzs as $tz) {
echo "\n";
}
?>
--EXPECTF--
--EXPECT--
America/Toronto
Y: 0 - January 2000-01-01T01:01:01-0500
Y: 69 - January 2069-01-01T01:01:01-0500
@@ -32,11 +32,11 @@ Y: 70 - January 1970-01-01T01:01:01-0500
Y: 71 - January 1971-01-01T01:01:01-0500
Y: 99 - January 1999-01-01T01:01:01-0500
Y: 100 - January 2000-01-01T01:01:01-0500
Y: 101 - January 0101-01-01T01:01:01-0%d
Y: 105 - January 0105-01-01T01:01:01-0%d
Y: 110 - January 0110-01-01T01:01:01-0%d
Y: 1900 - January 1900-01-01T01:01:01-0%d
Y: 1901 - January 1901-01-01T01:01:01-0%d
Y: 101 - January 0101-01-01T01:01:01-0500
Y: 105 - January 0105-01-01T01:01:01-0500
Y: 110 - January 0110-01-01T01:01:01-0500
Y: 1900 - January 1900-01-01T01:01:01-0500
Y: 1901 - January 1901-01-01T01:01:01-0500
Y: 1902 - January 1902-01-01T01:01:01-0500
Y: 1999 - January 1999-01-01T01:01:01-0500
Y: 2000 - January 2000-01-01T01:01:01-0500
@@ -49,11 +49,11 @@ Y: 70 - January 1970-01-01T01:01:01+0100
Y: 71 - January 1971-01-01T01:01:01+0100
Y: 99 - January 1999-01-01T01:01:01+0100
Y: 100 - January 2000-01-01T01:01:01+0100
Y: 101 - January 0101-01-01T01:01:01+0%d
Y: 105 - January 0105-01-01T01:01:01+0%d
Y: 110 - January 0110-01-01T01:01:01+0%d
Y: 1900 - January 1900-01-01T01:01:01+0%d
Y: 1901 - January 1901-01-01T01:01:01+0%d
Y: 101 - January 0101-01-01T01:01:01+0100
Y: 105 - January 0105-01-01T01:01:01+0100
Y: 110 - January 0110-01-01T01:01:01+0100
Y: 1900 - January 1900-01-01T01:01:01+0100
Y: 1901 - January 1901-01-01T01:01:01+0100
Y: 1902 - January 1902-01-01T01:01:01+0100
Y: 1999 - January 1999-01-01T01:01:01+0100
Y: 2000 - January 2000-01-01T01:01:01+0100
@@ -18,24 +18,24 @@ $tz = timezone_open("Europe/London");
$tran = timezone_transitions_get($tz);
echo "\n-- Get all 60s transitions --\n";
$tran = timezone_transitions_get($tz, -306972000, -37241999);
echo "\n-- Get all transitions --\n";
$tran = timezone_transitions_get($tz);
var_dump( gettype($tran) );
echo "\n-- Total number of transitions: " . count($tran). " --\n";
echo "\n-- Format a sample entry pfor Spring 1963 --\n";
var_dump( $tran[6] );
var_dump( $tran[97] );
?>
===DONE===
--EXPECT--
*** Testing timezone_transitions_get() : basic functionality ***
-- Get all 60s transitions --
-- Get all transitions --
string(5) "array"
-- Total number of transitions: 18 --
-- Total number of transitions: 243 --
-- Format a sample entry pfor Spring 1963 --
array(5) {
+1 -1
View File
@@ -914,7 +914,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
RETURN_FALSE;
#ifdef F_SETFL
} else if (modenr == DBA_CREAT) {
int flags = fcntl(info->fd, F_GETFL);
int flags = fcntl(info->fd, F_SETFL);
fcntl(info->fd, F_SETFL, flags & ~O_APPEND);
#endif
}
+58 -74
View File
@@ -187,10 +187,10 @@ ZEND_END_ARG_INFO();
/* }}} */
/*
* class DOMDocument extends DOMNode
* class DOMDocument extends DOMNode
*
* URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-i-Document
* Since:
* Since:
*/
const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
@@ -235,10 +235,10 @@ const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
};
/* }}} */
/* {{{ docType DOMDocumentType
readonly=yes
/* {{{ docType DOMDocumentType
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-B63ED1A31
Since:
Since:
*/
int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
{
@@ -266,15 +266,15 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
return FAILURE;
}
return SUCCESS;
}
/* }}} */
/* {{{ implementation DOMImplementation
readonly=yes
/* {{{ implementation DOMImplementation
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1B793EBA
Since:
Since:
*/
int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
{
@@ -285,10 +285,10 @@ int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
/* {{{ documentElement DOMElement
readonly=yes
/* {{{ documentElement DOMElement
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-87CD092
Since:
Since:
*/
int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
{
@@ -391,8 +391,8 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
/* {{{ standalone boolean
readonly=no
/* {{{ standalone boolean
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-standalone
Since: DOM Level 3
*/
@@ -455,7 +455,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
/* {{{ version string
/* {{{ version string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-version
Since: DOM Level 3
@@ -520,8 +520,8 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
/* {{{ strictErrorChecking boolean
readonly=no
/* {{{ strictErrorChecking boolean
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-strictErrorChecking
Since: DOM Level 3
*/
@@ -565,7 +565,7 @@ int dom_document_strict_error_checking_write(dom_object *obj, zval *newval TSRML
/* }}} */
/* {{{ formatOutput boolean
/* {{{ formatOutput boolean
readonly=no
*/
int dom_document_format_output_read(dom_object *obj, zval **retval TSRMLS_DC)
@@ -607,7 +607,7 @@ int dom_document_format_output_write(dom_object *obj, zval *newval TSRMLS_DC)
}
/* }}} */
/* {{{ validateOnParse boolean
/* {{{ validateOnParse boolean
readonly=no
*/
int dom_document_validate_on_parse_read(dom_object *obj, zval **retval TSRMLS_DC)
@@ -649,7 +649,7 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
}
/* }}} */
/* {{{ resolveExternals boolean
/* {{{ resolveExternals boolean
readonly=no
*/
int dom_document_resolve_externals_read(dom_object *obj, zval **retval TSRMLS_DC)
@@ -691,7 +691,7 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
}
/* }}} */
/* {{{ preserveWhiteSpace boolean
/* {{{ preserveWhiteSpace boolean
readonly=no
*/
int dom_document_preserve_whitespace_read(dom_object *obj, zval **retval TSRMLS_DC)
@@ -733,7 +733,7 @@ int dom_document_preserve_whitespace_write(dom_object *obj, zval *newval TSRMLS_
}
/* }}} */
/* {{{ recover boolean
/* {{{ recover boolean
readonly=no
*/
int dom_document_recover_read(dom_object *obj, zval **retval TSRMLS_DC)
@@ -775,7 +775,7 @@ int dom_document_recover_write(dom_object *obj, zval *newval TSRMLS_DC)
}
/* }}} */
/* {{{ substituteEntities boolean
/* {{{ substituteEntities boolean
readonly=no
*/
int dom_document_substitue_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
@@ -817,8 +817,8 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
}
/* }}} */
/* {{{ documentURI string
readonly=no
/* {{{ documentURI string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-documentURI
Since: DOM Level 3
*/
@@ -881,8 +881,8 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
/* {{{ config DOMConfiguration
readonly=yes
/* {{{ config DOMConfiguration
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-config
Since: DOM Level 3
*/
@@ -897,7 +897,7 @@ int dom_document_config_read(dom_object *obj, zval **retval TSRMLS_DC)
/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547
Since:
Since:
*/
PHP_FUNCTION(dom_document_create_element)
{
@@ -930,7 +930,7 @@ PHP_FUNCTION(dom_document_create_element)
/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment();
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5
Since:
Since:
*/
PHP_FUNCTION(dom_document_create_document_fragment)
{
@@ -957,7 +957,7 @@ PHP_FUNCTION(dom_document_create_document_fragment)
/* {{{ proto DOMText dom_document_create_text_node(string data);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127
Since:
Since:
*/
PHP_FUNCTION(dom_document_create_text_node)
{
@@ -985,7 +985,7 @@ PHP_FUNCTION(dom_document_create_text_node)
/* {{{ proto DOMComment dom_document_create_comment(string data);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328
Since:
Since:
*/
PHP_FUNCTION(dom_document_create_comment)
{
@@ -1013,7 +1013,7 @@ PHP_FUNCTION(dom_document_create_comment)
/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8
Since:
Since:
*/
PHP_FUNCTION(dom_document_create_cdatasection)
{
@@ -1041,7 +1041,7 @@ PHP_FUNCTION(dom_document_create_cdatasection)
/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439
Since:
Since:
*/
PHP_FUNCTION(dom_document_create_processing_instruction)
{
@@ -1076,7 +1076,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
/* {{{ proto DOMAttr dom_document_create_attribute(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198
Since:
Since:
*/
PHP_FUNCTION(dom_document_create_attribute)
{
@@ -1110,7 +1110,7 @@ PHP_FUNCTION(dom_document_create_attribute)
/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE
Since:
Since:
*/
PHP_FUNCTION(dom_document_create_entity_reference)
{
@@ -1143,7 +1143,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094
Since:
Since:
*/
PHP_FUNCTION(dom_document_get_elements_by_tag_name)
{
@@ -1177,7 +1177,7 @@ PHP_FUNCTION(dom_document_import_node)
xmlDocPtr docp;
xmlNodePtr nodep, retnodep;
dom_object *intern, *nodeobj;
int ret;
int ret;
long recursive = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) {
@@ -1188,7 +1188,7 @@ PHP_FUNCTION(dom_document_import_node)
DOM_GET_OBJ(nodep, node, xmlNodePtr, nodeobj);
if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE
if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE
|| nodep->type == XML_DOCUMENT_TYPE_NODE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot import: Node Type Not Supported");
RETURN_FALSE;
@@ -1278,7 +1278,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
RETURN_FALSE;
}
nodep->ns = nsptr;
DOM_RET_OBJ(nodep, &ret, intern);
@@ -1580,15 +1580,11 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int sourc
xmlInitParser();
if (mode == DOM_LOAD_FILE) {
char *file_dest;
if (CHECK_NULL_PATH(source, source_len)) {
return NULL;
}
file_dest = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
char *file_dest = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
if (file_dest) {
ctxt = xmlCreateFileParserCtxt(file_dest);
}
} else {
ctxt = xmlCreateMemoryParserCtxt(source, source_len);
}
@@ -1761,7 +1757,7 @@ PHP_FUNCTION(dom_document_save)
char *file;
long options = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
return;
}
@@ -1910,7 +1906,7 @@ PHP_FUNCTION(dom_document_xinclude)
zval *id;
xmlDoc *docp;
xmlNodePtr root;
long flags = 0;
long flags = 0;
int err;
dom_object *intern;
@@ -1923,7 +1919,7 @@ PHP_FUNCTION(dom_document_xinclude)
err = xmlXIncludeProcessFlags(docp, flags);
/* XML_XINCLUDE_START and XML_XINCLUDE_END nodes need to be removed as these
are added via xmlXIncludeProcess to mark beginning and ending of xincluded document
are added via xmlXIncludeProcess to mark beginning and ending of xincluded document
but are not wanted in resulting document - must be done even if err as it could fail after
having processed some xincludes */
root = (xmlNodePtr) docp->children;
@@ -1939,7 +1935,7 @@ PHP_FUNCTION(dom_document_xinclude)
} else {
RETVAL_FALSE;
}
}
/* }}} */
@@ -1960,19 +1956,19 @@ PHP_FUNCTION(dom_document_validate)
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
cvp = xmlNewValidCtxt();
cvp->userData = NULL;
cvp->error = (xmlValidityErrorFunc) php_libxml_error_handler;
cvp->warning = (xmlValidityErrorFunc) php_libxml_error_handler;
if (xmlValidateDocument(cvp, docp)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
xmlFreeValidCtxt(cvp);
}
/* }}} */
@@ -1991,7 +1987,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
int is_valid;
char resolved_path[MAXPATHLEN + 1];
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
return;
}
@@ -2004,10 +2000,6 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
switch (type) {
case DOM_LOAD_FILE:
if (CHECK_NULL_PATH(source, source_len)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
RETURN_FALSE;
}
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
if (!valid_file) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
@@ -2017,7 +2009,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
break;
case DOM_LOAD_STRING:
parser = xmlSchemaNewMemParserCtxt(source, source_len);
/* If loading from memory, we need to set the base directory for the document
/* If loading from memory, we need to set the base directory for the document
but it is not apparent how to do that for schema's */
break;
default:
@@ -2091,7 +2083,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
int is_valid;
char resolved_path[MAXPATHLEN + 1];
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
return;
}
@@ -2104,10 +2096,6 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
switch (type) {
case DOM_LOAD_FILE:
if (CHECK_NULL_PATH(source, source_len)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
RETURN_FALSE;
}
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
if (!valid_file) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
@@ -2117,7 +2105,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
break;
case DOM_LOAD_STRING:
parser = xmlRelaxNGNewMemParserCtxt(source, source_len);
/* If loading from memory, we need to set the base directory for the document
/* If loading from memory, we need to set the base directory for the document
but it is not apparent how to do that for schema's */
break;
default:
@@ -2185,7 +2173,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
int source_len, refcount, ret;
long options = 0;
htmlParserCtxtPtr ctxt;
id = getThis();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
@@ -2198,10 +2186,6 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
}
if (mode == DOM_LOAD_FILE) {
if (CHECK_NULL_PATH(source, source_len)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid file source");
RETURN_FALSE;
}
ctxt = htmlCreateFileParserCtxt(source, NULL);
} else {
source_len = xmlStrlen(source);
@@ -2225,7 +2209,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
htmlParseDocument(ctxt);
newdoc = ctxt->myDoc;
htmlFreeParserCtxt(ctxt);
if (!newdoc)
RETURN_FALSE;
@@ -2290,7 +2274,7 @@ PHP_FUNCTION(dom_document_save_html_file)
char *file;
const char *encoding;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
return;
}
@@ -2347,13 +2331,13 @@ PHP_FUNCTION(dom_document_save_html)
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
RETURN_FALSE;
}
buf = xmlBufferCreate();
if (!buf) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch buffer");
RETURN_FALSE;
}
if (node->type == XML_DOCUMENT_FRAG_NODE) {
int one_size;
@@ -13,11 +13,6 @@ assert.bail=true
$doc = new DOMDocument();
$result = $doc->loadHTMLFile("");
assert('$result === false');
$doc = new DOMDocument();
$result = $doc->loadHTMLFile("text.html\0something");
assert('$result === false');
?>
--EXPECTF--
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Empty string supplied as input %s
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Invalid file source %s
-4
View File
@@ -1284,10 +1284,6 @@ int c;
register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
register unsigned uc = (unsigned char)c;
if (!g->setbits) {
return(0);
}
for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
if (col[uc] != 0)
return(1);
+108 -121
View File
@@ -74,7 +74,7 @@
#include "php_ini.h"
#include "ext/standard/php_string.h"
#include "ext/standard/php_image.h"
#include "ext/standard/info.h"
#include "ext/standard/info.h"
/* needed for ssize_t definition */
#include <sys/types.h>
@@ -161,7 +161,7 @@ ZEND_BEGIN_MODULE_GLOBALS(exif)
char * encode_jis;
char * decode_jis_be;
char * decode_jis_le;
ZEND_END_MODULE_GLOBALS(exif)
ZEND_END_MODULE_GLOBALS(exif)
ZEND_DECLARE_MODULE_GLOBALS(exif)
@@ -170,7 +170,7 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
#else
#define EXIF_G(v) (exif_globals.v)
#endif
/* {{{ PHP_INI
*/
@@ -213,7 +213,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("exif.decode_jis_intel", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_le, zend_exif_globals, exif_globals)
PHP_INI_END()
/* }}} */
/* {{{ PHP_GINIT_FUNCTION
*/
static PHP_GINIT_FUNCTION(exif)
@@ -233,9 +233,9 @@ PHP_MINIT_FUNCTION(exif)
{
REGISTER_INI_ENTRIES();
if (zend_hash_exists(&module_registry, "mbstring", sizeof("mbstring"))) {
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
} else {
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
}
return SUCCESS;
}
@@ -265,7 +265,7 @@ zend_module_entry exif_module_entry = {
exif_module_deps,
"exif",
exif_functions,
PHP_MINIT(exif),
PHP_MINIT(exif),
PHP_MSHUTDOWN(exif),
NULL, NULL,
PHP_MINFO(exif),
@@ -278,7 +278,7 @@ zend_module_entry exif_module_entry = {
NULL,
NULL,
STANDARD_MODULE_PROPERTIES_EX
#else
#else
STANDARD_MODULE_PROPERTIES
#endif
};
@@ -667,73 +667,73 @@ static tag_info_array tag_table_IFD = {
{ 0x0213, "YCbCrPositioning"},
{ 0x0214, "ReferenceBlackWhite"},
{ 0x02BC, "ExtensibleMetadataPlatform"}, /* XAP: Extensible Authoring Publishing, obsoleted by XMP: Extensible Metadata Platform */
{ 0x0301, "Gamma"},
{ 0x0302, "ICCProfileDescriptor"},
{ 0x0303, "SRGBRenderingIntent"},
{ 0x0320, "ImageTitle"},
{ 0x5001, "ResolutionXUnit"},
{ 0x5002, "ResolutionYUnit"},
{ 0x5003, "ResolutionXLengthUnit"},
{ 0x5004, "ResolutionYLengthUnit"},
{ 0x5005, "PrintFlags"},
{ 0x5006, "PrintFlagsVersion"},
{ 0x5007, "PrintFlagsCrop"},
{ 0x5008, "PrintFlagsBleedWidth"},
{ 0x5009, "PrintFlagsBleedWidthScale"},
{ 0x500A, "HalftoneLPI"},
{ 0x500B, "HalftoneLPIUnit"},
{ 0x500C, "HalftoneDegree"},
{ 0x500D, "HalftoneShape"},
{ 0x500E, "HalftoneMisc"},
{ 0x500F, "HalftoneScreen"},
{ 0x5010, "JPEGQuality"},
{ 0x5011, "GridSize"},
{ 0x5012, "ThumbnailFormat"},
{ 0x5013, "ThumbnailWidth"},
{ 0x5014, "ThumbnailHeight"},
{ 0x5015, "ThumbnailColorDepth"},
{ 0x5016, "ThumbnailPlanes"},
{ 0x5017, "ThumbnailRawBytes"},
{ 0x5018, "ThumbnailSize"},
{ 0x5019, "ThumbnailCompressedSize"},
{ 0x501A, "ColorTransferFunction"},
{ 0x501B, "ThumbnailData"},
{ 0x5020, "ThumbnailImageWidth"},
{ 0x5021, "ThumbnailImageHeight"},
{ 0x5022, "ThumbnailBitsPerSample"},
{ 0x5023, "ThumbnailCompression"},
{ 0x5024, "ThumbnailPhotometricInterp"},
{ 0x5025, "ThumbnailImageDescription"},
{ 0x5026, "ThumbnailEquipMake"},
{ 0x5027, "ThumbnailEquipModel"},
{ 0x5028, "ThumbnailStripOffsets"},
{ 0x5029, "ThumbnailOrientation"},
{ 0x502A, "ThumbnailSamplesPerPixel"},
{ 0x502B, "ThumbnailRowsPerStrip"},
{ 0x502C, "ThumbnailStripBytesCount"},
{ 0x502D, "ThumbnailResolutionX"},
{ 0x502E, "ThumbnailResolutionY"},
{ 0x502F, "ThumbnailPlanarConfig"},
{ 0x5030, "ThumbnailResolutionUnit"},
{ 0x5031, "ThumbnailTransferFunction"},
{ 0x5032, "ThumbnailSoftwareUsed"},
{ 0x5033, "ThumbnailDateTime"},
{ 0x5034, "ThumbnailArtist"},
{ 0x5035, "ThumbnailWhitePoint"},
{ 0x5036, "ThumbnailPrimaryChromaticities"},
{ 0x5037, "ThumbnailYCbCrCoefficients"},
{ 0x5038, "ThumbnailYCbCrSubsampling"},
{ 0x5039, "ThumbnailYCbCrPositioning"},
{ 0x503A, "ThumbnailRefBlackWhite"},
{ 0x503B, "ThumbnailCopyRight"},
{ 0x5090, "LuminanceTable"},
{ 0x5091, "ChrominanceTable"},
{ 0x5100, "FrameDelay"},
{ 0x5101, "LoopCount"},
{ 0x5110, "PixelUnit"},
{ 0x5111, "PixelPerUnitX"},
{ 0x5112, "PixelPerUnitY"},
{ 0x5113, "PaletteHistogram"},
{ 0x0301, "Gamma"},
{ 0x0302, "ICCProfileDescriptor"},
{ 0x0303, "SRGBRenderingIntent"},
{ 0x0320, "ImageTitle"},
{ 0x5001, "ResolutionXUnit"},
{ 0x5002, "ResolutionYUnit"},
{ 0x5003, "ResolutionXLengthUnit"},
{ 0x5004, "ResolutionYLengthUnit"},
{ 0x5005, "PrintFlags"},
{ 0x5006, "PrintFlagsVersion"},
{ 0x5007, "PrintFlagsCrop"},
{ 0x5008, "PrintFlagsBleedWidth"},
{ 0x5009, "PrintFlagsBleedWidthScale"},
{ 0x500A, "HalftoneLPI"},
{ 0x500B, "HalftoneLPIUnit"},
{ 0x500C, "HalftoneDegree"},
{ 0x500D, "HalftoneShape"},
{ 0x500E, "HalftoneMisc"},
{ 0x500F, "HalftoneScreen"},
{ 0x5010, "JPEGQuality"},
{ 0x5011, "GridSize"},
{ 0x5012, "ThumbnailFormat"},
{ 0x5013, "ThumbnailWidth"},
{ 0x5014, "ThumbnailHeight"},
{ 0x5015, "ThumbnailColorDepth"},
{ 0x5016, "ThumbnailPlanes"},
{ 0x5017, "ThumbnailRawBytes"},
{ 0x5018, "ThumbnailSize"},
{ 0x5019, "ThumbnailCompressedSize"},
{ 0x501A, "ColorTransferFunction"},
{ 0x501B, "ThumbnailData"},
{ 0x5020, "ThumbnailImageWidth"},
{ 0x5021, "ThumbnailImageHeight"},
{ 0x5022, "ThumbnailBitsPerSample"},
{ 0x5023, "ThumbnailCompression"},
{ 0x5024, "ThumbnailPhotometricInterp"},
{ 0x5025, "ThumbnailImageDescription"},
{ 0x5026, "ThumbnailEquipMake"},
{ 0x5027, "ThumbnailEquipModel"},
{ 0x5028, "ThumbnailStripOffsets"},
{ 0x5029, "ThumbnailOrientation"},
{ 0x502A, "ThumbnailSamplesPerPixel"},
{ 0x502B, "ThumbnailRowsPerStrip"},
{ 0x502C, "ThumbnailStripBytesCount"},
{ 0x502D, "ThumbnailResolutionX"},
{ 0x502E, "ThumbnailResolutionY"},
{ 0x502F, "ThumbnailPlanarConfig"},
{ 0x5030, "ThumbnailResolutionUnit"},
{ 0x5031, "ThumbnailTransferFunction"},
{ 0x5032, "ThumbnailSoftwareUsed"},
{ 0x5033, "ThumbnailDateTime"},
{ 0x5034, "ThumbnailArtist"},
{ 0x5035, "ThumbnailWhitePoint"},
{ 0x5036, "ThumbnailPrimaryChromaticities"},
{ 0x5037, "ThumbnailYCbCrCoefficients"},
{ 0x5038, "ThumbnailYCbCrSubsampling"},
{ 0x5039, "ThumbnailYCbCrPositioning"},
{ 0x503A, "ThumbnailRefBlackWhite"},
{ 0x503B, "ThumbnailCopyRight"},
{ 0x5090, "LuminanceTable"},
{ 0x5091, "ChrominanceTable"},
{ 0x5100, "FrameDelay"},
{ 0x5101, "LoopCount"},
{ 0x5110, "PixelUnit"},
{ 0x5111, "PixelPerUnitX"},
{ 0x5112, "PixelPerUnitY"},
{ 0x5113, "PaletteHistogram"},
{ 0x1000, "RelatedImageFileFormat"},
{ 0x800D, "ImageID"},
{ 0x80E3, "Matteing"}, /* obsoleted by ExtraSamples */
@@ -939,7 +939,7 @@ static tag_info_array tag_table_VND_NIKON = {
{ 0x000b, "Converter"},
TAG_TABLE_END
};
static tag_info_array tag_table_VND_NIKON_990 = {
{ 0x0001, "Version"},
{ 0x0002, "ISOSetting"},
@@ -958,7 +958,7 @@ static tag_info_array tag_table_VND_NIKON_990 = {
{ 0x0010, "DataDump"},
TAG_TABLE_END
};
static tag_info_array tag_table_VND_OLYMPUS = {
{ 0x0200, "SpecialMode"},
{ 0x0201, "JPEGQuality"},
@@ -1224,7 +1224,7 @@ char * exif_dump_data(int *dump_free, int format, int components, int length, in
if (components > 0) {
dump = erealloc(dump, len + 2 + 1);
snprintf(dump + len, 2 + 1, ", ");
len += 2;
len += 2;
components--;
} else{
break;
@@ -1574,7 +1574,7 @@ typedef struct {
static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type *ImageInfo, int type, const char *format, ...)
{
va_list args;
va_start(args, format);
#ifdef EXIF_DEBUG
{
@@ -2627,7 +2627,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
*pszEncoding = estrdup((const char*)szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
* since we have no encoding support for the BOM yet we skip that.
*/
if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
@@ -2645,8 +2645,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
}
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
(unsigned char**)pszInfoPtr,
&len,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
@@ -2666,8 +2666,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
ByteCount -= 8;
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
(unsigned char**)pszInfoPtr,
&len,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
@@ -2701,12 +2701,12 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
* Process unicode field in IFD. */
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
{
xp_field->tag = tag;
xp_field->tag = tag;
xp_field->value = NULL;
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)&xp_field->value,
&xp_field->size,
(unsigned char**)&xp_field->value,
&xp_field->size,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
@@ -2731,7 +2731,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
return FALSE;
maker_note = maker_note_array+i;
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
continue;
@@ -2852,9 +2852,9 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
/* If its bigger than 4 bytes, the dir entry contains an offset. */
value_ptr = offset_base+offset_val;
/*
/*
dir_entry is ImageInfo->file.list[sn].data+2+i*12
offset_base is ImageInfo->file.list[sn].data-dir_offset
offset_base is ImageInfo->file.list[sn].data-dir_offset
dir_entry - offset_base is dir_offset+2+i*12
*/
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
@@ -2925,18 +2925,18 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
case TAG_COMP_IMAGE_WIDTH:
ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
break;
case TAG_IMAGEHEIGHT:
case TAG_COMP_IMAGE_HEIGHT:
ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
break;
case TAG_STRIP_OFFSETS:
case TAG_JPEG_INTERCHANGE_FORMAT:
/* accept both formats */
ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
break;
case TAG_STRIP_BYTE_COUNTS:
if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) {
ImageInfo->Thumbnail.filetype = ImageInfo->FileType;
@@ -2946,7 +2946,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
}
ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
break;
case TAG_JPEG_INTERCHANGE_FORMAT_LEN:
if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) {
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG;
@@ -2964,16 +2964,16 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
if (length<byte_count-1) {
/* When there are any characters after the first NUL */
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1);
spprintf(&ImageInfo->Copyright, 0, "%s, %s", ImageInfo->CopyrightPhotographer, ImageInfo->CopyrightEditor);
ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
/* but we are not supposed to change this */
/* keep in mind that image_info does not store editor value */
} else {
ImageInfo->Copyright = estrndup(value_ptr, byte_count);
ImageInfo->Copyright = estrdup(value_ptr);
}
}
break;
break;
case TAG_USERCOMMENT:
ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC);
@@ -3061,10 +3061,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
break;
case TAG_MAKE:
ImageInfo->make = estrndup(value_ptr, byte_count);
ImageInfo->make = estrdup(value_ptr);
break;
case TAG_MODEL:
ImageInfo->model = estrndup(value_ptr, byte_count);
ImageInfo->model = estrdup(value_ptr);
break;
case TAG_MAKER_NOTE:
@@ -3134,11 +3134,6 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
ImageInfo->sections_found |= FOUND_IFD0;
if ((dir_start + 2) >= (offset_base+IFDlength)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
return FALSE;
}
NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) {
@@ -3162,10 +3157,6 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
* Hack to make it process IDF1 I hope
* There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
*/
if ((dir_start+2+12*de + 4) >= (offset_base+IFDlength)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
return FALSE;
}
NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
if (NextDirOffset) {
/* the next line seems false but here IFDlength means length of all IFDs */
@@ -3215,13 +3206,9 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
}
/* Check the next two values for correctness. */
if (length < 8) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)");
return;
}
exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel);
offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel);
if (exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)");
return;
}
@@ -3427,7 +3414,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
if ((itemlen - 2) < 6) {
return FALSE;
}
exif_process_SOFn(Data, marker, &sof_info);
ImageInfo->Width = sof_info.width;
ImageInfo->Height = sof_info.height;
@@ -3472,21 +3459,21 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC)
}
for (;;) {
pos += length;
if (pos>=ImageInfo->Thumbnail.size)
if (pos>=ImageInfo->Thumbnail.size)
return FALSE;
c = data[pos++];
if (pos>=ImageInfo->Thumbnail.size)
if (pos>=ImageInfo->Thumbnail.size)
return FALSE;
if (c != 0xFF) {
return FALSE;
}
n = 8;
while ((c = data[pos++]) == 0xFF && n--) {
if (pos+3>=ImageInfo->Thumbnail.size)
if (pos+3>=ImageInfo->Thumbnail.size)
return FALSE;
/* +3 = pos++ of next check when reaching marker + 2 bytes for length */
}
if (c == 0xFF)
if (c == 0xFF)
return FALSE;
marker = c;
length = php_jpg_get16(data+pos);
@@ -3800,7 +3787,7 @@ static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC)
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/II format");
#endif
ImageInfo->sections_found |= FOUND_IFD0;
if (exif_process_IFD_in_TIFF(ImageInfo,
if (exif_process_IFD_in_TIFF(ImageInfo,
php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
SECTION_IFD0 TSRMLS_CC)) {
ret = TRUE;
@@ -3980,7 +3967,7 @@ PHP_FUNCTION(exif_read_data)
sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC);
#ifdef EXIF_DEBUG
if (sections_str)
if (sections_str)
exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections found: %s", sections_str[0] ? sections_str : "None");
#endif
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #68799 (Free called on uninitialized pointer)
Bug #68799 (Free called on unitialized pointer)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
-61
View File
@@ -1,61 +0,0 @@
--TEST--
Bug #72094: Out of bounds heap read access in exif header processing
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
print_r(exif_read_data(__DIR__ . '/bug72094_1.jpg'));
print_r(exif_read_data(__DIR__ . '/bug72094_2.jpg'));
print_r(exif_read_data(__DIR__ . '/bug72094_3.jpg'));
print_r(exif_read_data(__DIR__ . '/bug72094_4.jpg'));
?>
DONE
--EXPECTF--
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): Process tag(x8298=Copyright ): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): Illegal IFD offset in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): File structure corrupted in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_1.jpg): Invalid JPEG file in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_2.jpg): Illegal IFD size in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_2.jpg): File structure corrupted in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_2.jpg): Invalid JPEG file in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Illegal IFD size in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): File structure corrupted in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_3.jpg): Invalid JPEG file in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_4.jpg): Invalid TIFF start (1) in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_4.jpg): File structure corrupted in %s/bug72094.php on line %d
Warning: exif_read_data(bug72094_4.jpg): Invalid JPEG file in %s/bug72094.php on line %d
DONE
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-5
View File
@@ -506,11 +506,6 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
RETVAL_FALSE;
goto clean;
}
if (CHECK_NULL_PATH(buffer, buffer_len)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
RETVAL_FALSE;
goto clean;
}
wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_CC);
+1 -1
View File
@@ -414,7 +414,7 @@ file_check_mem(struct magic_set *ms, unsigned int level)
size_t len;
if (level >= ms->c.len) {
len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
len = (ms->c.len += 20) * sizeof(*ms->c.li);
ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
emalloc(len) :
erealloc(ms->c.li, len));
-3
View File
@@ -1037,9 +1037,6 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
if (bytecnt > nbytes) {
bytecnt = nbytes;
}
if (offset > bytecnt) {
offset = bytecnt;
}
if (s == NULL) {
ms->search.s_len = 0;
ms->search.s = NULL;
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #68819 Fileinfo on specific file causes spurious OOM and/or segfault, var 1
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$string = <<<HERE
----a-----'''---------a---------------a--------a-----a-----a---------a-----as-------a----a--a-------------a--as-----s---------------a---------a---a--s-a-----a-----------asy---------a-----a-----------a----s--------a-------------a-------a--------a----s------------a-----a----------------a----s-----------------\r\n-------------------a-------a-a-------a-----a----a----s----s--------a-----------------------a----a----s-------------a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a----s----s--------a----------a----------------------a----a----s-------------a----------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n------a-------a-a-------a-----a----a---a-----a-----------------------a----a---a-----a------------------s-------a----a---a-----a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s------\r\n-------------------a-------a-a-------a-----a----a---a-------a------------------------a----a---a-----''--a-------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a-------s-----a---a-------------------------a----a-------------a---a-------------------s-------a----a-------------a---a-----as-a--------------a-----a--s----s---------y------------a-----a-s---a-------''----a---s--a-''------''----s------------a-y----------------s------a-----y--a-s--a-s------s--a-s----------''----------------------------a---s--a----a---------a-s---a-s--------s--------a---------s--a-y-------------as----a----a-------------a------a---s--a-s------a--------a----s----y--as--a----a-s---------------a-----a--------------------------------------\r\n-------------------a-------a-a-------a-----a----a-----------s--------a-----------------------a----a--------------------a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a-----------s--------a----------a----------------------a----a--------------------a------------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a---a-----------------------a----a---a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a---a----------a----------------------a----a---a------------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-----a-a-----------a-------a-a-------a-----a----a----a---s-----a-----------------------a----a----a---------a-----------------s-------a----a----a---------a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a--------a----a-----------------------a----a----------a----a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-----a-------------a-------a-a-------a-----a----a--------s-----a---a-------------------------a----a--------------a---a-------------------s-------------a---------------a----a---a---a-----as-a--------------a-----a--s----s---------y------------a-----a-s---a-------''----a---s--a-''------''----s------------a-y----------------s------a-----y--a-s--a-s------s--a-s----------''----------------------------a---s--a----a---------a-s---a-s--------s--------a---------s--a-y-------------as----a----a-------------a------a---s--a-s------a--------a----s----y--as--a----a-s---------------a-----a-----------Line truncated
HERE;
$finfo = new finfo();
$type = $finfo->buffer($string);
var_dump($type);
?>
--EXPECT--
string(60) "ASCII text, with very long lines, with CRLF line terminators"
-26
View File
@@ -1,26 +0,0 @@
--TEST--
Bug #68819 Fileinfo on specific file causes spurious OOM and/or segfault, var 2
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$string = '';
// These two in any order
$string .= "\r\n";
$string .= "''''";
// Total string length > 8192
$string .= str_repeat(chr(rand(32, 127)), 8184);
// Ending in this string
$string .= "say";
$finfo = new finfo();
$type = $finfo->buffer($string);
var_dump($type);
?>
--EXPECT--
string(60) "ASCII text, with very long lines, with CRLF line terminators"
-1
View File
@@ -1 +0,0 @@
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Bug #71527 Buffer over-write in finfo_open with malformed magic file
--SKIPIF--
<?php
if (!class_exists('finfo'))
die('skip no fileinfo extension');
--ENV--
USE_ZEND_ALLOC=0
--FILE--
<?php
$finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527.magic");
$info = finfo_file($finfo, __FILE__);
var_dump($info);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d
Warning: finfo_file() expects parameter 1 to be resource, boolean given in %sbug71527.php on line %d
bool(false)
-4
View File
@@ -19,7 +19,6 @@ echo "*** Testing finfo_file() : basic functionality ***\n";
var_dump( finfo_file( $finfo, __FILE__) );
var_dump( finfo_file( $finfo, __FILE__, FILEINFO_CONTINUE ) );
var_dump( finfo_file( $finfo, $magicFile ) );
var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
?>
===DONE===
@@ -28,7 +27,4 @@ var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
string(28) "text/x-php; charset=us-ascii"
string(22) "PHP script, ASCII text"
string(25) "text/plain; charset=utf-8"
Warning: finfo_file(): Invalid path in %s%efinfo_file_basic.php on line %d
bool(false)
===DONE===
+2 -2
View File
@@ -113,7 +113,7 @@ static void php_filter_strip(zval *value, long flags)
int i, c;
/* Optimization for if no strip flags are set */
if (!(flags & (FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_BACKTICK))) {
if (! ((flags & FILTER_FLAG_STRIP_LOW) || (flags & FILTER_FLAG_STRIP_HIGH)) ) {
return;
}
@@ -121,7 +121,7 @@ static void php_filter_strip(zval *value, long flags)
buf = safe_emalloc(1, Z_STRLEN_P(value) + 1, 1);
c = 0;
for (i = 0; i < Z_STRLEN_P(value); i++) {
if ((str[i] >= 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
if ((str[i] > 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
} else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) {
} else if ((str[i] == '`') && (flags & FILTER_FLAG_STRIP_BACKTICK)) {
} else {
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #69202 (FILTER_FLAG_STRIP_BACKTICK ignored unless other flags are used)
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
--FILE--
<?php
var_dump(filter_var("``a`b`c``", FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_BACKTICK));
var_dump(filter_var("``a`b`c``", FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_BACKTICK));
var_dump(filter_var("``a`b`c``", FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_BACKTICK));
var_dump(filter_var("``a`b`c``", FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
?>
--EXPECT--
string(3) "abc"
string(3) "abc"
string(3) "abc"
string(9) "``a`b`c``"
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #69203 (FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127)
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
--FILE--
<?php
var_dump(filter_var("\x7f", FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH));
var_dump(filter_var("\x7f", FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_HIGH));
var_dump(filter_var("\x7f", FILTER_SANITIZE_ENCODED, FILTER_FLAG_STRIP_HIGH));
var_dump(filter_var("\x7f", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_HIGH));
?>
--EXPECT--
string(0) ""
string(0) ""
string(0) ""
string(0) ""
+43 -41
View File
@@ -188,9 +188,9 @@ ftp_close(ftpbuf_t *ftp)
SSL_shutdown(ftp->ssl_handle);
SSL_free(ftp->ssl_handle);
}
#endif
#endif
closesocket(ftp->fd);
}
}
ftp_gc(ftp);
efree(ftp);
return NULL;
@@ -262,7 +262,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
if (!ftp_getresp(ftp)) {
return 0;
}
if (ftp->resp != 234) {
if (!ftp_putcmd(ftp, "AUTH", "SSL")) {
return 0;
@@ -270,7 +270,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
if (!ftp_getresp(ftp)) {
return 0;
}
if (ftp->resp != 334) {
return 0;
} else {
@@ -278,7 +278,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
ftp->use_ssl_for_data = 1;
}
}
ctx = SSL_CTX_new(SSLv23_client_method());
if (ctx == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create the SSL context");
@@ -325,8 +325,8 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
if (!ftp_getresp(ftp)) {
return 0;
}
ftp->use_ssl_for_data = (ftp->resp >= 200 && ftp->resp <=299);
ftp->use_ssl_for_data = (ftp->resp >= 200 && ftp->resp <=299);
}
}
#endif
@@ -360,7 +360,7 @@ ftp_reinit(ftpbuf_t *ftp)
{
if (ftp == NULL) {
return 0;
}
}
ftp_gc(ftp);
@@ -395,7 +395,7 @@ ftp_syst(ftpbuf_t *ftp)
if (!ftp_putcmd(ftp, "SYST", NULL)) {
return NULL;
}
if (!ftp_getresp(ftp) || ftp->resp != 215) {
if (!ftp_getresp(ftp) || ftp->resp != 215) {
return NULL;
}
syst = ftp->inbuf;
@@ -431,14 +431,14 @@ ftp_pwd(ftpbuf_t *ftp)
if (!ftp_putcmd(ftp, "PWD", NULL)) {
return NULL;
}
if (!ftp_getresp(ftp) || ftp->resp != 257) {
if (!ftp_getresp(ftp) || ftp->resp != 257) {
return NULL;
}
/* copy out the pwd from response */
if ((pwd = strchr(ftp->inbuf, '"')) == NULL) {
if ((pwd = strchr(ftp->inbuf, '"')) == NULL) {
return NULL;
}
if ((end = strrchr(++pwd, '"')) == NULL) {
if ((end = strrchr(++pwd, '"')) == NULL) {
return NULL;
}
ftp->pwd = estrndup(pwd, end - pwd);
@@ -608,7 +608,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
if (!ftp_getresp(ftp) || ftp->resp != 200) {
return 0;
}
return 1;
}
/* }}} */
@@ -625,7 +625,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
}
snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
return 0;
}
@@ -642,7 +642,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
return 0;
}
return 1;
return 1;
}
/* }}} */
@@ -674,7 +674,7 @@ ftp_type(ftpbuf_t *ftp, ftptype_t type)
if (ftp == NULL) {
return 0;
}
if (type == ftp->type) {
if (type == ftp->type) {
return 1;
}
if (type == FTPTYPE_ASCII) {
@@ -765,7 +765,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
if (!ftp_putcmd(ftp, "PASV", NULL)) {
return 0;
}
if (!ftp_getresp(ftp) || ftp->resp != 227) {
if (!ftp_getresp(ftp) || ftp->resp != 227) {
return 0;
}
/* parse out the IP and port */
@@ -807,7 +807,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
goto bail;
}
ftp->data = data;
if (resumepos > 0) {
@@ -900,7 +900,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, l
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
goto bail;
}
ftp->data = data;
ftp->data = data;
if (startpos > 0) {
snprintf(arg, sizeof(arg), "%ld", startpos);
@@ -1101,7 +1101,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
if (strpbrk(cmd, "\r\n")) {
return 0;
}
}
/* build the output buffer */
if (args && args[0]) {
/* "cmd args\r\n\0" */
@@ -1247,7 +1247,7 @@ my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
#if HAVE_OPENSSL_EXT
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
sent = SSL_write(ftp->ssl_handle, buf, size);
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
sent = SSL_write(ftp->data->ssl_handle, buf, size);
} else {
#endif
@@ -1287,14 +1287,14 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
#if HAVE_OPENSSL_EXT
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
nr_bytes = SSL_read(ftp->ssl_handle, buf, len);
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
nr_bytes = SSL_read(ftp->data->ssl_handle, buf, len);
} else {
#endif
nr_bytes = recv(s, buf, len, 0);
#if HAVE_OPENSSL_EXT
}
#endif
#endif
return (nr_bytes);
}
/* }}} */
@@ -1511,7 +1511,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC)
data_accepted:
#if HAVE_OPENSSL_EXT
/* now enable ssl if we need to */
if (ftp->use_ssl && ftp->use_ssl_for_data) {
ctx = SSL_CTX_new(SSLv23_client_method());
@@ -1531,23 +1531,23 @@ data_accepted:
SSL_CTX_free(ctx);
return 0;
}
SSL_set_fd(data->ssl_handle, data->fd);
if (ftp->old_ssl) {
SSL_copy_session_id(data->ssl_handle, ftp->ssl_handle);
}
if (SSL_connect(data->ssl_handle) <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: SSL/TLS handshake failed");
SSL_shutdown(data->ssl_handle);
SSL_free(data->ssl_handle);
return 0;
}
data->ssl_active = 1;
}
}
#endif
@@ -1562,14 +1562,14 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
{
#if HAVE_OPENSSL_EXT
SSL_CTX *ctx;
#endif
#endif
if (data == NULL) {
return NULL;
}
if (data->listener != -1) {
#if HAVE_OPENSSL_EXT
if (data->ssl_active) {
ctx = SSL_get_SSL_CTX(data->ssl_handle);
SSL_CTX_free(ctx);
@@ -1577,9 +1577,9 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
SSL_free(data->ssl_handle);
data->ssl_active = 0;
}
#endif
#endif
closesocket(data->listener);
}
}
if (data->fd != -1) {
#if HAVE_OPENSSL_EXT
if (data->ssl_active) {
@@ -1590,9 +1590,9 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
SSL_free(data->ssl_handle);
data->ssl_active = 0;
}
#endif
#endif
closesocket(data->fd);
}
}
if (ftp) {
ftp->data = NULL;
}
@@ -1610,8 +1610,8 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
databuf_t *data = NULL;
char *ptr;
int ch, lastch;
size_t size, rcvd;
size_t lines;
int size, rcvd;
int lines;
char **ret = NULL;
char **entry;
char *text;
@@ -1629,7 +1629,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
goto bail;
}
ftp->data = data;
ftp->data = data;
if (!ftp_putcmd(ftp, cmd, path)) {
goto bail;
@@ -1653,7 +1653,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
lines = 0;
lastch = 0;
while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
if (rcvd == -1 || rcvd > ((size_t)(-1))-size) {
if (rcvd == -1) {
goto bail;
}
@@ -1663,6 +1663,8 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
if (*ptr == '\n' && lastch == '\r') {
lines++;
} else {
size++;
}
lastch = *ptr;
}
@@ -1856,7 +1858,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
goto bail;
}
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
goto bail;
}
ftp->data = data;
@@ -1912,7 +1914,7 @@ ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC)
goto bail;
}
ftp->data = data_close(ftp, ftp->data);
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
goto bail;
}
+12 -13
View File
@@ -1417,7 +1417,7 @@ PHP_FUNCTION(imageloadfont)
gdFontPtr font;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_name) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_name) == FAILURE) {
return;
}
@@ -1735,7 +1735,7 @@ PHP_FUNCTION(imagefilledarc)
long cx, cy, w, h, ST, E, col, style;
gdImagePtr im;
int e, st;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
return;
}
@@ -1976,7 +1976,7 @@ PHP_FUNCTION(imagegrabwindow)
if ( handle == 0 ) {
goto clean;
}
pPrintWindow = (tPrintWindow) GetProcAddress(handle, "PrintWindow");
pPrintWindow = (tPrintWindow) GetProcAddress(handle, "PrintWindow");
if ( pPrintWindow ) {
pPrintWindow(window, memDC, (UINT) client_area);
@@ -2354,7 +2354,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
long ignore_warning;
if (image_type == PHP_GDIMG_TYPE_GD2PART) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
return;
}
if (width < 1 || height < 1) {
@@ -2362,7 +2362,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
RETURN_FALSE;
}
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
return;
}
}
@@ -3045,11 +3045,10 @@ PHP_FUNCTION(imagegammacorrect)
for (x = 0; x < gdImageSX(im); x++) {
c = gdImageGetPixel(im, x, y);
gdImageSetPixel(im, x, y,
gdTrueColorAlpha(
gdTrueColor(
(int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5),
(int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5),
(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5),
gdTrueColorGetAlpha(c)
(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5)
)
);
}
@@ -3846,7 +3845,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
if (zend_hash_get_current_data_ex(HASH_OF(EXT), (void **) &item, &pos) == FAILURE) {
continue;
}
if (strcmp("linespacing", key) == 0) {
convert_to_double_ex(item);
strex.flags |= gdFTEX_LINESPACE;
@@ -3925,7 +3924,7 @@ PHP_FUNCTION(imagepsloadfont)
struct stat st;
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
return;
}
@@ -4032,7 +4031,7 @@ PHP_FUNCTION(imagepsencodefont)
char *enc, **enc_vector;
int enc_len, *f_ind;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &fnt, &enc, &enc_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &fnt, &enc, &enc_len) == FAILURE) {
return;
}
@@ -4265,11 +4264,11 @@ PHP_FUNCTION(imagepsbbox)
if (argc != 3 && argc != 6) {
ZEND_WRONG_PARAM_COUNT();
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srl|lld", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) {
return;
}
if (argc == 6) {
space = sp;
add_width = wd;
-6
View File
@@ -145,15 +145,9 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
cidx = gdCalloc(sidx, 1);
for (i = 0; i < nc; i++) {
if (gdGetInt(&cidx[i].offset, in) != 1) {
gdFree(cidx);
goto fail1;
}
if (gdGetInt(&cidx[i].size, in) != 1) {
gdFree(cidx);
goto fail1;
}
if (cidx[i].offset < 0 || cidx[i].size < 0) {
gdFree(cidx);
goto fail1;
}
}
+1 -1
View File
@@ -2162,7 +2162,7 @@ gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, in
images can be done at a later point.
*/
if (src->trueColor == 0) {
if (bgcolor < gdMaxColors) {
if (bgcolor >= 0) {
bgcolor = gdTrueColorAlpha(src->red[bgcolor], src->green[bgcolor], src->blue[bgcolor], src->alpha[bgcolor]);
}
gdImagePaletteToTrueColor(src);
+7 -7
View File
@@ -706,14 +706,14 @@ static WebPResult VPXEncode(const uint8* Y,
codec_ctl(&enc, VP8E_SET_STATIC_THRESHOLD, 0);
codec_ctl(&enc, VP8E_SET_TOKEN_PARTITIONS, 2);
vpx_img_wrap(&img, VPX_IMG_FMT_I420,
vpx_img_wrap(&img, IMG_FMT_I420,
y_width, y_height, 16, (uint8*)(Y));
img.planes[VPX_PLANE_Y] = (uint8*)(Y);
img.planes[VPX_PLANE_U] = (uint8*)(U);
img.planes[VPX_PLANE_V] = (uint8*)(V);
img.stride[VPX_PLANE_Y] = y_stride;
img.stride[VPX_PLANE_U] = uv_stride;
img.stride[VPX_PLANE_V] = uv_stride;
img.planes[PLANE_Y] = (uint8*)(Y);
img.planes[PLANE_U] = (uint8*)(U);
img.planes[PLANE_V] = (uint8*)(V);
img.stride[PLANE_Y] = y_stride;
img.stride[PLANE_U] = uv_stride;
img.stride[PLANE_V] = uv_stride;
res = vpx_codec_encode(&enc, &img, 0, 1, 0, VPX_DL_BEST_QUALITY);
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #61221 - imagegammacorrect function loses alpha channel
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$imagew = 50;
$imageh = 50;
$img = imagecreatetruecolor($imagew, $imageh);
$blacktransparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
$redsolid = imagecolorallocate($img, 255, 0, 0);
imagefill($img, 0, 0, $blacktransparent);
imageline($img, $imagew / 2, 0, $imagew / 2, $imageh - 1, $redsolid);
imageline($img, 0, $imageh / 2, $imagew - 1, $imageh / 2, $redsolid);
imagegammacorrect($img, 1, 1);
$color = imagecolorat($img, 0, 0);
var_dump($color === $blacktransparent);
imagedestroy($img);
?>
--EXPECT--
bool(true)
Loaded 100 of 461 files, more files were not shown because too many files have changed in this diff. Show more