mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-25 18:05:42 +00:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7ed1f65c1 | ||
|
|
7c3b55049f | ||
|
|
240f5ce408 | ||
|
|
f0416adf20 | ||
|
|
3e1309ffba | ||
|
|
49906f2011 | ||
|
|
07ab86ef3b | ||
|
|
bba35f16fd | ||
|
|
8a72b247bd |
No files matched your search
+6
-3
@@ -1,4 +1,8 @@
|
||||
language: c
|
||||
language: php
|
||||
|
||||
php:
|
||||
# We only specify one version so we only get one worker
|
||||
- 5.4
|
||||
|
||||
notifications:
|
||||
email:
|
||||
@@ -23,7 +27,6 @@ env:
|
||||
before_install:
|
||||
- sudo cp ./travis/de /var/lib/locales/supported.d/de
|
||||
- sudo dpkg-reconfigure locales
|
||||
- ./travis/install.sh
|
||||
|
||||
before_script:
|
||||
# Compile PHP
|
||||
@@ -36,4 +39,4 @@ before_script:
|
||||
- . ./travis/ext/pdo_pgsql/setup.sh
|
||||
|
||||
# Run PHPs run-tests.php
|
||||
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
|
||||
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120 -s
|
||||
@@ -1,103 +1,6 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
22 Jan 2014, PHP 5.5.21
|
||||
|
||||
- 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 #65576 (Constructor from trait conflicts with inherited
|
||||
constructor). (dunglas at gmail dot com)
|
||||
. 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 #68594 (Use after free vulnerability in unserialize()).
|
||||
(CVE-2014-8142) (Stefan Esser)
|
||||
. 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)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #68799: Free called on unitialized pointer. (CVE-2015-0232)
|
||||
(Stas)
|
||||
|
||||
- Fileinfo:
|
||||
. 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 bug #68751 (listen.allowed_clients is broken). (Remi)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #68601 (buffer read overflow in gd_gif_in.c). (Jan Bee, Remi)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #68504 (--with-libmbfl configure option not present on Windows).
|
||||
(Ashesh Vashi)
|
||||
|
||||
- Mcrypt:
|
||||
. Fixed possible read after end of buffer and use after free. (Dmitry)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #67111 (Memory leak when using "continue 2" inside two foreach
|
||||
loops). (Nikita)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #55618 (use case-insensitive cert name matching). (Daniel Lowrey)
|
||||
|
||||
- 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-specific
|
||||
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 #65213 (cannot cast SplFileInfo to boolean) (Tjerk)
|
||||
. 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.5.20
|
||||
17 Dec 2014, PHP 5.5.20
|
||||
|
||||
- Core:
|
||||
. Fixed bug #68091 (Some Zend headers lack appropriate extern "C" blocks).
|
||||
@@ -106,6 +9,8 @@ PHP NEWS
|
||||
triggered). (Julien)
|
||||
. Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence)
|
||||
. Fixed bug #68545 (NULL pointer dereference in unserialize.c). (Anatol)
|
||||
. 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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -809,6 +809,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);
|
||||
|
||||
|
||||
+2
-8
@@ -2140,12 +2140,6 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
|
||||
if (!CG(active_class_entry)) {
|
||||
zend_error(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);
|
||||
@@ -3842,7 +3836,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(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name);
|
||||
}
|
||||
ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR;
|
||||
@@ -3867,7 +3861,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(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name);
|
||||
}
|
||||
ce->constructor = fe;
|
||||
|
||||
@@ -352,6 +352,13 @@ ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, uint class_n
|
||||
ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC);
|
||||
void zend_verify_abstract_class(zend_class_entry *ce 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))
|
||||
|
||||
|
||||
+118
-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
|
||||
@@ -1336,19 +1339,115 @@ 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;
|
||||
#ifdef ZTS
|
||||
THREAD_T thread_id = (THREAD_T)wParam;
|
||||
#endif
|
||||
|
||||
/* The doc states it'll be always true, however it theoretically
|
||||
could be FALSE when the thread was signaled. */
|
||||
if (!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, &thread_id);
|
||||
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;
|
||||
|
||||
tsrm_ls = ts_resource_ex(0, &thread_id);
|
||||
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 */
|
||||
@@ -1366,28 +1465,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
|
||||
{
|
||||
@@ -1429,16 +1513,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)) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=21
|
||||
PHP_RELEASE_VERSION=20
|
||||
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`
|
||||
@@ -1170,7 +1170,7 @@ case $libdir in
|
||||
libdir=$libdir/php
|
||||
;;
|
||||
esac
|
||||
case `eval echo $datadir` in
|
||||
case $datadir in
|
||||
'${prefix}/share')
|
||||
datadir=$datadir/php
|
||||
;;
|
||||
@@ -1185,7 +1185,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:
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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
|
||||
@@ -3665,7 +3665,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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -2702,7 +2702,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,
|
||||
|
||||
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"
|
||||
|
||||
PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic)
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/libmagic)
|
||||
|
||||
@@ -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');
|
||||
|
||||
+335
-54
@@ -1,6 +1,6 @@
|
||||
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
--- libmagic.orig/apprentice.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/apprentice.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/apprentice.c Mon Sep 29 10:53:07 2014
|
||||
@@ -29,6 +29,8 @@
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
@@ -842,7 +842,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
--- libmagic.orig/ascmagic.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/ascmagic.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/ascmagic.c Mon Mar 10 16:40:55 2014
|
||||
@@ -139,7 +139,7 @@
|
||||
/* malloc size is a conservative overestimate; could be
|
||||
improved, or at least realloced after conversion. */
|
||||
@@ -881,7 +881,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
}
|
||||
diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
--- libmagic.orig/cdf.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/cdf.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/cdf.c Wed Aug 20 21:20:34 2014
|
||||
@@ -43,7 +43,17 @@
|
||||
#include <err.h>
|
||||
#endif
|
||||
@@ -1070,7 +1070,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
} else {
|
||||
diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
--- libmagic.orig/cdf.h Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/cdf.h Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/cdf.h Mon Dec 2 15:25:29 2013
|
||||
@@ -35,10 +35,12 @@
|
||||
#ifndef _H_CDF_
|
||||
#define _H_CDF_
|
||||
@@ -1113,7 +1113,7 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
void cdf_unpack_header(cdf_header_t *, char *);
|
||||
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
--- libmagic.orig/cdf_time.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/cdf_time.c Sun Nov 9 19:16:18 2014
|
||||
+++ libmagic/cdf_time.c Mon Dec 2 15:25:29 2013
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
|
||||
@@ -1173,7 +1173,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 6 21:35:43 2013
|
||||
+++ libmagic/compress.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/compress.c Mon Dec 2 15:25:29 2013
|
||||
@@ -32,6 +32,7 @@
|
||||
* uncompress(method, old, n, newch) - uncompress old into new,
|
||||
* using method, return sizeof new
|
||||
@@ -1336,7 +1336,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 Mon Feb 18 16:40:59 2013
|
||||
+++ libmagic/file.h Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/file.h Mon Mar 10 16:40:55 2014
|
||||
@@ -33,11 +33,9 @@
|
||||
#ifndef __file_h__
|
||||
#define __file_h__
|
||||
@@ -1423,7 +1423,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
void *map; /* internal resources used by entry */
|
||||
struct mlist *next, *prev;
|
||||
};
|
||||
@@ -411,21 +413,16 @@
|
||||
@@ -411,21 +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 *);
|
||||
@@ -1440,8 +1440,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
|
||||
@@ -1449,7 +1449,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
|
||||
@@ -438,21 +435,18 @@
|
||||
@@ -438,21 +437,18 @@
|
||||
unichar **, size_t *, const char **, const char **, const char **);
|
||||
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
|
||||
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
|
||||
@@ -1476,7 +1476,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 *);
|
||||
@@ -462,16 +456,14 @@
|
||||
@@ -462,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 *);
|
||||
@@ -1494,7 +1494,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
@@ -484,32 +476,16 @@
|
||||
@@ -484,32 +478,16 @@
|
||||
#define strtoul(a, b, c) strtol(a, b, c)
|
||||
#endif
|
||||
|
||||
@@ -1529,7 +1529,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
|
||||
#define QUICK
|
||||
@@ -531,6 +507,14 @@
|
||||
@@ -531,6 +509,14 @@
|
||||
#endif
|
||||
#else
|
||||
#define FILE_RCSID(id)
|
||||
@@ -1546,7 +1546,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 Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/fsmagic.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/fsmagic.c Mon Dec 2 15:25:29 2013
|
||||
@@ -59,27 +59,21 @@
|
||||
# define minor(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
@@ -1913,7 +1913,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
}
|
||||
diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
--- libmagic.orig/funcs.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/funcs.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/funcs.c Mon Mar 10 16:40:55 2014
|
||||
@@ -41,52 +41,42 @@
|
||||
#if defined(HAVE_WCTYPE_H)
|
||||
#include <wctype.h>
|
||||
@@ -2207,7 +2207,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
+
|
||||
diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
--- libmagic.orig/magic.c Fri Jan 11 17:43:09 2013
|
||||
+++ libmagic/magic.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/magic.c Mon Dec 2 15:29:02 2013
|
||||
@@ -25,11 +25,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
@@ -2551,7 +2551,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
magic_error(struct magic_set *ms)
|
||||
diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h Thu Mar 21 18:52:42 2013
|
||||
+++ libmagic/magic.h Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/magic.h Mon Dec 2 15:25:29 2013
|
||||
@@ -87,6 +87,7 @@
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
@@ -2570,7 +2570,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
|
||||
diff -u libmagic.orig/print.c libmagic/print.c
|
||||
--- libmagic.orig/print.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/print.c Sun Jan 4 17:04:32 2015
|
||||
+++ libmagic/print.c Mon Dec 2 15:29:02 2013
|
||||
@@ -28,13 +28,17 @@
|
||||
/*
|
||||
* print.c - debugging printout routines
|
||||
@@ -2589,7 +2589,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>
|
||||
|
||||
@@ -2768,8 +2768,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 */
|
||||
@@ -2781,19 +2780,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) {
|
||||
@@ -2804,7 +2801,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
}
|
||||
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
--- libmagic.orig/readcdf.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/readcdf.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/readcdf.c Thu Apr 24 19:54:40 2014
|
||||
@@ -30,7 +30,11 @@
|
||||
#endif
|
||||
|
||||
@@ -2878,9 +2875,296 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
} else {
|
||||
if (file_printf(ms, "application/CDFV2-corrupt") == -1)
|
||||
return -1;
|
||||
diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
--- libmagic.orig/readelf.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/readelf.c Sat Oct 25 11:50:05 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,11 +127,17 @@
|
||||
|
||||
#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 \
|
||||
- : (void *)&sh64)
|
||||
+ ? (void *) &sh32 \
|
||||
+ : (void *) &sh64)
|
||||
#define xsh_sizeof (clazz == ELFCLASS32 \
|
||||
? sizeof(sh32) \
|
||||
: sizeof(sh64))
|
||||
@@ -168,8 +174,8 @@
|
||||
? elf_getu32(swap, ph32.p_filesz) \
|
||||
: elf_getu64(swap, ph64.p_filesz)))
|
||||
#define xnh_addr (clazz == ELFCLASS32 \
|
||||
- ? (void *)&nh32 \
|
||||
- : (void *)&nh64)
|
||||
+ ? (void *) &nh32 \
|
||||
+ : (void *) &nh64)
|
||||
#define xph_memsz (size_t)((clazz == ELFCLASS32 \
|
||||
? elf_getu32(swap, ph32.p_memsz) \
|
||||
: elf_getu64(swap, ph64.p_memsz)))
|
||||
@@ -189,8 +195,8 @@
|
||||
? prpsoffsets32[i] \
|
||||
: prpsoffsets64[i])
|
||||
#define xcap_addr (clazz == ELFCLASS32 \
|
||||
- ? (void *)&cap32 \
|
||||
- : (void *)&cap64)
|
||||
+ ? (void *) &cap32 \
|
||||
+ : (void *) &cap64)
|
||||
#define xcap_sizeof (clazz == ELFCLASS32 \
|
||||
? sizeof cap32 \
|
||||
: sizeof cap64)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -357,6 +372,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;
|
||||
|
||||
@@ -852,24 +874,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;
|
||||
}
|
||||
@@ -894,14 +904,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) {
|
||||
+ efree(nbuf);
|
||||
file_badread(ms);
|
||||
- free(nbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -910,25 +923,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;
|
||||
}
|
||||
@@ -940,7 +944,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;
|
||||
@@ -966,13 +970,12 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
- /*FALLTHROUGH*/
|
||||
- skip:
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
-
|
||||
if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
|
||||
return -1;
|
||||
if (cap_hw1) {
|
||||
@@ -1051,7 +1054,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)
|
||||
@@ -1060,8 +1063,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;
|
||||
}
|
||||
|
||||
@@ -1099,9 +1107,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;
|
||||
@@ -1162,7 +1173,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 Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/readelf.h Mon Dec 2 15:25:29 2013
|
||||
@@ -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 Mar 21 18:45:14 2013
|
||||
+++ libmagic/softmagic.c Sun Jan 4 17:02:29 2015
|
||||
+++ libmagic/softmagic.c Wed Aug 20 21:20:34 2014
|
||||
@@ -41,6 +41,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
@@ -3039,7 +3323,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
break; \
|
||||
} \
|
||||
|
||||
@@ -896,10 +881,21 @@
|
||||
@@ -896,10 +881,18 @@
|
||||
return 1;
|
||||
}
|
||||
case FILE_PSTRING: {
|
||||
@@ -3049,22 +3333,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';
|
||||
@@ -1010,7 +1006,7 @@
|
||||
@@ -1010,7 +1003,7 @@
|
||||
|
||||
private int
|
||||
mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
@@ -3073,7 +3354,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
{
|
||||
/*
|
||||
* Note: FILE_SEARCH and FILE_REGEX do not actually copy
|
||||
@@ -1030,15 +1026,24 @@
|
||||
@@ -1030,15 +1023,24 @@
|
||||
const char *last; /* end of search region */
|
||||
const char *buf; /* start of search region */
|
||||
const char *end;
|
||||
@@ -3100,7 +3381,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 *,
|
||||
@@ -1051,7 +1056,7 @@
|
||||
@@ -1051,7 +1053,7 @@
|
||||
b++;
|
||||
}
|
||||
if (lines)
|
||||
@@ -3109,7 +3390,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
|
||||
ms->search.s = buf;
|
||||
ms->search.s_len = last - buf;
|
||||
@@ -1125,7 +1130,6 @@
|
||||
@@ -1125,7 +1127,6 @@
|
||||
int *need_separator, int *returnval)
|
||||
{
|
||||
uint32_t soffset, offset = ms->offset;
|
||||
@@ -3117,7 +3398,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
int rv, oneed_separator;
|
||||
char *sbuf, *rbuf;
|
||||
union VALUETYPE *p = &ms->ms_value;
|
||||
@@ -1137,17 +1141,13 @@
|
||||
@@ -1137,17 +1138,13 @@
|
||||
}
|
||||
|
||||
if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
|
||||
@@ -3137,7 +3418,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
|
||||
if (m->flag & INDIR) {
|
||||
@@ -1191,7 +1191,7 @@
|
||||
@@ -1191,7 +1188,7 @@
|
||||
}
|
||||
switch (cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
@@ -3146,7 +3427,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1226,7 +1226,7 @@
|
||||
@@ -1226,7 +1223,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
@@ -3155,7 +3436,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1278,7 +1278,7 @@
|
||||
@@ -1278,7 +1275,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
@@ -3164,7 +3445,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1330,7 +1330,7 @@
|
||||
@@ -1330,7 +1327,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
@@ -3173,7 +3454,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1367,7 +1367,7 @@
|
||||
@@ -1367,7 +1364,7 @@
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
@@ -3182,7 +3463,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1438,7 +1438,7 @@
|
||||
@@ -1438,7 +1435,7 @@
|
||||
break;
|
||||
case FILE_LELONG:
|
||||
case FILE_LEID3:
|
||||
@@ -3191,7 +3472,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1508,7 +1508,7 @@
|
||||
@@ -1508,7 +1505,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
@@ -3200,7 +3481,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1578,7 +1578,7 @@
|
||||
@@ -1578,7 +1575,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LONG:
|
||||
@@ -3209,7 +3490,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1637,30 +1637,27 @@
|
||||
@@ -1637,30 +1634,27 @@
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect +offs=%u\n", offset);
|
||||
}
|
||||
@@ -3243,7 +3524,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1679,38 +1676,40 @@
|
||||
@@ -1679,38 +1673,40 @@
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
@@ -3290,7 +3571,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
|
||||
rbuf = ms->o.buf;
|
||||
@@ -1718,16 +1717,26 @@
|
||||
@@ -1718,16 +1714,26 @@
|
||||
ms->offset = soffset;
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
@@ -3321,7 +3602,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
sbuf = m->value.s;
|
||||
if (*sbuf == '^') {
|
||||
@@ -1837,6 +1846,42 @@
|
||||
@@ -1837,6 +1843,42 @@
|
||||
return file_strncmp(a, b, len, flags);
|
||||
}
|
||||
|
||||
@@ -3364,7 +3645,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
private int
|
||||
magiccheck(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -1996,69 +2041,157 @@
|
||||
@@ -1996,69 +2038,157 @@
|
||||
break;
|
||||
}
|
||||
case FILE_REGEX: {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,333 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
/* 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
|
||||
@@ -884,17 +884,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++;
|
||||
|
||||
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===
|
||||
+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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,9 +1,5 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegd2
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
?>
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegd
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
?>
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
@@ -6,7 +6,6 @@ foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
$support = gd_info();
|
||||
if (!isset($support['GIF Create Support']) || $support['GIF Create Support'] === false) {
|
||||
print 'skip gif support not available';
|
||||
|
||||
@@ -6,7 +6,6 @@ foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
$support = gd_info();
|
||||
if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
|
||||
print 'skip jpeg support not available';
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
does the imagepalettetotruecollor function realy converts the image palette?
|
||||
--CREDITS--
|
||||
Carlos André Ferrari <caferrari [at] gmail [dot] com>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available.");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(100, 100);
|
||||
var_dump(is_resource($im));
|
||||
var_dump(imageistruecolor($im));
|
||||
var_dump(imagepalettetotruecolor($im));
|
||||
var_dump(imageistruecolor($im));
|
||||
imagedestroy($im);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
imagepalettetotruecollor must return an error if no resource is given
|
||||
--CREDITS--
|
||||
Carlos André Ferrari <caferrari [at] gmail [dot] com>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available.");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imagepalettetotruecolor();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagepalettetotruecolor() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
imagepalettetotruecollor must return an error if not a resource is given
|
||||
--CREDITS--
|
||||
Carlos André Ferrari <caferrari [at] gmail [dot] com>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available.");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imagepalettetotruecolor("bla");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagepalettetotruecolor() expects parameter 1 to be resource, string given in %s on line %d
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
imagepalettetotruecollor must return an error if not an image resource is given
|
||||
--CREDITS--
|
||||
Carlos André Ferrari <caferrari [at] gmail [dot] com>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available.");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = fopen('php://memory', 'w');
|
||||
imagepalettetotruecolor($im);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagepalettetotruecolor(): supplied resource is not a valid Image resource in %s on line %d
|
||||
@@ -6,7 +6,6 @@ foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
$support = gd_info();
|
||||
if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
|
||||
print 'skip png support not available';
|
||||
|
||||
@@ -6,7 +6,6 @@ foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
$support = gd_info();
|
||||
if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
|
||||
print 'skip wbmp support not available';
|
||||
|
||||
@@ -6,7 +6,6 @@ foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
$support = gd_info();
|
||||
if (!isset($support['WEBP Support']) || $support['WEBP Support'] === false) {
|
||||
print 'skip webp support not available';
|
||||
|
||||
@@ -5,10 +5,8 @@ Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
|
||||
<?php if(substr(PHP_OS, 0, 3) == 'WIN' ) {die('skip not for windows');} ?>
|
||||
<?php if(setlocale(LC_ALL, "en_US.utf8",) === false) { die('skip en_US.utf8 locales not available'); } ?>
|
||||
--FILE--
|
||||
<?php
|
||||
setlocale(LC_ALL, "en_US.utf8");
|
||||
$in_charset = 'UTF-8';
|
||||
$out_charset = 'ASCII//TRANSLIT';
|
||||
$string_to_translate = 'Žluťoučký kůň\n';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#ifndef COLLATOR_ATTR_H
|
||||
#define COLLATOR_ATTR_H
|
||||
#define CCOLLATOR_ATTR_H
|
||||
|
||||
#include <php.h>
|
||||
|
||||
|
||||
+40
-59
@@ -1,71 +1,53 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_WITH("libmbfl", "use external libmbfl", "no");
|
||||
ARG_ENABLE("mbstring", "multibyte string functions", "no");
|
||||
ARG_ENABLE("mbregex", "multibyte regex support", "no");
|
||||
ARG_ENABLE("mbregex-backtrack", "check multibyte regex backtrack", "yes");
|
||||
|
||||
if (PHP_MBSTRING != "no") {
|
||||
|
||||
EXTENSION("mbstring", "mbstring.c php_unicode.c mb_gpc.c", PHP_MBSTRING_SHARED);
|
||||
FSO.CopyFile("ext\\mbstring\\libmbfl\\config.h.w32",
|
||||
"ext\\mbstring\\libmbfl\\config.h", true);
|
||||
FSO.CopyFile("ext\\mbstring\\oniguruma\\win32\\config.h",
|
||||
"ext\\mbstring\\oniguruma\\config.h", true);
|
||||
|
||||
EXTENSION("mbstring", "mbstring.c php_unicode.c mb_gpc.c", PHP_MBSTRING_SHARED,
|
||||
"-Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl \
|
||||
-Iext/mbstring/oniguruma /D NOT_RUBY=1 /D LIBMBFL_EXPORTS=1 \
|
||||
/D HAVE_STDARG_PROTOTYPES=1 /D HAVE_CONFIG_H /D HAVE_STDLIB_H \
|
||||
/D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /D EXPORT");
|
||||
|
||||
ADD_SOURCES("ext/mbstring/libmbfl/filters", "html_entities.c \
|
||||
mbfilter_7bit.c mbfilter_ascii.c mbfilter_base64.c mbfilter_big5.c \
|
||||
mbfilter_byte2.c mbfilter_byte4.c mbfilter_cp1251.c mbfilter_cp1252.c \
|
||||
mbfilter_cp866.c mbfilter_cp932.c mbfilter_cp936.c mbfilter_cp51932.c \
|
||||
mbfilter_euc_cn.c mbfilter_euc_jp.c mbfilter_euc_jp_win.c mbfilter_euc_kr.c \
|
||||
mbfilter_euc_tw.c mbfilter_htmlent.c mbfilter_hz.c mbfilter_iso2022_kr.c \
|
||||
mbfilter_iso8859_1.c mbfilter_iso8859_10.c mbfilter_iso8859_13.c \
|
||||
mbfilter_iso8859_14.c mbfilter_iso8859_15.c mbfilter_iso8859_16.c \
|
||||
mbfilter_iso8859_2.c mbfilter_iso8859_3.c mbfilter_iso8859_4.c \
|
||||
mbfilter_iso8859_5.c mbfilter_iso8859_6.c mbfilter_iso8859_7.c \
|
||||
mbfilter_iso8859_8.c mbfilter_iso8859_9.c mbfilter_jis.c \
|
||||
mbfilter_iso2022_jp_ms.c mbfilter_gb18030.c mbfilter_sjis_2004.c \
|
||||
mbfilter_koi8r.c mbfilter_qprint.c mbfilter_sjis.c mbfilter_ucs2.c \
|
||||
mbfilter_ucs4.c mbfilter_uhc.c mbfilter_utf16.c mbfilter_utf32.c \
|
||||
mbfilter_utf7.c mbfilter_utf7imap.c mbfilter_utf8.c mbfilter_utf8_mobile.c \
|
||||
mbfilter_koi8u.c mbfilter_cp1254.c mbfilter_euc_jp_2004.c \
|
||||
mbfilter_uuencode.c mbfilter_armscii8.c mbfilter_cp850.c \
|
||||
mbfilter_cp5022x.c mbfilter_sjis_open.c mbfilter_sjis_mobile.c \
|
||||
mbfilter_sjis_mac.c \
|
||||
mbfilter_iso2022jp_2004.c mbfilter_iso2022jp_mobile.c \
|
||||
mbfilter_tl_jisx0201_jisx0208.c", "mbstring");
|
||||
|
||||
if (PHP_LIBMBFL != "no" &&
|
||||
CHECK_HEADER_ADD_INCLUDE("mbfl/mbfilter.h", "CFLAGS_LIBMBFL", PHP_LIBMBFL + "\\include") &&
|
||||
CHECK_LIB("mbfl.lib", "libmbfl", PHP_LIBMBFL + "\\lib")) {
|
||||
ADD_SOURCES("ext/mbstring/libmbfl/mbfl", "mbfilter.c mbfilter_8bit.c \
|
||||
mbfilter_pass.c mbfilter_wchar.c mbfl_convert.c mbfl_encoding.c \
|
||||
mbfl_filter_output.c mbfl_ident.c mbfl_language.c mbfl_memory_device.c \
|
||||
mbfl_string.c mbfl_allocators.c", "mbstring");
|
||||
|
||||
ADD_FLAG("LIBS_MBSTRING", get_define("LIBS_LIBMBFL"));
|
||||
ADD_FLAG("LDFLAGS_MBSTRING", get_define("LDFLAGS_LIBMBFL"));
|
||||
ADD_FLAG("CFLAGS_MBSTRING", get_define("CFLAGS_LIBMBFL") +
|
||||
" /I ext/mbstring/oniguruma /D NOT_RUBY=1 \
|
||||
/D HAVE_STDARG_PROTOTYPES=1 /D HAVE_STDLIB_H \
|
||||
/D HAVE_STRICMP /D EXPORT");
|
||||
|
||||
PHP_INSTALL_HEADERS("ext/mbstring", "mbstring.h oniguruma/oniguruma.h php_mbregex.h php_onig_compat.h");
|
||||
} else {
|
||||
STDOUT.WriteLine("Using bundled libmbfl...");
|
||||
|
||||
ADD_FLAG("CFLAGS_MBSTRING", "-Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl \
|
||||
-Iext/mbstring/oniguruma /D NOT_RUBY=1 /D LIBMBFL_EXPORTS=1 \
|
||||
/D HAVE_STDARG_PROTOTYPES=1 /D HAVE_CONFIG_H /D HAVE_STDLIB_H \
|
||||
/D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /D EXPORT")
|
||||
|
||||
FSO.CopyFile("ext\\mbstring\\libmbfl\\config.h.w32",
|
||||
"ext\\mbstring\\libmbfl\\config.h", true);
|
||||
|
||||
ADD_SOURCES("ext/mbstring/libmbfl/filters", "html_entities.c \
|
||||
mbfilter_7bit.c mbfilter_ascii.c mbfilter_base64.c mbfilter_big5.c \
|
||||
mbfilter_byte2.c mbfilter_byte4.c mbfilter_cp1251.c mbfilter_cp1252.c \
|
||||
mbfilter_cp866.c mbfilter_cp932.c mbfilter_cp936.c mbfilter_cp51932.c \
|
||||
mbfilter_euc_cn.c mbfilter_euc_jp.c mbfilter_euc_jp_win.c mbfilter_euc_kr.c \
|
||||
mbfilter_euc_tw.c mbfilter_htmlent.c mbfilter_hz.c mbfilter_iso2022_kr.c \
|
||||
mbfilter_iso8859_1.c mbfilter_iso8859_10.c mbfilter_iso8859_13.c \
|
||||
mbfilter_iso8859_14.c mbfilter_iso8859_15.c mbfilter_iso8859_16.c \
|
||||
mbfilter_iso8859_2.c mbfilter_iso8859_3.c mbfilter_iso8859_4.c \
|
||||
mbfilter_iso8859_5.c mbfilter_iso8859_6.c mbfilter_iso8859_7.c \
|
||||
mbfilter_iso8859_8.c mbfilter_iso8859_9.c mbfilter_jis.c \
|
||||
mbfilter_iso2022_jp_ms.c mbfilter_gb18030.c mbfilter_sjis_2004.c \
|
||||
mbfilter_koi8r.c mbfilter_qprint.c mbfilter_sjis.c mbfilter_ucs2.c \
|
||||
mbfilter_ucs4.c mbfilter_uhc.c mbfilter_utf16.c mbfilter_utf32.c \
|
||||
mbfilter_utf7.c mbfilter_utf7imap.c mbfilter_utf8.c mbfilter_utf8_mobile.c \
|
||||
mbfilter_koi8u.c mbfilter_cp1254.c mbfilter_euc_jp_2004.c \
|
||||
mbfilter_uuencode.c mbfilter_armscii8.c mbfilter_cp850.c \
|
||||
mbfilter_cp5022x.c mbfilter_sjis_open.c mbfilter_sjis_mobile.c \
|
||||
mbfilter_sjis_mac.c \
|
||||
mbfilter_iso2022jp_2004.c mbfilter_iso2022jp_mobile.c \
|
||||
mbfilter_tl_jisx0201_jisx0208.c", "mbstring");
|
||||
|
||||
ADD_SOURCES("ext/mbstring/libmbfl/mbfl", "mbfilter.c mbfilter_8bit.c \
|
||||
mbfilter_pass.c mbfilter_wchar.c mbfl_convert.c mbfl_encoding.c \
|
||||
mbfl_filter_output.c mbfl_ident.c mbfl_language.c mbfl_memory_device.c \
|
||||
mbfl_string.c mbfl_allocators.c", "mbstring");
|
||||
|
||||
ADD_SOURCES("ext/mbstring/libmbfl/nls", "nls_de.c nls_en.c nls_ja.c \
|
||||
nls_kr.c nls_neutral.c nls_ru.c nls_uni.c nls_zh.c nls_hy.c \
|
||||
nls_ua.c nls_tr.c", "mbstring");
|
||||
|
||||
PHP_INSTALL_HEADERS("ext/mbstring", "mbstring.h oniguruma/oniguruma.h php_mbregex.h php_onig_compat.h libmbfl/config.h libmbfl/mbfl/eaw_table.h libmbfl/mbfl/mbfilter.h libmbfl/mbfl/mbfilter_8bit.h libmbfl/mbfl/mbfilter_pass.h libmbfl/mbfl/mbfilter_wchar.h libmbfl/mbfl/mbfl_allocators.h libmbfl/mbfl/mbfl_consts.h libmbfl/mbfl/mbfl_convert.h libmbfl/mbfl/mbfl_defs.h libmbfl/mbfl/mbfl_encoding.h libmbfl/mbfl/mbfl_filter_output.h libmbfl/mbfl/mbfl_ident.h libmbfl/mbfl/mbfl_language.h libmbfl/mbfl/mbfl_memory_device.h libmbfl/mbfl/mbfl_string.h");
|
||||
}
|
||||
ADD_SOURCES("ext/mbstring/libmbfl/nls", "nls_de.c nls_en.c nls_ja.c \
|
||||
nls_kr.c nls_neutral.c nls_ru.c nls_uni.c nls_zh.c nls_hy.c \
|
||||
nls_ua.c nls_tr.c", "mbstring");
|
||||
|
||||
AC_DEFINE('HAVE_MBSTRING', 1, 'Have mbstring support');
|
||||
AC_DEFINE('HAVE_MBSTR_CN', 1, 'CN');
|
||||
@@ -74,8 +56,7 @@ if (PHP_MBSTRING != "no") {
|
||||
AC_DEFINE('HAVE_MBSTR_RU', 1, 'RU');
|
||||
AC_DEFINE('HAVE_MBSTR_TW', 1, 'TW');
|
||||
|
||||
FSO.CopyFile("ext\\mbstring\\oniguruma\\win32\\config.h",
|
||||
"ext\\mbstring\\oniguruma\\config.h", true);
|
||||
PHP_INSTALL_HEADERS("ext/mbstring", "mbstring.h oniguruma/oniguruma.h php_mbregex.h php_onig_compat.h libmbfl/config.h libmbfl/mbfl/eaw_table.h libmbfl/mbfl/mbfilter.h libmbfl/mbfl/mbfilter_8bit.h libmbfl/mbfl/mbfilter_pass.h libmbfl/mbfl/mbfilter_wchar.h libmbfl/mbfl/mbfl_allocators.h libmbfl/mbfl/mbfl_consts.h libmbfl/mbfl/mbfl_convert.h libmbfl/mbfl/mbfl_defs.h libmbfl/mbfl/mbfl_encoding.h libmbfl/mbfl/mbfl_filter_output.h libmbfl/mbfl/mbfl_ident.h libmbfl/mbfl/mbfl_language.h libmbfl/mbfl/mbfl_memory_device.h libmbfl/mbfl/mbfl_string.h");
|
||||
|
||||
if (PHP_MBREGEX != "no") {
|
||||
AC_DEFINE('HAVE_STDARG_PROTOTYPES', 1, 'have stdarg.h');
|
||||
|
||||
@@ -195,8 +195,7 @@ ps_fetch_float(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_l
|
||||
#ifdef HAVE_DECIMAL_FP_SUPPORT
|
||||
{
|
||||
typedef float dec32 __attribute__((mode(SD)));
|
||||
/* volatile so the compiler will not optimize away the conversion */
|
||||
volatile dec32 d32val = fval;
|
||||
dec32 d32val = fval;
|
||||
|
||||
/* The following cast is guaranteed to do the right thing */
|
||||
dval = (double) d32val;
|
||||
|
||||
@@ -175,9 +175,9 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
|
||||
jmp_to = &op_array->brk_cont_array[array_offset];
|
||||
array_offset = jmp_to->parent;
|
||||
if (--nest_levels > 0) {
|
||||
if (op_array->opcodes[jmp_to->brk].opcode == ZEND_FREE ||
|
||||
op_array->opcodes[jmp_to->brk].opcode == ZEND_SWITCH_FREE
|
||||
) {
|
||||
if (opline->opcode == ZEND_BRK &&
|
||||
(op_array->opcodes[jmp_to->brk].opcode == ZEND_FREE ||
|
||||
op_array->opcodes[jmp_to->brk].opcode == ZEND_SWITCH_FREE)) {
|
||||
dont_optimize = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
Regular → Executable
+2
-2
@@ -4619,14 +4619,14 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stre
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
match = strcasecmp(cnmatch, buf) == 0;
|
||||
match = strcmp(cnmatch, buf) == 0;
|
||||
if (!match && strlen(buf) > 3 && buf[0] == '*' && buf[1] == '.') {
|
||||
/* Try wildcard */
|
||||
|
||||
if (strchr(buf+2, '.')) {
|
||||
char *tmp = strstr(cnmatch, buf+1);
|
||||
|
||||
match = tmp && strcasecmp(tmp, buf+2) && tmp == strchr(cnmatch, '.');
|
||||
match = tmp && strcmp(tmp, buf+2) && tmp == strchr(cnmatch, '.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -878,7 +878,6 @@ PHP_FUNCTION(pcntl_signal)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_hash_index_del(&PCNTL_G(php_signal_table), signo);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
@@ -1225,7 +1224,6 @@ static void pcntl_signal_handler(int signo)
|
||||
PCNTL_G(head) = psig;
|
||||
}
|
||||
PCNTL_G(tail) = psig;
|
||||
PCNTL_G(pending_signals) = 1;
|
||||
}
|
||||
|
||||
void pcntl_signal_dispatch()
|
||||
@@ -1235,10 +1233,6 @@ void pcntl_signal_dispatch()
|
||||
sigset_t mask;
|
||||
sigset_t old_mask;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if(!PCNTL_G(pending_signals)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Mask all signals */
|
||||
sigfillset(&mask);
|
||||
@@ -1278,8 +1272,6 @@ void pcntl_signal_dispatch()
|
||||
queue = next;
|
||||
}
|
||||
|
||||
PCNTL_G(pending_signals) = 0;
|
||||
|
||||
/* Re-enable queue */
|
||||
PCNTL_G(processing_signal_queue) = 0;
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ ZEND_BEGIN_MODULE_GLOBALS(pcntl)
|
||||
int processing_signal_queue;
|
||||
struct php_pcntl_pending_signal *head, *tail, *spares;
|
||||
int last_error;
|
||||
volatile char pending_signals;
|
||||
ZEND_END_MODULE_GLOBALS(pcntl)
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
@@ -3071,7 +3071,7 @@ const pcre_uint32 *ochr_ptr;
|
||||
const pcre_uint32 *list_ptr;
|
||||
const pcre_uchar *next_code;
|
||||
const pcre_uint8 *class_bitset;
|
||||
const pcre_uint8 *set1, *set2, *set_end;
|
||||
const pcre_uint32 *set1, *set2, *set_end;
|
||||
pcre_uint32 chr;
|
||||
BOOL accepted, invert_bits;
|
||||
|
||||
@@ -3202,12 +3202,12 @@ for(;;)
|
||||
if (base_list[0] == OP_CLASS)
|
||||
#endif
|
||||
{
|
||||
set1 = (pcre_uint8 *)(base_end - base_list[2]);
|
||||
set1 = (pcre_uint32 *)(base_end - base_list[2]);
|
||||
list_ptr = list;
|
||||
}
|
||||
else
|
||||
{
|
||||
set1 = (pcre_uint8 *)(code - list[2]);
|
||||
set1 = (pcre_uint32 *)(code - list[2]);
|
||||
list_ptr = base_list;
|
||||
}
|
||||
|
||||
@@ -3216,38 +3216,41 @@ for(;;)
|
||||
{
|
||||
case OP_CLASS:
|
||||
case OP_NCLASS:
|
||||
set2 = (pcre_uint8 *)
|
||||
set2 = (pcre_uint32 *)
|
||||
((list_ptr == list ? code : base_end) - list_ptr[2]);
|
||||
break;
|
||||
|
||||
/* OP_XCLASS cannot be supported here, because its bitset
|
||||
is not necessarily complete. E.g: [a-\0x{200}] is stored
|
||||
as a character range, and the appropriate bits are not set. */
|
||||
|
||||
case OP_NOT_DIGIT:
|
||||
invert_bits = TRUE;
|
||||
/* Fall through */
|
||||
invert_bits = TRUE;
|
||||
/* Fall through */
|
||||
case OP_DIGIT:
|
||||
set2 = (pcre_uint8 *)(cd->cbits + cbit_digit);
|
||||
break;
|
||||
set2 = (pcre_uint32 *)(cd->cbits + cbit_digit);
|
||||
break;
|
||||
|
||||
case OP_NOT_WHITESPACE:
|
||||
invert_bits = TRUE;
|
||||
/* Fall through */
|
||||
invert_bits = TRUE;
|
||||
/* Fall through */
|
||||
case OP_WHITESPACE:
|
||||
set2 = (pcre_uint8 *)(cd->cbits + cbit_space);
|
||||
break;
|
||||
set2 = (pcre_uint32 *)(cd->cbits + cbit_space);
|
||||
break;
|
||||
|
||||
case OP_NOT_WORDCHAR:
|
||||
invert_bits = TRUE;
|
||||
/* Fall through */
|
||||
invert_bits = TRUE;
|
||||
/* Fall through */
|
||||
case OP_WORDCHAR:
|
||||
set2 = (pcre_uint8 *)(cd->cbits + cbit_word);
|
||||
break;
|
||||
set2 = (pcre_uint32 *)(cd->cbits + cbit_word);
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Because the sets are unaligned, we need
|
||||
to perform byte comparison here. */
|
||||
set_end = set1 + 32;
|
||||
/* Compare 4 bytes to improve speed. */
|
||||
set_end = set1 + (32 / 4);
|
||||
if (invert_bits)
|
||||
{
|
||||
do
|
||||
|
||||
@@ -1141,6 +1141,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
|
||||
}
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
#endif
|
||||
#if PHP_MAJOR_VERSION > 5 || PHP_MINOR_VERSION >= 1
|
||||
if (!ce->unserialize) {
|
||||
zval_ptr_dtor(&val);
|
||||
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC);
|
||||
@@ -1154,6 +1155,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
|
||||
} else {
|
||||
zval_ptr_dtor(&val);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1254,6 +1256,13 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, long mode, int fetch_all TSRML
|
||||
mode = stmt->default_fetch_type & ~PDO_FETCH_FLAGS;
|
||||
}
|
||||
|
||||
#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 1
|
||||
if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) {
|
||||
pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "PDO::FETCH_SERIALIZE is not supported in this PHP version" TSRMLS_CC);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch(mode) {
|
||||
case PDO_FETCH_FUNC:
|
||||
if (!fetch_all) {
|
||||
|
||||
@@ -458,7 +458,6 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value
|
||||
ZVAL_LONG(return_value, H->buffered);
|
||||
break;
|
||||
|
||||
case PDO_ATTR_EMULATE_PREPARES:
|
||||
case PDO_MYSQL_ATTR_DIRECT_QUERY:
|
||||
ZVAL_LONG(return_value, H->emulate_prepare);
|
||||
break;
|
||||
@@ -551,21 +550,16 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
int connect_opts = 0
|
||||
#ifdef CLIENT_MULTI_RESULTS
|
||||
|CLIENT_MULTI_RESULTS
|
||||
#endif
|
||||
#ifdef CLIENT_MULTI_STATEMENTS
|
||||
|CLIENT_MULTI_STATEMENTS
|
||||
#endif
|
||||
;
|
||||
|
||||
#if defined(PDO_USE_MYSQLND)
|
||||
int dbname_len = 0;
|
||||
int password_len = 0;
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT_MULTI_STATEMENTS
|
||||
if (!driver_options) {
|
||||
connect_opts |= CLIENT_MULTI_STATEMENTS;
|
||||
} else if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_MULTI_STATEMENTS, 1 TSRMLS_CC)) {
|
||||
connect_opts |= CLIENT_MULTI_STATEMENTS;
|
||||
}
|
||||
#endif
|
||||
|
||||
PDO_DBG_ENTER("pdo_mysql_handle_factory");
|
||||
PDO_DBG_INF_FMT("dbh=%p", dbh);
|
||||
#ifdef CLIENT_MULTI_RESULTS
|
||||
|
||||
@@ -124,9 +124,9 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CAPATH", (long)PDO_MYSQL_ATTR_SSL_CAPATH);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CIPHER", (long)PDO_MYSQL_ATTR_SSL_CIPHER);
|
||||
#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND)
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SERVER_PUBLIC_KEY", (long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SERVER_PUBLIC_KEY", (long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY);
|
||||
#endif
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_MULTI_STATEMENTS", (long)PDO_MYSQL_ATTR_MULTI_STATEMENTS);
|
||||
|
||||
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
mysqlnd_reverse_api_register_api(&pdo_mysql_reverse_api TSRMLS_CC);
|
||||
|
||||
@@ -172,9 +172,8 @@ enum {
|
||||
PDO_MYSQL_ATTR_SSL_CAPATH,
|
||||
PDO_MYSQL_ATTR_SSL_CIPHER,
|
||||
#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND)
|
||||
PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY,
|
||||
PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY
|
||||
#endif
|
||||
PDO_MYSQL_ATTR_MULTI_STATEMENTS,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,101 +0,0 @@
|
||||
--TEST--
|
||||
PDO MySQL Bug #38671 (PDO#getAttribute() cannot be called with platform-specific attribute names)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
$pdo = MySQLPDOTest::factory();
|
||||
$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$attrs = array(
|
||||
// Extensive test: default value and set+get values
|
||||
PDO::ATTR_EMULATE_PREPARES => array(null, 1, 0),
|
||||
PDO::MYSQL_ATTR_DIRECT_QUERY => array(null, 0, 1),
|
||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => array(null, 0, 1),
|
||||
|
||||
// Just test the default
|
||||
PDO::ATTR_AUTOCOMMIT => array(null),
|
||||
PDO::ATTR_PREFETCH => array(null),
|
||||
PDO::ATTR_TIMEOUT => array(null),
|
||||
PDO::ATTR_ERRMODE => array(null),
|
||||
PDO::ATTR_SERVER_VERSION => array(null),
|
||||
PDO::ATTR_CLIENT_VERSION => array(null),
|
||||
PDO::ATTR_SERVER_INFO => array(null),
|
||||
PDO::ATTR_CONNECTION_STATUS => array(null),
|
||||
PDO::ATTR_CASE => array(null),
|
||||
PDO::ATTR_CURSOR_NAME => array(null),
|
||||
PDO::ATTR_CURSOR => array(null),
|
||||
PDO::ATTR_ORACLE_NULLS => array(null),
|
||||
PDO::ATTR_PERSISTENT => array(null),
|
||||
PDO::ATTR_STATEMENT_CLASS => array(null),
|
||||
PDO::ATTR_FETCH_TABLE_NAMES => array(null),
|
||||
PDO::ATTR_FETCH_CATALOG_NAMES => array(null),
|
||||
PDO::ATTR_DRIVER_NAME => array(null),
|
||||
PDO::ATTR_STRINGIFY_FETCHES => array(null),
|
||||
PDO::ATTR_MAX_COLUMN_LEN => array(null),
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => array(null),
|
||||
);
|
||||
|
||||
foreach ($attrs as $a => $vals) {
|
||||
foreach ($vals as $v) {
|
||||
try {
|
||||
if (!isset($v)) {
|
||||
var_dump($pdo->getAttribute($a));
|
||||
} else {
|
||||
$pdo->setAttribute($a, $v);
|
||||
if ($pdo->getAttribute($a) === $v) {
|
||||
echo "OK\n";
|
||||
} else {
|
||||
throw new \Exception('KO');
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
if ($e->getCode() == 'IM001') {
|
||||
echo "ERR\n";
|
||||
} else {
|
||||
echo "ERR {$e->getMessage()}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
OK
|
||||
OK
|
||||
int(0)
|
||||
OK
|
||||
OK
|
||||
int(1)
|
||||
OK
|
||||
OK
|
||||
int(1)
|
||||
ERR
|
||||
ERR
|
||||
int(2)
|
||||
string(%d) "%s"
|
||||
string(%d) "%s"
|
||||
string(%d) "%s"
|
||||
string(%d) "%s"
|
||||
int(2)
|
||||
ERR
|
||||
ERR
|
||||
int(0)
|
||||
bool(false)
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(12) "PDOStatement"
|
||||
}
|
||||
ERR
|
||||
ERR
|
||||
string(5) "mysql"
|
||||
ERR
|
||||
ERR
|
||||
int(4)
|
||||
|
||||
@@ -50,7 +50,6 @@ MySQLPDOTest::skip();
|
||||
PDO::MYSQL_ATTR_DIRECT_QUERY => 'PDO::MYSQL_ATTR_DIRECT_QUERY',
|
||||
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'PDO::MYSQL_ATTR_INIT_COMMAND',
|
||||
PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
|
||||
);
|
||||
|
||||
$defaults = array(
|
||||
@@ -164,10 +163,19 @@ MySQLPDOTest::skip();
|
||||
?>
|
||||
--EXPECTF--
|
||||
[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!
|
||||
[003a] Expecting default value for 'PDO::ATTR_EMULATE_PREPARES' of '1'/integer, getAttribute() reports setting ''/boolean
|
||||
[003a] Expecting default value for 'PDO::MYSQL_ATTR_INIT_COMMAND' of ''/string, getAttribute() reports setting ''/boolean
|
||||
|
||||
Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in %s on line %d
|
||||
[010] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be on
|
||||
|
||||
Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in %s on line %d
|
||||
|
||||
Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in %s on line %d
|
||||
[015] PDO::ATTR_EMULATE_PREPARES should be on
|
||||
[016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on
|
||||
[017] PDO::ATTR_EMULATE_PREPARES should be off
|
||||
|
||||
Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in %s on line %d
|
||||
[018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off
|
||||
[021] Execting '1'/boolean got ''/boolean' for options 'PDO::MYSQL_ATTR_LOCAL_INFILE'
|
||||
[023] Execting 'SET @a=1'/string got ''/boolean' for options 'PDO::MYSQL_ATTR_INIT_COMMAND'
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
--TEST--
|
||||
PDO::MYSQL_ATTR_MULTI_STATEMENTS
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
$db = MySQLPDOTest::factory();
|
||||
?>
|
||||
--INI--
|
||||
error_reporting=E_ALL
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
|
||||
$dsn = MySQLPDOTest::getDSN();
|
||||
$user = PDO_MYSQL_TEST_USER;
|
||||
$pass = PDO_MYSQL_TEST_PASS;
|
||||
|
||||
$table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX)));
|
||||
$db = new PDO($dsn, $user, $pass);
|
||||
$db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
|
||||
$create = sprintf('CREATE TABLE %s(id INT)', $table);
|
||||
$db->exec($create);
|
||||
$db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table));
|
||||
$stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (2)', $table, $table));
|
||||
$stmt->closeCursor();
|
||||
$info = $db->errorInfo();
|
||||
var_dump($info[0]);
|
||||
$stmt = $db->query(sprintf('SELECT id FROM %s', $table));
|
||||
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
// A single query with a trailing delimiter.
|
||||
$stmt = $db->query('SELECT 1 AS value;');
|
||||
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
// New connection, does not allow multiple statements.
|
||||
$db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => false));
|
||||
$stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (3)', $table, $table));
|
||||
var_dump($stmt);
|
||||
$info = $db->errorInfo();
|
||||
var_dump($info[0]);
|
||||
|
||||
$stmt = $db->query(sprintf('SELECT id FROM %s', $table));
|
||||
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
// A single query with a trailing delimiter.
|
||||
$stmt = $db->query('SELECT 1 AS value;');
|
||||
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
$db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
|
||||
print "done!";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(5) "00000"
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["value"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
}
|
||||
bool(false)
|
||||
string(5) "42000"
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["value"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
}
|
||||
done!
|
||||
|
||||
@@ -26,7 +26,6 @@ if (!extension_loaded('mysqli') && !extension_loaded('mysqlnd')) {
|
||||
"MYSQL_ATTR_SSL_CAPATH" => true,
|
||||
"MYSQL_ATTR_SSL_CIPHER" => true,
|
||||
"MYSQL_ATTR_COMPRESS" => true,
|
||||
"MYSQL_ATTR_MULTI_STATEMENTS" => true,
|
||||
);
|
||||
|
||||
if (!MySQLPDOTest::isPDOMySQLnd()) {
|
||||
|
||||
@@ -1,261 +0,0 @@
|
||||
--TEST--
|
||||
MySQL PDOStatement->nextRowSet() with PDO::MYSQL_ATTR_MULTI_STATEMENTS either true or false
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
$db = MySQLPDOTest::factory();
|
||||
$row = $db->query('SELECT VERSION() as _version')->fetch(PDO::FETCH_ASSOC);
|
||||
$matches = array();
|
||||
if (!preg_match('/^(\d+)\.(\d+)\.(\d+)/ismU', $row['_version'], $matches))
|
||||
die(sprintf("skip Cannot determine MySQL Server version\n"));
|
||||
|
||||
$version = $matches[0] * 10000 + $matches[1] * 100 + $matches[2];
|
||||
if ($version < 50000)
|
||||
die(sprintf("skip Need MySQL Server 5.0.0+, found %d.%02d.%02d (%d)\n",
|
||||
$matches[0], $matches[1], $matches[2], $version));
|
||||
|
||||
if (!MySQLPDOTest::isPDOMySQLnd())
|
||||
die("skip This will not work with libmysql");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
$db = MySQLPDOTest::factory();
|
||||
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
|
||||
|
||||
MySQLPDOTest::createTestTable($db);
|
||||
|
||||
function test_proc($db) {
|
||||
|
||||
$db->exec('DROP PROCEDURE IF EXISTS p');
|
||||
$db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;');
|
||||
$stmt = $db->query('CALL p()');
|
||||
do {
|
||||
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
} while ($stmt->nextRowSet());
|
||||
var_dump($stmt->nextRowSet());
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// Using native PS for proc, since emulated fails.
|
||||
printf("Native PS...\n");
|
||||
foreach (array(false, true) as $multi) {
|
||||
$value = $multi ? 'true' : 'false';
|
||||
echo "\nTesting with PDO::MYSQL_ATTR_MULTI_STATEMENTS set to {$value}\n";
|
||||
$dsn = MySQLPDOTest::getDSN();
|
||||
$user = PDO_MYSQL_TEST_USER;
|
||||
$pass = PDO_MYSQL_TEST_PASS;
|
||||
$db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi));
|
||||
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
|
||||
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
|
||||
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
|
||||
test_proc($db);
|
||||
|
||||
$db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi));
|
||||
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
|
||||
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0);
|
||||
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
|
||||
|
||||
test_proc($db);
|
||||
|
||||
// Switch back to emulated prepares to verify multi statement attribute.
|
||||
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
|
||||
// This will fail when $multi is false.
|
||||
$stmt = $db->query("SELECT * FROM test; INSERT INTO test (id, label) VALUES (99, 'x')");
|
||||
if ($stmt !== false) {
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
$info = $db->errorInfo();
|
||||
var_dump($info[0]);
|
||||
}
|
||||
@$db->exec('DROP PROCEDURE IF EXISTS p');
|
||||
|
||||
} catch (PDOException $e) {
|
||||
printf("[001] %s [%s] %s\n",
|
||||
$e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
|
||||
}
|
||||
|
||||
print "done!";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require dirname(__FILE__) . '/mysql_pdo_test.inc';
|
||||
MySQLPDOTest::dropTestTable();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Native PS...
|
||||
|
||||
Testing with PDO::MYSQL_ATTR_MULTI_STATEMENTS set to false
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "3"
|
||||
}
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "3"
|
||||
["label"]=>
|
||||
string(1) "c"
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
["label"]=>
|
||||
string(1) "b"
|
||||
}
|
||||
[2]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
["label"]=>
|
||||
string(1) "a"
|
||||
}
|
||||
}
|
||||
bool(false)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "3"
|
||||
}
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "3"
|
||||
["label"]=>
|
||||
string(1) "c"
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
["label"]=>
|
||||
string(1) "b"
|
||||
}
|
||||
[2]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
["label"]=>
|
||||
string(1) "a"
|
||||
}
|
||||
}
|
||||
bool(false)
|
||||
string(5) "42000"
|
||||
|
||||
Testing with PDO::MYSQL_ATTR_MULTI_STATEMENTS set to true
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "3"
|
||||
}
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "3"
|
||||
["label"]=>
|
||||
string(1) "c"
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
["label"]=>
|
||||
string(1) "b"
|
||||
}
|
||||
[2]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
["label"]=>
|
||||
string(1) "a"
|
||||
}
|
||||
}
|
||||
bool(false)
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "3"
|
||||
}
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "3"
|
||||
["label"]=>
|
||||
string(1) "c"
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "2"
|
||||
["label"]=>
|
||||
string(1) "b"
|
||||
}
|
||||
[2]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
["label"]=>
|
||||
string(1) "a"
|
||||
}
|
||||
}
|
||||
bool(false)
|
||||
string(5) "00000"
|
||||
done!
|
||||
@@ -379,14 +379,6 @@ static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value
|
||||
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
|
||||
|
||||
switch (attr) {
|
||||
case PDO_ATTR_EMULATE_PREPARES:
|
||||
ZVAL_BOOL(return_value, H->emulate_prepares);
|
||||
break;
|
||||
|
||||
case PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT:
|
||||
ZVAL_BOOL(return_value, H->disable_native_prepares);
|
||||
break;
|
||||
|
||||
case PDO_ATTR_CLIENT_VERSION:
|
||||
ZVAL_STRING(return_value, PG_VERSION, 1);
|
||||
break;
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
--TEST--
|
||||
PDO PgSQL Bug #38671 (PDO#getAttribute() cannot be called with platform-specific attribute names)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||
require dirname(__FILE__) . '/config.inc';
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$attrs = array(
|
||||
// Extensive test: default value and set+get values
|
||||
PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT => array(null, true, false),
|
||||
PDO::ATTR_EMULATE_PREPARES => array(null, true, false),
|
||||
|
||||
// Just test the default
|
||||
PDO::ATTR_AUTOCOMMIT => array(null),
|
||||
PDO::ATTR_PREFETCH => array(null),
|
||||
PDO::ATTR_TIMEOUT => array(null),
|
||||
PDO::ATTR_ERRMODE => array(null),
|
||||
PDO::ATTR_SERVER_VERSION => array(null),
|
||||
PDO::ATTR_CLIENT_VERSION => array(null),
|
||||
PDO::ATTR_SERVER_INFO => array(null),
|
||||
PDO::ATTR_CONNECTION_STATUS => array(null),
|
||||
PDO::ATTR_CASE => array(null),
|
||||
PDO::ATTR_CURSOR_NAME => array(null),
|
||||
PDO::ATTR_CURSOR => array(null),
|
||||
PDO::ATTR_ORACLE_NULLS => array(null),
|
||||
PDO::ATTR_PERSISTENT => array(null),
|
||||
PDO::ATTR_STATEMENT_CLASS => array(null),
|
||||
PDO::ATTR_FETCH_TABLE_NAMES => array(null),
|
||||
PDO::ATTR_FETCH_CATALOG_NAMES => array(null),
|
||||
PDO::ATTR_DRIVER_NAME => array(null),
|
||||
PDO::ATTR_STRINGIFY_FETCHES => array(null),
|
||||
PDO::ATTR_MAX_COLUMN_LEN => array(null),
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => array(null),
|
||||
);
|
||||
|
||||
foreach ($attrs as $a => $vals) {
|
||||
foreach ($vals as $v) {
|
||||
try {
|
||||
if (!isset($v)) {
|
||||
var_dump($pdo->getAttribute($a));
|
||||
} else {
|
||||
$pdo->setAttribute($a, $v);
|
||||
if ($pdo->getAttribute($a) === $v) {
|
||||
echo "OK\n";
|
||||
} else {
|
||||
throw new \Exception('KO');
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
if ($e->getCode() == 'IM001') {
|
||||
echo "ERR\n";
|
||||
} else {
|
||||
echo "ERR {$e->getMessage()}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
OK
|
||||
OK
|
||||
bool(false)
|
||||
OK
|
||||
OK
|
||||
ERR
|
||||
ERR
|
||||
ERR
|
||||
int(2)
|
||||
string(%d) "%s"
|
||||
string(%d) "%s"
|
||||
string(%d) "%s"
|
||||
string(31) "%s"
|
||||
int(2)
|
||||
ERR
|
||||
ERR
|
||||
int(0)
|
||||
bool(false)
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(12) "PDOStatement"
|
||||
}
|
||||
ERR
|
||||
ERR
|
||||
string(5) "pgsql"
|
||||
ERR
|
||||
ERR
|
||||
int(4)
|
||||
|
||||
+3
-3
@@ -3631,10 +3631,10 @@ PHP_FUNCTION(pg_lo_export)
|
||||
|
||||
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
|
||||
|
||||
if (lo_export(pgsql, oid, file_out) == -1) {
|
||||
RETURN_FALSE;
|
||||
if (lo_export(pgsql, oid, file_out)) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+26
-33
@@ -1523,25 +1523,29 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren)
|
||||
|
||||
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
|
||||
|
||||
MAKE_STD_ZVAL(zflags);
|
||||
MAKE_STD_ZVAL(zpath);
|
||||
ZVAL_LONG(zflags, intern->flags);
|
||||
ZVAL_STRINGL(zpath, intern->file_name, intern->file_name_len, 1);
|
||||
spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), &return_value, 0, zpath, zflags TSRMLS_CC);
|
||||
zval_ptr_dtor(&zpath);
|
||||
zval_ptr_dtor(&zflags);
|
||||
|
||||
subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
if (subdir) {
|
||||
if (intern->u.dir.sub_path && intern->u.dir.sub_path[0]) {
|
||||
subdir->u.dir.sub_path_len = spprintf(&subdir->u.dir.sub_path, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name);
|
||||
} else {
|
||||
subdir->u.dir.sub_path_len = strlen(intern->u.dir.entry.d_name);
|
||||
subdir->u.dir.sub_path = estrndup(intern->u.dir.entry.d_name, subdir->u.dir.sub_path_len);
|
||||
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
|
||||
RETURN_STRINGL(intern->file_name, intern->file_name_len, 1);
|
||||
} else {
|
||||
MAKE_STD_ZVAL(zflags);
|
||||
MAKE_STD_ZVAL(zpath);
|
||||
ZVAL_LONG(zflags, intern->flags);
|
||||
ZVAL_STRINGL(zpath, intern->file_name, intern->file_name_len, 1);
|
||||
spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), &return_value, 0, zpath, zflags TSRMLS_CC);
|
||||
zval_ptr_dtor(&zpath);
|
||||
zval_ptr_dtor(&zflags);
|
||||
|
||||
subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
if (subdir) {
|
||||
if (intern->u.dir.sub_path && intern->u.dir.sub_path[0]) {
|
||||
subdir->u.dir.sub_path_len = spprintf(&subdir->u.dir.sub_path, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name);
|
||||
} else {
|
||||
subdir->u.dir.sub_path_len = strlen(intern->u.dir.entry.d_name);
|
||||
subdir->u.dir.sub_path = estrndup(intern->u.dir.entry.d_name, subdir->u.dir.sub_path_len);
|
||||
}
|
||||
subdir->info_class = intern->info_class;
|
||||
subdir->file_class = intern->file_class;
|
||||
subdir->oth = intern->oth;
|
||||
}
|
||||
subdir->info_class = intern->info_class;
|
||||
subdir->file_class = intern->file_class;
|
||||
subdir->oth = intern->oth;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1907,9 +1911,6 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type TS
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
} else if (type == IS_BOOL) {
|
||||
ZVAL_BOOL(writeobj, 1);
|
||||
return SUCCESS;
|
||||
}
|
||||
if (readobj == writeobj) {
|
||||
zval_dtor(readobj);
|
||||
@@ -2615,26 +2616,19 @@ SPL_METHOD(SplFileObject, fgetcsv)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int SplFileObject::fputcsv(array fields, [string delimiter [, string enclosure [, string escape]]])
|
||||
/* {{{ proto int SplFileObject::fputcsv(array fields, [string delimiter [, string enclosure]])
|
||||
Output a field array as a CSV line */
|
||||
SPL_METHOD(SplFileObject, fputcsv)
|
||||
{
|
||||
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape;
|
||||
char *delim = NULL, *enclo = NULL, *esc = NULL;
|
||||
int d_len = 0, e_len = 0, esc_len = 0, ret;
|
||||
char *delim = NULL, *enclo = NULL;
|
||||
int d_len = 0, e_len = 0, ret;
|
||||
zval *fields = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|sss", &fields, &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|ss", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) {
|
||||
switch(ZEND_NUM_ARGS())
|
||||
{
|
||||
case 4:
|
||||
if (esc_len != 1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "escape must be a character");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
escape = esc[0];
|
||||
/* no break */
|
||||
case 3:
|
||||
if (e_len != 1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "enclosure must be a character");
|
||||
@@ -2952,7 +2946,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fputcsv, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, fields)
|
||||
ZEND_ARG_INFO(0, delimiter)
|
||||
ZEND_ARG_INFO(0, enclosure)
|
||||
ZEND_ARG_INFO(0, escape)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_flock, 0, 0, 1)
|
||||
|
||||
@@ -14,8 +14,7 @@ echo "-- Testing fputcsv() with more than expected number of arguments --\n";
|
||||
$fields = array("fld1", "fld2");
|
||||
$delim = ";";
|
||||
$enclosure ="\"";
|
||||
$escape = "\\";
|
||||
var_dump( $fo->fputcsv($fields, $delim, $enclosure, $escape, $fo) );
|
||||
var_dump( $fo->fputcsv($fields, $delim, $enclosure, $fo) );
|
||||
|
||||
echo "Done\n";
|
||||
--CLEAN--
|
||||
@@ -31,6 +30,6 @@ Warning: SplFileObject::fputcsv() expects at least 1 parameter, 0 given in %s on
|
||||
NULL
|
||||
-- Testing fputcsv() with more than expected number of arguments --
|
||||
|
||||
Warning: SplFileObject::fputcsv() expects at most 4 parameters, 5 given in %s on line %d
|
||||
Warning: SplFileObject::fputcsv() expects at most 3 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
Done
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65213 (cannot cast SplFileInfo to boolean)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$o = new SplFileInfo('.');
|
||||
var_dump((bool) $o);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -1,59 +0,0 @@
|
||||
--TEST--
|
||||
SPL: RecursiveDirectoryIterator with CURRENT_AS_PATHNAME flag
|
||||
--CREDITS--
|
||||
Paul Garvin pgarvin76@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
$td = __DIR__ . '/bug66405';
|
||||
mkdir($td);
|
||||
touch($td . '/file1.txt');
|
||||
touch($td . '/file2.md');
|
||||
mkdir($td . '/testsubdir');
|
||||
touch($td . '/testsubdir/file3.csv');
|
||||
|
||||
class Bug66405 extends RecursiveDirectoryIterator
|
||||
{
|
||||
public function current()
|
||||
{
|
||||
$current = parent::current();
|
||||
echo gettype($current) . " $current\n";
|
||||
return $current;
|
||||
}
|
||||
|
||||
public function getChildren()
|
||||
{
|
||||
$children = parent::getChildren();
|
||||
if (is_object($children)) {
|
||||
echo get_class($children) . " $children\n";
|
||||
} else {
|
||||
echo gettype($children) . " $children\n";
|
||||
}
|
||||
return $children;
|
||||
}
|
||||
}
|
||||
|
||||
$rdi = new Bug66405($td, FilesystemIterator::CURRENT_AS_PATHNAME | FilesystemIterator::SKIP_DOTS);
|
||||
$rii = new RecursiveIteratorIterator($rdi);
|
||||
|
||||
ob_start();
|
||||
foreach ($rii as $file) {
|
||||
//noop
|
||||
}
|
||||
$results = explode("\n", ob_get_clean());
|
||||
sort($results);
|
||||
echo implode("\n", $results);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$td = __DIR__ . '/bug66405';
|
||||
unlink($td . '/testsubdir/file3.csv');
|
||||
unlink($td . '/file2.md');
|
||||
unlink($td . '/file1.txt');
|
||||
rmdir($td . '/testsubdir');
|
||||
rmdir($td);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Bug66405 file3.csv
|
||||
string %sbug66405%efile1.txt
|
||||
string %sbug66405%efile2.md
|
||||
string %sbug66405%etestsubdir%efile3.csv
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68479 (Escape parameter missing from SplFileObject::fputcsv)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$method = new ReflectionMethod('SplFileObject', 'fputcsv');
|
||||
$params = $method->getParameters();
|
||||
var_dump($params);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
array(4) {
|
||||
[0]=>
|
||||
&object(ReflectionParameter)#2 (1) {
|
||||
["name"]=>
|
||||
string(6) "fields"
|
||||
}
|
||||
[1]=>
|
||||
&object(ReflectionParameter)#3 (1) {
|
||||
["name"]=>
|
||||
string(9) "delimiter"
|
||||
}
|
||||
[2]=>
|
||||
&object(ReflectionParameter)#4 (1) {
|
||||
["name"]=>
|
||||
string(9) "enclosure"
|
||||
}
|
||||
[3]=>
|
||||
&object(ReflectionParameter)#5 (1) {
|
||||
["name"]=>
|
||||
string(6) "escape"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
+6156
-11456
File diff suppressed because it is too large.
Load diff
+99
-256
@@ -107,9 +107,9 @@ extern "C" {
|
||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||
** [sqlite_version()] and [sqlite_source_id()].
|
||||
*/
|
||||
#define SQLITE_VERSION "3.8.7.2"
|
||||
#define SQLITE_VERSION_NUMBER 3008007
|
||||
#define SQLITE_SOURCE_ID "2014-11-18 20:57:56 2ab564bf9655b7c7b97ab85cafc8a48329b27f93"
|
||||
#define SQLITE_VERSION "3.8.4.3"
|
||||
#define SQLITE_VERSION_NUMBER 3008004
|
||||
#define SQLITE_SOURCE_ID "2014-04-03 16:53:12 a611fa96c4a848614efe899130359c9f6fb889c3"
|
||||
|
||||
/*
|
||||
** CAPI3REF: Run-Time Library Version Numbers
|
||||
@@ -269,7 +269,7 @@ typedef sqlite_uint64 sqlite3_uint64;
|
||||
**
|
||||
** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
|
||||
** for the [sqlite3] object.
|
||||
** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if
|
||||
** ^Calls to sqlite3_close() and sqlite3_close_v2() return SQLITE_OK if
|
||||
** the [sqlite3] object is successfully destroyed and all associated
|
||||
** resources are deallocated.
|
||||
**
|
||||
@@ -277,7 +277,7 @@ typedef sqlite_uint64 sqlite3_uint64;
|
||||
** statements or unfinished sqlite3_backup objects then sqlite3_close()
|
||||
** will leave the database connection open and return [SQLITE_BUSY].
|
||||
** ^If sqlite3_close_v2() is called with unfinalized prepared statements
|
||||
** and/or unfinished sqlite3_backups, then the database connection becomes
|
||||
** and unfinished sqlite3_backups, then the database connection becomes
|
||||
** an unusable "zombie" which will automatically be deallocated when the
|
||||
** last prepared statement is finalized or the last sqlite3_backup is
|
||||
** finished. The sqlite3_close_v2() interface is intended for use with
|
||||
@@ -290,7 +290,7 @@ typedef sqlite_uint64 sqlite3_uint64;
|
||||
** with the [sqlite3] object prior to attempting to close the object. ^If
|
||||
** sqlite3_close_v2() is called on a [database connection] that still has
|
||||
** outstanding [prepared statements], [BLOB handles], and/or
|
||||
** [sqlite3_backup] objects then it returns [SQLITE_OK] and the deallocation
|
||||
** [sqlite3_backup] objects then it returns SQLITE_OK but the deallocation
|
||||
** of resources is deferred until all [prepared statements], [BLOB handles],
|
||||
** and [sqlite3_backup] objects are also destroyed.
|
||||
**
|
||||
@@ -386,14 +386,16 @@ SQLITE_API int sqlite3_exec(
|
||||
|
||||
/*
|
||||
** CAPI3REF: Result Codes
|
||||
** KEYWORDS: {result code definitions}
|
||||
** KEYWORDS: SQLITE_OK {error code} {error codes}
|
||||
** KEYWORDS: {result code} {result codes}
|
||||
**
|
||||
** Many SQLite functions return an integer result code from the set shown
|
||||
** here in order to indicate success or failure.
|
||||
**
|
||||
** New error codes may be added in future versions of SQLite.
|
||||
**
|
||||
** See also: [extended result code definitions]
|
||||
** See also: [SQLITE_IOERR_READ | extended result codes],
|
||||
** [sqlite3_vtab_on_conflict()] [SQLITE_ROLLBACK | result codes].
|
||||
*/
|
||||
#define SQLITE_OK 0 /* Successful result */
|
||||
/* beginning-of-error-codes */
|
||||
@@ -431,19 +433,26 @@ SQLITE_API int sqlite3_exec(
|
||||
|
||||
/*
|
||||
** CAPI3REF: Extended Result Codes
|
||||
** KEYWORDS: {extended result code definitions}
|
||||
** KEYWORDS: {extended error code} {extended error codes}
|
||||
** KEYWORDS: {extended result code} {extended result codes}
|
||||
**
|
||||
** In its default configuration, SQLite API routines return one of 30 integer
|
||||
** [result codes]. However, experience has shown that many of
|
||||
** In its default configuration, SQLite API routines return one of 26 integer
|
||||
** [SQLITE_OK | result codes]. However, experience has shown that many of
|
||||
** these result codes are too coarse-grained. They do not provide as
|
||||
** much information about problems as programmers might like. In an effort to
|
||||
** address this, newer versions of SQLite (version 3.3.8 and later) include
|
||||
** support for additional result codes that provide more detailed information
|
||||
** about errors. These [extended result codes] are enabled or disabled
|
||||
** about errors. The extended result codes are enabled or disabled
|
||||
** on a per database connection basis using the
|
||||
** [sqlite3_extended_result_codes()] API. Or, the extended code for
|
||||
** the most recent error can be obtained using
|
||||
** [sqlite3_extended_errcode()].
|
||||
** [sqlite3_extended_result_codes()] API.
|
||||
**
|
||||
** Some of the available extended result codes are listed here.
|
||||
** One may expect the number of extended result codes will increase
|
||||
** over time. Software that uses extended result codes should expect
|
||||
** to see new result codes in future releases of SQLite.
|
||||
**
|
||||
** The SQLITE_OK result code will never be extended. It will always
|
||||
** be exactly zero.
|
||||
*/
|
||||
#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
|
||||
#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
|
||||
@@ -497,7 +506,6 @@ SQLITE_API int sqlite3_exec(
|
||||
#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
|
||||
#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
|
||||
#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
|
||||
#define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
|
||||
|
||||
/*
|
||||
** CAPI3REF: Flags For File Open Operations
|
||||
@@ -552,10 +560,7 @@ SQLITE_API int sqlite3_exec(
|
||||
** file that were written at the application level might have changed
|
||||
** and that adjacent bytes, even bytes within the same sector are
|
||||
** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
|
||||
** flag indicate that a file cannot be deleted when open. The
|
||||
** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
|
||||
** read-only media and cannot be changed even by processes with
|
||||
** elevated privileges.
|
||||
** flag indicate that a file cannot be deleted when open.
|
||||
*/
|
||||
#define SQLITE_IOCAP_ATOMIC 0x00000001
|
||||
#define SQLITE_IOCAP_ATOMIC512 0x00000002
|
||||
@@ -570,7 +575,6 @@ SQLITE_API int sqlite3_exec(
|
||||
#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
|
||||
#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
|
||||
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
|
||||
#define SQLITE_IOCAP_IMMUTABLE 0x00002000
|
||||
|
||||
/*
|
||||
** CAPI3REF: File Locking Levels
|
||||
@@ -677,7 +681,7 @@ struct sqlite3_file {
|
||||
** locking strategy (for example to use dot-file locks), to inquire
|
||||
** about the status of a lock, or to break stale locks. The SQLite
|
||||
** core reserves all opcodes less than 100 for its own use.
|
||||
** A [file control opcodes | list of opcodes] less than 100 is available.
|
||||
** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
|
||||
** Applications that define a custom xFileControl method should use opcodes
|
||||
** greater than 100 to avoid conflicts. VFS implementations should
|
||||
** return [SQLITE_NOTFOUND] for file control opcodes that they do not
|
||||
@@ -750,7 +754,6 @@ struct sqlite3_io_methods {
|
||||
|
||||
/*
|
||||
** CAPI3REF: Standard File Control Opcodes
|
||||
** KEYWORDS: {file control opcodes} {file control opcode}
|
||||
**
|
||||
** These integer constants are opcodes for the xFileControl method
|
||||
** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
|
||||
@@ -940,12 +943,6 @@ struct sqlite3_io_methods {
|
||||
** on whether or not the file has been renamed, moved, or deleted since it
|
||||
** was first opened.
|
||||
**
|
||||
** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
|
||||
** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
|
||||
** opcode causes the xFileControl method to swap the file handle with the one
|
||||
** pointed to by the pArg argument. This capability is used during testing
|
||||
** and only needs to be supported when SQLITE_TEST is defined.
|
||||
**
|
||||
** </ul>
|
||||
*/
|
||||
#define SQLITE_FCNTL_LOCKSTATE 1
|
||||
@@ -969,7 +966,6 @@ struct sqlite3_io_methods {
|
||||
#define SQLITE_FCNTL_HAS_MOVED 20
|
||||
#define SQLITE_FCNTL_SYNC 21
|
||||
#define SQLITE_FCNTL_COMMIT_PHASETWO 22
|
||||
#define SQLITE_FCNTL_WIN32_SET_HANDLE 23
|
||||
|
||||
/*
|
||||
** CAPI3REF: Mutex Handle
|
||||
@@ -2030,33 +2026,27 @@ SQLITE_API int sqlite3_complete16(const void *sql);
|
||||
/*
|
||||
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
|
||||
**
|
||||
** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
|
||||
** that might be invoked with argument P whenever
|
||||
** an attempt is made to access a database table associated with
|
||||
** [database connection] D when another thread
|
||||
** or process has the table locked.
|
||||
** The sqlite3_busy_handler() interface is used to implement
|
||||
** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout].
|
||||
** ^This routine sets a callback function that might be invoked whenever
|
||||
** an attempt is made to open a database table that another thread
|
||||
** or process has locked.
|
||||
**
|
||||
** ^If the busy callback is NULL, then [SQLITE_BUSY]
|
||||
** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]
|
||||
** is returned immediately upon encountering the lock. ^If the busy callback
|
||||
** is not NULL, then the callback might be invoked with two arguments.
|
||||
**
|
||||
** ^The first argument to the busy handler is a copy of the void* pointer which
|
||||
** is the third argument to sqlite3_busy_handler(). ^The second argument to
|
||||
** the busy handler callback is the number of times that the busy handler has
|
||||
** been invoked for the same locking event. ^If the
|
||||
** been invoked for this locking event. ^If the
|
||||
** busy callback returns 0, then no additional attempts are made to
|
||||
** access the database and [SQLITE_BUSY] is returned
|
||||
** to the application.
|
||||
** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.
|
||||
** ^If the callback returns non-zero, then another attempt
|
||||
** is made to access the database and the cycle repeats.
|
||||
** is made to open the database for reading and the cycle repeats.
|
||||
**
|
||||
** The presence of a busy handler does not guarantee that it will be invoked
|
||||
** when there is lock contention. ^If SQLite determines that invoking the busy
|
||||
** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
|
||||
** to the application instead of invoking the
|
||||
** busy handler.
|
||||
** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler.
|
||||
** Consider a scenario where one process is holding a read lock that
|
||||
** it is trying to promote to a reserved lock and
|
||||
** a second process is holding a reserved lock that it is trying
|
||||
@@ -2070,15 +2060,28 @@ SQLITE_API int sqlite3_complete16(const void *sql);
|
||||
**
|
||||
** ^The default busy callback is NULL.
|
||||
**
|
||||
** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]
|
||||
** when SQLite is in the middle of a large transaction where all the
|
||||
** changes will not fit into the in-memory cache. SQLite will
|
||||
** already hold a RESERVED lock on the database file, but it needs
|
||||
** to promote this lock to EXCLUSIVE so that it can spill cache
|
||||
** pages into the database file without harm to concurrent
|
||||
** readers. ^If it is unable to promote the lock, then the in-memory
|
||||
** cache will be left in an inconsistent state and so the error
|
||||
** code is promoted from the relatively benign [SQLITE_BUSY] to
|
||||
** the more severe [SQLITE_IOERR_BLOCKED]. ^This error code promotion
|
||||
** forces an automatic rollback of the changes. See the
|
||||
** <a href="/cvstrac/wiki?p=CorruptionFollowingBusyError">
|
||||
** CorruptionFollowingBusyError</a> wiki page for a discussion of why
|
||||
** this is important.
|
||||
**
|
||||
** ^(There can only be a single busy handler defined for each
|
||||
** [database connection]. Setting a new busy handler clears any
|
||||
** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()]
|
||||
** or evaluating [PRAGMA busy_timeout=N] will change the
|
||||
** busy handler and thus clear any previously set busy handler.
|
||||
** will also set or clear the busy handler.
|
||||
**
|
||||
** The busy callback should not take any actions which modify the
|
||||
** database connection that invoked the busy handler. In other words,
|
||||
** the busy handler is not reentrant. Any such actions
|
||||
** database connection that invoked the busy handler. Any such actions
|
||||
** result in undefined behavior.
|
||||
**
|
||||
** A busy handler must not close the database connection
|
||||
@@ -2094,17 +2097,15 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
|
||||
** will sleep multiple times until at least "ms" milliseconds of sleeping
|
||||
** have accumulated. ^After at least "ms" milliseconds of sleeping,
|
||||
** the handler returns 0 which causes [sqlite3_step()] to return
|
||||
** [SQLITE_BUSY].
|
||||
** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].
|
||||
**
|
||||
** ^Calling this routine with an argument less than or equal to zero
|
||||
** turns off all busy handlers.
|
||||
**
|
||||
** ^(There can only be a single busy handler for a particular
|
||||
** [database connection] at any given moment. If another busy handler
|
||||
** [database connection] any any given moment. If another busy handler
|
||||
** was defined (using [sqlite3_busy_handler()]) prior to calling
|
||||
** this routine, that other busy handler is cleared.)^
|
||||
**
|
||||
** See also: [PRAGMA busy_timeout]
|
||||
*/
|
||||
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
||||
|
||||
@@ -2304,10 +2305,6 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
||||
** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
|
||||
** a NULL pointer.
|
||||
**
|
||||
** ^The sqlite3_malloc64(N) routine works just like
|
||||
** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead
|
||||
** of a signed 32-bit integer.
|
||||
**
|
||||
** ^Calling sqlite3_free() with a pointer previously returned
|
||||
** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
|
||||
** that it might be reused. ^The sqlite3_free() routine is
|
||||
@@ -2319,38 +2316,24 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
||||
** might result if sqlite3_free() is called with a non-NULL pointer that
|
||||
** was not obtained from sqlite3_malloc() or sqlite3_realloc().
|
||||
**
|
||||
** ^The sqlite3_realloc(X,N) interface attempts to resize a
|
||||
** prior memory allocation X to be at least N bytes.
|
||||
** ^If the X parameter to sqlite3_realloc(X,N)
|
||||
** ^(The sqlite3_realloc() interface attempts to resize a
|
||||
** prior memory allocation to be at least N bytes, where N is the
|
||||
** second parameter. The memory allocation to be resized is the first
|
||||
** parameter.)^ ^ If the first parameter to sqlite3_realloc()
|
||||
** is a NULL pointer then its behavior is identical to calling
|
||||
** sqlite3_malloc(N).
|
||||
** ^If the N parameter to sqlite3_realloc(X,N) is zero or
|
||||
** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().
|
||||
** ^If the second parameter to sqlite3_realloc() is zero or
|
||||
** negative then the behavior is exactly the same as calling
|
||||
** sqlite3_free(X).
|
||||
** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
|
||||
** of at least N bytes in size or NULL if insufficient memory is available.
|
||||
** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().
|
||||
** ^sqlite3_realloc() returns a pointer to a memory allocation
|
||||
** of at least N bytes in size or NULL if sufficient memory is unavailable.
|
||||
** ^If M is the size of the prior allocation, then min(N,M) bytes
|
||||
** of the prior allocation are copied into the beginning of buffer returned
|
||||
** by sqlite3_realloc(X,N) and the prior allocation is freed.
|
||||
** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
|
||||
** prior allocation is not freed.
|
||||
** by sqlite3_realloc() and the prior allocation is freed.
|
||||
** ^If sqlite3_realloc() returns NULL, then the prior allocation
|
||||
** is not freed.
|
||||
**
|
||||
** ^The sqlite3_realloc64(X,N) interfaces works the same as
|
||||
** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
|
||||
** of a 32-bit signed integer.
|
||||
**
|
||||
** ^If X is a memory allocation previously obtained from sqlite3_malloc(),
|
||||
** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then
|
||||
** sqlite3_msize(X) returns the size of that memory allocation in bytes.
|
||||
** ^The value returned by sqlite3_msize(X) might be larger than the number
|
||||
** of bytes requested when X was allocated. ^If X is a NULL pointer then
|
||||
** sqlite3_msize(X) returns zero. If X points to something that is not
|
||||
** the beginning of memory allocation, or if it points to a formerly
|
||||
** valid memory allocation that has now been freed, then the behavior
|
||||
** of sqlite3_msize(X) is undefined and possibly harmful.
|
||||
**
|
||||
** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(),
|
||||
** sqlite3_malloc64(), and sqlite3_realloc64()
|
||||
** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()
|
||||
** is always aligned to at least an 8 byte boundary, or to a
|
||||
** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
|
||||
** option is used.
|
||||
@@ -2378,11 +2361,8 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
||||
** [sqlite3_free()] or [sqlite3_realloc()].
|
||||
*/
|
||||
SQLITE_API void *sqlite3_malloc(int);
|
||||
SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
|
||||
SQLITE_API void *sqlite3_realloc(void*, int);
|
||||
SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
|
||||
SQLITE_API void sqlite3_free(void*);
|
||||
SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Memory Allocator Statistics
|
||||
@@ -2527,8 +2507,8 @@ SQLITE_API int sqlite3_set_authorizer(
|
||||
** [sqlite3_set_authorizer | authorizer documentation] for additional
|
||||
** information.
|
||||
**
|
||||
** Note that SQLITE_IGNORE is also used as a [conflict resolution mode]
|
||||
** returned from the [sqlite3_vtab_on_conflict()] interface.
|
||||
** Note that SQLITE_IGNORE is also used as a [SQLITE_ROLLBACK | return code]
|
||||
** from the [sqlite3_vtab_on_conflict()] interface.
|
||||
*/
|
||||
#define SQLITE_DENY 1 /* Abort the SQL statement with an error */
|
||||
#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */
|
||||
@@ -2669,9 +2649,9 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
||||
** an English language description of the error following a failure of any
|
||||
** of the sqlite3_open() routines.
|
||||
**
|
||||
** ^The default encoding will be UTF-8 for databases created using
|
||||
** sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases
|
||||
** created using sqlite3_open16() will be UTF-16 in the native byte order.
|
||||
** ^The default encoding for the database will be UTF-8 if
|
||||
** sqlite3_open() or sqlite3_open_v2() is called and
|
||||
** UTF-16 in the native byte order if sqlite3_open16() is used.
|
||||
**
|
||||
** Whether or not an error occurs when it is opened, resources
|
||||
** associated with the [database connection] handle should be released by
|
||||
@@ -2759,14 +2739,13 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
||||
** then it is interpreted as an absolute path. ^If the path does not begin
|
||||
** with a '/' (meaning that the authority section is omitted from the URI)
|
||||
** then the path is interpreted as a relative path.
|
||||
** ^(On windows, the first component of an absolute path
|
||||
** is a drive specification (e.g. "C:").)^
|
||||
** ^On windows, the first component of an absolute path
|
||||
** is a drive specification (e.g. "C:").
|
||||
**
|
||||
** [[core URI query parameters]]
|
||||
** The query component of a URI may contain parameters that are interpreted
|
||||
** either by SQLite itself, or by a [VFS | custom VFS implementation].
|
||||
** SQLite and its built-in [VFSes] interpret the
|
||||
** following query parameters:
|
||||
** SQLite interprets the following three query parameters:
|
||||
**
|
||||
** <ul>
|
||||
** <li> <b>vfs</b>: ^The "vfs" parameter may be used to specify the name of
|
||||
@@ -2800,28 +2779,6 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
||||
** ^If sqlite3_open_v2() is used and the "cache" parameter is present in
|
||||
** a URI filename, its value overrides any behavior requested by setting
|
||||
** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
|
||||
**
|
||||
** <li> <b>psow</b>: ^The psow parameter indicates whether or not the
|
||||
** [powersafe overwrite] property does or does not apply to the
|
||||
** storage media on which the database file resides.
|
||||
**
|
||||
** <li> <b>nolock</b>: ^The nolock parameter is a boolean query parameter
|
||||
** which if set disables file locking in rollback journal modes. This
|
||||
** is useful for accessing a database on a filesystem that does not
|
||||
** support locking. Caution: Database corruption might result if two
|
||||
** or more processes write to the same database and any one of those
|
||||
** processes uses nolock=1.
|
||||
**
|
||||
** <li> <b>immutable</b>: ^The immutable parameter is a boolean query
|
||||
** parameter that indicates that the database file is stored on
|
||||
** read-only media. ^When immutable is set, SQLite assumes that the
|
||||
** database file cannot be changed, even by a process with higher
|
||||
** privilege, and so the database is opened read-only and all locking
|
||||
** and change detection is disabled. Caution: Setting the immutable
|
||||
** property on a database file that does in fact change can result
|
||||
** in incorrect query results and/or [SQLITE_CORRUPT] errors.
|
||||
** See also: [SQLITE_IOCAP_IMMUTABLE].
|
||||
**
|
||||
** </ul>
|
||||
**
|
||||
** ^Specifying an unknown parameter in the query component of a URI is not an
|
||||
@@ -2851,9 +2808,8 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
||||
** Open file "data.db" in the current directory for read-only access.
|
||||
** Regardless of whether or not shared-cache mode is enabled by
|
||||
** default, use a private cache.
|
||||
** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
|
||||
** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
|
||||
** that uses dot-files in place of posix advisory locking.
|
||||
** <tr><td> file:/home/fred/data.db?vfs=unix-nolock <td>
|
||||
** Open file "/home/fred/data.db". Use the special VFS "unix-nolock".
|
||||
** <tr><td> file:data.db?mode=readonly <td>
|
||||
** An error. "readonly" is not a valid option for the "mode" parameter.
|
||||
** </table>
|
||||
@@ -3099,10 +3055,6 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
||||
**
|
||||
** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
|
||||
** <dd>The maximum depth of recursion for triggers.</dd>)^
|
||||
**
|
||||
** [[SQLITE_LIMIT_WORKER_THREADS]] ^(<dt>SQLITE_LIMIT_WORKER_THREADS</dt>
|
||||
** <dd>The maximum number of auxiliary worker threads that a single
|
||||
** [prepared statement] may start.</dd>)^
|
||||
** </dl>
|
||||
*/
|
||||
#define SQLITE_LIMIT_LENGTH 0
|
||||
@@ -3116,7 +3068,6 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
||||
#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8
|
||||
#define SQLITE_LIMIT_VARIABLE_NUMBER 9
|
||||
#define SQLITE_LIMIT_TRIGGER_DEPTH 10
|
||||
#define SQLITE_LIMIT_WORKER_THREADS 11
|
||||
|
||||
/*
|
||||
** CAPI3REF: Compiling An SQL Statement
|
||||
@@ -3390,18 +3341,18 @@ typedef struct sqlite3_context sqlite3_context;
|
||||
** If the fourth parameter to sqlite3_bind_blob() is negative, then
|
||||
** the behavior is undefined.
|
||||
** If a non-negative fourth parameter is provided to sqlite3_bind_text()
|
||||
** or sqlite3_bind_text16() or sqlite3_bind_text64() then
|
||||
** that parameter must be the byte offset
|
||||
** or sqlite3_bind_text16() then that parameter must be the byte offset
|
||||
** where the NUL terminator would occur assuming the string were NUL
|
||||
** terminated. If any NUL characters occur at byte offsets less than
|
||||
** the value of the fourth parameter then the resulting string value will
|
||||
** contain embedded NULs. The result of expressions involving strings
|
||||
** with embedded NULs is undefined.
|
||||
**
|
||||
** ^The fifth argument to the BLOB and string binding interfaces
|
||||
** is a destructor used to dispose of the BLOB or
|
||||
** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
|
||||
** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
|
||||
** string after SQLite has finished with it. ^The destructor is called
|
||||
** to dispose of the BLOB or string even if the call to bind API fails.
|
||||
** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(),
|
||||
** sqlite3_bind_text(), or sqlite3_bind_text16() fails.
|
||||
** ^If the fifth argument is
|
||||
** the special value [SQLITE_STATIC], then SQLite assumes that the
|
||||
** information is in static, unmanaged space and does not need to be freed.
|
||||
@@ -3409,14 +3360,6 @@ typedef struct sqlite3_context sqlite3_context;
|
||||
** SQLite makes its own private copy of the data immediately, before
|
||||
** the sqlite3_bind_*() routine returns.
|
||||
**
|
||||
** ^The sixth argument to sqlite3_bind_text64() must be one of
|
||||
** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
|
||||
** to specify the encoding of the text in the third parameter. If
|
||||
** the sixth argument to sqlite3_bind_text64() is not one of the
|
||||
** allowed values shown above, or if the text encoding is different
|
||||
** from the encoding specified by the sixth parameter, then the behavior
|
||||
** is undefined.
|
||||
**
|
||||
** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
|
||||
** is filled with zeroes. ^A zeroblob uses a fixed amount of memory
|
||||
** (just an integer to hold its size) while it is being processed.
|
||||
@@ -3437,9 +3380,6 @@ typedef struct sqlite3_context sqlite3_context;
|
||||
**
|
||||
** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
|
||||
** [error code] if anything goes wrong.
|
||||
** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB
|
||||
** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or
|
||||
** [SQLITE_MAX_LENGTH].
|
||||
** ^[SQLITE_RANGE] is returned if the parameter
|
||||
** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
|
||||
**
|
||||
@@ -3447,16 +3387,12 @@ typedef struct sqlite3_context sqlite3_context;
|
||||
** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
|
||||
*/
|
||||
SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
|
||||
SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
|
||||
void(*)(void*));
|
||||
SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
|
||||
SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
|
||||
SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
|
||||
SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
|
||||
SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
|
||||
SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
|
||||
SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
|
||||
SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
|
||||
void(*)(void*), unsigned char encoding);
|
||||
SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
|
||||
SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
|
||||
|
||||
@@ -4205,7 +4141,7 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
|
||||
** object results in undefined behavior.
|
||||
**
|
||||
** ^These routines work just like the corresponding [column access functions]
|
||||
** except that these routines take a single [protected sqlite3_value] object
|
||||
** except that these routines take a single [protected sqlite3_value] object
|
||||
** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
|
||||
**
|
||||
** ^The sqlite3_value_text16() interface extracts a UTF-16 string
|
||||
@@ -4452,10 +4388,6 @@ typedef void (*sqlite3_destructor_type)(void*);
|
||||
** set the return value of the application-defined function to be
|
||||
** a text string which is represented as UTF-8, UTF-16 native byte order,
|
||||
** UTF-16 little endian, or UTF-16 big endian, respectively.
|
||||
** ^The sqlite3_result_text64() interface sets the return value of an
|
||||
** application-defined function to be a text string in an encoding
|
||||
** specified by the fifth (and last) parameter, which must be one
|
||||
** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
|
||||
** ^SQLite takes the text result from the application from
|
||||
** the 2nd parameter of the sqlite3_result_text* interfaces.
|
||||
** ^If the 3rd parameter to the sqlite3_result_text* interfaces
|
||||
@@ -4499,7 +4431,6 @@ typedef void (*sqlite3_destructor_type)(void*);
|
||||
** the [sqlite3_context] pointer, the results are undefined.
|
||||
*/
|
||||
SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
|
||||
SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint64,void(*)(void*));
|
||||
SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
|
||||
SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
|
||||
SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
|
||||
@@ -4510,8 +4441,6 @@ SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
|
||||
SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
|
||||
SQLITE_API void sqlite3_result_null(sqlite3_context*);
|
||||
SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
|
||||
SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
|
||||
void(*)(void*), unsigned char encoding);
|
||||
SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
|
||||
SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
|
||||
SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
|
||||
@@ -4741,13 +4670,6 @@ SQLITE_API int sqlite3_sleep(int);
|
||||
** is a NULL pointer, then SQLite performs a search for an appropriate
|
||||
** temporary file directory.
|
||||
**
|
||||
** Applications are strongly discouraged from using this global variable.
|
||||
** It is required to set a temporary folder on Windows Runtime (WinRT).
|
||||
** But for all other platforms, it is highly recommended that applications
|
||||
** neither read nor write this variable. This global variable is a relic
|
||||
** that exists for backwards compatibility of legacy applications and should
|
||||
** be avoided in new projects.
|
||||
**
|
||||
** It is not safe to read or modify this variable in more than one
|
||||
** thread at a time. It is not safe to read or modify this variable
|
||||
** if a [database connection] is being used at the same time in a separate
|
||||
@@ -4766,11 +4688,6 @@ SQLITE_API int sqlite3_sleep(int);
|
||||
** Hence, if this variable is modified directly, either it should be
|
||||
** made NULL or made to point to memory obtained from [sqlite3_malloc]
|
||||
** or else the use of the [temp_store_directory pragma] should be avoided.
|
||||
** Except when requested by the [temp_store_directory pragma], SQLite
|
||||
** does not free the memory that sqlite3_temp_directory points to. If
|
||||
** the application wants that memory to be freed, it must do
|
||||
** so itself, taking care to only do so after all [database connection]
|
||||
** objects have been destroyed.
|
||||
**
|
||||
** <b>Note to Windows Runtime users:</b> The temporary directory must be set
|
||||
** prior to calling [sqlite3_open] or [sqlite3_open_v2]. Otherwise, various
|
||||
@@ -5905,12 +5822,10 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
|
||||
** <li> SQLITE_MUTEX_RECURSIVE
|
||||
** <li> SQLITE_MUTEX_STATIC_MASTER
|
||||
** <li> SQLITE_MUTEX_STATIC_MEM
|
||||
** <li> SQLITE_MUTEX_STATIC_OPEN
|
||||
** <li> SQLITE_MUTEX_STATIC_MEM2
|
||||
** <li> SQLITE_MUTEX_STATIC_PRNG
|
||||
** <li> SQLITE_MUTEX_STATIC_LRU
|
||||
** <li> SQLITE_MUTEX_STATIC_PMEM
|
||||
** <li> SQLITE_MUTEX_STATIC_APP1
|
||||
** <li> SQLITE_MUTEX_STATIC_APP2
|
||||
** <li> SQLITE_MUTEX_STATIC_LRU2
|
||||
** </ul>)^
|
||||
**
|
||||
** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
|
||||
@@ -6114,9 +6029,6 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
|
||||
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
|
||||
#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
|
||||
#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
|
||||
#define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
|
||||
#define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
|
||||
#define SQLITE_MUTEX_STATIC_APP3 10 /* For use by application */
|
||||
|
||||
/*
|
||||
** CAPI3REF: Retrieve the mutex for a database connection
|
||||
@@ -6208,13 +6120,10 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
||||
#define SQLITE_TESTCTRL_ISKEYWORD 16
|
||||
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17
|
||||
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
||||
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
|
||||
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19
|
||||
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
|
||||
#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
|
||||
#define SQLITE_TESTCTRL_BYTEORDER 22
|
||||
#define SQLITE_TESTCTRL_ISINIT 23
|
||||
#define SQLITE_TESTCTRL_SORTER_MMAP 24
|
||||
#define SQLITE_TESTCTRL_LAST 24
|
||||
#define SQLITE_TESTCTRL_LAST 21
|
||||
|
||||
/*
|
||||
** CAPI3REF: SQLite Runtime Status
|
||||
@@ -6405,12 +6314,12 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
||||
** the current value is always zero.)^
|
||||
**
|
||||
** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
|
||||
** <dd>This parameter returns the approximate number of bytes of heap
|
||||
** <dd>This parameter returns the approximate number of of bytes of heap
|
||||
** memory used by all pager caches associated with the database connection.)^
|
||||
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
||||
**
|
||||
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
||||
** <dd>This parameter returns the approximate number of bytes of heap
|
||||
** <dd>This parameter returns the approximate number of of bytes of heap
|
||||
** memory used to store the schema for all databases associated
|
||||
** with the connection - main, temp, and any [ATTACH]-ed databases.)^
|
||||
** ^The full amount of memory used by the schemas is reported, even if the
|
||||
@@ -6419,7 +6328,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
||||
** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
|
||||
**
|
||||
** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
|
||||
** <dd>This parameter returns the approximate number of bytes of heap
|
||||
** <dd>This parameter returns the approximate number of of bytes of heap
|
||||
** and lookaside memory used by all prepared statements associated with
|
||||
** the database connection.)^
|
||||
** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
|
||||
@@ -7198,9 +7107,6 @@ SQLITE_API void *sqlite3_wal_hook(
|
||||
** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
|
||||
** from SQL.
|
||||
**
|
||||
** ^Checkpoints initiated by this mechanism are
|
||||
** [sqlite3_wal_checkpoint_v2|PASSIVE].
|
||||
**
|
||||
** ^Every new [database connection] defaults to having the auto-checkpoint
|
||||
** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
|
||||
** pages. The use of this interface
|
||||
@@ -7217,10 +7123,6 @@ SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
|
||||
** empty string, then a checkpoint is run on all databases of
|
||||
** connection D. ^If the database connection D is not in
|
||||
** [WAL | write-ahead log mode] then this interface is a harmless no-op.
|
||||
** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
|
||||
** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
|
||||
** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
|
||||
** or RESET checkpoint.
|
||||
**
|
||||
** ^The [wal_checkpoint pragma] can be used to invoke this interface
|
||||
** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
|
||||
@@ -7243,12 +7145,10 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
|
||||
** Checkpoint as many frames as possible without waiting for any database
|
||||
** readers or writers to finish. Sync the db file if all frames in the log
|
||||
** are checkpointed. This mode is the same as calling
|
||||
** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback]
|
||||
** is never invoked.
|
||||
** sqlite3_wal_checkpoint(). The busy-handler callback is never invoked.
|
||||
**
|
||||
** <dt>SQLITE_CHECKPOINT_FULL<dd>
|
||||
** This mode blocks (it invokes the
|
||||
** [sqlite3_busy_handler|busy-handler callback]) until there is no
|
||||
** This mode blocks (calls the busy-handler callback) until there is no
|
||||
** database writer and all readers are reading from the most recent database
|
||||
** snapshot. It then checkpoints all frames in the log file and syncs the
|
||||
** database file. This call blocks database writers while it is running,
|
||||
@@ -7256,8 +7156,7 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
|
||||
**
|
||||
** <dt>SQLITE_CHECKPOINT_RESTART<dd>
|
||||
** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after
|
||||
** checkpointing the log file it blocks (calls the
|
||||
** [sqlite3_busy_handler|busy-handler callback])
|
||||
** checkpointing the log file it blocks (calls the busy-handler callback)
|
||||
** until all readers are reading from the database file only. This ensures
|
||||
** that the next client to write to the database file restarts the log file
|
||||
** from the beginning. This call blocks database writers while it is running,
|
||||
@@ -7395,7 +7294,6 @@ SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Conflict resolution modes
|
||||
** KEYWORDS: {conflict resolution mode}
|
||||
**
|
||||
** These constants are returned by [sqlite3_vtab_on_conflict()] to
|
||||
** inform a [virtual table] implementation what the [ON CONFLICT] mode
|
||||
@@ -7448,16 +7346,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
|
||||
typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
|
||||
|
||||
/* The double-precision datatype used by RTree depends on the
|
||||
** SQLITE_RTREE_INT_ONLY compile-time option.
|
||||
*/
|
||||
#ifdef SQLITE_RTREE_INT_ONLY
|
||||
typedef sqlite3_int64 sqlite3_rtree_dbl;
|
||||
#else
|
||||
typedef double sqlite3_rtree_dbl;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Register a geometry callback named zGeom that can be used as part of an
|
||||
@@ -7468,7 +7356,11 @@ typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
|
||||
SQLITE_API int sqlite3_rtree_geometry_callback(
|
||||
sqlite3 *db,
|
||||
const char *zGeom,
|
||||
int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
|
||||
#ifdef SQLITE_RTREE_INT_ONLY
|
||||
int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes),
|
||||
#else
|
||||
int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes),
|
||||
#endif
|
||||
void *pContext
|
||||
);
|
||||
|
||||
@@ -7480,60 +7372,11 @@ SQLITE_API int sqlite3_rtree_geometry_callback(
|
||||
struct sqlite3_rtree_geometry {
|
||||
void *pContext; /* Copy of pContext passed to s_r_g_c() */
|
||||
int nParam; /* Size of array aParam[] */
|
||||
sqlite3_rtree_dbl *aParam; /* Parameters passed to SQL geom function */
|
||||
double *aParam; /* Parameters passed to SQL geom function */
|
||||
void *pUser; /* Callback implementation user data */
|
||||
void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */
|
||||
};
|
||||
|
||||
/*
|
||||
** Register a 2nd-generation geometry callback named zScore that can be
|
||||
** used as part of an R-Tree geometry query as follows:
|
||||
**
|
||||
** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
|
||||
*/
|
||||
SQLITE_API int sqlite3_rtree_query_callback(
|
||||
sqlite3 *db,
|
||||
const char *zQueryFunc,
|
||||
int (*xQueryFunc)(sqlite3_rtree_query_info*),
|
||||
void *pContext,
|
||||
void (*xDestructor)(void*)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
** A pointer to a structure of the following type is passed as the
|
||||
** argument to scored geometry callback registered using
|
||||
** sqlite3_rtree_query_callback().
|
||||
**
|
||||
** Note that the first 5 fields of this structure are identical to
|
||||
** sqlite3_rtree_geometry. This structure is a subclass of
|
||||
** sqlite3_rtree_geometry.
|
||||
*/
|
||||
struct sqlite3_rtree_query_info {
|
||||
void *pContext; /* pContext from when function registered */
|
||||
int nParam; /* Number of function parameters */
|
||||
sqlite3_rtree_dbl *aParam; /* value of function parameters */
|
||||
void *pUser; /* callback can use this, if desired */
|
||||
void (*xDelUser)(void*); /* function to free pUser */
|
||||
sqlite3_rtree_dbl *aCoord; /* Coordinates of node or entry to check */
|
||||
unsigned int *anQueue; /* Number of pending entries in the queue */
|
||||
int nCoord; /* Number of coordinates */
|
||||
int iLevel; /* Level of current node or entry */
|
||||
int mxLevel; /* The largest iLevel value in the tree */
|
||||
sqlite3_int64 iRowid; /* Rowid for current entry */
|
||||
sqlite3_rtree_dbl rParentScore; /* Score of parent node */
|
||||
int eParentWithin; /* Visibility of parent node */
|
||||
int eWithin; /* OUT: Visiblity */
|
||||
sqlite3_rtree_dbl rScore; /* OUT: Write the score here */
|
||||
};
|
||||
|
||||
/*
|
||||
** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
|
||||
*/
|
||||
#define NOT_WITHIN 0 /* Object completely outside of query region */
|
||||
#define PARTLY_WITHIN 1 /* Object partially overlaps query region */
|
||||
#define FULLY_WITHIN 2 /* Object fully contained within query region */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of the 'extern "C"' block */
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef struct sqlite3_api_routines sqlite3_api_routines;
|
||||
** WARNING: In order to maintain backwards compatibility, add new
|
||||
** interfaces to the end of this structure only. If you insert new
|
||||
** interfaces in the middle of this structure, then older different
|
||||
** versions of SQLite will not be able to load each other's shared
|
||||
** versions of SQLite will not be able to load each others' shared
|
||||
** libraries!
|
||||
*/
|
||||
struct sqlite3_api_routines {
|
||||
@@ -250,28 +250,11 @@ struct sqlite3_api_routines {
|
||||
const char *(*uri_parameter)(const char*,const char*);
|
||||
char *(*vsnprintf)(int,char*,const char*,va_list);
|
||||
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
|
||||
/* Version 3.8.7 and later */
|
||||
int (*auto_extension)(void(*)(void));
|
||||
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
|
||||
void(*)(void*));
|
||||
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
|
||||
void(*)(void*),unsigned char);
|
||||
int (*cancel_auto_extension)(void(*)(void));
|
||||
int (*load_extension)(sqlite3*,const char*,const char*,char**);
|
||||
void *(*malloc64)(sqlite3_uint64);
|
||||
sqlite3_uint64 (*msize)(void*);
|
||||
void *(*realloc64)(void*,sqlite3_uint64);
|
||||
void (*reset_auto_extension)(void);
|
||||
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
|
||||
void(*)(void*));
|
||||
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
|
||||
void(*)(void*), unsigned char);
|
||||
int (*strglob)(const char*,const char*);
|
||||
};
|
||||
|
||||
/*
|
||||
** The following macros redefine the API routines so that they are
|
||||
** redirected through the global sqlite3_api structure.
|
||||
** redirected throught the global sqlite3_api structure.
|
||||
**
|
||||
** This header file is also used by the loadext.c source file
|
||||
** (part of the main SQLite library - not an extension) so that
|
||||
@@ -484,19 +467,6 @@ struct sqlite3_api_routines {
|
||||
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
|
||||
#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf
|
||||
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
|
||||
/* Version 3.8.7 and later */
|
||||
#define sqlite3_auto_extension sqlite3_api->auto_extension
|
||||
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
|
||||
#define sqlite3_bind_text64 sqlite3_api->bind_text64
|
||||
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
|
||||
#define sqlite3_load_extension sqlite3_api->load_extension
|
||||
#define sqlite3_malloc64 sqlite3_api->malloc64
|
||||
#define sqlite3_msize sqlite3_api->msize
|
||||
#define sqlite3_realloc64 sqlite3_api->realloc64
|
||||
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
|
||||
#define sqlite3_result_blob64 sqlite3_api->result_blob64
|
||||
#define sqlite3_result_text64 sqlite3_api->result_text64
|
||||
#define sqlite3_strglob sqlite3_api->strglob
|
||||
#endif /* SQLITE_CORE */
|
||||
|
||||
#ifndef SQLITE_CORE
|
||||
|
||||
@@ -196,6 +196,7 @@ PHPAPI int php_crypt(const char *password, const int pass_len, const char *salt,
|
||||
} else if (
|
||||
salt[0] == '$' &&
|
||||
salt[1] == '2' &&
|
||||
salt[2] >= 'a' && salt[2] <= 'z' &&
|
||||
salt[3] == '$' &&
|
||||
salt[4] >= '0' && salt[4] <= '3' &&
|
||||
salt[5] >= '0' && salt[5] <= '9' &&
|
||||
@@ -218,7 +219,7 @@ PHPAPI int php_crypt(const char *password, const int pass_len, const char *salt,
|
||||
_crypt_extended_init_r();
|
||||
|
||||
crypt_res = _crypt_extended_r(password, salt, &buffer);
|
||||
if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
|
||||
if (!crypt_res) {
|
||||
return FAILURE;
|
||||
} else {
|
||||
*result = estrdup(crypt_res);
|
||||
@@ -239,7 +240,7 @@ PHPAPI int php_crypt(const char *password, const int pass_len, const char *salt,
|
||||
# error Data struct used by crypt_r() is unknown. Please report.
|
||||
# endif
|
||||
crypt_res = crypt_r(password, salt, &buffer);
|
||||
if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
|
||||
if (!crypt_res) {
|
||||
return FAILURE;
|
||||
} else {
|
||||
*result = estrdup(crypt_res);
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
* and crypt(3) interfaces added, but optimizations specific to password
|
||||
* cracking removed.
|
||||
*
|
||||
* Written by Solar Designer <solar at openwall.com> in 1998-2014.
|
||||
* Written by Solar Designer <solar at openwall.com> in 1998-2011.
|
||||
* No copyright is claimed, and the software is hereby placed in the public
|
||||
* domain. In case this attempt to disclaim copyright and place the software
|
||||
* in the public domain is deemed null and void, then the software is
|
||||
* Copyright (c) 1998-2014 Solar Designer and it is hereby released to the
|
||||
* Copyright (c) 1998-2011 Solar Designer and it is hereby released to the
|
||||
* general public under the following terms:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -28,12 +28,12 @@
|
||||
* you place this code and any modifications you make under a license
|
||||
* of your choice.
|
||||
*
|
||||
* This implementation is fully compatible with OpenBSD's bcrypt.c for prefix
|
||||
* "$2b$", originally by Niels Provos <provos at citi.umich.edu>, and it uses
|
||||
* some of his ideas. The password hashing algorithm was designed by David
|
||||
* Mazieres <dm at lcs.mit.edu>. For information on the level of
|
||||
* compatibility for bcrypt hash prefixes other than "$2b$", please refer to
|
||||
* the comments in BF_set_key() below and to the included crypt(3) man page.
|
||||
* This implementation is mostly compatible with OpenBSD's bcrypt.c (prefix
|
||||
* "$2a$") by Niels Provos <provos at citi.umich.edu>, and uses some of his
|
||||
* ideas. The password hashing algorithm was designed by David Mazieres
|
||||
* <dm at lcs.mit.edu>. For more information on the level of compatibility,
|
||||
* please refer to the comments in BF_set_key() below and to the crypt(3)
|
||||
* man page included in the crypt_blowfish tarball.
|
||||
*
|
||||
* There's a paper on the algorithm that explains its design decisions:
|
||||
*
|
||||
@@ -583,7 +583,6 @@ static void BF_set_key(const char *key, BF_key expanded, BF_key initial,
|
||||
* Valid combinations of settings are:
|
||||
*
|
||||
* Prefix "$2a$": bug = 0, safety = 0x10000
|
||||
* Prefix "$2b$": bug = 0, safety = 0
|
||||
* Prefix "$2x$": bug = 1, safety = 0
|
||||
* Prefix "$2y$": bug = 0, safety = 0
|
||||
*/
|
||||
@@ -647,10 +646,6 @@ static void BF_set_key(const char *key, BF_key expanded, BF_key initial,
|
||||
initial[0] ^= sign;
|
||||
}
|
||||
|
||||
static const unsigned char flags_by_subtype[26] =
|
||||
{2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0};
|
||||
|
||||
static char *BF_crypt(const char *key, const char *setting,
|
||||
char *output, int size,
|
||||
BF_word min)
|
||||
@@ -658,6 +653,9 @@ static char *BF_crypt(const char *key, const char *setting,
|
||||
#if BF_ASM
|
||||
extern void _BF_body_r(BF_ctx *ctx);
|
||||
#endif
|
||||
static const unsigned char flags_by_subtype[26] =
|
||||
{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0};
|
||||
struct {
|
||||
BF_ctx ctx;
|
||||
BF_key expanded_key;
|
||||
@@ -823,10 +821,9 @@ char *php_crypt_blowfish_rn(const char *key, const char *setting,
|
||||
{
|
||||
const char *test_key = "8b \xd0\xc1\xd2\xcf\xcc\xd8";
|
||||
const char *test_setting = "$2a$00$abcdefghijklmnopqrstuu";
|
||||
static const char * const test_hashes[2] =
|
||||
{"i1D709vfamulimlGcq0qq3UvuUasvEa\0\x55", /* 'a', 'b', 'y' */
|
||||
"VUrPmXD6q/nVSSp7pNDhCR9071IfIRe\0\x55"}; /* 'x' */
|
||||
const char *test_hash = test_hashes[0];
|
||||
static const char * const test_hash[2] =
|
||||
{"VUrPmXD6q/nVSSp7pNDhCR9071IfIRe\0\x55", /* $2x$ */
|
||||
"i1D709vfamulimlGcq0qq3UvuUasvEa\0\x55"}; /* $2a$, $2y$ */
|
||||
char *retval;
|
||||
const char *p;
|
||||
int save_errno, ok;
|
||||
@@ -848,19 +845,17 @@ char *php_crypt_blowfish_rn(const char *key, const char *setting,
|
||||
* detected by the self-test.
|
||||
*/
|
||||
memcpy(buf.s, test_setting, sizeof(buf.s));
|
||||
if (retval) {
|
||||
unsigned int flags = flags_by_subtype[
|
||||
(unsigned int)(unsigned char)setting[2] - 'a'];
|
||||
test_hash = test_hashes[flags & 1];
|
||||
if (retval)
|
||||
buf.s[2] = setting[2];
|
||||
}
|
||||
memset(buf.o, 0x55, sizeof(buf.o));
|
||||
buf.o[sizeof(buf.o) - 1] = 0;
|
||||
p = BF_crypt(test_key, buf.s, buf.o, sizeof(buf.o) - (1 + 1), 1);
|
||||
|
||||
ok = (p == buf.o &&
|
||||
!memcmp(p, buf.s, 7 + 22) &&
|
||||
!memcmp(p + (7 + 22), test_hash, 31 + 1 + 1 + 1));
|
||||
!memcmp(p + (7 + 22),
|
||||
test_hash[(unsigned int)(unsigned char)buf.s[2] & 1],
|
||||
31 + 1 + 1 + 1));
|
||||
|
||||
{
|
||||
const char *k = "\xff\xa3" "34" "\xff\xff\xff\xa3" "345";
|
||||
@@ -890,7 +885,7 @@ char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count,
|
||||
if (size < 16 || output_size < 7 + 22 + 1 ||
|
||||
(count && (count < 4 || count > 31)) ||
|
||||
prefix[0] != '$' || prefix[1] != '2' ||
|
||||
(prefix[2] != 'a' && prefix[2] != 'b' && prefix[2] != 'y')) {
|
||||
(prefix[2] != 'a' && prefix[2] != 'y')) {
|
||||
if (output_size > 0) output[0] = '\0';
|
||||
__set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL);
|
||||
return NULL;
|
||||
|
||||
+1
-18
@@ -897,24 +897,7 @@ PHP_FUNCTION(dns_get_record)
|
||||
|
||||
if (n < 0) {
|
||||
php_dns_free_handle(handle);
|
||||
switch (h_errno) {
|
||||
case NO_DATA:
|
||||
case HOST_NOT_FOUND:
|
||||
continue;
|
||||
|
||||
case NO_RECOVERY:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unexpected server failure occurred.");
|
||||
break;
|
||||
|
||||
case TRY_AGAIN:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A temporary server error occurred.");
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DNS Query failed");
|
||||
}
|
||||
zval_dtor(return_value);
|
||||
RETURN_FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
cp = answer.qb2 + HFIXEDSZ;
|
||||
|
||||
@@ -458,7 +458,7 @@ PHP_FUNCTION(dns_get_record)
|
||||
if (status == DNS_INFO_NO_RECORDS || status == DNS_ERROR_RCODE_NAME_ERROR) {
|
||||
continue;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DNS Query failed");
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dns Query failed");
|
||||
zval_dtor(return_value);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -27,12 +27,7 @@
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#ifdef ZTS
|
||||
#include "ext/standard/php_string.h"
|
||||
#define LCONV_DECIMAL_POINT (*lconv.decimal_point)
|
||||
#else
|
||||
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
|
||||
#endif
|
||||
#else
|
||||
#define LCONV_DECIMAL_POINT '.'
|
||||
#endif
|
||||
@@ -219,11 +214,7 @@ php_sprintf_appenddouble(char **buffer, int *pos,
|
||||
char *s = NULL;
|
||||
int s_len = 0, is_negative = 0;
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#ifdef ZTS
|
||||
struct lconv lconv;
|
||||
#else
|
||||
struct lconv *lconv;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
|
||||
@@ -255,11 +246,7 @@ php_sprintf_appenddouble(char **buffer, int *pos,
|
||||
case 'f':
|
||||
case 'F':
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#ifdef ZTS
|
||||
localeconv_r(&lconv);
|
||||
#else
|
||||
lconv = localeconv();
|
||||
#endif
|
||||
#endif
|
||||
s = php_conv_fp((fmt == 'f')?'F':fmt, number, 0, precision,
|
||||
(fmt == 'f')?LCONV_DECIMAL_POINT:'.',
|
||||
@@ -283,11 +270,7 @@ php_sprintf_appenddouble(char **buffer, int *pos,
|
||||
* * We use &num_buf[ 1 ], so that we have room for the sign
|
||||
*/
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#ifdef ZTS
|
||||
localeconv_r(&lconv);
|
||||
#else
|
||||
lconv = localeconv();
|
||||
#endif
|
||||
#endif
|
||||
s = php_gcvt(number, precision, LCONV_DECIMAL_POINT, (fmt == 'G')?'E':'e', &num_buf[1]);
|
||||
is_negative = 0;
|
||||
|
||||
@@ -203,18 +203,8 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out)
|
||||
tsrm_mutex_lock( locale_mutex );
|
||||
# endif
|
||||
|
||||
#if defined(PHP_WIN32) && defined(ZTS)
|
||||
{
|
||||
/* Even with the enabled per thread locale, localeconv
|
||||
won't check any locale change in the master thread. */
|
||||
_locale_t cur = _get_current_locale();
|
||||
|
||||
res = cur->locinfo->lconv;
|
||||
}
|
||||
#else
|
||||
/* localeconv doesn't return an error condition */
|
||||
res = localeconv();
|
||||
#endif
|
||||
|
||||
*out = *res;
|
||||
|
||||
|
||||
@@ -117,11 +117,11 @@ PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len
|
||||
ca = *ap; cb = *bp;
|
||||
|
||||
/* skip over leading zeros */
|
||||
while (leading && ca == '0' && (ap+1 < aend) && isdigit((int)(unsigned char)*(ap+1))) {
|
||||
while (leading && ca == '0' && (ap+1 < aend) && isdigit(*(ap+1))) {
|
||||
ca = *++ap;
|
||||
}
|
||||
|
||||
while (leading && cb == '0' && (bp+1 < bend) && isdigit((int)(unsigned char)*(bp+1))) {
|
||||
while (leading && cb == '0' && (bp+1 < bend) && isdigit(*(bp+1))) {
|
||||
cb = *++bp;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68335: rmdir doesnt work with file:// stream wrapper
|
||||
--FILE--
|
||||
<?php
|
||||
$dir = 'file://' . dirname(__FILE__) . '/testDir';
|
||||
mkdir($dir);
|
||||
var_dump(is_dir($dir));
|
||||
rmdir($dir);
|
||||
var_dump(is_dir($dir));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68532: convert.base64-encode omits padding bytes
|
||||
--FILE--
|
||||
<?php
|
||||
$testString = 'test';
|
||||
$stream = fopen('php://memory','r+');
|
||||
fwrite($stream, $testString);
|
||||
rewind($stream);
|
||||
$filter = stream_filter_append($stream, 'convert.base64-encode');
|
||||
echo "memoryStream = " . stream_get_contents($stream).PHP_EOL;
|
||||
|
||||
|
||||
$fileStream = fopen(__DIR__ . '/base64test.txt','w+');
|
||||
fwrite($fileStream , $testString);
|
||||
rewind($fileStream );
|
||||
$filter = stream_filter_append($fileStream , 'convert.base64-encode');
|
||||
echo "fileStream = " . stream_get_contents($fileStream ).PHP_EOL;
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . '/base64test.txt');
|
||||
?>
|
||||
--EXPECT--
|
||||
memoryStream = dGVzdA==
|
||||
fileStream = dGVzdA==
|
||||
@@ -27,7 +27,6 @@ foreach($streams as $stream)
|
||||
var_dump(feof($fp));
|
||||
echo "===GETC===\n";
|
||||
var_dump(fgetc($fp));
|
||||
var_dump(fgetc($fp));
|
||||
var_dump(ftell($fp));
|
||||
var_dump(feof($fp));
|
||||
echo "===REWIND===\n";
|
||||
@@ -95,7 +94,6 @@ int(5)
|
||||
bool(false)
|
||||
===GETC===
|
||||
string(1) "5"
|
||||
bool(false)
|
||||
int(6)
|
||||
bool(true)
|
||||
===REWIND===
|
||||
|
||||
@@ -37,7 +37,7 @@ echo "Testing directory:\n";
|
||||
$path = __DIR__ . '/adir';
|
||||
$i = 1;
|
||||
foreach ($iteration as $perms => $exp) {
|
||||
create_dir($path, $perms);
|
||||
create_file($path, $perms);
|
||||
clearstatcache(true, $path);
|
||||
echo 'Iteration #' . $i++ . ': ';
|
||||
if (is_writable($path) == $exp) {
|
||||
@@ -46,7 +46,7 @@ foreach ($iteration as $perms => $exp) {
|
||||
var_dump(is_writable($path), $exp);
|
||||
echo "failed.\n";
|
||||
}
|
||||
delete_dir($path);
|
||||
delete_file($path);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -37,7 +37,7 @@ echo "Testing directory:\n";
|
||||
$path = __DIR__ . '/adir';
|
||||
$i = 1;
|
||||
foreach ($iteration as $perms => $exp) {
|
||||
create_dir($path, $perms);
|
||||
create_file($path, $perms);
|
||||
clearstatcache(true, $path);
|
||||
echo 'Iteration #' . $i++ . ': ';
|
||||
if (is_readable($path) == $exp) {
|
||||
@@ -46,7 +46,7 @@ foreach ($iteration as $perms => $exp) {
|
||||
var_dump(is_readable($path), $exp);
|
||||
echo "failed.\n";
|
||||
}
|
||||
delete_dir($path);
|
||||
delete_file($path);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -39,7 +39,7 @@ echo "Testing directory with relative path:\n";
|
||||
$path = 'adir';
|
||||
$i = 1;
|
||||
foreach ($iteration as $perms => $exp) {
|
||||
create_dir($path, $perms);
|
||||
create_file($path, $perms);
|
||||
clearstatcache(true, $path);
|
||||
echo 'Iteration #' . $i++ . ': ';
|
||||
if (is_readable($path) == $exp) {
|
||||
@@ -48,7 +48,7 @@ foreach ($iteration as $perms => $exp) {
|
||||
var_dump(is_readable($path), $exp);
|
||||
echo "failed.\n";
|
||||
}
|
||||
delete_dir($path);
|
||||
delete_file($path);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -6,7 +6,7 @@ Bug #68044 Integer overflow in unserialize() (32-bits only)
|
||||
?>
|
||||
===DONE==
|
||||
--EXPECTF--
|
||||
Warning: Insufficient data for unserializing - %d required, 1 present in %s%ebug68044.php on line 2
|
||||
Warning: Insufficient data for unserializing - %d required, 1 present in %s/bug68044.php on line 2
|
||||
|
||||
Notice: unserialize(): Error at offset 32 of 33 bytes in %s%ebug68044.php on line 2
|
||||
Notice: unserialize(): Error at offset 32 of 33 bytes in %s/bug68044.php on line 2
|
||||
===DONE==
|
||||
@@ -1,60 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65230 setting locale randomly broken
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip');
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
date.timezone=Europe/Berlin
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test($locale, $value)
|
||||
{
|
||||
$newlocale = setlocale(LC_ALL, $locale);
|
||||
$conv = localeconv();
|
||||
$sep = $conv['decimal_point'];
|
||||
|
||||
printf("%s\n--------------------------\n", $newlocale);
|
||||
printf(" sep: %s\n", $sep);
|
||||
printf(" %%f: %f\n", $value);
|
||||
printf(" %%F: %F\n", $value);
|
||||
printf("date: %s\n", strftime('%x', mktime(0, 0, 0, 12, 5, 2014)));
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
test('german', 3.41);
|
||||
test('english', 3.41);
|
||||
test('french', 3.41);
|
||||
test('german', 3.41);
|
||||
--EXPECT--
|
||||
German_Germany.1252
|
||||
--------------------------
|
||||
sep: ,
|
||||
%f: 3,410000
|
||||
%F: 3.410000
|
||||
date: 05.12.2014
|
||||
|
||||
English_United States.1252
|
||||
--------------------------
|
||||
sep: .
|
||||
%f: 3.410000
|
||||
%F: 3.410000
|
||||
date: 12/5/2014
|
||||
|
||||
French_France.1252
|
||||
--------------------------
|
||||
sep: ,
|
||||
%f: 3,410000
|
||||
%F: 3.410000
|
||||
date: 05/12/2014
|
||||
|
||||
German_Germany.1252
|
||||
--------------------------
|
||||
sep: ,
|
||||
%f: 3,410000
|
||||
%F: 3.410000
|
||||
date: 05.12.2014
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65769 localeconv() broken in TS builds
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip Windows only');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$locales = array('sve', 'french', 'us', 'ru', 'czech', 'serbian');
|
||||
|
||||
foreach ($locales as $locale) {
|
||||
$locale = setlocale(LC_ALL, $locale);
|
||||
$lconv = localeconv();
|
||||
var_dump(
|
||||
$locale,
|
||||
$lconv['decimal_point'],
|
||||
$lconv['thousands_sep'],
|
||||
$lconv['int_curr_symbol'],
|
||||
$lconv['currency_symbol'],
|
||||
$lconv['mon_decimal_point'],
|
||||
$lconv['mon_thousands_sep']
|
||||
);
|
||||
echo '++++++++++++++++++++++', "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
+++DONE+++
|
||||
--EXPECTF--
|
||||
string(19) "Swedish_Sweden.1252"
|
||||
string(1) ","
|
||||
string(1) " "
|
||||
string(3) "SEK"
|
||||
string(2) "kr"
|
||||
string(1) ","
|
||||
string(1) "."
|
||||
++++++++++++++++++++++
|
||||
string(18) "French_France.1252"
|
||||
string(1) ","
|
||||
string(1) " "
|
||||
string(3) "EUR"
|
||||
string(1) "€"
|
||||
string(1) ","
|
||||
string(1) " "
|
||||
++++++++++++++++++++++
|
||||
string(26) "English_United States.1252"
|
||||
string(1) "."
|
||||
string(1) ","
|
||||
string(3) "USD"
|
||||
string(1) "$"
|
||||
string(1) "."
|
||||
string(1) ","
|
||||
++++++++++++++++++++++
|
||||
string(2) "ru"
|
||||
string(1) ","
|
||||
string(1) " "
|
||||
string(3) "RUB"
|
||||
string(1) "?"
|
||||
string(1) ","
|
||||
string(1) " "
|
||||
++++++++++++++++++++++
|
||||
string(25) "Czech_Czech Republic.1250"
|
||||
string(1) ","
|
||||
string(1) " "
|
||||
string(3) "CZK"
|
||||
string(2) "Kè"
|
||||
string(1) ","
|
||||
string(1) " "
|
||||
++++++++++++++++++++++
|
||||
string(19) "Serbian_Serbia.1250"
|
||||
string(1) ","
|
||||
string(1) "."
|
||||
string(3) "RSD"
|
||||
string(4) "din."
|
||||
string(1) ","
|
||||
string(1) "."
|
||||
++++++++++++++++++++++
|
||||
+++DONE+++
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Bug #68710 Use after free vulnerability in unserialize() (bypassing the
|
||||
CVE-2014-8142 fix)
|
||||
--FILE--
|
||||
<?php
|
||||
for ($i=4; $i<100; $i++) {
|
||||
$m = new StdClass();
|
||||
|
||||
$u = array(1);
|
||||
|
||||
$m->aaa = array(1,2,&$u,4,5);
|
||||
$m->bbb = 1;
|
||||
$m->ccc = &$u;
|
||||
$m->ddd = str_repeat("A", $i);
|
||||
|
||||
$z = serialize($m);
|
||||
$z = str_replace("aaa", "123", $z);
|
||||
$z = str_replace("bbb", "123", $z);
|
||||
$y = unserialize($z);
|
||||
$z = serialize($y);
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
===DONE===
|
||||
@@ -18,10 +18,8 @@ $tests =array(
|
||||
array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
|
||||
array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
|
||||
array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nqd1wy.pTMdcvrRWxyiGL2eMz.2a85.', "\xff\xff\xa3"),
|
||||
array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
|
||||
array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
|
||||
array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
|
||||
array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
|
||||
array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "1\xa3345"),
|
||||
array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa3345"),
|
||||
array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"),
|
||||
@@ -38,35 +36,14 @@ $tests =array(
|
||||
array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55"),
|
||||
array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff"),
|
||||
array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', ''),
|
||||
);
|
||||
|
||||
$tests2 = array(
|
||||
array('$2a$03$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
|
||||
array('$2a$32$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
|
||||
array('$2c$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
|
||||
array('$2z$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
|
||||
array('$2`$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
|
||||
array('$2{$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
|
||||
array('*0', '*1'),
|
||||
);
|
||||
|
||||
$i=0;
|
||||
foreach($tests as $test) {
|
||||
$result = crypt($test[1], $test[0]);
|
||||
if($result === $test[0]) {
|
||||
if(crypt($test[1], $test[0]) == $test[0]) {
|
||||
echo "$i. OK\n";
|
||||
} else {
|
||||
echo "$i. Not OK: $test[0] $result\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
foreach($tests2 as $test) {
|
||||
$result = crypt('', $test[0]);
|
||||
if($result === $test[1]) {
|
||||
echo "$i. OK\n";
|
||||
} else {
|
||||
echo "$i. Not OK: $test[0] $result\n";
|
||||
echo "$i. Not OK: $test[0] ".crypt($test[1], $test[0])."\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@@ -99,12 +76,3 @@ foreach($tests2 as $test) {
|
||||
23. OK
|
||||
24. OK
|
||||
25. OK
|
||||
26. OK
|
||||
27. OK
|
||||
28. OK
|
||||
29. OK
|
||||
30. OK
|
||||
31. OK
|
||||
32. OK
|
||||
33. OK
|
||||
34. OK
|
||||
@@ -343,7 +343,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
|
||||
} else {
|
||||
/* object properties should include no integers */
|
||||
convert_to_string(key);
|
||||
if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
|
||||
if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
|
||||
var_push_dtor(var_hash, old_data);
|
||||
}
|
||||
zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,
|
||||
|
||||
@@ -347,7 +347,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
|
||||
} else {
|
||||
/* object properties should include no integers */
|
||||
convert_to_string(key);
|
||||
if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
|
||||
if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
|
||||
var_push_dtor(var_hash, old_data);
|
||||
}
|
||||
zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #52944 (segfault with zlib filter and corrupted data)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("zlib")) print "skip"; ?>
|
||||
<?php
|
||||
if (PHP_OS != 'Darwin') {
|
||||
die("skip Darwin only");
|
||||
}
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--FILE--
|
||||
<?php
|
||||
require dirname(__FILE__) . "/bug_52944_corrupted_data.inc";
|
||||
|
||||
$fp = fopen('data://text/plain;base64,' . $data, 'r');
|
||||
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
|
||||
var_dump(fread($fp,1));
|
||||
var_dump(fread($fp,1));
|
||||
fclose($fp);
|
||||
echo "Done.\n";
|
||||
--EXPECT--
|
||||
string(1) "%"
|
||||
string(1) "C"
|
||||
Done.
|
||||
@@ -2,6 +2,10 @@
|
||||
Bug #52944 (segfault with zlib filter and corrupted data)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("zlib")) print "skip"; ?>
|
||||
<?php
|
||||
if (PHP_OS == 'Darwin') {
|
||||
die("skip not for Darwin");
|
||||
}
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--FILE--
|
||||
|
||||
+2
-2
@@ -1066,8 +1066,8 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
|
||||
if (!module_initialized || PG(log_errors)) {
|
||||
char *log_buffer;
|
||||
#ifdef PHP_WIN32
|
||||
if (type == E_CORE_ERROR || type == E_CORE_WARNING) {
|
||||
syslog(LOG_ALERT, "PHP %s: %s (%s)", error_type_str, buffer, GetCommandLine());
|
||||
if ((type == E_CORE_ERROR || type == E_CORE_WARNING) && PG(display_startup_errors)) {
|
||||
MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE);
|
||||
}
|
||||
#endif
|
||||
spprintf(&log_buffer, 0, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_MAJOR_VERSION 5
|
||||
#define PHP_MINOR_VERSION 5
|
||||
#define PHP_RELEASE_VERSION 21
|
||||
#define PHP_RELEASE_VERSION 20
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "5.5.21"
|
||||
#define PHP_VERSION_ID 50521
|
||||
#define PHP_VERSION "5.5.20"
|
||||
#define PHP_VERSION_ID 50520
|
||||
@@ -38,12 +38,7 @@
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#ifdef ZTS
|
||||
#include "ext/standard/php_string.h"
|
||||
#define LCONV_DECIMAL_POINT (*lconv.decimal_point)
|
||||
#else
|
||||
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
|
||||
#endif
|
||||
#else
|
||||
#define LCONV_DECIMAL_POINT '.'
|
||||
#endif
|
||||
@@ -611,11 +606,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
|
||||
char char_buf[2]; /* for printing %% and %<unknown> */
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#ifdef ZTS
|
||||
struct lconv lconv;
|
||||
#else
|
||||
struct lconv *lconv = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -1007,13 +998,9 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
|
||||
s_len = 3;
|
||||
} else {
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#ifdef ZTS
|
||||
localeconv_r(&lconv);
|
||||
#else
|
||||
if (!lconv) {
|
||||
lconv = localeconv();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form,
|
||||
(adjust_precision == NO) ? FLOAT_DIGITS : precision,
|
||||
@@ -1068,13 +1055,9 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
|
||||
* * We use &num_buf[ 1 ], so that we have room for the sign
|
||||
*/
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#ifdef ZTS
|
||||
localeconv_r(&lconv);
|
||||
#else
|
||||
if (!lconv) {
|
||||
lconv = localeconv();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]);
|
||||
if (*s == '-') {
|
||||
|
||||
Loaded 100 of 118 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user