mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-16 21:46:38 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df586243a3 | ||
|
|
25848cec92 | ||
|
|
c301479e9e | ||
|
|
eb8baaaafd | ||
|
|
45ef9014eb | ||
|
|
6e9144de5a | ||
|
|
01b665ee7e | ||
|
|
b5cfeaf13c | ||
|
|
b1003c95a9 | ||
|
|
6116c0e559 | ||
|
|
a02250879b |
No files matched your search
+5
-2
@@ -1,4 +1,8 @@
|
||||
language: c
|
||||
language: php
|
||||
|
||||
php:
|
||||
# We only specify one version so we only get one worker
|
||||
- 5.4
|
||||
|
||||
notifications:
|
||||
email:
|
||||
@@ -25,7 +29,6 @@ before_install:
|
||||
- sudo apt-get install -y libenchant-dev libaspell-dev libpspell-dev librecode-dev
|
||||
- sudo cp ./travis/de /var/lib/locales/supported.d/de
|
||||
- sudo dpkg-reconfigure locales
|
||||
- ./travis/install.sh
|
||||
|
||||
before_script:
|
||||
# Compile PHP
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ Exceptions:
|
||||
|
||||
4. When writing functions that deal with strings, be sure to remember
|
||||
that PHP holds the length property of each string, and that it
|
||||
shouldn't be calculated with strlen(). Write your functions in such
|
||||
shouldn't be calculated with strlen(). Write your functions in a such
|
||||
a way so that they'll take advantage of the length property, both
|
||||
for efficiency and in order for them to be binary-safe.
|
||||
Functions that change strings and obtain their new lengths while
|
||||
|
||||
@@ -155,7 +155,7 @@ Table of Contents
|
||||
a list of all available options along with short explanations running
|
||||
./configure --help. Our manual documents the different options
|
||||
separately. You will find the core options in the appendix, while the
|
||||
different extension specific options are described on the reference
|
||||
different extension specific options are descibed on the reference
|
||||
pages.
|
||||
|
||||
When PHP is configured, you are ready to build the module and/or
|
||||
|
||||
@@ -1,172 +1,5 @@
|
||||
PHP NEWS
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
22 Jan 2015, PHP 5.6.5
|
||||
|
||||
- Core:
|
||||
. Upgraded crypt_blowfish to version 1.3. (Leigh)
|
||||
. Fixed bug #60704 (unlink() bug with some files path).
|
||||
. Fixed bug #65419 (Inside trait, self::class != __CLASS__). (Julien)
|
||||
. Fixed bug #68536 (pack for 64bits integer is broken on bigendian). (Remi)
|
||||
. Fixed bug #55541 (errors spawn MessageBox, which blocks test automation).
|
||||
(Anatol)
|
||||
. Fixed bug #68297 (Application Popup provides too few information). (Anatol)
|
||||
. Fixed bug #65769 (localeconv() broken in TS builds). (Anatol)
|
||||
. Fixed bug #65230 (setting locale randomly broken). (Anatol)
|
||||
. Fixed bug #66764 (configure doesn't define EXPANDED_DATADIR / PHP_DATADIR
|
||||
correctly). (Ferenc)
|
||||
. Fixed bug #68583 (Crash in timeout thread). (Anatol)
|
||||
. Fixed bug #65576 (Constructor from trait conflicts with inherited
|
||||
constructor). (dunglas at gmail dot com)
|
||||
. Fixed bug #68676 (Explicit Double Free). (Kalle)
|
||||
. Fixed bug #68710 (Use After Free Vulnerability in PHP's unserialize()).
|
||||
(CVE-2015-0231) (Stefan Esser)
|
||||
|
||||
- CGI:
|
||||
. Fixed bug #68618 (out of bounds read crashes php-cgi). (CVE-2014-9427)
|
||||
(Stas)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #68745 (Invalid HTTP requests make web server segfault). (Adam)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #67643 (curl_multi_getcontent returns '' when
|
||||
CURLOPT_RETURNTRANSFER isn't set). (Jille Timmermans)
|
||||
|
||||
- Date:
|
||||
. Implemented FR #68268 (DatePeriod: Getter for start date, end date and
|
||||
interval). (Marc Bennewitz)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #68799: Free called on unitialized pointer. (CVE-2015-0232)
|
||||
(Stas)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #68398 (msooxml matches too many archives). (Anatol)
|
||||
. Fixed bug #68665 (invalid free in libmagic). (Joshua Rogers, Anatol Belski)
|
||||
. Fixed bug #68671 (incorrect expression in libmagic).
|
||||
(Joshua Rogers, Anatol Belski)
|
||||
. Removed readelf.c and related code from libmagic sources
|
||||
(Remi, Anatol)
|
||||
. Fixed bug #68735 (fileinfo out-of-bounds memory access).
|
||||
(Anatol)
|
||||
|
||||
- FPM:
|
||||
. Fixed request #68526 (Implement POSIX Access Control List for UDS). (Remi)
|
||||
. Fixed bug #68751 (listen.allowed_clients is broken). (Remi)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #68601 (buffer read overflow in gd_gif_in.c). (Jan Bee, Remi)
|
||||
. Fixed request #68656 (Report gd library version). (Remi)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #68504 (--with-libmbfl configure option not present on Windows).
|
||||
(Ashesh Vashi)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #68644 (strlen incorrect : mbstring + func_overload=2 +UTF-8
|
||||
+ Opcache). (Laruence)
|
||||
. Fixed bug #67111 (Memory leak when using "continue 2" inside two foreach
|
||||
loops). (Nikita)
|
||||
|
||||
- OpenSSL:
|
||||
. Improved handling of OPENSSL_KEYTYPE_EC keys. (Dominic Luechinger)
|
||||
|
||||
- pcntl:
|
||||
. Fixed bug #60509 (pcntl_signal doesn't decrease ref-count of old handler
|
||||
when setting SIG_DFL). (Julien)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #66679 (Alignment Bug in PCRE 8.34 upstream).
|
||||
(Rainer Jung, Anatol Belski)
|
||||
|
||||
- pgsql:
|
||||
. Fixed bug #68697 (lo_export return -1 on failure). (Ondřej Surý)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #68371 (PDO#getAttribute() cannot be called with platform-specifi
|
||||
attribute names). (Matteo)
|
||||
|
||||
- PDO_mysql:
|
||||
. Fixed bug #68424 (Add new PDO mysql connection attr to control multi
|
||||
statements option). (peter dot wolanin at acquia dot com)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #66405 (RecursiveDirectoryIterator::CURRENT_AS_PATHNAME
|
||||
breaks the RecursiveIterator). (Paul Garvin)
|
||||
. Fixed bug #68479 (Added escape parameter to SplFileObject::fputcsv). (Salathe)
|
||||
|
||||
- SQLite:
|
||||
. Fixed bug #68120 (Update bundled libsqlite to 3.8.7.2). (Anatol)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #68532 (convert.base64-encode omits padding bytes).
|
||||
(blaesius at krumedia dot de)
|
||||
|
||||
18 Dec 2014, PHP 5.6.4
|
||||
|
||||
- Core:
|
||||
. Fixed bug #68091 (Some Zend headers lack appropriate extern "C" blocks).
|
||||
(Adam)
|
||||
. Fixed bug #68104 (Segfault while pre-evaluating a disabled function).
|
||||
(Laruence)
|
||||
. Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly
|
||||
triggered). (Julien)
|
||||
. Fixed bug #68355 (Inconsistency in example php.ini comments).
|
||||
(Chris McCafferty)
|
||||
. Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence)
|
||||
. Fixed bug #68422 (Incorrect argument reflection info for array_multisort()).
|
||||
(Alexander Lisachenko)
|
||||
. Fixed bug #68545 (NULL pointer dereference in unserialize.c). (Anatol)
|
||||
. Fixed bug #68446 (Array constant not accepted for array parameter default).
|
||||
(Bob, Dmitry)
|
||||
. Fixed bug #68594 (Use after free vulnerability in unserialize()).
|
||||
(CVE-2014-8142) (Stefan Esser)
|
||||
|
||||
- Date:
|
||||
. Fixed day_of_week function as it could sometimes return negative values
|
||||
internally. (Derick)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #68381 (fpm_unix_init_main ignores log_level).
|
||||
(David Zuelke, Remi)
|
||||
. Fixed bug #68420 (listen=9000 listens to ipv6 localhost instead of all
|
||||
addresses). (Remi)
|
||||
. Fixed bug #68421 (access.format='%R' doesn't log ipv6 address). (Remi)
|
||||
. Fixed bug #68423 (PHP-FPM will no longer load all pools). (Remi)
|
||||
. Fixed bug #68428 (listen.allowed_clients is IPv4 only). (Remi)
|
||||
. Fixed bug #68452 (php-fpm man page is oudated). (Remi)
|
||||
. Fixed request #68458 (Change pm.start_servers default warning to
|
||||
notice). (David Zuelke, Remi)
|
||||
. Fixed bug #68463 (listen.allowed_clients can silently result
|
||||
in no allowed access). (Remi)
|
||||
. Fixed request #68391 (php-fpm conf files loading order).
|
||||
(Florian Margaine, Remi)
|
||||
. Fixed bug #68478 (access.log don't use prefix). (Remi)
|
||||
|
||||
- Mcrypt:
|
||||
. Fixed possible read after end of buffer and use after free. (Dmitry)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #68419 (build error with gmp 4.1). (Remi)
|
||||
|
||||
- PDO_pgsql:
|
||||
. Fixed bug #67462 (PDO_PGSQL::beginTransaction() wrongly throws exception
|
||||
when not in transaction) (Matteo)
|
||||
. Fixed bug #68351 (PDO::PARAM_BOOL and ATTR_EMULATE_PREPARES misbehaving)
|
||||
(Matteo)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #68331 (Session custom storage callable functions not being called)
|
||||
(Yasuo Ohgaki)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #68361 (Segmentation fault on SoapClient::__getTypes).
|
||||
(Laruence)
|
||||
|
||||
- zlib:
|
||||
. Fixed bug #53829 (Compiling PHP with large file support will replace
|
||||
function gzopen by gzopen64) (Sascha Kettler, Matteo)
|
||||
|
||||
13 Nov 2014, PHP 5.6.3
|
||||
|
||||
- Core:
|
||||
@@ -567,7 +400,6 @@
|
||||
. Fixed issue with null bytes in LDAP bindings. (Matthew Daley)
|
||||
|
||||
- litespeed
|
||||
. Updated LiteSpeed SAPI code to V6.6 (George Wang)
|
||||
. Fixed bug #63228 (-Werror=format-security error in lsapi code).
|
||||
(Elan Ruusamäe, George)
|
||||
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ the original run-tests.php script. server-tests is *not* used by
|
||||
'make test'. server-tests was developed to provide support for
|
||||
testing PHP under it's primary environment, HTTP, and can run the
|
||||
PHP tests under any of the SAPI modules that are direct executables,
|
||||
or are accessible via HTTP.
|
||||
or are accessable via HTTP.
|
||||
|
||||
[New features]
|
||||
----------------
|
||||
@@ -95,7 +95,7 @@ include:
|
||||
$filename full native path to file, will become PATH_TRANSLATED
|
||||
$filepath =dirname($filename)
|
||||
$scriptname this is what will become SCRIPT_NAME unless you override it
|
||||
$docroot the equivalent of DOCUMENT_ROOT under Apache
|
||||
$docroot the equivelant of DOCUMENT_ROOT under Apache
|
||||
$cwd the directory that the test is being initiated from
|
||||
$this->conf all server-tests configuration vars
|
||||
$this->env all environment variables that will get passed to the test
|
||||
@@ -105,7 +105,7 @@ include:
|
||||
This section is also eval'd, and is similar in nature to --ENV--. However,
|
||||
this section is used to build the url used in an HTTP request. Valid values
|
||||
to set in this section would include:
|
||||
SCRIPT_NAME The initial part of the request url
|
||||
SCRIPT_NAME The inital part of the request url
|
||||
PATH_INFO The pathinfo part of a request url
|
||||
FRAGMENT The fragment section of a url (after #)
|
||||
QUERY_STRING The query part of a url (after ?)
|
||||
|
||||
@@ -266,9 +266,6 @@ PHP 5.6 UPGRADE NOTES
|
||||
6. New Functions
|
||||
========================================
|
||||
|
||||
- Datetime:
|
||||
Added DatePeriod::getStartDate(), DatePeriod::getEndDate(), DatePeriod::getDateInterval() in 5.6.5.
|
||||
|
||||
- GMP:
|
||||
Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots.
|
||||
Added gmp_import($data, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
|
||||
@@ -301,15 +298,12 @@ PHP 5.6 UPGRADE NOTES
|
||||
Added PDO::pgsqlGetNotify($result_type = PDO::FETCH_USE_DEFAULT, $ms_timeout = 0)
|
||||
Added PDO::pgsqlGetPid()
|
||||
|
||||
- Reflection
|
||||
Added ReflectionFunction::isVariadic() and ReflectionParameter::isVariadic().
|
||||
- Zip:
|
||||
Added ZipArchive::setPassword($password)
|
||||
|
||||
- SPL
|
||||
Added SplFileObject::fread($length) to complement fwrite() method (>= 5.5.11)
|
||||
|
||||
- Zip:
|
||||
Added ZipArchive::setPassword($password)
|
||||
|
||||
========================================
|
||||
7. New Classes and Interfaces
|
||||
========================================
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65419 (Inside trait, self::class != __CLASS__)
|
||||
--FILE--
|
||||
<?php
|
||||
trait abc
|
||||
{
|
||||
static function def()
|
||||
{
|
||||
echo self::class, "\n";
|
||||
echo __CLASS__, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class ghi
|
||||
{
|
||||
use abc;
|
||||
}
|
||||
|
||||
ghi::def();
|
||||
?>
|
||||
--EXPECTF--
|
||||
ghi
|
||||
ghi
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67111: Memory leak when using "continue 2" inside two foreach loops
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array1 = [1, 2, 3];
|
||||
$array2 = [1, 2, 3];
|
||||
|
||||
foreach ($array1 as $x) {
|
||||
foreach ($array2 as $y) {
|
||||
echo "$x.$y\n";
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
1.1
|
||||
2.1
|
||||
3.1
|
||||
@@ -19,6 +19,6 @@ $b = new b();
|
||||
$b->test();
|
||||
|
||||
--EXPECTF--
|
||||
Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.php on line %d
|
||||
Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s/bug67436/b.php on line %d
|
||||
b::test()
|
||||
a::test(c::TESTCONSTANT)
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68370 "unset($this)" can make the program crash
|
||||
--FILE--
|
||||
<?php
|
||||
class C {
|
||||
public function test() {
|
||||
unset($this);
|
||||
return get_defined_vars();
|
||||
}
|
||||
}
|
||||
$c = new C();
|
||||
$x = $c->test();
|
||||
print_r($x);
|
||||
unset($c, $x);
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
)
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68446 (Array constant not accepted for array parameter default)
|
||||
--FILE--
|
||||
<?php
|
||||
const FOO = [1];
|
||||
const BAR = null;
|
||||
|
||||
function a(array $a = FOO) {
|
||||
var_dump($a);
|
||||
}
|
||||
|
||||
function b(array $b = BAR) {
|
||||
var_dump($b);
|
||||
}
|
||||
|
||||
b(null);
|
||||
b([]);
|
||||
b();
|
||||
a([]);
|
||||
a();
|
||||
a(null);
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
array(0) {
|
||||
}
|
||||
NULL
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
|
||||
Catchable fatal error: Argument 1 passed to a() must be of the type array, null given, called in %s on line %d and defined in %s on line %d
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65576 (Constructor from trait conflicts with inherited constructor)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait T
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
echo "Trait contructor\n";
|
||||
}
|
||||
}
|
||||
|
||||
class A
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
echo "Parent constructor\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
use T;
|
||||
}
|
||||
|
||||
new B();
|
||||
|
||||
--EXPECT--
|
||||
Trait contructor
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65576 (Constructor from trait conflicts with inherited constructor)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait T
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
echo "Trait contructor\n";
|
||||
}
|
||||
}
|
||||
|
||||
class A
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
echo "Parent constructor\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
use T;
|
||||
}
|
||||
|
||||
new B();
|
||||
|
||||
--EXPECT--
|
||||
Parent constructor
|
||||
Trait contructor
|
||||
|
||||
@@ -817,6 +817,9 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
#ifdef ZEND_SIGNALS
|
||||
zend_signal_shutdown(TSRMLS_C);
|
||||
#endif
|
||||
#ifdef ZEND_WIN32
|
||||
zend_shutdown_timeout_thread();
|
||||
#endif
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
|
||||
|
||||
+9
-6
@@ -2635,15 +2635,18 @@ ZEND_API ZEND_FUNCTION(display_disabled_function)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_function_entry disabled_function[] = {
|
||||
ZEND_FE(display_disabled_function, NULL)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_internal_function *func;
|
||||
if (zend_hash_find(CG(function_table), function_name, function_name_length+1, (void **)&func)==SUCCESS) {
|
||||
func->arg_info = NULL;
|
||||
func->handler = ZEND_FN(display_disabled_function);
|
||||
return SUCCESS;
|
||||
if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return FAILURE;
|
||||
disabled_function[0].fname = function_name;
|
||||
return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+7
-22
@@ -1931,11 +1931,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
|
||||
if (class_type->u.constant.type == IS_ARRAY) {
|
||||
cur_arg_info->type_hint = IS_ARRAY;
|
||||
if (op == ZEND_RECV_INIT) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
|
||||
cur_arg_info->allow_null = 1;
|
||||
} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
|
||||
/* delay constant resolution and check to run-time */
|
||||
cur_arg_info->allow_null = 0;
|
||||
} else if (Z_TYPE(initialization->u.constant) != IS_ARRAY) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL");
|
||||
}
|
||||
@@ -1943,11 +1940,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
|
||||
} else if (class_type->u.constant.type == IS_CALLABLE) {
|
||||
cur_arg_info->type_hint = IS_CALLABLE;
|
||||
if (op == ZEND_RECV_INIT) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
|
||||
cur_arg_info->allow_null = 1;
|
||||
} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
|
||||
/* delay constant resolution and check to run-time */
|
||||
cur_arg_info->allow_null = 0;
|
||||
} else {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL");
|
||||
}
|
||||
@@ -1961,11 +1955,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
|
||||
cur_arg_info->class_name = Z_STRVAL(class_type->u.constant);
|
||||
cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant);
|
||||
if (op == ZEND_RECV_INIT) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
|
||||
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
|
||||
cur_arg_info->allow_null = 1;
|
||||
} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
|
||||
/* delay constant resolution and check to run-time */
|
||||
cur_arg_info->allow_null = 0;
|
||||
} else {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL");
|
||||
}
|
||||
@@ -2214,12 +2205,6 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
|
||||
if (!CG(active_class_entry)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot access self::class when no class scope is active");
|
||||
}
|
||||
if (CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) {
|
||||
constant_name.op_type = IS_CONST;
|
||||
ZVAL_STRINGL(&constant_name.u.constant, "class", sizeof("class")-1, 1);
|
||||
zend_do_fetch_constant(result, class_name, &constant_name, ZEND_RT, 1 TSRMLS_CC);
|
||||
break;
|
||||
}
|
||||
zval_dtor(&class_name->u.constant);
|
||||
class_name->op_type = IS_CONST;
|
||||
ZVAL_STRINGL(&class_name->u.constant, CG(active_class_entry)->name, CG(active_class_entry)->name_length, 1);
|
||||
@@ -3979,7 +3964,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint
|
||||
if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) {
|
||||
ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE;
|
||||
} else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) {
|
||||
if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
|
||||
if (ce->constructor) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name);
|
||||
}
|
||||
ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR;
|
||||
@@ -4006,7 +3991,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint
|
||||
zend_str_tolower_copy(lowercase_name, ce->name, ce->name_length);
|
||||
lowercase_name = (char*)zend_new_interned_string(lowercase_name, ce->name_length + 1, 1 TSRMLS_CC);
|
||||
if (!memcmp(mname, lowercase_name, mname_len)) {
|
||||
if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
|
||||
if (ce->constructor) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name);
|
||||
}
|
||||
ce->constructor = fe;
|
||||
@@ -4261,8 +4246,8 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
|
||||
|
||||
/* make sure that the trait method is not from a class mentioned in
|
||||
exclude_from_classes, for consistency */
|
||||
if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[j]) {
|
||||
zend_error(E_COMPILE_ERROR,
|
||||
if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i]) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR,
|
||||
"Inconsistent insteadof definition. "
|
||||
"The method %s is to be used from %s, but %s is also on the exclude list",
|
||||
cur_method_ref->method_name,
|
||||
|
||||
+4
-19
@@ -608,22 +608,7 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_null_constant(zval *default_value TSRMLS_DC)
|
||||
{
|
||||
if (IS_CONSTANT_TYPE(Z_TYPE_P(default_value))) {
|
||||
zval constant = *default_value;
|
||||
zval *constant_ptr = &constant;
|
||||
|
||||
zval_update_constant(&constant_ptr, 0 TSRMLS_CC);
|
||||
if (Z_TYPE(constant) == IS_NULL) {
|
||||
return 1;
|
||||
}
|
||||
zval_dtor(&constant);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type, zval *default_value TSRMLS_DC)
|
||||
static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type TSRMLS_DC)
|
||||
{
|
||||
zend_arg_info *cur_arg_info;
|
||||
char *need_msg;
|
||||
@@ -653,7 +638,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
|
||||
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC);
|
||||
}
|
||||
} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC)))) {
|
||||
} else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
|
||||
need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC);
|
||||
}
|
||||
@@ -664,7 +649,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
|
||||
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
@@ -673,7 +658,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
|
||||
if (!arg) {
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC);
|
||||
}
|
||||
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
|
||||
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
|
||||
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -364,6 +364,13 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_fetch_dimension_by_zval(zval **result, zval *container, zval *dim TSRMLS_DC);
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
void zend_init_timeout_thread(void);
|
||||
void zend_shutdown_timeout_thread(void);
|
||||
#define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
|
||||
#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
|
||||
#endif
|
||||
|
||||
#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
|
||||
#define zendi_zval_dtor(p) zval_dtor(&(p))
|
||||
|
||||
|
||||
+121
-41
@@ -46,10 +46,13 @@ ZEND_API const zend_fcall_info empty_fcall_info = { 0, NULL, NULL, NULL, NULL, 0
|
||||
ZEND_API const zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL, NULL };
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
#ifdef ZTS
|
||||
__declspec(thread)
|
||||
#endif
|
||||
HANDLE tq_timer = NULL;
|
||||
#include <process.h>
|
||||
static WNDCLASS wc;
|
||||
static HWND timeout_window;
|
||||
static HANDLE timeout_thread_event;
|
||||
static HANDLE timeout_thread_handle;
|
||||
static DWORD timeout_thread_id;
|
||||
static int timeout_thread_initialized=0;
|
||||
#endif
|
||||
|
||||
#if 0&&ZEND_DEBUG
|
||||
@@ -1231,19 +1234,111 @@ ZEND_API void zend_timeout(int dummy) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
VOID CALLBACK tq_timer_cb(PVOID arg, BOOLEAN timed_out)
|
||||
static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /* {{{ */
|
||||
{
|
||||
zend_bool *php_timed_out;
|
||||
switch (message) {
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_REGISTER_ZEND_TIMEOUT:
|
||||
/* wParam is the thread id pointer, lParam is the timeout amount in seconds */
|
||||
if (lParam == 0) {
|
||||
KillTimer(timeout_window, wParam);
|
||||
} else {
|
||||
#ifdef ZTS
|
||||
void ***tsrm_ls;
|
||||
#endif
|
||||
SetTimer(timeout_window, wParam, lParam*1000, NULL);
|
||||
#ifdef ZTS
|
||||
tsrm_ls = ts_resource_ex(0, &wParam);
|
||||
if (!tsrm_ls) {
|
||||
/* shouldn't normally happen */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
EG(timed_out) = 0;
|
||||
}
|
||||
break;
|
||||
case WM_UNREGISTER_ZEND_TIMEOUT:
|
||||
/* wParam is the thread id pointer */
|
||||
KillTimer(timeout_window, wParam);
|
||||
break;
|
||||
case WM_TIMER: {
|
||||
#ifdef ZTS
|
||||
void ***tsrm_ls;
|
||||
|
||||
/* The doc states it'll be always true, however it theoretically
|
||||
could be FALSE when the thread was signaled. */
|
||||
if (!timed_out) {
|
||||
tsrm_ls = ts_resource_ex(0, &wParam);
|
||||
if (!tsrm_ls) {
|
||||
/* Thread died before receiving its timeout? */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
KillTimer(timeout_window, wParam);
|
||||
EG(timed_out) = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static unsigned __stdcall timeout_thread_proc(void *pArgs) /* {{{ */
|
||||
{
|
||||
MSG message;
|
||||
|
||||
wc.style=0;
|
||||
wc.lpfnWndProc = zend_timeout_WndProc;
|
||||
wc.cbClsExtra=0;
|
||||
wc.cbWndExtra=0;
|
||||
wc.hInstance=NULL;
|
||||
wc.hIcon=NULL;
|
||||
wc.hCursor=NULL;
|
||||
wc.hbrBackground=(HBRUSH)(COLOR_BACKGROUND + 5);
|
||||
wc.lpszMenuName=NULL;
|
||||
wc.lpszClassName = "Zend Timeout Window";
|
||||
if (!RegisterClass(&wc)) {
|
||||
return -1;
|
||||
}
|
||||
timeout_window = CreateWindow(wc.lpszClassName, wc.lpszClassName, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
|
||||
SetEvent(timeout_thread_event);
|
||||
while (GetMessage(&message, NULL, 0, 0)) {
|
||||
SendMessage(timeout_window, message.message, message.wParam, message.lParam);
|
||||
if (message.message == WM_QUIT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
DestroyWindow(timeout_window);
|
||||
UnregisterClass(wc.lpszClassName, NULL);
|
||||
SetEvent(timeout_thread_handle);
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_init_timeout_thread(void) /* {{{ */
|
||||
{
|
||||
timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
timeout_thread_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
_beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id);
|
||||
WaitForSingleObject(timeout_thread_event, INFINITE);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_shutdown_timeout_thread(void) /* {{{ */
|
||||
{
|
||||
if (!timeout_thread_initialized) {
|
||||
return;
|
||||
}
|
||||
PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
|
||||
|
||||
php_timed_out = (zend_bool *)arg;
|
||||
*php_timed_out = 1;
|
||||
/* Wait for thread termination */
|
||||
WaitForSingleObject(timeout_thread_handle, 5000);
|
||||
CloseHandle(timeout_thread_handle);
|
||||
timeout_thread_initialized = 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
/* This one doesn't exists on QNX */
|
||||
@@ -1261,28 +1356,13 @@ void zend_set_timeout(long seconds, int reset_signals) /* {{{ */
|
||||
if(!seconds) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't use ChangeTimerQueueTimer() as it will not restart an expired
|
||||
timer, so we could end up with just an ignored timeout. Instead
|
||||
delete and recreate. */
|
||||
if (NULL != tq_timer) {
|
||||
if (!DeleteTimerQueueTimer(NULL, tq_timer, NULL)) {
|
||||
EG(timed_out) = 0;
|
||||
tq_timer = NULL;
|
||||
zend_error(E_ERROR, "Could not delete queued timer");
|
||||
return;
|
||||
}
|
||||
tq_timer = NULL;
|
||||
if (timeout_thread_initialized == 0 && InterlockedIncrement(&timeout_thread_initialized) == 1) {
|
||||
/* We start up this process-wide thread here and not in zend_startup(), because if Zend
|
||||
* is initialized inside a DllMain(), you're not supposed to start threads from it.
|
||||
*/
|
||||
zend_init_timeout_thread();
|
||||
}
|
||||
|
||||
/* XXX passing NULL means the default timer queue provided by the system is used */
|
||||
if (!CreateTimerQueueTimer(&tq_timer, NULL, (WAITORTIMERCALLBACK)tq_timer_cb, (VOID*)&EG(timed_out), seconds*1000, 0, WT_EXECUTEONLYONCE)) {
|
||||
EG(timed_out) = 0;
|
||||
tq_timer = NULL;
|
||||
zend_error(E_ERROR, "Could not queue new timer");
|
||||
return;
|
||||
}
|
||||
EG(timed_out) = 0;
|
||||
PostThreadMessage(timeout_thread_id, WM_REGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) seconds);
|
||||
#else
|
||||
# ifdef HAVE_SETITIMER
|
||||
{
|
||||
@@ -1324,16 +1404,9 @@ void zend_set_timeout(long seconds, int reset_signals) /* {{{ */
|
||||
void zend_unset_timeout(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
#ifdef ZEND_WIN32
|
||||
if (NULL != tq_timer) {
|
||||
if (!DeleteTimerQueueTimer(NULL, tq_timer, NULL)) {
|
||||
EG(timed_out) = 0;
|
||||
tq_timer = NULL;
|
||||
zend_error(E_ERROR, "Could not delete queued timer");
|
||||
return;
|
||||
}
|
||||
tq_timer = NULL;
|
||||
if(timeout_thread_initialized) {
|
||||
PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0);
|
||||
}
|
||||
EG(timed_out) = 0;
|
||||
#else
|
||||
# ifdef HAVE_SETITIMER
|
||||
if (EG(timeout_seconds)) {
|
||||
@@ -1583,6 +1656,13 @@ ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
|
||||
/*printf("Cache miss! Initialized %x\n", EG(active_symbol_table));*/
|
||||
}
|
||||
ex->symbol_table = EG(active_symbol_table);
|
||||
|
||||
if (ex->op_array->this_var != -1 &&
|
||||
!*EX_CV_NUM(ex, ex->op_array->this_var) &&
|
||||
EG(This)) {
|
||||
*EX_CV_NUM(ex, ex->op_array->this_var) = (zval**)EX_CV_NUM(ex, ex->op_array->last_var + ex->op_array->this_var);
|
||||
**EX_CV_NUM(ex, ex->op_array->this_var) = EG(This);
|
||||
}
|
||||
for (i = 0; i < ex->op_array->last_var; i++) {
|
||||
if (*EX_CV_NUM(ex, i)) {
|
||||
zend_hash_quick_update(EG(active_symbol_table),
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#ifndef ZEND_FLOAT_H
|
||||
#define ZEND_FLOAT_H
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
/*
|
||||
Define functions for FP initialization and de-initialization.
|
||||
*/
|
||||
@@ -30,8 +28,6 @@ extern ZEND_API void zend_init_fpu(TSRMLS_D);
|
||||
extern ZEND_API void zend_shutdown_fpu(TSRMLS_D);
|
||||
extern ZEND_API void zend_ensure_fpu_mode(TSRMLS_D);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
/* Copy of the contents of xpfpa.h (which is under public domain)
|
||||
See http://wiki.php.net/rfc/rounding for details.
|
||||
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
#include "zend_ini_scanner.h"
|
||||
#include "zend_extensions.h"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include "win32/syslog.h"
|
||||
#endif
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define YYSTYPE zval
|
||||
|
||||
@@ -183,9 +179,10 @@ static void ini_error(char *msg)
|
||||
|
||||
if (CG(ini_parser_unbuffered_errors)) {
|
||||
#ifdef PHP_WIN32
|
||||
syslog(LOG_ALERT, "PHP: %s (%s)", error_buf, GetCommandLine());
|
||||
#endif
|
||||
MessageBox(NULL, error_buf, "PHP Error", MB_OK|MB_TOPMOST|0x00200000L);
|
||||
#else
|
||||
fprintf(stderr, "PHP: %s", error_buf);
|
||||
#endif
|
||||
} else {
|
||||
zend_error(E_WARNING, "%s", error_buf);
|
||||
}
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht)
|
||||
|
||||
#ifdef ZTS
|
||||
tsrm_mutex_free(ht->mx_reader);
|
||||
tsrm_mutex_free(ht->mx_writer);
|
||||
tsrm_mutex_free(ht->mx_reader);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,9 @@
|
||||
#ifndef ZEND_VM_H
|
||||
#define ZEND_VM_H
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
ZEND_API void zend_vm_use_old_executor(void);
|
||||
ZEND_API void zend_vm_set_opcode_handler(zend_op* opcode);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_VM_SET_OPCODE_HANDLER(opline) zend_vm_set_opcode_handler(opline)
|
||||
|
||||
#endif
|
||||
+5
-5
@@ -1961,7 +1961,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
void **p = EX(function_state).arguments - num_args;
|
||||
|
||||
for (i = 0; i < num_args; ++i, ++p) {
|
||||
zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0, NULL TSRMLS_CC);
|
||||
zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3374,7 +3374,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (UNEXPECTED(param == NULL)) {
|
||||
if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value, NULL TSRMLS_CC)) {
|
||||
if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) {
|
||||
const char *space;
|
||||
const char *class_name;
|
||||
zend_execute_data *ptr;
|
||||
@@ -3396,7 +3396,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
|
||||
} else {
|
||||
zval **var_ptr;
|
||||
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value, NULL TSRMLS_CC);
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
|
||||
var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
|
||||
Z_DELREF_PP(var_ptr);
|
||||
*var_ptr = *param;
|
||||
@@ -3438,7 +3438,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
|
||||
Z_ADDREF_P(assignment_value);
|
||||
}
|
||||
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value, opline->op2.zv TSRMLS_CC);
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
|
||||
var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
|
||||
zval_ptr_dtor(var_ptr);
|
||||
*var_ptr = assignment_value;
|
||||
@@ -3469,7 +3469,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
|
||||
|
||||
for (; arg_num <= arg_count; ++arg_num) {
|
||||
zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value, NULL TSRMLS_CC);
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
|
||||
Z_ADDREF_PP(param);
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
|
||||
void **p = EX(function_state).arguments - num_args;
|
||||
|
||||
for (i = 0; i < num_args; ++i, ++p) {
|
||||
zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0, NULL TSRMLS_CC);
|
||||
zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (UNEXPECTED(param == NULL)) {
|
||||
if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value, NULL TSRMLS_CC)) {
|
||||
if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) {
|
||||
const char *space;
|
||||
const char *class_name;
|
||||
zend_execute_data *ptr;
|
||||
@@ -883,7 +883,7 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
} else {
|
||||
zval **var_ptr;
|
||||
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value, NULL TSRMLS_CC);
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
|
||||
var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
|
||||
Z_DELREF_PP(var_ptr);
|
||||
*var_ptr = *param;
|
||||
@@ -916,7 +916,7 @@ static int ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
|
||||
for (; arg_num <= arg_count; ++arg_num) {
|
||||
zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value, NULL TSRMLS_CC);
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
|
||||
Z_ADDREF_PP(param);
|
||||
}
|
||||
@@ -1643,7 +1643,7 @@ static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
Z_ADDREF_P(assignment_value);
|
||||
}
|
||||
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value, opline->op2.zv TSRMLS_CC);
|
||||
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
|
||||
var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
|
||||
zval_ptr_dtor(var_ptr);
|
||||
*var_ptr = assignment_value;
|
||||
|
||||
@@ -1208,9 +1208,7 @@ function gen_vm($def, $skel) {
|
||||
out($f, $GLOBALS['header_text']);
|
||||
|
||||
fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
|
||||
fputs($f, "BEGIN_EXTERN_C()\n\n");
|
||||
fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n");
|
||||
fputs($f, "END_EXTERN_C()\n\n");
|
||||
|
||||
foreach ($opcodes as $code => $dsc) {
|
||||
$code = str_pad((string)$code,$code_len," ",STR_PAD_LEFT);
|
||||
|
||||
@@ -21,12 +21,8 @@
|
||||
#ifndef ZEND_VM_OPCODES_H
|
||||
#define ZEND_VM_OPCODES_H
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_NOP 0
|
||||
#define ZEND_ADD 1
|
||||
#define ZEND_SUB 2
|
||||
|
||||
+3
-3
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=5
|
||||
PHP_RELEASE_VERSION=3
|
||||
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`
|
||||
@@ -1173,7 +1173,7 @@ case $libdir in
|
||||
libdir=$libdir/php
|
||||
;;
|
||||
esac
|
||||
case `eval echo $datadir` in
|
||||
case $datadir in
|
||||
'${prefix}/share')
|
||||
datadir=$datadir/php
|
||||
;;
|
||||
@@ -1188,7 +1188,7 @@ old_libdir=$libdir
|
||||
old_datadir=$datadir
|
||||
exec_prefix=`eval echo $exec_prefix`
|
||||
libdir=`eval echo $libdir`
|
||||
datadir=`eval eval echo $datadir`
|
||||
datadir=`eval echo $datadir`
|
||||
|
||||
dnl Build extension directory path
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
|
||||
#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName)
|
||||
|
||||
/* For jddayofweek */
|
||||
enum { CAL_DOW_DAYNO, CAL_DOW_LONG, CAL_DOW_SHORT };
|
||||
enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG };
|
||||
|
||||
/* For jdmonthname */
|
||||
enum { CAL_MONTH_GREGORIAN_SHORT, CAL_MONTH_GREGORIAN_LONG,
|
||||
@@ -696,10 +696,10 @@ PHP_FUNCTION(jddayofweek)
|
||||
daynames = DayNameShort[day];
|
||||
|
||||
switch (mode) {
|
||||
case CAL_DOW_LONG:
|
||||
case CAL_DOW_SHORT:
|
||||
RETURN_STRING(daynamel, 1);
|
||||
break;
|
||||
case CAL_DOW_SHORT:
|
||||
case CAL_DOW_LONG:
|
||||
RETURN_STRING(daynames, 1);
|
||||
break;
|
||||
case CAL_DOW_DAYNO:
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
*
|
||||
* CALENDAR OVERVIEW
|
||||
*
|
||||
* Julius Caesar created the calendar in 46 B.C. as a modified form of
|
||||
* Julias Ceasar created the calendar in 46 B.C. as a modified form of
|
||||
* the old Roman republican calendar which was based on lunar cycles.
|
||||
* The new Julian calendar set fixed lengths for the months, abandoning
|
||||
* the lunar cycle. It also specified that there would be exactly 12
|
||||
|
||||
@@ -6,7 +6,7 @@ jddayofweek()
|
||||
<?php
|
||||
foreach (array(2440588, 2452162, 2453926, -1000) as $jd) {
|
||||
echo "### JD $jd ###\n";
|
||||
foreach (array(CAL_DOW_DAYNO, CAL_DOW_LONG, CAL_DOW_SHORT) as $mode) {
|
||||
for ($mode = 0; $mode <= 2; $mode++) {
|
||||
echo "--- mode $mode ---\n";
|
||||
for ($offset = 0; $offset <= 7; $offset++) {
|
||||
echo jddayofweek($jd + $offset, $mode). "\n";
|
||||
|
||||
@@ -21,10 +21,10 @@ putenv('TZ=UTC');
|
||||
// -uses --INI-- section with date.timezone=UTC
|
||||
// -uses putenv('TZ=UTC')
|
||||
// date.timezone=UTC
|
||||
// -if omitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning
|
||||
// -if ommitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning
|
||||
// -easter_date() calls mktime() and localtime()
|
||||
// -whereas unixtojd(1000000000) calls localtime(1000000000)
|
||||
// -if omitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG
|
||||
// -if ommitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG
|
||||
//
|
||||
// unixtojd() calls php_localtime_r() which for Pacific timezone systems, returns a time -8 hours
|
||||
// -this incorrect localtime is passed to the julian date conversion (GregorianToSDN) function which works (probably correctly)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
| license@php.net so we can mail you 6 copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Sterling Hughes <sterling@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
+2
-5
@@ -244,15 +244,12 @@ PHP_FUNCTION(curl_multi_getcontent)
|
||||
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
|
||||
|
||||
if (ch->handlers->write->method == PHP_CURL_RETURN) {
|
||||
if (ch->handlers->write->buf.len == 0) {
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
|
||||
smart_str_0(&ch->handlers->write->buf);
|
||||
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
|
||||
}
|
||||
|
||||
RETURN_NULL();
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67643 (curl_multi_getcontent returns '' when RETURNTRANSFER isn't set)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('curl')) print 'skip';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'file://'. dirname(__FILE__) . DIRECTORY_SEPARATOR .'curl_testdata1.txt');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
|
||||
|
||||
$mh = curl_multi_init();
|
||||
curl_multi_add_handle($mh, $ch);
|
||||
|
||||
$running = 0;
|
||||
do {
|
||||
curl_multi_exec($mh, $running);
|
||||
} while($running > 0);
|
||||
|
||||
$results = curl_multi_getcontent($ch);
|
||||
|
||||
curl_multi_remove_handle($mh, $ch);
|
||||
curl_multi_close($mh);
|
||||
|
||||
var_dump($results);
|
||||
?>
|
||||
--EXPECT--
|
||||
CURL1
|
||||
NULL
|
||||
@@ -13,6 +13,6 @@ var_dump(curl_setopt($ch, CURLOPT_URL, $url));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s%ebug68089.php on line 4
|
||||
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Test curl_multi_init() fail if any parameter is passed
|
||||
--CREDITS--
|
||||
Paulo Eduardo <pauloelr [at] gmail [dot] com>
|
||||
#testfest SP 2014
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : resource curl_multi_init(void)
|
||||
* Description : Returns a new cURL multi handle
|
||||
* Source code : ext/curl/multi.c
|
||||
* Test documentation: http://wiki.php.net/qa/temp/ext/curl
|
||||
*/
|
||||
|
||||
// start testing
|
||||
|
||||
//create the multiple cURL handle
|
||||
$mh = curl_multi_init('test');
|
||||
var_dump($mh);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: curl_multi_init() expects exactly 0 parameters, %d given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
+3
-15
@@ -23,21 +23,9 @@
|
||||
static int m_table_common[13] = { -1, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
|
||||
static int m_table_leap[13] = { -1, 6, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
|
||||
|
||||
static timelib_sll positive_mod(timelib_sll x, timelib_sll y)
|
||||
{
|
||||
timelib_sll tmp;
|
||||
|
||||
tmp = x % y;
|
||||
if (tmp < 0) {
|
||||
tmp += y;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static timelib_sll century_value(timelib_sll j)
|
||||
{
|
||||
return 6 - positive_mod(j, 4) * 2;
|
||||
return 6 - (j % 4) * 2;
|
||||
}
|
||||
|
||||
static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_sll d, int iso)
|
||||
@@ -48,9 +36,9 @@ static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_
|
||||
* Julian calendar. We just return the 'wrong' day of week to be
|
||||
* consistent. */
|
||||
c1 = century_value(y / 100);
|
||||
y1 = positive_mod(y, 100);
|
||||
y1 = (y % 100);
|
||||
m1 = timelib_is_leap(y) ? m_table_leap[m] : m_table_common[m];
|
||||
dow = positive_mod((c1 + y1 + m1 + (y1 / 4) + d), 7);
|
||||
dow = (c1 + y1 + m1 + (y1 / 4) + d) % 7;
|
||||
if (iso) {
|
||||
if (dow == 0) {
|
||||
dow = 7;
|
||||
|
||||
@@ -336,7 +336,7 @@ 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->timecnt || !tz->trans) {
|
||||
*transition_time = 0;
|
||||
@@ -346,8 +346,8 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
|
||||
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]) {
|
||||
|
||||
+668
-688
File diff suppressed because it is too large.
Load diff
+1
-80
@@ -533,9 +533,6 @@ const zend_function_entry date_funcs_period[] = {
|
||||
PHP_ME(DatePeriod, __construct, arginfo_date_period_construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DatePeriod, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DatePeriod, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME(DatePeriod, getStartDate, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DatePeriod, getEndDate, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DatePeriod, getDateInterval, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
@@ -3693,7 +3690,6 @@ static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz TSRML
|
||||
return FAILURE;
|
||||
} else {
|
||||
set_timezone_from_timelib_time(tzobj, dummy_t);
|
||||
free(dummy_t->tz_abbr);
|
||||
efree(dummy_t);
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -4478,82 +4474,7 @@ PHP_METHOD(DatePeriod, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DatePeriod::getStartDate()
|
||||
Get start date.
|
||||
*/
|
||||
PHP_METHOD(DatePeriod, getStartDate)
|
||||
{
|
||||
php_period_obj *dpobj;
|
||||
php_date_obj *dateobj;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
dpobj = (php_period_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
php_date_instantiate(dpobj->start_ce, return_value TSRMLS_CC);
|
||||
dateobj = (php_date_obj *)zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
dateobj->time = timelib_time_ctor();
|
||||
*dateobj->time = *dpobj->start;
|
||||
if (dpobj->start->tz_abbr) {
|
||||
dateobj->time->tz_abbr = strdup(dpobj->start->tz_abbr);
|
||||
}
|
||||
if (dpobj->start->tz_info) {
|
||||
dateobj->time->tz_info = dpobj->start->tz_info;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DatePeriod::getEndDate()
|
||||
Get end date.
|
||||
*/
|
||||
PHP_METHOD(DatePeriod, getEndDate)
|
||||
{
|
||||
php_period_obj *dpobj;
|
||||
php_date_obj *dateobj;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
dpobj = (php_period_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
php_date_instantiate(dpobj->start_ce, return_value TSRMLS_CC);
|
||||
dateobj = (php_date_obj *)zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
dateobj->time = timelib_time_ctor();
|
||||
*dateobj->time = *dpobj->end;
|
||||
if (dpobj->end->tz_abbr) {
|
||||
dateobj->time->tz_abbr = strdup(dpobj->end->tz_abbr);
|
||||
}
|
||||
if (dpobj->end->tz_info) {
|
||||
dateobj->time->tz_info = dpobj->end->tz_info;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DatePeriod::getDateInterval()
|
||||
Get date interval.
|
||||
*/
|
||||
PHP_METHOD(DatePeriod, getDateInterval)
|
||||
{
|
||||
php_period_obj *dpobj;
|
||||
php_interval_obj *diobj;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
dpobj = (php_period_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
php_date_instantiate(date_ce_interval, return_value TSRMLS_CC);
|
||||
diobj = (php_interval_obj *)zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
diobj->diff = timelib_rel_time_clone(dpobj->interval);
|
||||
diobj->initialized = 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int check_id_allowed(char *id, long what) /* {{{ */
|
||||
static int check_id_allowed(char *id, long what)
|
||||
{
|
||||
if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1;
|
||||
if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA && strncasecmp(id, "America/", 8) == 0) return 1;
|
||||
|
||||
@@ -106,9 +106,6 @@ PHP_FUNCTION(date_interval_create_from_date_string);
|
||||
PHP_METHOD(DatePeriod, __construct);
|
||||
PHP_METHOD(DatePeriod, __wakeup);
|
||||
PHP_METHOD(DatePeriod, __set_state);
|
||||
PHP_METHOD(DatePeriod, getStartDate);
|
||||
PHP_METHOD(DatePeriod, getEndDate);
|
||||
PHP_METHOD(DatePeriod, getDateInterval);
|
||||
|
||||
/* Options and Configuration */
|
||||
PHP_FUNCTION(date_default_timezone_set);
|
||||
|
||||
@@ -3,7 +3,7 @@ strtotime() function
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
|
||||
die("skip unable to change TZ environment variable\n");
|
||||
die("skip unable to change TZ enviroment variable\n");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
DatePeriod: Test getter
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
$start = new DateTime('2000-01-01 00:00:00', new DateTimeZone('Europe/Berlin'));
|
||||
$end = new DateTime('2000-01-31 00:00:00', new DateTimeZone('UTC'));
|
||||
$interval = new DateInterval('P1D');
|
||||
$period = new DatePeriod($start, $interval, $end);
|
||||
|
||||
var_dump($period->getStartDate()->format('Y-m-d H:i:s'));
|
||||
var_dump($period->getStartDate()->getTimeZone()->getName());
|
||||
|
||||
var_dump($period->getEndDate()->format('Y-m-d H:i:s'));
|
||||
var_dump($period->getEndDate()->getTimeZone()->getName());
|
||||
|
||||
var_dump($period->getDateInterval()->format('%R%y-%m-%d-%h-%i-%s'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(19) "2000-01-01 00:00:00"
|
||||
string(13) "Europe/Berlin"
|
||||
string(19) "2000-01-31 00:00:00"
|
||||
string(3) "UTC"
|
||||
string(12) "+0-0-1-0-0-0"
|
||||
@@ -145,7 +145,7 @@ object(DateTime)#%d (3) {
|
||||
-- int -12345 --
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(28) "-12345-02-11 08:34:10.000000"
|
||||
string(28) "-12345-02-15 08:34:10.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
@@ -165,7 +165,7 @@ object(DateTime)#%d (3) {
|
||||
-- float -10.5 --
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(27) "-0010-02-14 08:34:10.000000"
|
||||
string(27) "-0010-02-19 08:34:10.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
|
||||
@@ -8,7 +8,7 @@ if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
die("skip. set TZ env is not supported at runtime.");
|
||||
}
|
||||
if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') {
|
||||
die("skip unable to change TZ environment variable\n");
|
||||
die("skip unable to change TZ enviroment variable\n");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
@@ -4,7 +4,7 @@ Bug #26317 (military timezone offset signedness)
|
||||
date.timezone=GMT0
|
||||
--SKIPIF--
|
||||
if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
|
||||
die("skip unable to change TZ environment variable\n");
|
||||
die("skip unable to change TZ enviroment variable\n");
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -4,7 +4,7 @@ Bug #26320 (strtotime handling of XML Schema/ISO 8601 format)
|
||||
date.timezone=GMT0
|
||||
--SKIPIF--
|
||||
if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
|
||||
die("skip unable to change TZ environment variable\n");
|
||||
die("skip unable to change TZ enviroment variable\n");
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -10,8 +10,7 @@ var_dump($date->format('r'));
|
||||
$date->setDate(-2147483648, 1, 1);
|
||||
var_dump($date->format('r'));
|
||||
var_dump($date->format('c'));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "Fri, 01 Jan -1500 00:00:00 +0000"
|
||||
string(38) "Mon, 01 Jan -2147483648 00:00:00 +0000"
|
||||
string(32) "Sat, 01 Jan -1500 00:00:00 +0000"
|
||||
string(42) "Unknown, 01 Jan -2147483648 00:00:00 +0000"
|
||||
string(32) "-2147483648-01-01T00:00:00+00:00"
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Test date_interval_create_from_date_string() function : basic functionality
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--FILE--
|
||||
<?php
|
||||
$string = '1 day'; //P1D
|
||||
$i = date_interval_create_from_date_string($string);
|
||||
var_dump($i->d);
|
||||
|
||||
$string = '2 weeks'; //14 days
|
||||
$i = date_interval_create_from_date_string($string);
|
||||
var_dump($i->d);
|
||||
|
||||
$string = '3 months';
|
||||
$i = date_interval_create_from_date_string($string);
|
||||
var_dump($i->m);
|
||||
|
||||
$string = '4 years';
|
||||
$i = date_interval_create_from_date_string($string);
|
||||
var_dump($i->y);
|
||||
|
||||
$string = '1 year + 1 day';
|
||||
$i = date_interval_create_from_date_string($string);
|
||||
var_dump($i->y);
|
||||
var_dump($i->d);
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(14)
|
||||
int(3)
|
||||
int(4)
|
||||
int(1)
|
||||
int(1)
|
||||
@@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
Test date_interval_create_from_date_string() function : null parameter
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--FILE--
|
||||
<?php
|
||||
$i = date_interval_create_from_date_string(null); //returns a empty object
|
||||
var_dump($i);
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(DateInterval)#1 (15) {
|
||||
["y"]=>
|
||||
int(0)
|
||||
["m"]=>
|
||||
int(0)
|
||||
["d"]=>
|
||||
int(0)
|
||||
["h"]=>
|
||||
int(0)
|
||||
["i"]=>
|
||||
int(0)
|
||||
["s"]=>
|
||||
int(0)
|
||||
["weekday"]=>
|
||||
int(0)
|
||||
["weekday_behavior"]=>
|
||||
int(0)
|
||||
["first_last_day_of"]=>
|
||||
int(0)
|
||||
["invert"]=>
|
||||
int(0)
|
||||
["days"]=>
|
||||
int(0)
|
||||
["special_type"]=>
|
||||
int(0)
|
||||
["special_amount"]=>
|
||||
int(0)
|
||||
["have_weekday_relative"]=>
|
||||
int(0)
|
||||
["have_special_relative"]=>
|
||||
int(0)
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Test date_interval_create_from_date_string() function : wrong parameter (array)
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--FILE--
|
||||
<?php
|
||||
$wrong_parameter = array();
|
||||
$i = date_interval_create_from_date_string($wrong_parameter);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: date_interval_create_from_date_string() expects parameter 1 to be string, array given in %s on line %d
|
||||
@@ -1,9 +0,0 @@
|
||||
--TEST--
|
||||
Test date_interval_create_from_date_string() function : with 2 parameters (wrong).
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--FILE--
|
||||
<?php
|
||||
$i = date_interval_create_from_date_string('1 year', 'wrong');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
@@ -145,7 +145,7 @@ object(DateTime)#%d (3) {
|
||||
-- int -12345 --
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(28) "-12345-02-11 08:34:10.000000"
|
||||
string(28) "-12345-02-15 08:34:10.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
@@ -165,7 +165,7 @@ object(DateTime)#%d (3) {
|
||||
-- float -10.5 --
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(27) "-0010-02-14 08:34:10.000000"
|
||||
string(27) "-0010-02-19 08:34:10.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Test the basics to function date_timestamp_set().
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--INI--
|
||||
date.timezone = UTC;
|
||||
date_default_timezone_set("America/Sao_Paulo");
|
||||
--FILE--
|
||||
<?php
|
||||
$dftz021 = date_default_timezone_get(); //UTC
|
||||
|
||||
$dtms021 = date_create();
|
||||
|
||||
date_timestamp_set($dtms021, 1234567890);
|
||||
|
||||
var_dump(date_format($dtms021, 'B => (U) => T Y-M-d H:i:s'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(47) "021 => (1234567890) => UTC 2009-Feb-13 23:31:30"
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Test the function date_timestamp_set() with first null parameter.
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--INI--
|
||||
date.timezone = UTC;
|
||||
date_default_timezone_set("America/Sao_Paulo");
|
||||
--FILE--
|
||||
<?php
|
||||
$dftz021 = date_default_timezone_get(); //UTC
|
||||
|
||||
$dtms021 = date_create();
|
||||
|
||||
date_timestamp_set(null, 1234567890);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: date_timestamp_set() expects parameter 1 to be DateTime, null given in %s on line %d
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Test the function date_timestamp_set() with second null parameter.
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--INI--
|
||||
date.timezone = UTC;
|
||||
date_default_timezone_set("America/Sao_Paulo");
|
||||
--FILE--
|
||||
<?php
|
||||
$dftz021 = date_default_timezone_get(); //UTC
|
||||
|
||||
$dtms021 = date_create();
|
||||
|
||||
var_dump(date_timestamp_set($dtms021, null));
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(DateTime)#1 (3) {
|
||||
["date"]=>
|
||||
string(26) "1970-01-01 00:00:00.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Check the function date_timestamp_set() with first parameter wrong (array).
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--INI--
|
||||
date.timezone = UTC;
|
||||
date_default_timezone_set("America/Sao_Paulo");
|
||||
--FILE--
|
||||
<?php
|
||||
$dftz021 = date_default_timezone_get(); //UTC
|
||||
|
||||
$dtms021 = array();
|
||||
|
||||
date_timestamp_set($dtms021, 123456789);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: date_timestamp_set() expects parameter 1 to be DateTime, array given in %s on line %d
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Check the function date_timestamp_set() with first parameter wrong (integer).
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--INI--
|
||||
date.timezone = UTC;
|
||||
date_default_timezone_set("America/Sao_Paulo");
|
||||
--FILE--
|
||||
<?php
|
||||
$dftz021 = date_default_timezone_get(); //UTC
|
||||
|
||||
date_timestamp_set(987654321, 123456789);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: date_timestamp_set() expects parameter 1 to be DateTime, integer given in %s on line %d
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Check the function date_timestamp_set() with second parameter wrong (array).
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--INI--
|
||||
date.timezone = UTC;
|
||||
date_default_timezone_set("America/Sao_Paulo");
|
||||
--FILE--
|
||||
<?php
|
||||
$dftz021 = date_default_timezone_get(); //UTC
|
||||
|
||||
$dtms021 = new DateTime();
|
||||
|
||||
$wrong_parameter = array();
|
||||
|
||||
date_timestamp_set($dtms021, $wrong_parameter);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: date_timestamp_set() expects parameter 2 to be long, array given in %s on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Check the function date_timestamp_set() with 3 parameters.
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--INI--
|
||||
date.timezone = UTC;
|
||||
date_default_timezone_set("America/Sao_Paulo");
|
||||
--FILE--
|
||||
<?php
|
||||
$dftz021 = date_default_timezone_get(); //UTC
|
||||
|
||||
$dtms021 = new DateTime();
|
||||
|
||||
date_timestamp_set($dtms021, 123456789, 'error');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: date_timestamp_set() expects exactly 2 parameters, 3 given in %s on line %d
|
||||
@@ -61,7 +61,7 @@ array\(11\) {
|
||||
\["mday"\]=>
|
||||
int\((9|14|23)\)
|
||||
\["wday"\]=>
|
||||
int\(0\)
|
||||
int\((6|-4)\)
|
||||
\["mon"\]=>
|
||||
int\((10|12)\)
|
||||
\["year"\]=>
|
||||
@@ -69,7 +69,7 @@ array\(11\) {
|
||||
\["yday"\]=>
|
||||
int\((282|347|295)\)
|
||||
\["weekday"\]=>
|
||||
string\(6\) "Sunday"
|
||||
string\((8|7)\) "(Saturday|Unknown)"
|
||||
\["month"\]=>
|
||||
string\((7|8)\) "(October|December)"
|
||||
\[0\]=>
|
||||
|
||||
@@ -87,7 +87,7 @@ array\(9\) {
|
||||
\[5\]=>
|
||||
int\((104|1|-3843)\)
|
||||
\[6\]=>
|
||||
int\(6\)
|
||||
int\((5|-5)\)
|
||||
\[7\]=>
|
||||
int\((281|346|294)\)
|
||||
\[8\]=>
|
||||
@@ -107,7 +107,7 @@ array\(9\) {
|
||||
\["tm_year"\]=>
|
||||
int\((104|1|-3843)\)
|
||||
\["tm_wday"\]=>
|
||||
int\(6\)
|
||||
int\((5|-5)\)
|
||||
\["tm_yday"\]=>
|
||||
int\((281|346|294)\)
|
||||
\["tm_isdst"\]=>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Test the basics to function timezone_version_get().
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--INI--
|
||||
date.timezone = UTC;
|
||||
date_default_timezone_set("America/Sao_Paulo");
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(timezone_version_get());
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
string\([6-7]\) \"20[0-9][0-9]\.[1-9][0-9]?\"
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
timezone_version_get: Test that timezone_location_get returns a date concatenated with a dot and a version number
|
||||
--CREDITS--
|
||||
Rodrigo Wanderley de Melo Cardoso <rodrigogepem@gmail.com>
|
||||
#PHPTestFest2014 São Paulo 2014-07-05
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php $versionTimezone = timezone_version_get();
|
||||
echo $versionTimezone; ?>
|
||||
--EXPECTREGEX--
|
||||
^[12][0-9]{3}.[0-9]+$
|
||||
+1
-1
@@ -2692,7 +2692,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
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->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,
|
||||
|
||||
@@ -10,8 +10,8 @@ var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s%ebug68113.php on line 2
|
||||
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
|
||||
|
||||
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s%ebug68113.php on line 2
|
||||
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 735 B |
@@ -1,63 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68799 (Free called on unitialized pointer)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* Pollute the heap. Helps trigger bug. Sometimes not needed.
|
||||
*/
|
||||
class A {
|
||||
function __construct() {
|
||||
$a = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa';
|
||||
$this->a = $a . $a . $a . $a . $a . $a;
|
||||
}
|
||||
};
|
||||
|
||||
function doStuff ($limit) {
|
||||
|
||||
$a = new A;
|
||||
|
||||
$b = array();
|
||||
for ($i = 0; $i < $limit; $i++) {
|
||||
$b[$i] = clone $a;
|
||||
}
|
||||
|
||||
unset($a);
|
||||
|
||||
gc_collect_cycles();
|
||||
}
|
||||
|
||||
$iterations = 3;
|
||||
|
||||
doStuff($iterations);
|
||||
doStuff($iterations);
|
||||
|
||||
gc_collect_cycles();
|
||||
|
||||
print_r(exif_read_data(__DIR__.'/bug68799.jpg'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[FileName] => bug68799.jpg
|
||||
[FileDateTime] => %d
|
||||
[FileSize] => 735
|
||||
[FileType] => 2
|
||||
[MimeType] => image/jpeg
|
||||
[SectionsFound] => ANY_TAG, IFD0, WINXP
|
||||
[COMPUTED] => Array
|
||||
(
|
||||
[html] => width="1" height="1"
|
||||
[Height] => 1
|
||||
[Width] => 1
|
||||
[IsColor] => 1
|
||||
[ByteOrderMotorola] => 1
|
||||
)
|
||||
|
||||
[XResolution] => 96/1
|
||||
[YResolution] => 96/1
|
||||
[ResolutionUnit] => 2
|
||||
[Author] =>
|
||||
)
|
||||
@@ -11,7 +11,7 @@ if test "$PHP_FILEINFO" != "no"; then
|
||||
libmagic/cdf.c libmagic/cdf_time.c libmagic/compress.c \
|
||||
libmagic/encoding.c libmagic/fsmagic.c libmagic/funcs.c \
|
||||
libmagic/is_tar.c libmagic/magic.c libmagic/print.c \
|
||||
libmagic/readcdf.c libmagic/softmagic.c"
|
||||
libmagic/readcdf.c libmagic/readelf.c libmagic/softmagic.c"
|
||||
|
||||
AC_MSG_CHECKING([for strcasestr])
|
||||
AC_TRY_RUN([
|
||||
|
||||
@@ -8,7 +8,7 @@ if (PHP_FILEINFO != 'no') {
|
||||
cdf.c cdf_time.c compress.c \
|
||||
encoding.c fsmagic.c funcs.c \
|
||||
is_tar.c magic.c print.c \
|
||||
readcdf.c softmagic.c";
|
||||
readcdf.c readelf.c softmagic.c";
|
||||
|
||||
if (VCVERS < 1500) {
|
||||
ADD_FLAG('CFLAGS', '/Zm1000');
|
||||
|
||||
@@ -48144,11 +48144,11 @@ const unsigned char php_magic_database[2803888] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x3D, 0x23, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x3D, 0x1F, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5C, 0x5B, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x5F, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5C,
|
||||
0x5D, 0x5C, 0x2E, 0x78, 0x6D, 0x6C, 0x7C, 0x5F, 0x72, 0x65, 0x6C, 0x73, 0x2F, 0x5C, 0x2E, 0x72,
|
||||
0x65, 0x6C, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5B, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x5F, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5D, 0x2E,
|
||||
0x78, 0x6D, 0x6C, 0x7C, 0x5F, 0x72, 0x65, 0x6C, 0x73, 0x2F, 0x2E, 0x72, 0x65, 0x6C, 0x73, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
@@ -3,7 +3,7 @@ if(!extension_loaded('fileinfo')) {
|
||||
dl('fileinfo.' . PHP_SHLIB_SUFFIX);
|
||||
}
|
||||
if(!extension_loaded('fileinfo')) {
|
||||
die("fileinfo extension is not available, please compile it.\n");
|
||||
die("fileinfo extension is not avaliable, please compile it.\n");
|
||||
}
|
||||
|
||||
// normal operation
|
||||
|
||||
+319
-74
@@ -1,6 +1,6 @@
|
||||
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
--- libmagic.orig/apprentice.c Tue Nov 19 22:01:12 2013
|
||||
+++ libmagic/apprentice.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/apprentice.c Fri Oct 3 22:48:34 2014
|
||||
@@ -29,6 +29,8 @@
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
@@ -411,7 +411,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
continue;
|
||||
}
|
||||
if (files >= maxfiles) {
|
||||
@@ -1171,23 +1195,22 @@
|
||||
@@ -1171,23 +1195,23 @@
|
||||
maxfiles = (maxfiles + 1) * 2;
|
||||
mlen = maxfiles * sizeof(*filearr);
|
||||
if ((filearr = CAST(char **,
|
||||
@@ -420,6 +420,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
file_oomem(ms, mlen);
|
||||
- free(mfn);
|
||||
- closedir(dir);
|
||||
+ efree(mfn);
|
||||
+ php_stream_closedir(dir);
|
||||
errs++;
|
||||
goto out;
|
||||
@@ -441,7 +442,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
} else
|
||||
load_1(ms, action, fn, &errs, mset);
|
||||
if (errs)
|
||||
@@ -1226,9 +1249,9 @@
|
||||
@@ -1226,9 +1250,9 @@
|
||||
if (errs) {
|
||||
for (j = 0; j < MAGIC_SETS; j++) {
|
||||
if (map->magic[j])
|
||||
@@ -453,7 +454,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return NULL;
|
||||
}
|
||||
return map;
|
||||
@@ -1248,7 +1271,7 @@
|
||||
@@ -1248,7 +1272,7 @@
|
||||
* the sign extension must have happened.
|
||||
*/
|
||||
case FILE_BYTE:
|
||||
@@ -462,7 +463,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
@@ -1516,7 +1539,7 @@
|
||||
@@ -1516,7 +1540,7 @@
|
||||
if (me->cont_count == me->max_count) {
|
||||
struct magic *nm;
|
||||
size_t cnt = me->max_count + ALLOC_CHUNK;
|
||||
@@ -471,7 +472,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
sizeof(*nm) * cnt))) == NULL) {
|
||||
file_oomem(ms, sizeof(*nm) * cnt);
|
||||
return -1;
|
||||
@@ -1531,7 +1554,7 @@
|
||||
@@ -1531,7 +1555,7 @@
|
||||
static const size_t len = sizeof(*m) * ALLOC_CHUNK;
|
||||
if (me->mp != NULL)
|
||||
return 1;
|
||||
@@ -480,7 +481,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
file_oomem(ms, len);
|
||||
return -1;
|
||||
}
|
||||
@@ -1704,7 +1727,7 @@
|
||||
@@ -1704,7 +1728,7 @@
|
||||
m->type = get_standard_integer_type(l, &l);
|
||||
else if (*l == 's' && !isalpha((unsigned char)l[1])) {
|
||||
m->type = FILE_STRING;
|
||||
@@ -489,7 +490,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1717,6 +1740,10 @@
|
||||
@@ -1717,6 +1741,10 @@
|
||||
if (m->type == FILE_INVALID) {
|
||||
if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms, "type `%s' invalid", l);
|
||||
@@ -500,7 +501,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1725,7 +1752,7 @@
|
||||
@@ -1725,7 +1753,7 @@
|
||||
|
||||
m->mask_op = 0;
|
||||
if (*l == '~') {
|
||||
@@ -509,7 +510,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
m->mask_op |= FILE_OPINVERSE;
|
||||
else if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms, "'~' invalid for string types");
|
||||
@@ -1734,7 +1761,7 @@
|
||||
@@ -1734,7 +1762,7 @@
|
||||
m->str_range = 0;
|
||||
m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0;
|
||||
if ((op = get_op(*l)) != -1) {
|
||||
@@ -518,7 +519,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
uint64_t val;
|
||||
++l;
|
||||
m->mask_op |= op;
|
||||
@@ -1925,11 +1952,6 @@
|
||||
@@ -1925,11 +1953,6 @@
|
||||
if (check_format(ms, m) == -1)
|
||||
return -1;
|
||||
}
|
||||
@@ -530,7 +531,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
m->mimetype[0] = '\0'; /* initialise MIME type to none */
|
||||
return 0;
|
||||
}
|
||||
@@ -2575,59 +2597,76 @@
|
||||
@@ -2575,59 +2598,76 @@
|
||||
private struct magic_map *
|
||||
apprentice_map(struct magic_set *ms, const char *fn)
|
||||
{
|
||||
@@ -628,7 +629,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
if (*ptr != MAGICNO) {
|
||||
if (swap4(*ptr) != MAGICNO) {
|
||||
file_error(ms, 0, "bad magic in `%s'", dbname);
|
||||
@@ -2641,17 +2680,29 @@
|
||||
@@ -2641,17 +2681,29 @@
|
||||
else
|
||||
version = ptr[1];
|
||||
if (version != VERSIONNO) {
|
||||
@@ -666,7 +667,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
map->magic[0] = CAST(struct magic *, map->p) + 1;
|
||||
nentries = 0;
|
||||
@@ -2664,22 +2715,29 @@
|
||||
@@ -2664,22 +2716,29 @@
|
||||
map->magic[i + 1] = map->magic[i] + map->nmagic[i];
|
||||
nentries += map->nmagic[i];
|
||||
}
|
||||
@@ -701,7 +702,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2700,14 +2758,19 @@
|
||||
@@ -2700,14 +2759,19 @@
|
||||
char *dbname;
|
||||
int rv = -1;
|
||||
uint32_t i;
|
||||
@@ -724,7 +725,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
file_error(ms, errno, "cannot open `%s'", dbname);
|
||||
goto out;
|
||||
}
|
||||
@@ -2717,31 +2780,33 @@
|
||||
@@ -2717,31 +2781,33 @@
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -764,7 +765,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -2754,6 +2819,7 @@
|
||||
@@ -2754,6 +2820,7 @@
|
||||
{
|
||||
const char *p, *q;
|
||||
char *buf;
|
||||
@@ -772,7 +773,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
|
||||
if (strip) {
|
||||
if ((p = strrchr(fn, '/')) != NULL)
|
||||
@@ -2775,16 +2841,18 @@
|
||||
@@ -2775,16 +2842,18 @@
|
||||
q++;
|
||||
/* Compatibility with old code that looked in .mime */
|
||||
if (ms->flags & MAGIC_MIME) {
|
||||
@@ -797,7 +798,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
|
||||
/* Compatibility with old code that looked in .mime */
|
||||
if (strstr(p, ".mime") != NULL)
|
||||
@@ -2874,7 +2942,7 @@
|
||||
@@ -2874,7 +2943,7 @@
|
||||
m->offset = swap4((uint32_t)m->offset);
|
||||
m->in_offset = swap4((uint32_t)m->in_offset);
|
||||
m->lineno = swap4((uint32_t)m->lineno);
|
||||
@@ -808,7 +809,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
--- libmagic.orig/ascmagic.c Thu Feb 13 00:20:53 2014
|
||||
+++ libmagic/ascmagic.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/ascmagic.c Fri Feb 21 00:21:27 2014
|
||||
@@ -139,7 +139,7 @@
|
||||
/* malloc size is a conservative overestimate; could be
|
||||
improved, or at least realloced after conversion. */
|
||||
@@ -830,7 +831,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
}
|
||||
diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
--- libmagic.orig/cdf.c Tue Feb 26 17:20:42 2013
|
||||
+++ libmagic/cdf.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/cdf.c Fri Oct 3 22:48:34 2014
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
@@ -1051,7 +1052,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
} else {
|
||||
diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
--- libmagic.orig/cdf.h Thu Jun 21 00:19:55 2012
|
||||
+++ libmagic/cdf.h Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/cdf.h Thu Jun 5 18:05:33 2014
|
||||
@@ -35,10 +35,12 @@
|
||||
#ifndef _H_CDF_
|
||||
#define _H_CDF_
|
||||
@@ -1104,7 +1105,7 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *,
|
||||
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
--- libmagic.orig/cdf_time.c Thu Jun 21 00:18:33 2012
|
||||
+++ libmagic/cdf_time.c Sun Nov 9 19:16:18 2014
|
||||
+++ libmagic/cdf_time.c Fri Feb 21 00:21:27 2014
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
|
||||
@@ -1164,7 +1165,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
static const char *ref = "Sat Apr 23 01:30:00 1977";
|
||||
diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
--- libmagic.orig/compress.c Sun Jan 5 16:55:21 2014
|
||||
+++ libmagic/compress.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/compress.c Fri Feb 21 00:21:27 2014
|
||||
@@ -32,6 +32,7 @@
|
||||
* uncompress(method, old, n, newch) - uncompress old into new,
|
||||
* using method, return sizeof new
|
||||
@@ -1327,7 +1328,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
|
||||
diff -u libmagic.orig/file.h libmagic/file.h
|
||||
--- libmagic.orig/file.h Thu Feb 13 00:20:53 2014
|
||||
+++ libmagic/file.h Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/file.h Fri Feb 21 00:21:27 2014
|
||||
@@ -33,11 +33,9 @@
|
||||
#ifndef __file_h__
|
||||
#define __file_h__
|
||||
@@ -1396,7 +1397,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
((t) == FILE_STRING || \
|
||||
(t) == FILE_PSTRING || \
|
||||
(t) == FILE_BESTRING16 || \
|
||||
@@ -411,22 +413,16 @@
|
||||
@@ -411,22 +413,18 @@
|
||||
protected const char *file_fmttime(uint64_t, int, char *);
|
||||
protected struct magic_set *file_ms_alloc(int);
|
||||
protected void file_ms_free(struct magic_set *);
|
||||
@@ -1414,8 +1415,8 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
- __attribute__((__format__(__printf__, 2, 3)));
|
||||
+protected int file_printf(struct magic_set *, const char *, ...);
|
||||
protected int file_reset(struct magic_set *);
|
||||
-protected int file_tryelf(struct magic_set *, int, const unsigned char *,
|
||||
- size_t);
|
||||
protected int file_tryelf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
protected int file_trycdf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
-#if HAVE_FORK
|
||||
@@ -1423,7 +1424,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
protected int file_zmagic(struct magic_set *, int, const char *,
|
||||
const unsigned char *, size_t);
|
||||
#endif
|
||||
@@ -444,16 +440,13 @@
|
||||
@@ -444,16 +442,13 @@
|
||||
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
|
||||
protected uint64_t file_signextend(struct magic_set *, struct magic *,
|
||||
uint64_t);
|
||||
@@ -1444,7 +1445,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
protected void file_showstr(FILE *, const char *, size_t);
|
||||
protected size_t file_mbswidth(const char *);
|
||||
protected const char *file_getbuffer(struct magic_set *);
|
||||
@@ -463,16 +456,14 @@
|
||||
@@ -463,16 +458,14 @@
|
||||
size_t *);
|
||||
protected size_t file_pstring_length_size(const struct magic *);
|
||||
protected size_t file_pstring_get_length(const struct magic *, const char *);
|
||||
@@ -1462,7 +1463,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
@@ -485,20 +476,10 @@
|
||||
@@ -485,20 +478,10 @@
|
||||
#define strtoul(a, b, c) strtol(a, b, c)
|
||||
#endif
|
||||
|
||||
@@ -1485,7 +1486,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
size_t strlcat(char *, const char *, size_t);
|
||||
#endif
|
||||
#ifndef HAVE_STRCASESTR
|
||||
@@ -535,6 +516,14 @@
|
||||
@@ -535,6 +518,14 @@
|
||||
#endif
|
||||
#else
|
||||
#define FILE_RCSID(id)
|
||||
@@ -1502,7 +1503,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
#endif /* __file_h__ */
|
||||
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
--- libmagic.orig/fsmagic.c Sun Dec 1 20:22:13 2013
|
||||
+++ libmagic/fsmagic.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/fsmagic.c Fri Feb 21 00:21:27 2014
|
||||
@@ -59,27 +59,21 @@
|
||||
# define minor(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
@@ -1827,7 +1828,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
}
|
||||
diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
--- libmagic.orig/funcs.c Thu Feb 13 00:20:53 2014
|
||||
+++ libmagic/funcs.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/funcs.c Fri Oct 3 22:48:34 2014
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
@@ -2167,7 +2168,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
}
|
||||
diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
--- libmagic.orig/magic.c Sun Dec 1 20:22:13 2013
|
||||
+++ libmagic/magic.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/magic.c Fri Feb 21 00:21:27 2014
|
||||
@@ -25,11 +25,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
@@ -2505,17 +2506,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
public const char *
|
||||
magic_error(struct magic_set *ms)
|
||||
diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h Tue Feb 11 16:30:44 2014
|
||||
+++ libmagic/magic.h Sun Jan 4 17:06:01 2015
|
||||
@@ -75,7 +75,7 @@
|
||||
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
|
||||
#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */
|
||||
|
||||
-#define MAGIC_VERSION 516 /* This implementation */
|
||||
+#define MAGIC_VERSION 517 /* This implementation */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
--- libmagic.orig/magic.h Wed Feb 19 10:53:11 2014
|
||||
+++ libmagic/magic.h Fri Feb 21 00:21:27 2014
|
||||
@@ -88,6 +88,7 @@
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
@@ -2534,7 +2526,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
|
||||
diff -u libmagic.orig/print.c libmagic/print.c
|
||||
--- libmagic.orig/print.c Tue Feb 26 19:25:00 2013
|
||||
+++ libmagic/print.c Sun Jan 4 17:04:32 2015
|
||||
+++ libmagic/print.c Fri Feb 21 00:21:27 2014
|
||||
@@ -28,13 +28,17 @@
|
||||
/*
|
||||
* print.c - debugging printout routines
|
||||
@@ -2553,7 +2545,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
@@ -43,188 +47,31 @@
|
||||
@@ -43,188 +47,28 @@
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
@@ -2732,8 +2724,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
file_magwarn(struct magic_set *ms, const char *f, ...)
|
||||
{
|
||||
va_list va;
|
||||
+ char *expanded_format = NULL;
|
||||
+ int expanded_len;
|
||||
+ char *expanded_format;
|
||||
+ TSRMLS_FETCH();
|
||||
|
||||
- /* cuz we use stdout for most, stderr here */
|
||||
@@ -2745,19 +2736,17 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
- (void) fprintf(stderr, "Warning: ");
|
||||
va_start(va, f);
|
||||
- (void) vfprintf(stderr, f, va);
|
||||
+ expanded_len = vasprintf(&expanded_format, f, va);
|
||||
+ if (vasprintf(&expanded_format, f, va)); /* silence */
|
||||
va_end(va);
|
||||
- (void) fputc('\n', stderr);
|
||||
+
|
||||
+ if (expanded_len >= 0 && expanded_format) {
|
||||
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
|
||||
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
|
||||
+
|
||||
+ free(expanded_format);
|
||||
+ }
|
||||
+ free(expanded_format);
|
||||
}
|
||||
|
||||
protected const char *
|
||||
@@ -235,7 +82,7 @@
|
||||
@@ -235,7 +79,7 @@
|
||||
struct tm *tm;
|
||||
|
||||
if (flags & FILE_T_WINDOWS) {
|
||||
@@ -2768,7 +2757,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
}
|
||||
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
--- libmagic.orig/readcdf.c Tue Jan 7 04:13:42 2014
|
||||
+++ libmagic/readcdf.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/readcdf.c Sat Oct 25 11:50:04 2014
|
||||
@@ -26,11 +26,15 @@
|
||||
#include "file.h"
|
||||
|
||||
@@ -2984,9 +2973,268 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
}
|
||||
if (NOTMIME(ms)) {
|
||||
if (str != NULL) {
|
||||
diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
--- libmagic.orig/readelf.c Tue Nov 5 16:44:01 2013
|
||||
+++ libmagic/readelf.c Sat Oct 25 11:50:04 2014
|
||||
@@ -48,8 +48,8 @@
|
||||
private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
|
||||
off_t, int *, int);
|
||||
private int doshn(struct magic_set *, int, int, int, off_t, int, size_t,
|
||||
- off_t, int *, int, int);
|
||||
-private size_t donote(struct magic_set *, void *, size_t, size_t, int,
|
||||
+ off_t, int *, int);
|
||||
+private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int,
|
||||
int, size_t, int *);
|
||||
|
||||
#define ELF_ALIGN(a) ((((a) + align - 1) / align) * align)
|
||||
@@ -127,7 +127,13 @@
|
||||
|
||||
#define elf_getu16(swap, value) getu16(swap, value)
|
||||
#define elf_getu32(swap, value) getu32(swap, value)
|
||||
-#define elf_getu64(swap, value) getu64(swap, value)
|
||||
+#ifdef USE_ARRAY_FOR_64BIT_TYPES
|
||||
+# define elf_getu64(swap, array) \
|
||||
+ ((swap ? ((uint64_t)elf_getu32(swap, array[0])) << 32 : elf_getu32(swap, array[0])) + \
|
||||
+ (swap ? elf_getu32(swap, array[1]) : ((uint64_t)elf_getu32(swap, array[1]) << 32)))
|
||||
+#else
|
||||
+# define elf_getu64(swap, value) getu64(swap, value)
|
||||
+#endif
|
||||
|
||||
#define xsh_addr (clazz == ELFCLASS32 \
|
||||
? (void *)&sh32 \
|
||||
@@ -292,7 +298,7 @@
|
||||
{
|
||||
Elf32_Phdr ph32;
|
||||
Elf64_Phdr ph64;
|
||||
- size_t offset, len;
|
||||
+ size_t offset;
|
||||
unsigned char nbuf[BUFSIZ];
|
||||
ssize_t bufsize;
|
||||
|
||||
@@ -306,7 +312,11 @@
|
||||
* Loop through all the program headers.
|
||||
*/
|
||||
for ( ; num; num--) {
|
||||
- if (pread(fd, xph_addr, xph_sizeof, off) == -1) {
|
||||
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (FINFO_READ_FUNC(fd, xph_addr, xph_sizeof) == -1) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
@@ -324,8 +334,13 @@
|
||||
* This is a PT_NOTE section; loop through all the notes
|
||||
* in the section.
|
||||
*/
|
||||
- len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
|
||||
- if ((bufsize = pread(fd, nbuf, len, xph_offset)) == -1) {
|
||||
+ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ bufsize = FINFO_READ_FUNC(fd, nbuf,
|
||||
+ ((xph_filesz < sizeof(nbuf)) ? xph_filesz : sizeof(nbuf)));
|
||||
+ if (bufsize == -1) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
@@ -477,6 +492,13 @@
|
||||
uint32_t namesz, descsz;
|
||||
unsigned char *nbuf = CAST(unsigned char *, vbuf);
|
||||
|
||||
+ if (xnh_sizeof + offset > size) {
|
||||
+ /*
|
||||
+ * We're out of note headers.
|
||||
+ */
|
||||
+ return xnh_sizeof + offset;
|
||||
+ }
|
||||
+
|
||||
(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
|
||||
offset += xnh_sizeof;
|
||||
|
||||
@@ -913,24 +935,12 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- /* Read offset of name section to be able to read section names later */
|
||||
- if (pread(fd, xsh_addr, xsh_sizeof, off + size * strtab) == -1) {
|
||||
- file_badread(ms);
|
||||
- return -1;
|
||||
- }
|
||||
- name_off = xsh_offset;
|
||||
-
|
||||
for ( ; num; num--) {
|
||||
- /* Read the name of this section. */
|
||||
- if (pread(fd, name, sizeof(name), name_off + xsh_name) == -1) {
|
||||
- file_badread(ms);
|
||||
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
return -1;
|
||||
}
|
||||
- name[sizeof(name) - 1] = '\0';
|
||||
- if (strcmp(name, ".debug_info") == 0)
|
||||
- stripped = 0;
|
||||
-
|
||||
- if (pread(fd, xsh_addr, xsh_sizeof, off) == -1) {
|
||||
+ if (FINFO_READ_FUNC(fd, xsh_addr, xsh_sizeof) == -1) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
@@ -955,14 +965,17 @@
|
||||
/* Things we can determine when we seek */
|
||||
switch (xsh_type) {
|
||||
case SHT_NOTE:
|
||||
- if ((nbuf = malloc(xsh_size)) == NULL) {
|
||||
- file_error(ms, errno, "Cannot allocate memory"
|
||||
- " for note");
|
||||
+ nbuf = emalloc((size_t)xsh_size);
|
||||
+ if ((noff = FINFO_LSEEK_FUNC(fd, (off_t)xsh_offset, SEEK_SET)) ==
|
||||
+ (off_t)-1) {
|
||||
+ file_badread(ms);
|
||||
+ efree(nbuf);
|
||||
return -1;
|
||||
}
|
||||
- if (pread(fd, nbuf, xsh_size, xsh_offset) == -1) {
|
||||
+ if (FINFO_READ_FUNC(fd, nbuf, (size_t)xsh_size) !=
|
||||
+ (ssize_t)xsh_size) {
|
||||
file_badread(ms);
|
||||
- free(nbuf);
|
||||
+ efree(nbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -971,25 +984,16 @@
|
||||
if (noff >= (off_t)xsh_size)
|
||||
break;
|
||||
noff = donote(ms, nbuf, (size_t)noff,
|
||||
- xsh_size, clazz, swap, 4, flags);
|
||||
+ (size_t)xsh_size, clazz, swap, 4,
|
||||
+ flags);
|
||||
if (noff == 0)
|
||||
break;
|
||||
}
|
||||
- free(nbuf);
|
||||
+ efree(nbuf);
|
||||
break;
|
||||
case SHT_SUNW_cap:
|
||||
- switch (mach) {
|
||||
- case EM_SPARC:
|
||||
- case EM_SPARCV9:
|
||||
- case EM_IA_64:
|
||||
- case EM_386:
|
||||
- case EM_AMD64:
|
||||
- break;
|
||||
- default:
|
||||
- goto skip;
|
||||
- }
|
||||
-
|
||||
- if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) {
|
||||
+ if (FINFO_LSEEK_FUNC(fd, (off_t)xsh_offset, SEEK_SET) ==
|
||||
+ (off_t)-1) {
|
||||
file_badseek(ms);
|
||||
return -1;
|
||||
}
|
||||
@@ -1001,7 +1005,7 @@
|
||||
MAX(sizeof cap32, sizeof cap64)];
|
||||
if ((coff += xcap_sizeof) > (off_t)xsh_size)
|
||||
break;
|
||||
- if (read(fd, cbuf, (size_t)xcap_sizeof) !=
|
||||
+ if (FINFO_READ_FUNC(fd, cbuf, (size_t)xcap_sizeof) !=
|
||||
(ssize_t)xcap_sizeof) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
@@ -1027,13 +1031,12 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
- /*FALLTHROUGH*/
|
||||
- skip:
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
-
|
||||
if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
|
||||
return -1;
|
||||
if (cap_hw1) {
|
||||
@@ -1112,7 +1115,7 @@
|
||||
const char *shared_libraries = "";
|
||||
unsigned char nbuf[BUFSIZ];
|
||||
ssize_t bufsize;
|
||||
- size_t offset, align, len;
|
||||
+ size_t offset, align;
|
||||
|
||||
if (size != xph_sizeof) {
|
||||
if (file_printf(ms, ", corrupted program header size") == -1)
|
||||
@@ -1121,8 +1124,13 @@
|
||||
}
|
||||
|
||||
for ( ; num; num--) {
|
||||
- if (pread(fd, xph_addr, xph_sizeof, off) == -1) {
|
||||
- file_badread(ms);
|
||||
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (FINFO_READ_FUNC(fd, xph_addr, xph_sizeof) == -1) {
|
||||
+ file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1160,9 +1168,12 @@
|
||||
* This is a PT_NOTE section; loop through all the notes
|
||||
* in the section.
|
||||
*/
|
||||
- len = xph_filesz < sizeof(nbuf) ? xph_filesz
|
||||
- : sizeof(nbuf);
|
||||
- bufsize = pread(fd, nbuf, len, xph_offset);
|
||||
+ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ bufsize = FINFO_READ_FUNC(fd, nbuf, ((xph_filesz < sizeof(nbuf)) ?
|
||||
+ xph_filesz : sizeof(nbuf)));
|
||||
if (bufsize == -1) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
@@ -1223,7 +1234,7 @@
|
||||
/*
|
||||
* If we cannot seek, it must be a pipe, socket or fifo.
|
||||
*/
|
||||
- if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
|
||||
+ if((FINFO_LSEEK_FUNC(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
|
||||
fd = file_pipe2file(ms, fd, buf, nbytes);
|
||||
|
||||
if (fstat(fd, &st) == -1) {
|
||||
diff -u libmagic.orig/readelf.h libmagic/readelf.h
|
||||
--- libmagic.orig/readelf.h Tue Nov 5 16:41:56 2013
|
||||
+++ libmagic/readelf.h Fri Feb 21 00:21:27 2014
|
||||
@@ -44,9 +44,17 @@
|
||||
typedef uint32_t Elf32_Word;
|
||||
typedef uint8_t Elf32_Char;
|
||||
|
||||
+#if SIZEOF_LONG_LONG != 8
|
||||
+#define USE_ARRAY_FOR_64BIT_TYPES
|
||||
+typedef uint32_t Elf64_Addr[2];
|
||||
+typedef uint32_t Elf64_Off[2];
|
||||
+typedef uint32_t Elf64_Xword[2];
|
||||
+#else
|
||||
+#undef USE_ARRAY_FOR_64BIT_TYPES
|
||||
typedef uint64_t Elf64_Addr;
|
||||
typedef uint64_t Elf64_Off;
|
||||
typedef uint64_t Elf64_Xword;
|
||||
+#endif
|
||||
typedef uint16_t Elf64_Half;
|
||||
typedef uint32_t Elf64_Word;
|
||||
typedef uint8_t Elf64_Char;
|
||||
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
--- libmagic.orig/softmagic.c Thu Feb 13 00:20:53 2014
|
||||
+++ libmagic/softmagic.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/softmagic.c Mon Aug 4 14:58:55 2014
|
||||
@@ -50,6 +50,11 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
@@ -3130,7 +3378,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
break; \
|
||||
} \
|
||||
|
||||
@@ -931,10 +915,21 @@
|
||||
@@ -931,10 +915,18 @@
|
||||
return 1;
|
||||
}
|
||||
case FILE_PSTRING: {
|
||||
@@ -3140,22 +3388,19 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
size_t len = file_pstring_get_length(m, ptr1);
|
||||
- if (len >= sizeof(p->s))
|
||||
- len = sizeof(p->s) - 1;
|
||||
+ sz = sizeof(p->s) - sz; /* maximum length of string */
|
||||
+ if (len >= sz) {
|
||||
+ if (len >= sizeof(p->s)) {
|
||||
+ /*
|
||||
+ * The size of the pascal string length (sz)
|
||||
+ * is 1, 2, or 4. We need at least 1 byte for NUL
|
||||
+ * termination, but we've already truncated the
|
||||
+ * string by p->s, so we need to deduct sz.
|
||||
+ * Because we can use one of the bytes of the length
|
||||
+ * after we shifted as NUL termination.
|
||||
+ */
|
||||
+ len = sz;
|
||||
+ len = sizeof(p->s) - sz;
|
||||
+ }
|
||||
while (len--)
|
||||
*ptr1++ = *ptr2++;
|
||||
*ptr1 = '\0';
|
||||
@@ -1046,7 +1041,7 @@
|
||||
@@ -1046,7 +1038,7 @@
|
||||
|
||||
private int
|
||||
mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
@@ -3164,7 +3409,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
{
|
||||
/*
|
||||
* Note: FILE_SEARCH and FILE_REGEX do not actually copy
|
||||
@@ -1066,15 +1061,24 @@
|
||||
@@ -1066,15 +1058,24 @@
|
||||
const char *last; /* end of search region */
|
||||
const char *buf; /* start of search region */
|
||||
const char *end;
|
||||
@@ -3191,7 +3436,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
/* mget() guarantees buf <= last */
|
||||
for (lines = linecnt, b = buf; lines && b < end &&
|
||||
((b = CAST(const char *,
|
||||
@@ -1087,7 +1091,7 @@
|
||||
@@ -1087,7 +1088,7 @@
|
||||
b++;
|
||||
}
|
||||
if (lines)
|
||||
@@ -3200,7 +3445,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
|
||||
ms->search.s = buf;
|
||||
ms->search.s_len = last - buf;
|
||||
@@ -1158,7 +1162,6 @@
|
||||
@@ -1158,7 +1159,6 @@
|
||||
int *need_separator, int *returnval)
|
||||
{
|
||||
uint32_t soffset, offset = ms->offset;
|
||||
@@ -3208,7 +3453,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
int rv, oneed_separator, in_type;
|
||||
char *sbuf, *rbuf;
|
||||
union VALUETYPE *p = &ms->ms_value;
|
||||
@@ -1170,17 +1173,13 @@
|
||||
@@ -1170,17 +1170,13 @@
|
||||
}
|
||||
|
||||
if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
|
||||
@@ -3228,7 +3473,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
|
||||
if (m->flag & INDIR) {
|
||||
@@ -1672,16 +1671,13 @@
|
||||
@@ -1672,16 +1668,13 @@
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect +offs=%u\n", offset);
|
||||
}
|
||||
@@ -3246,7 +3491,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1755,11 +1751,21 @@
|
||||
@@ -1755,11 +1748,21 @@
|
||||
ms->offset = soffset;
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
@@ -3271,7 +3516,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
return rv;
|
||||
|
||||
@@ -1875,6 +1881,42 @@
|
||||
@@ -1875,6 +1878,42 @@
|
||||
return file_strncmp(a, b, len, flags);
|
||||
}
|
||||
|
||||
@@ -3314,7 +3559,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
private int
|
||||
magiccheck(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -2035,63 +2077,151 @@
|
||||
@@ -2035,63 +2074,151 @@
|
||||
break;
|
||||
}
|
||||
case FILE_REGEX: {
|
||||
@@ -3520,7 +3765,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
case FILE_INDIRECT:
|
||||
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
|
||||
--- libmagic.orig/strcasestr.c Thu Dec 5 17:57:50 2013
|
||||
+++ libmagic/strcasestr.c Sun Jan 4 17:06:01 2015
|
||||
+++ libmagic/strcasestr.c Sun May 4 21:29:20 2014
|
||||
@@ -37,6 +37,8 @@
|
||||
__RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -1197,6 +1197,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
|
||||
if ((filearr = CAST(char **,
|
||||
erealloc(filearr, mlen))) == NULL) {
|
||||
file_oomem(ms, mlen);
|
||||
efree(mfn);
|
||||
php_stream_closedir(dir);
|
||||
errs++;
|
||||
goto out;
|
||||
|
||||
@@ -420,6 +420,8 @@ protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
|
||||
protected int file_replace(struct magic_set *, const char *, const char *);
|
||||
protected int file_printf(struct magic_set *, const char *, ...);
|
||||
protected int file_reset(struct magic_set *);
|
||||
protected int file_tryelf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
protected int file_trycdf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
#ifdef PHP_FILEINFO_UNCOMPRESS
|
||||
|
||||
@@ -351,7 +351,7 @@
|
||||
*
|
||||
* Revision 1.8 93/02/19 15:01:26 ian
|
||||
* Numerous changes from Guy Harris too numerous to mention but including
|
||||
* byte-order independence, fixing "old-style masking", etc. etc. A bugfix
|
||||
* byte-order independance, fixing "old-style masking", etc. etc. A bugfix
|
||||
* for broken symlinks from martin@@d255s004.zfe.siemens.de.
|
||||
*
|
||||
* Revision 1.7 93/01/05 14:57:27 ian
|
||||
|
||||
@@ -59,19 +59,16 @@ protected void
|
||||
file_magwarn(struct magic_set *ms, const char *f, ...)
|
||||
{
|
||||
va_list va;
|
||||
char *expanded_format = NULL;
|
||||
int expanded_len;
|
||||
char *expanded_format;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
va_start(va, f);
|
||||
expanded_len = vasprintf(&expanded_format, f, va);
|
||||
if (vasprintf(&expanded_format, f, va)); /* silence */
|
||||
va_end(va);
|
||||
|
||||
if (expanded_len >= 0 && expanded_format) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
|
||||
|
||||
free(expanded_format);
|
||||
}
|
||||
free(expanded_format);
|
||||
}
|
||||
|
||||
protected const char *
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,373 @@
|
||||
/*
|
||||
* Copyright (c) Christos Zoulas 2003.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, without modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* @(#)Id: readelf.h,v 1.9 2002/05/16 18:45:56 christos Exp
|
||||
*
|
||||
* Provide elf data structures for non-elf machines, allowing file
|
||||
* non-elf hosts to determine if an elf binary is stripped.
|
||||
* Note: cobbled from the linux header file, with modifications
|
||||
*/
|
||||
#ifndef __fake_elf_h__
|
||||
#define __fake_elf_h__
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef uint32_t Elf32_Addr;
|
||||
typedef uint32_t Elf32_Off;
|
||||
typedef uint16_t Elf32_Half;
|
||||
typedef uint32_t Elf32_Word;
|
||||
typedef uint8_t Elf32_Char;
|
||||
|
||||
#if SIZEOF_LONG_LONG != 8
|
||||
#define USE_ARRAY_FOR_64BIT_TYPES
|
||||
typedef uint32_t Elf64_Addr[2];
|
||||
typedef uint32_t Elf64_Off[2];
|
||||
typedef uint32_t Elf64_Xword[2];
|
||||
#else
|
||||
#undef USE_ARRAY_FOR_64BIT_TYPES
|
||||
typedef uint64_t Elf64_Addr;
|
||||
typedef uint64_t Elf64_Off;
|
||||
typedef uint64_t Elf64_Xword;
|
||||
#endif
|
||||
typedef uint16_t Elf64_Half;
|
||||
typedef uint32_t Elf64_Word;
|
||||
typedef uint8_t Elf64_Char;
|
||||
|
||||
#define EI_NIDENT 16
|
||||
|
||||
typedef struct {
|
||||
Elf32_Char e_ident[EI_NIDENT];
|
||||
Elf32_Half e_type;
|
||||
Elf32_Half e_machine;
|
||||
Elf32_Word e_version;
|
||||
Elf32_Addr e_entry; /* Entry point */
|
||||
Elf32_Off e_phoff;
|
||||
Elf32_Off e_shoff;
|
||||
Elf32_Word e_flags;
|
||||
Elf32_Half e_ehsize;
|
||||
Elf32_Half e_phentsize;
|
||||
Elf32_Half e_phnum;
|
||||
Elf32_Half e_shentsize;
|
||||
Elf32_Half e_shnum;
|
||||
Elf32_Half e_shstrndx;
|
||||
} Elf32_Ehdr;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Char e_ident[EI_NIDENT];
|
||||
Elf64_Half e_type;
|
||||
Elf64_Half e_machine;
|
||||
Elf64_Word e_version;
|
||||
Elf64_Addr e_entry; /* Entry point */
|
||||
Elf64_Off e_phoff;
|
||||
Elf64_Off e_shoff;
|
||||
Elf64_Word e_flags;
|
||||
Elf64_Half e_ehsize;
|
||||
Elf64_Half e_phentsize;
|
||||
Elf64_Half e_phnum;
|
||||
Elf64_Half e_shentsize;
|
||||
Elf64_Half e_shnum;
|
||||
Elf64_Half e_shstrndx;
|
||||
} Elf64_Ehdr;
|
||||
|
||||
/* e_type */
|
||||
#define ET_REL 1
|
||||
#define ET_EXEC 2
|
||||
#define ET_DYN 3
|
||||
#define ET_CORE 4
|
||||
|
||||
/* e_machine (used only for SunOS 5.x hardware capabilities) */
|
||||
#define EM_SPARC 2
|
||||
#define EM_386 3
|
||||
#define EM_SPARC32PLUS 18
|
||||
#define EM_SPARCV9 43
|
||||
#define EM_IA_64 50
|
||||
#define EM_AMD64 62
|
||||
|
||||
/* sh_type */
|
||||
#define SHT_SYMTAB 2
|
||||
#define SHT_NOTE 7
|
||||
#define SHT_DYNSYM 11
|
||||
#define SHT_SUNW_cap 0x6ffffff5 /* SunOS 5.x hw/sw capabilites */
|
||||
|
||||
/* elf type */
|
||||
#define ELFDATANONE 0 /* e_ident[EI_DATA] */
|
||||
#define ELFDATA2LSB 1
|
||||
#define ELFDATA2MSB 2
|
||||
|
||||
/* elf class */
|
||||
#define ELFCLASSNONE 0
|
||||
#define ELFCLASS32 1
|
||||
#define ELFCLASS64 2
|
||||
|
||||
/* magic number */
|
||||
#define EI_MAG0 0 /* e_ident[] indexes */
|
||||
#define EI_MAG1 1
|
||||
#define EI_MAG2 2
|
||||
#define EI_MAG3 3
|
||||
#define EI_CLASS 4
|
||||
#define EI_DATA 5
|
||||
#define EI_VERSION 6
|
||||
#define EI_PAD 7
|
||||
|
||||
#define ELFMAG0 0x7f /* EI_MAG */
|
||||
#define ELFMAG1 'E'
|
||||
#define ELFMAG2 'L'
|
||||
#define ELFMAG3 'F'
|
||||
#define ELFMAG "\177ELF"
|
||||
|
||||
#define OLFMAG1 'O'
|
||||
#define OLFMAG "\177OLF"
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word p_type;
|
||||
Elf32_Off p_offset;
|
||||
Elf32_Addr p_vaddr;
|
||||
Elf32_Addr p_paddr;
|
||||
Elf32_Word p_filesz;
|
||||
Elf32_Word p_memsz;
|
||||
Elf32_Word p_flags;
|
||||
Elf32_Word p_align;
|
||||
} Elf32_Phdr;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word p_type;
|
||||
Elf64_Word p_flags;
|
||||
Elf64_Off p_offset;
|
||||
Elf64_Addr p_vaddr;
|
||||
Elf64_Addr p_paddr;
|
||||
Elf64_Xword p_filesz;
|
||||
Elf64_Xword p_memsz;
|
||||
Elf64_Xword p_align;
|
||||
} Elf64_Phdr;
|
||||
|
||||
#define PT_NULL 0 /* p_type */
|
||||
#define PT_LOAD 1
|
||||
#define PT_DYNAMIC 2
|
||||
#define PT_INTERP 3
|
||||
#define PT_NOTE 4
|
||||
#define PT_SHLIB 5
|
||||
#define PT_PHDR 6
|
||||
#define PT_NUM 7
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word sh_name;
|
||||
Elf32_Word sh_type;
|
||||
Elf32_Word sh_flags;
|
||||
Elf32_Addr sh_addr;
|
||||
Elf32_Off sh_offset;
|
||||
Elf32_Word sh_size;
|
||||
Elf32_Word sh_link;
|
||||
Elf32_Word sh_info;
|
||||
Elf32_Word sh_addralign;
|
||||
Elf32_Word sh_entsize;
|
||||
} Elf32_Shdr;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word sh_name;
|
||||
Elf64_Word sh_type;
|
||||
Elf64_Off sh_flags;
|
||||
Elf64_Addr sh_addr;
|
||||
Elf64_Off sh_offset;
|
||||
Elf64_Off sh_size;
|
||||
Elf64_Word sh_link;
|
||||
Elf64_Word sh_info;
|
||||
Elf64_Off sh_addralign;
|
||||
Elf64_Off sh_entsize;
|
||||
} Elf64_Shdr;
|
||||
|
||||
#define NT_NETBSD_CORE_PROCINFO 1
|
||||
|
||||
/* Note header in a PT_NOTE section */
|
||||
typedef struct elf_note {
|
||||
Elf32_Word n_namesz; /* Name size */
|
||||
Elf32_Word n_descsz; /* Content size */
|
||||
Elf32_Word n_type; /* Content type */
|
||||
} Elf32_Nhdr;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word n_namesz;
|
||||
Elf64_Word n_descsz;
|
||||
Elf64_Word n_type;
|
||||
} Elf64_Nhdr;
|
||||
|
||||
/* Notes used in ET_CORE */
|
||||
#define NT_PRSTATUS 1
|
||||
#define NT_PRFPREG 2
|
||||
#define NT_PRPSINFO 3
|
||||
#define NT_PRXREG 4
|
||||
#define NT_TASKSTRUCT 4
|
||||
#define NT_PLATFORM 5
|
||||
#define NT_AUXV 6
|
||||
|
||||
/* Note types used in executables */
|
||||
/* NetBSD executables (name = "NetBSD") */
|
||||
#define NT_NETBSD_VERSION 1
|
||||
#define NT_NETBSD_EMULATION 2
|
||||
#define NT_FREEBSD_VERSION 1
|
||||
#define NT_OPENBSD_VERSION 1
|
||||
#define NT_DRAGONFLY_VERSION 1
|
||||
/*
|
||||
* GNU executables (name = "GNU")
|
||||
* word[0]: GNU OS tags
|
||||
* word[1]: major version
|
||||
* word[2]: minor version
|
||||
* word[3]: tiny version
|
||||
*/
|
||||
#define NT_GNU_VERSION 1
|
||||
|
||||
/* GNU OS tags */
|
||||
#define GNU_OS_LINUX 0
|
||||
#define GNU_OS_HURD 1
|
||||
#define GNU_OS_SOLARIS 2
|
||||
#define GNU_OS_KFREEBSD 3
|
||||
#define GNU_OS_KNETBSD 4
|
||||
|
||||
/*
|
||||
* GNU Hardware capability information
|
||||
* word[0]: Number of entries
|
||||
* word[1]: Bitmask of enabled entries
|
||||
* Followed by a byte id, and a NUL terminated string per entry
|
||||
*/
|
||||
#define NT_GNU_HWCAP 2
|
||||
|
||||
/*
|
||||
* GNU Build ID generated by ld
|
||||
* 160 bit SHA1 [default]
|
||||
* 128 bit md5 or uuid
|
||||
*/
|
||||
#define NT_GNU_BUILD_ID 3
|
||||
|
||||
/*
|
||||
* NetBSD-specific note type: PaX.
|
||||
* There should be 1 NOTE per executable.
|
||||
* name: PaX\0
|
||||
* namesz: 4
|
||||
* desc:
|
||||
* word[0]: capability bitmask
|
||||
* descsz: 4
|
||||
*/
|
||||
#define NT_NETBSD_PAX 3
|
||||
#define NT_NETBSD_PAX_MPROTECT 0x01 /* Force enable Mprotect */
|
||||
#define NT_NETBSD_PAX_NOMPROTECT 0x02 /* Force disable Mprotect */
|
||||
#define NT_NETBSD_PAX_GUARD 0x04 /* Force enable Segvguard */
|
||||
#define NT_NETBSD_PAX_NOGUARD 0x08 /* Force disable Servguard */
|
||||
#define NT_NETBSD_PAX_ASLR 0x10 /* Force enable ASLR */
|
||||
#define NT_NETBSD_PAX_NOASLR 0x20 /* Force disable ASLR */
|
||||
|
||||
/*
|
||||
* NetBSD-specific note type: MACHINE_ARCH.
|
||||
* There should be 1 NOTE per executable.
|
||||
* name: NetBSD\0
|
||||
* namesz: 7
|
||||
* desc: string
|
||||
* descsz: variable
|
||||
*/
|
||||
#define NT_NETBSD_MARCH 5
|
||||
|
||||
/*
|
||||
* NetBSD-specific note type: COMPILER MODEL.
|
||||
* There should be 1 NOTE per executable.
|
||||
* name: NetBSD\0
|
||||
* namesz: 7
|
||||
* desc: string
|
||||
* descsz: variable
|
||||
*/
|
||||
#define NT_NETBSD_CMODEL 6
|
||||
|
||||
#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
|
||||
#define ELFSIZE ARCH_ELFSIZE
|
||||
#endif
|
||||
/* SunOS 5.x hardware/software capabilities */
|
||||
typedef struct {
|
||||
Elf32_Word c_tag;
|
||||
union {
|
||||
Elf32_Word c_val;
|
||||
Elf32_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf32_Cap;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Xword c_tag;
|
||||
union {
|
||||
Elf64_Xword c_val;
|
||||
Elf64_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf64_Cap;
|
||||
|
||||
/* SunOS 5.x hardware/software capability tags */
|
||||
#define CA_SUNW_NULL 0
|
||||
#define CA_SUNW_HW_1 1
|
||||
#define CA_SUNW_SF_1 2
|
||||
|
||||
/* SunOS 5.x software capabilities */
|
||||
#define SF1_SUNW_FPKNWN 0x01
|
||||
#define SF1_SUNW_FPUSED 0x02
|
||||
#define SF1_SUNW_MASK 0x03
|
||||
|
||||
/* SunOS 5.x hardware capabilities: sparc */
|
||||
#define AV_SPARC_MUL32 0x0001
|
||||
#define AV_SPARC_DIV32 0x0002
|
||||
#define AV_SPARC_FSMULD 0x0004
|
||||
#define AV_SPARC_V8PLUS 0x0008
|
||||
#define AV_SPARC_POPC 0x0010
|
||||
#define AV_SPARC_VIS 0x0020
|
||||
#define AV_SPARC_VIS2 0x0040
|
||||
#define AV_SPARC_ASI_BLK_INIT 0x0080
|
||||
#define AV_SPARC_FMAF 0x0100
|
||||
#define AV_SPARC_FJFMAU 0x4000
|
||||
#define AV_SPARC_IMA 0x8000
|
||||
|
||||
/* SunOS 5.x hardware capabilities: 386 */
|
||||
#define AV_386_FPU 0x00000001
|
||||
#define AV_386_TSC 0x00000002
|
||||
#define AV_386_CX8 0x00000004
|
||||
#define AV_386_SEP 0x00000008
|
||||
#define AV_386_AMD_SYSC 0x00000010
|
||||
#define AV_386_CMOV 0x00000020
|
||||
#define AV_386_MMX 0x00000040
|
||||
#define AV_386_AMD_MMX 0x00000080
|
||||
#define AV_386_AMD_3DNow 0x00000100
|
||||
#define AV_386_AMD_3DNowx 0x00000200
|
||||
#define AV_386_FXSR 0x00000400
|
||||
#define AV_386_SSE 0x00000800
|
||||
#define AV_386_SSE2 0x00001000
|
||||
#define AV_386_PAUSE 0x00002000
|
||||
#define AV_386_SSE3 0x00004000
|
||||
#define AV_386_MON 0x00008000
|
||||
#define AV_386_CX16 0x00010000
|
||||
#define AV_386_AHF 0x00020000
|
||||
#define AV_386_TSCP 0x00040000
|
||||
#define AV_386_AMD_SSE4A 0x00080000
|
||||
#define AV_386_POPCNT 0x00100000
|
||||
#define AV_386_AMD_LZCNT 0x00200000
|
||||
#define AV_386_SSSE3 0x00400000
|
||||
#define AV_386_SSE4_1 0x00800000
|
||||
#define AV_386_SSE4_2 0x01000000
|
||||
|
||||
#endif
|
||||
@@ -918,17 +918,14 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
|
||||
size_t sz = file_pstring_length_size(m);
|
||||
char *ptr1 = p->s, *ptr2 = ptr1 + sz;
|
||||
size_t len = file_pstring_get_length(m, ptr1);
|
||||
sz = sizeof(p->s) - sz; /* maximum length of string */
|
||||
if (len >= sz) {
|
||||
if (len >= sizeof(p->s)) {
|
||||
/*
|
||||
* The size of the pascal string length (sz)
|
||||
* is 1, 2, or 4. We need at least 1 byte for NUL
|
||||
* termination, but we've already truncated the
|
||||
* string by p->s, so we need to deduct sz.
|
||||
* Because we can use one of the bytes of the length
|
||||
* after we shifted as NUL termination.
|
||||
*/
|
||||
len = sz;
|
||||
len = sizeof(p->s) - sz;
|
||||
}
|
||||
while (len--)
|
||||
*ptr1++ = *ptr2++;
|
||||
|
||||
@@ -56,28 +56,3 @@ index 26b2869..bcd0f43 100644
|
||||
--
|
||||
2.0.3
|
||||
|
||||
From 71d04468a5777fe43064af02f06d74cb60feafab Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20K=C3=B6hler?= <andi5.py@gmx.net>
|
||||
Date: Sat, 14 Jun 2014 03:04:28 +0200
|
||||
Subject: [PATCH] Fix regex in msooxml to avoid matching other archives.
|
||||
|
||||
---
|
||||
magic/Magdir/msooxml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/magic/Magdir/msooxml b/magic/Magdir/msooxml
|
||||
index c908b71..5ff3760 100644
|
||||
--- a/magic/Magdir/msooxml
|
||||
+++ b/magic/Magdir/msooxml
|
||||
@@ -16,7 +16,7 @@
|
||||
0 string PK\003\004
|
||||
!:strength +10
|
||||
# make sure the first file is correct
|
||||
->0x1E regex \[Content_Types\]\.xml|_rels/\.rels
|
||||
+>0x1E regex \\[Content_Types\\]\\.xml|_rels/\\.rels
|
||||
# skip to the second local file header
|
||||
# since some documents include a 520-byte extra field following the file
|
||||
# header, we need to scan for the next header
|
||||
--
|
||||
2.0.0
|
||||
|
||||
Binary file not shown.
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68398: msooxml matches too many archives
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$f = new finfo(FILEINFO_MIME);
|
||||
var_dump($f->file(dirname(__FILE__) . DIRECTORY_SEPARATOR . '68398.zip'));
|
||||
?>
|
||||
+++DONE+++
|
||||
--EXPECTF--
|
||||
string(31) "application/zip; charset=binary"
|
||||
+++DONE+++
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 24 B |
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68735 fileinfo out-of-bounds memory access
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$test_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug68735.jpg";
|
||||
$f = new finfo;
|
||||
|
||||
var_dump($f->file($test_file));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
string(%d) "JPEG image data, JFIF standard 1.01, comment: "%S""
|
||||
===DONE===
|
||||
@@ -3918,7 +3918,7 @@
|
||||
>7 string x version %.2s
|
||||
# We skip the path here, because it is often long (so file will
|
||||
# truncate it) and mostly redundant.
|
||||
# The inverted index functionality was added some time between
|
||||
# The inverted index functionality was added some time betwen
|
||||
# versions 11 and 15, so look for -q if version is above 14:
|
||||
>7 string >14
|
||||
>>10 search/100 \ -q\ with inverted index
|
||||
@@ -3972,7 +3972,7 @@
|
||||
# .cwk
|
||||
0 string \002\000\210\003\102\117\102\117\000\001\206 Claris works document
|
||||
# .plt
|
||||
0 string \020\341\000\000\010\010 Claris Works palette files .plt
|
||||
0 string \020\341\000\000\010\010 Claris Works pallete files .plt
|
||||
|
||||
# .msp a dictionary file I am not sure about this I have only one .msp file
|
||||
0 string \002\271\262\000\040\002\000\164 Claris works dictionary
|
||||
@@ -4443,9 +4443,9 @@
|
||||
>6 byte&0x04 =0x8 \b, [4-Scr]
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# game boy: file(1) magic for the Nintendo (Color) Game Boy raw ROM format
|
||||
# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
|
||||
#
|
||||
0x104 belong 0xCEED6666 Game Boy ROM:
|
||||
0x104 belong 0xCEED6666 Gameboy ROM:
|
||||
>0x134 string >\0 "%.16s"
|
||||
>0x146 byte 0x03 \b,[SGB]
|
||||
>0x147 byte 0x00 \b, [ROM ONLY]
|
||||
@@ -4605,8 +4605,8 @@
|
||||
0 string \x01ZZZZZ\x01 3DO "Opera" file system
|
||||
|
||||
# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
|
||||
0 string GBS Nintendo Game Boy Music/Audio Data
|
||||
12 string GameBoy\ Music\ Module Nintendo Game Boy Music Module
|
||||
0 string GBS Nintendo Gameboy Music/Audio Data
|
||||
12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module
|
||||
|
||||
# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
|
||||
0 string PPF30 Playstation Patch File version 3.0
|
||||
@@ -15279,7 +15279,7 @@
|
||||
# $File: oasis,v 1.1 2011/03/15 02:09:38 christos Exp $
|
||||
# OASIS
|
||||
# Summary: OASIS stream file
|
||||
# Long description: Open Artwork System Interchange Standard
|
||||
# Long descripton: Open Artwork System Interchange Standard
|
||||
# File extension: .oas
|
||||
# Full name: Ben Cowley (bcowley@broadcom.com)
|
||||
# Philip Dixon (pdixon@broadcom.com)
|
||||
|
||||
+1
-1
@@ -791,7 +791,7 @@ PHP_FUNCTION(filter_input)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto mixed filter_var(mixed variable [, long filter [, mixed options]])
|
||||
* Returns the filtered version of the variable.
|
||||
* Returns the filtered version of the vriable.
|
||||
*/
|
||||
PHP_FUNCTION(filter_var)
|
||||
{
|
||||
|
||||
+2
-2
@@ -69,8 +69,8 @@ typedef struct ftpbuf
|
||||
ftptype_t type; /* current transfer type */
|
||||
int pasv; /* 0=off; 1=pasv; 2=ready */
|
||||
php_sockaddr_storage pasvaddr; /* passive mode address */
|
||||
long timeout_sec; /* User configurable timeout (seconds) */
|
||||
int autoseek; /* User configurable autoseek flag */
|
||||
long timeout_sec; /* User configureable timeout (seconds) */
|
||||
int autoseek; /* User configureable autoseek flag */
|
||||
|
||||
int nb; /* "nonblocking" transfer in progress */
|
||||
databuf_t *data; /* Data connection for "nonblocking" transfers */
|
||||
|
||||
@@ -251,7 +251,6 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[
|
||||
PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdVersionString, [AC_DEFINE(HAVE_GD_LIBVERSION, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
|
||||
])
|
||||
|
||||
dnl
|
||||
|
||||
@@ -1289,14 +1289,7 @@ PHP_MINFO_FUNCTION(gd)
|
||||
|
||||
/* need to use a PHPAPI function here because it is external module in windows */
|
||||
|
||||
#if defined(HAVE_GD_BUNDLED)
|
||||
php_info_print_table_row(2, "GD Version", PHP_GD_VERSION_STRING);
|
||||
#else
|
||||
php_info_print_table_row(2, "GD headers Version", PHP_GD_VERSION_STRING);
|
||||
#if defined(HAVE_GD_LIBVERSION)
|
||||
php_info_print_table_row(2, "GD library Version", gdVersionString());
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_GD_TTF
|
||||
php_info_print_table_row(2, "FreeType Support", "enabled");
|
||||
|
||||
+2
-2
@@ -3051,8 +3051,8 @@ int gdImagePaletteToTrueColor(gdImagePtr src)
|
||||
}
|
||||
}
|
||||
|
||||
/* free old palette buffer (y is sy) */
|
||||
for (yy = 0; yy < y; yy++) {
|
||||
/* free old palette buffer */
|
||||
for (yy = y - 1; yy >= yy - 1; yy--) {
|
||||
gdFree(src->pixels[yy]);
|
||||
}
|
||||
gdFree(src->pixels);
|
||||
|
||||
+1
-1
@@ -782,7 +782,7 @@ int gdImageBrightness(gdImagePtr src, int brightness);
|
||||
/* Set the contrast level <contrast> for the image <src> */
|
||||
int gdImageContrast(gdImagePtr src, double contrast);
|
||||
|
||||
/* Simply adds or subtracts respectively red, green or blue to a pixel */
|
||||
/* Simply adds or substracts respectively red, green or blue to a pixel */
|
||||
int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
|
||||
|
||||
/* Image convolution by a 3x3 custom matrix */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This is potentially great stuff, but fails against the test
|
||||
program at the end. This would probably be much more
|
||||
efficient than the implementation currently in gd.c if the
|
||||
efficent than the implementation currently in gd.c if the
|
||||
errors in the output were corrected. TBB */
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -72,10 +72,8 @@ static struct {
|
||||
|
||||
#define STACK_SIZE ((1<<(MAX_LWZ_BITS))*2)
|
||||
|
||||
#define CSD_BUF_SIZE 280
|
||||
|
||||
typedef struct {
|
||||
unsigned char buf[CSD_BUF_SIZE];
|
||||
unsigned char buf[280];
|
||||
int curbit, lastbit, done, last_byte;
|
||||
} CODE_STATIC_DATA;
|
||||
|
||||
@@ -400,14 +398,9 @@ GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroD
|
||||
scd->lastbit = (2+count)*8 ;
|
||||
}
|
||||
|
||||
if ((scd->curbit + code_size - 1) >= (CSD_BUF_SIZE * 8)) {
|
||||
ret = -1;
|
||||
} else {
|
||||
ret = 0;
|
||||
for (i = scd->curbit, j = 0; j < code_size; ++i, ++j) {
|
||||
ret |= ((scd->buf[i / 8] & (1 << (i % 8))) != 0) << j;
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
for (i = scd->curbit, j = 0; j < code_size; ++i, ++j)
|
||||
ret |= ((scd->buf[ i / 8 ] & (1 << (i % 8))) != 0) << j;
|
||||
|
||||
scd->curbit += code_size;
|
||||
return ret;
|
||||
|
||||
+1
-1
@@ -464,7 +464,7 @@ static void *fontFetch (char **error, void *key)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* FIXME - This mapping stuff is incomplete - where is the spec? */
|
||||
/* FIXME - This mapping stuff is imcomplete - where is the spec? */
|
||||
/* EAM - It's worse than that. It's pointless to match character encodings here.
|
||||
* As currently written, the stored a->face->charmap only matches one of
|
||||
* the actual charmaps and we cannot know at this stage if it is the right
|
||||
|
||||
@@ -169,7 +169,7 @@ static inline uint32 get_le32(const uint8* const data) {
|
||||
* Y2/U2/V2: The Y/U/V data of the second image
|
||||
*
|
||||
* Returns the PSNR (http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio)
|
||||
* value computed between the two images
|
||||
* value computed bewteen the two images
|
||||
*/
|
||||
double GetPSNRYuv(const uint8* Y1,
|
||||
const uint8* U1,
|
||||
@@ -210,7 +210,7 @@ double GetPSNRYuv(const uint8* Y1,
|
||||
* imgdata: data buffer containing webp image
|
||||
* imgdata_size: size of the imgdata buffer
|
||||
*
|
||||
* Returns the PSNR value computed between the two images
|
||||
* Returns the PSNR value computed bewteen the two images
|
||||
*/
|
||||
double WebPGetPSNR(const uint8* Y1,
|
||||
const uint8* U1,
|
||||
|
||||
@@ -57,7 +57,7 @@ typedef enum WebPResultType {
|
||||
* 3. p_Y/p_U/p_V : pointer to the Y/U/V data buffer (this routine will
|
||||
* allocate memory for the buffer, fill the buffer with
|
||||
* appropriate data and transfer owner ship of the buffer
|
||||
* to caller. Caller is responsible for freeing the memory).
|
||||
* to caller. Caller is reponsible for freeing the memory).
|
||||
* Note that the memory for Y, U, V buffers is alloacted
|
||||
* in one chunk, hence one should call free(*p_Y) only.
|
||||
* Do not try to free the U and V buffers.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Bug #67248 (imageaffinematrixget missing check of parameters)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available')}
|
||||
if(!function_exists('imageaffinematrixget')) die('skip imageaffinematrixget() not available');
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
test imagealphablending without arguments
|
||||
|
||||
--CREDITS--
|
||||
Marcelo Diniz <marcelo.leo27 [at] gmail [dot] com
|
||||
#phpspMaisTestFest PHPSP on 2014-07-05
|
||||
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available.");
|
||||
?>
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
imagealphablending();
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
Warning: imagealphablending() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
Loaded 100 of 377 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user