mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-20 07:26:38 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e9d39f15c | ||
|
|
5fff8fae9b | ||
|
|
d824c3e5fb | ||
|
|
21341834d4 | ||
|
|
5346d0ae69 | ||
|
|
a668ce82de | ||
|
|
1e5f414394 |
No files matched your search
@@ -352,8 +352,7 @@ define ____print_ht
|
||||
end
|
||||
printf "[%d] ", $i
|
||||
if $p->key
|
||||
____print_str $p->key->val $p->key->len
|
||||
printf " => "
|
||||
printf "%s => ", $p->key->val
|
||||
else
|
||||
printf "%d => ", $p->h
|
||||
end
|
||||
|
||||
@@ -70,13 +70,10 @@ jobs:
|
||||
include:
|
||||
- env: ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
|
||||
arch: amd64
|
||||
if: type = cron
|
||||
- env: ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
|
||||
arch: amd64
|
||||
if: type = cron
|
||||
- env: ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
|
||||
arch: arm64
|
||||
if: type = cron
|
||||
|
||||
before_script:
|
||||
- ccache --version
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2021 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2019 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,113 +1,5 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
18 Mar 2021, PHP 7.4.17RC1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #80781 (Error handler that throws ErrorException infinite loop).
|
||||
(Nikita)
|
||||
. Fixed bug #75776 (Flushing streams with compression filter is broken). (cmb)
|
||||
|
||||
- Dba:
|
||||
. Fixed bug #80817 (dba_popen() may cause segfault during RSHUTDOWN). (cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #80763 (msgfmt_format() does not accept DateTime references).
|
||||
(cmb)
|
||||
|
||||
- Libxml:
|
||||
. Fixed bug #51903 (simplexml_load_file() doesn't use HTTP headers). (cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #80713 (SegFault when disabling ATTR_EMULATE_PREPARES and
|
||||
MySQL 8.0). (Nikita)
|
||||
. Fixed bug #80837 (Calling stmt_store_result after fetch doesn't throw an
|
||||
error). (Kamil Tekiela)
|
||||
|
||||
- opcache:
|
||||
. Fixed bug #80805 (create simple class and get error in opcache.so). (Nikita)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #80866 (preg_split ignores limit flag when pattern with \K has
|
||||
0-width fullstring match). (Kamil Tekiela)
|
||||
|
||||
- phpdbg:
|
||||
. Fixed bug #80757 (Exit code is 0 when could not open file). (Felipe)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #80774 (session_name() problem with backslash). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI). (cmb)
|
||||
. Fixed bug #78719 (http wrapper silently ignores long Location headers).
|
||||
(cmb)
|
||||
. Fixed bug #80838 (HTTP wrapper waits for HTTP 1 response after HTTP 101).
|
||||
(manuelm)
|
||||
|
||||
04 Mar 2021, php 7.4.16
|
||||
|
||||
- Core:
|
||||
. Fixed #80706 (mail(): Headers after Bcc headers may be ignored). (cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #78680 (mysqlnd's mysql_clear_password does not transmit
|
||||
null-terminated password). (Daniel Black)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #74779 (x() and y() truncating floats to integers). (cmb)
|
||||
|
||||
- OPcache:
|
||||
. Fixed bug #80682 (opcache doesn't honour pcre.jit option). (Remi)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #80747 (Providing RSA key size < 512 generates key that crash
|
||||
PHP). (Nikita)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #75850 (Unclear error message wrt. __halt_compiler() w/o
|
||||
semicolon) (cmb)
|
||||
. Fixed bug #70091 (Phar does not mark UTF-8 filenames in ZIP archives). (cmb)
|
||||
. Fixed bug #53467 (Phar cannot compress large archives). (cmb, lserni)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug#80719 (Iterating after failed ArrayObject::setIteratorClass()
|
||||
causes Segmentation fault). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80654 (file_get_contents() maxlen fails above (2**31)-1 bytes).
|
||||
(cmb)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #80648 (Fix for bug 79296 should be based on runtime version).
|
||||
(cmb, Remi)
|
||||
|
||||
04 Feb 2021, PHP 7.4.15
|
||||
|
||||
- Core:
|
||||
. Fixed bug #80523 (bogus parse error on >4GB source code). (Nikita)
|
||||
. Fixed bug #80384 (filter buffers entire read until file closed). (Adam
|
||||
Seitz, cmb)
|
||||
|
||||
- Curl:
|
||||
. Fixed bug #80595 (Resetting POSTFIELDS to empty array breaks request). (cmb)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #80376 (last day of the month causes runway cpu usage. (Derick)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #67983 (mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to
|
||||
interpret bit columns). (Nikita)
|
||||
. Fixed bug #64638 (Fetching resultsets from stored procedure with cursor
|
||||
fails). (Nikita)
|
||||
. Fixed bug #72862 (segfault using prepared statements on stored procedures
|
||||
that use a cursor). (Nikita)
|
||||
. Fixed bug #77935 (Crash in mysqlnd_fetch_stmt_row_cursor when calling an SP
|
||||
with a cursor). (Nikita)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #77565 (Incorrect locator detection in ZIP-based phars). (cmb)
|
||||
. Fixed bug #69279 (Compressed ZIP Phar extractTo() creates garbage files).
|
||||
(cmb)
|
||||
|
||||
07 Jan 2021, PHP 7.4.14
|
||||
|
||||
- Core:
|
||||
@@ -158,7 +50,7 @@ PHP NEWS
|
||||
PROCEDURE resultset SIGNAL). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
|
||||
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
|
||||
(CVE-2020-7071) (cmb)
|
||||
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
|
||||
. Fixed bug #80411 (References to null-serialized object break serialize()).
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
HT iterator should be destroyed if array becomes empty during array_splice
|
||||
--FILE--
|
||||
<?php
|
||||
$a=[4];
|
||||
$i = 0;
|
||||
foreach ($a as &$r) {
|
||||
var_dump($r);
|
||||
$a = array_splice($a, 0);
|
||||
if (++$i == 2) break;
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
int(4)
|
||||
int(4)
|
||||
@@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80781: Error handler that throws ErrorException infinite loop
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function handle(int $severity, string $message, string $file, int $line): bool {
|
||||
if((error_reporting() & $severity) !== 0) {
|
||||
throw new \ErrorException($message, 0, $severity, $file, $line);
|
||||
}
|
||||
|
||||
return true; // stfu operator
|
||||
}
|
||||
|
||||
set_error_handler('handle');
|
||||
|
||||
function getPlugin(string $plugin) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$array = [];
|
||||
if (isset($array[$data]) or getPlugin($data)) {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught ErrorException: Illegal offset type in isset or empty in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): handle(2, 'Illegal offset ...', %s, %d, Array)
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Symtable cache slots may be acquired while cleaning symtable
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
// Must be larger than the symtable cache.
|
||||
static $max = 40;
|
||||
function __destruct() {
|
||||
if (self::$max-- < 0) return;
|
||||
$x = 'y';
|
||||
$$x = new a;
|
||||
}
|
||||
}
|
||||
new A;
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
+3
-5
@@ -3437,13 +3437,12 @@ ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_val
|
||||
|
||||
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table) /* {{{ */
|
||||
{
|
||||
/* Clean before putting into the cache, since clean could call dtors,
|
||||
* which could use the cached hash. Also do this before the check for
|
||||
* available cache slots, as those may be used by a dtor as well. */
|
||||
zend_symtable_clean(symbol_table);
|
||||
if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
|
||||
zend_array_destroy(symbol_table);
|
||||
} else {
|
||||
/* clean before putting into the cache, since clean
|
||||
could call dtors, which could use cached hash */
|
||||
zend_symtable_clean(symbol_table);
|
||||
*(EG(symtable_cache_ptr)++) = symbol_table;
|
||||
}
|
||||
}
|
||||
@@ -4555,7 +4554,6 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint
|
||||
if (check_exception) { \
|
||||
OPLINE = EX(opline) + (skip); \
|
||||
} else { \
|
||||
ZEND_ASSERT(!EG(exception)); \
|
||||
OPLINE = opline + (skip); \
|
||||
} \
|
||||
ZEND_VM_CONTINUE()
|
||||
|
||||
+1
-1
@@ -1630,10 +1630,10 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
|
||||
} else if (EXPECTED(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED)) {
|
||||
goto free_ht;
|
||||
}
|
||||
zend_hash_iterators_remove(ht);
|
||||
SET_INCONSISTENT(HT_DESTROYED);
|
||||
efree(HT_GET_DATA_ADDR(ht));
|
||||
free_ht:
|
||||
zend_hash_iterators_remove(ht);
|
||||
FREE_HASHTABLE(ht);
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ static void yy_pop_state(void)
|
||||
zend_stack_del_top(&SCNG(state_stack));
|
||||
}
|
||||
|
||||
static void yy_scan_buffer(char *str, size_t len)
|
||||
static void yy_scan_buffer(char *str, unsigned int len)
|
||||
{
|
||||
YYCURSOR = (YYCTYPE*)str;
|
||||
YYLIMIT = YYCURSOR + len;
|
||||
@@ -554,7 +554,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
|
||||
}
|
||||
}
|
||||
SCNG(yy_start) = (unsigned char *)buf;
|
||||
yy_scan_buffer(buf, size);
|
||||
yy_scan_buffer(buf, (unsigned int)size);
|
||||
} else {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
|
||||
}
|
||||
@@ -722,7 +722,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
yy_scan_buffer(buf, size);
|
||||
yy_scan_buffer(buf, (unsigned int)size);
|
||||
|
||||
new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
|
||||
zend_set_compiled_filename(new_compiled_filename);
|
||||
|
||||
@@ -6937,10 +6937,6 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
ZEND_VM_C_GOTO(isset_again);
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
ZEND_VM_C_GOTO(isset_dim_obj_exit);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
|
||||
@@ -6302,10 +6302,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
@@ -8500,10 +8496,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
@@ -10957,10 +10949,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
@@ -14997,10 +14985,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
@@ -16418,10 +16402,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
@@ -17709,10 +17689,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
@@ -41529,10 +41505,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
@@ -44978,10 +44950,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
@@ -50155,10 +50123,6 @@ num_index_prop:
|
||||
goto isset_again;
|
||||
} else {
|
||||
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
result = 0;
|
||||
goto isset_dim_obj_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(opline->extended_value & ZEND_ISEMPTY)) {
|
||||
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/laravel/framework.git --branch=master --depth=1
|
||||
cd framework
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
export USE_ZEND_ALLOC=0
|
||||
sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php
|
||||
# Avoid test using exit(), which thus leaks.
|
||||
@@ -61,8 +61,8 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/symfony/symfony.git --depth=1
|
||||
cd symfony
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
php7.4 ./phpunit install
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
php7.3 ./phpunit install
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
export ASAN_OPTIONS=exitcode=139
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
displayName: 'Test Amphp'
|
||||
condition: or(succeeded(), failed())
|
||||
- script: |
|
||||
php7.4 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
|
||||
php7.3 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
|
||||
cd symfony_demo
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ parameters:
|
||||
jobs:
|
||||
- job: ${{ parameters.configurationName }}
|
||||
pool:
|
||||
vmImage: 'ubuntu-20.04'
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- template: apt.yml
|
||||
- script: |
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([PHP],[7.4.17RC1],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_INIT([PHP],[7.4.14],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_CONFIG_SRCDIR([main/php_version.h])
|
||||
AC_CONFIG_AUX_DIR([build])
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
|
||||
+3
-10
@@ -41,7 +41,6 @@ typedef struct _php_bz2_filter_data {
|
||||
enum strm_status status; /* Decompress option */
|
||||
unsigned int small_footprint : 1; /* Decompress option */
|
||||
unsigned int expect_concatenated : 1; /* Decompress option */
|
||||
unsigned int is_flushed : 1; /* only for compression */
|
||||
|
||||
int persistent;
|
||||
} php_bz2_filter_data;
|
||||
@@ -229,8 +228,6 @@ static php_stream_filter_status_t php_bz2_compress_filter(
|
||||
bucket = php_stream_bucket_make_writeable(buckets_in->head);
|
||||
|
||||
while (bin < bucket->buflen) {
|
||||
int flush_mode;
|
||||
|
||||
desired = bucket->buflen - bin;
|
||||
if (desired > data->inbuf_len) {
|
||||
desired = data->inbuf_len;
|
||||
@@ -238,9 +235,7 @@ static php_stream_filter_status_t php_bz2_compress_filter(
|
||||
memcpy(data->strm.next_in, bucket->buf + bin, desired);
|
||||
data->strm.avail_in = desired;
|
||||
|
||||
flush_mode = flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : (flags & PSFS_FLAG_FLUSH_INC ? BZ_FLUSH : BZ_RUN);
|
||||
data->is_flushed = flush_mode != BZ_RUN;
|
||||
status = BZ2_bzCompress(&(data->strm), flush_mode);
|
||||
status = BZ2_bzCompress(&(data->strm), flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : (flags & PSFS_FLAG_FLUSH_INC ? BZ_FLUSH : BZ_RUN));
|
||||
if (status != BZ_RUN_OK && status != BZ_FLUSH_OK && status != BZ_FINISH_OK) {
|
||||
/* Something bad happened */
|
||||
php_stream_bucket_delref(bucket);
|
||||
@@ -266,12 +261,11 @@ static php_stream_filter_status_t php_bz2_compress_filter(
|
||||
php_stream_bucket_delref(bucket);
|
||||
}
|
||||
|
||||
if (flags & PSFS_FLAG_FLUSH_CLOSE || ((flags & PSFS_FLAG_FLUSH_INC) && !data->is_flushed)) {
|
||||
if (flags & PSFS_FLAG_FLUSH_CLOSE) {
|
||||
/* Spit it out! */
|
||||
status = BZ_FINISH_OK;
|
||||
while (status == BZ_FINISH_OK) {
|
||||
status = BZ2_bzCompress(&(data->strm), (flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : BZ_FLUSH));
|
||||
data->is_flushed = 1;
|
||||
status = BZ2_bzCompress(&(data->strm), BZ_FINISH);
|
||||
if (data->strm.avail_out < data->outbuf_len) {
|
||||
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
|
||||
|
||||
@@ -387,7 +381,6 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
}
|
||||
|
||||
status = BZ2_bzCompressInit(&(data->strm), blockSize100k, 0, workFactor);
|
||||
data->is_flushed = 1;
|
||||
fops = &php_bz2_compress_ops;
|
||||
} else {
|
||||
status = BZ_DATA_ERROR;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #75776 (Flushing streams with compression filter is broken)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bz2')) die('skip bz2 extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$text = str_repeat('0123456789abcdef', 1000);
|
||||
|
||||
$temp = fopen('php://temp', 'r+');
|
||||
stream_filter_append($temp, 'bzip2.compress', STREAM_FILTER_WRITE);
|
||||
fwrite($temp, $text);
|
||||
|
||||
rewind($temp);
|
||||
|
||||
var_dump(bin2hex(stream_get_contents($temp)));
|
||||
var_dump(ftell($temp));
|
||||
|
||||
fclose($temp);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(144) "425a68343141592653599fe7bbbf0001f389007fe03f002000902980026826aa80003ea9061520c6a41954833a9069520d6a41b54837a9071520e6a41d5483ba9079520f6a41f548"
|
||||
int(72)
|
||||
+1
-11
@@ -2207,7 +2207,6 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
#endif
|
||||
|
||||
prop = zend_read_property(curl_CURLFile_class, current, "name", sizeof("name")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) != IS_STRING) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", ZSTR_VAL(string_key));
|
||||
} else {
|
||||
@@ -2218,12 +2217,10 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
}
|
||||
|
||||
prop = zend_read_property(curl_CURLFile_class, current, "mime", sizeof("mime")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
|
||||
type = Z_STRVAL_P(prop);
|
||||
}
|
||||
prop = zend_read_property(curl_CURLFile_class, current, "postname", sizeof("postname")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
|
||||
filename = Z_STRVAL_P(prop);
|
||||
}
|
||||
@@ -2972,14 +2969,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
|
||||
case CURLOPT_POSTFIELDS:
|
||||
if (Z_TYPE_P(zvalue) == IS_ARRAY || Z_TYPE_P(zvalue) == IS_OBJECT) {
|
||||
if (zend_hash_num_elements(HASH_OF(zvalue)) == 0) {
|
||||
/* no need to build the mime structure for empty hashtables;
|
||||
also works around https://github.com/curl/curl/issues/6455 */
|
||||
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0);
|
||||
} else {
|
||||
return build_mime_structure_from_hash(ch, zvalue);
|
||||
}
|
||||
return build_mime_structure_from_hash(ch, zvalue);
|
||||
} else {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071101
|
||||
zend_string *tmp_str;
|
||||
|
||||
@@ -21,10 +21,9 @@ var_dump(curl_getinfo($ch)["request_header"]);
|
||||
string(%d) "array(0) {
|
||||
}
|
||||
"
|
||||
string(%d) "POST /get.inc?test=post HTTP/1.1
|
||||
string(90) "POST /get.inc?test=post HTTP/1.1
|
||||
Host: localhost:%d
|
||||
Accept: */*
|
||||
Content-Length: 0
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
|
||||
"
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80595 (Resetting POSTFIELDS to empty array breaks request)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_URL => "{$host}/get.inc?test=post",
|
||||
]);
|
||||
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, ['foo' => 'bar']);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, []);
|
||||
var_dump(curl_exec($ch));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(43) "array(1) {
|
||||
["foo"]=>
|
||||
string(3) "bar"
|
||||
}
|
||||
"
|
||||
string(13) "array(0) {
|
||||
}
|
||||
"
|
||||
+20035
-22827
File diff suppressed because it is too large.
Load diff
+435
-398
File diff suppressed because it is too large.
Load diff
+2350
-2549
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -972,9 +972,9 @@ restart:
|
||||
zend_bool close_both;
|
||||
|
||||
close_both = (info->fp != info->lock.fp);
|
||||
php_stream_free(info->lock.fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
|
||||
php_stream_close(info->lock.fp);
|
||||
if (close_both) {
|
||||
php_stream_free(info->fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
|
||||
php_stream_close(info->fp);
|
||||
}
|
||||
info->fp = NULL;
|
||||
info->lock.fp = NULL;
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once __DIR__ .'/skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$filename = __DIR__."/DOMDocument_saveHTMLFile_basic.html";
|
||||
$filename = __DIR__."/tmp_savehtmlfile".time().".html";
|
||||
$doc = new DOMDocument('1.0');
|
||||
$root = $doc->createElement('html');
|
||||
$root = $doc->appendChild($root);
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once __DIR__ .'/skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$filename = __DIR__."/DOMDocument_saveHTMLFile_formatOutput.html";
|
||||
$filename = __DIR__."/tmp_savehtmlfile".time().".html";
|
||||
$doc = new DOMDocument('1.0');
|
||||
$doc->formatOutput = true;
|
||||
$root = $doc->createElement('html');
|
||||
|
||||
@@ -555,22 +555,6 @@ void php_filter_validate_domain(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int is_userinfo_valid(zend_string *str)
|
||||
{
|
||||
const char *valid = "-._~!$&'()*+,;=:";
|
||||
const char *p = ZSTR_VAL(str);
|
||||
while (p - ZSTR_VAL(str) < ZSTR_LEN(str)) {
|
||||
if (isalpha(*p) || isdigit(*p) || strchr(valid, *p)) {
|
||||
p++;
|
||||
} else if (*p == '%' && p - ZSTR_VAL(str) <= ZSTR_LEN(str) - 3 && isdigit(*(p+1)) && isxdigit(*(p+2))) {
|
||||
p += 3;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
{
|
||||
php_url *url;
|
||||
@@ -631,13 +615,6 @@ bad_url:
|
||||
php_url_free(url);
|
||||
RETURN_VALIDATION_FAILED
|
||||
}
|
||||
|
||||
if (url->user != NULL && !is_userinfo_valid(url->user)) {
|
||||
php_url_free(url);
|
||||
RETURN_VALIDATION_FAILED
|
||||
|
||||
}
|
||||
|
||||
php_url_free(url);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -175,7 +175,6 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func)
|
||||
return ZEND_NAN;
|
||||
}
|
||||
|
||||
try_again:
|
||||
switch (Z_TYPE_P(z)) {
|
||||
case IS_STRING:
|
||||
type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0);
|
||||
@@ -228,9 +227,6 @@ try_again:
|
||||
efree(message);
|
||||
}
|
||||
break;
|
||||
case IS_REFERENCE:
|
||||
z = Z_REFVAL_P(z);
|
||||
goto try_again;
|
||||
default:
|
||||
spprintf(&message, 0, "%s: invalid PHP type for date", func);
|
||||
intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80763 (msgfmt_format() does not accept DateTime references)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl')) die('skip intl extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$today = new DateTime('2021-02-17 12:00:00');
|
||||
$formatter = new \MessageFormatter('en_US', 'Today is {today, date, full}.');
|
||||
$params = ['today' => $today];
|
||||
array_walk($params, fn() => 1);
|
||||
var_dump($formatter->format($params));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(38) "Today is Wednesday, February 17, 2021."
|
||||
@@ -409,54 +409,6 @@ php_libxml_input_buffer_create_filename(const char *URI, xmlCharEncoding enc)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Check if there's been an external transport protocol with an encoding information */
|
||||
if (enc == XML_CHAR_ENCODING_NONE) {
|
||||
php_stream *s = (php_stream *) context;
|
||||
|
||||
if (Z_TYPE(s->wrapperdata) == IS_ARRAY) {
|
||||
zval *header;
|
||||
|
||||
ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(s->wrapperdata), header) {
|
||||
const char buf[] = "Content-Type:";
|
||||
if (Z_TYPE_P(header) == IS_STRING &&
|
||||
!zend_binary_strncasecmp(Z_STRVAL_P(header), Z_STRLEN_P(header), buf, sizeof(buf)-1, sizeof(buf)-1)) {
|
||||
char *needle = estrdup("charset=");
|
||||
char *haystack = estrndup(Z_STRVAL_P(header), Z_STRLEN_P(header));
|
||||
char *encoding = php_stristr(haystack, needle, Z_STRLEN_P(header), sizeof("charset=")-1);
|
||||
|
||||
if (encoding) {
|
||||
char *end;
|
||||
|
||||
encoding += sizeof("charset=")-1;
|
||||
if (*encoding == '"') {
|
||||
encoding++;
|
||||
}
|
||||
end = strchr(encoding, ';');
|
||||
if (end == NULL) {
|
||||
end = encoding + strlen(encoding);
|
||||
}
|
||||
end--; /* end == encoding-1 isn't a buffer underrun */
|
||||
while (*end == ' ' || *end == '\t') {
|
||||
end--;
|
||||
}
|
||||
if (*end == '"') {
|
||||
end--;
|
||||
}
|
||||
if (encoding >= end) continue;
|
||||
*(end+1) = '\0';
|
||||
enc = xmlParseCharEncoding(encoding);
|
||||
if (enc <= XML_CHAR_ENCODING_NONE) {
|
||||
enc = XML_CHAR_ENCODING_NONE;
|
||||
}
|
||||
}
|
||||
efree(haystack);
|
||||
efree(needle);
|
||||
break; /* found content-type */
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate the Input buffer front-end. */
|
||||
ret = xmlAllocParserInputBuffer(enc);
|
||||
if (ret != NULL) {
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Bug #51903 (simplexml_load_file() doesn't use HTTP headers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
|
||||
if (@!include "./ext/standard/tests/http/server.inc") die('skip server.inc not available');
|
||||
http_server_skipif('tcp://127.0.0.1:12342');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require "./ext/standard/tests/http/server.inc";
|
||||
$responses = [
|
||||
"data://text/plain,HTTP/1.1 200 OK\r\n"
|
||||
. "Content-Type: text/xml; charset=ISO-8859-1\r\n\r\n"
|
||||
. "<?xml version=\"1.0\"?>\n"
|
||||
. "<root>\xE4\xF6\xFC</root>\n",
|
||||
"data://text/plain,HTTP/1.1 200 OK\r\n"
|
||||
. "Content-Type: text/xml; charset=ISO-8859-1; foo=bar\r\n\r\n"
|
||||
. "<?xml version=\"1.0\"?>\n"
|
||||
. "<root>\xE4\xF6\xFC</root>\n",
|
||||
"data://text/plain,HTTP/1.1 200 OK\r\n"
|
||||
. "Content-Type: text/xml; charset=\"ISO-8859-1\" ; foo=bar\r\n\r\n"
|
||||
. "<?xml version=\"1.0\"?>\n"
|
||||
. "<root>\xE4\xF6\xFC</root>\n",
|
||||
];
|
||||
$pid = http_server('tcp://127.0.0.1:12342', $responses);
|
||||
|
||||
for ($i = 0; $i < count($responses); $i++) {
|
||||
$sxe = simplexml_load_file('http://127.0.0.1:12342/');
|
||||
echo "$sxe\n";
|
||||
}
|
||||
|
||||
http_server_kill($pid);
|
||||
?>
|
||||
--EXPECT--
|
||||
äöü
|
||||
äöü
|
||||
äöü
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67983: mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to interpret bit columns
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
if (!$IS_MYSQLND) {
|
||||
die("skip mysqlnd only test");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once("connect.inc");
|
||||
|
||||
$connection = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
mysqli_options($connection, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true);
|
||||
|
||||
mysqli_set_charset($connection, 'utf8');
|
||||
mysqli_query($connection, 'DROP TABLE IF EXISTS test');
|
||||
mysqli_query($connection, 'CREATE TABLE test (id BIT(8))');
|
||||
mysqli_query($connection, 'INSERT INTO test VALUES (0), (1), (42)');
|
||||
|
||||
$res = mysqli_query($connection, 'SELECT * FROM test');
|
||||
|
||||
while ($result = mysqli_fetch_assoc($res)) {
|
||||
var_dump($result['id']);
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(1)
|
||||
int(42)
|
||||
@@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
Bug #74779 (x() and y() truncating floats to integers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
if (!setlocale(LC_NUMERIC, "de_DE", "de_DE.UTF-8", "de-DE")) die('skip locale not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
}
|
||||
|
||||
if (!setlocale(LC_NUMERIC, "de_DE", "de_DE.UTF-8", "de-DE")) {
|
||||
echo "[002] Cannot set locale\n";
|
||||
}
|
||||
|
||||
if (!$link->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true)) {
|
||||
printf("[003] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (!$result = $link->query("SELECT ST_Y(Point(56.7, 53.34))")) {
|
||||
printf("[004] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (!$array = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
var_dump($array);
|
||||
|
||||
mysqli_close($link);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["ST_Y(Point(56.7, 53.34))"]=>
|
||||
float(53,34)
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Bug #77935: Crash in mysqlnd_fetch_stmt_row_cursor when calling an SP with a cursor
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(__DIR__ . '/connect.inc');
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$db = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
$db->query('DROP PROCEDURE IF EXISTS testSp');
|
||||
$db->query(<<<'SQL'
|
||||
CREATE
|
||||
PROCEDURE `testSp`()
|
||||
BEGIN
|
||||
DECLARE `cur` CURSOR FOR SELECT 1;
|
||||
OPEN `cur`;
|
||||
CLOSE `cur`;
|
||||
SELECT 1;
|
||||
END;
|
||||
SQL);
|
||||
|
||||
$stmt = $db->prepare("CALL testSp()");
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[1]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80837 Calling stmt_store_result after fetch doesn't throw an error
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once 'skipif.inc';
|
||||
require_once 'skipifconnectfailure.inc';
|
||||
if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once "connect.inc";
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
$mysqli->query('DROP TABLE IF EXISTS test');
|
||||
$mysqli->query('CREATE TABLE test (b int)');
|
||||
$mysqli->query('INSERT INTO test VALUES (1),(2),(3)');
|
||||
|
||||
$statement = $mysqli->prepare("SELECT b FROM test");
|
||||
$statement->execute();
|
||||
$statement->bind_result($name);
|
||||
$statement->fetch();
|
||||
try {
|
||||
$statement->store_result();
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
$mysqli->close();
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "clean_table.inc";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Commands out of sync; you can't run this command now
|
||||
@@ -19,8 +19,8 @@ if (!$res = $link->query("SHOW PLUGINS"))
|
||||
|
||||
$have_pam = false;
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
if (isset($row['Name']) && in_array($row['Name'], array('pam', 'authentication_pam', 'auth_pam_compat'))) {
|
||||
$have_pam = $row['Name'];
|
||||
if (isset($row['Name']) && ('mysql_clear_password' == $row['Name'])) {
|
||||
$have_pam = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -29,54 +29,12 @@ $res->close();
|
||||
if (!$have_pam)
|
||||
die("SKIP Server PAM plugin not installed");
|
||||
|
||||
if ($have_pam == 'pam') {
|
||||
/* MariaDB - needs system variable pam_use_cleartext_plugin=ON to be set */
|
||||
if (!$res = mysqli_query($link, 'SHOW GLOBAL VARIABLES LIKE "pam_use_cleartext_plugin"'))
|
||||
die(sprintf("SKIP MariaDB probe of GLOBAL VARIABLES failed [%d] %s\n",
|
||||
mysqli_errno($link), mysqli_error($link)));
|
||||
$pam_use_cleartext_plugin = mysqli_fetch_row($res);
|
||||
mysqli_free_result($res);
|
||||
if (!$pam_use_cleartext_plugin or $pam_use_cleartext_plugin[1]!='ON')
|
||||
die("SKIP Server setting pam_use_cleartext_plugin!=ON");
|
||||
|
||||
$pam_service = file_get_contents('/etc/pam.d/mysql');
|
||||
} elseif ($have_pam == 'authentication_pam') {
|
||||
/*
|
||||
required MySQL syntax:
|
||||
https://dev.mysql.com/doc/refman/8.0/en/pam-pluggable-authentication.html#pam-pluggable-authentication-usage
|
||||
*/
|
||||
$have_pam .= " AS 'mysql-unix'";
|
||||
$pam_service = file_get_contents('/etc/pam.d/mysql-unix');
|
||||
} else {
|
||||
$pam_service = file_get_contents('/etc/pam.d/mysql');
|
||||
}
|
||||
$auth = 0;
|
||||
$account = 0;
|
||||
foreach (explode("\n", $pam_service) as $line)
|
||||
{
|
||||
if (preg_match('/^auth/', $line)) {
|
||||
$auth = 1;
|
||||
} elseif (preg_match('/^account/', $line)) {
|
||||
$account = 1;
|
||||
}
|
||||
}
|
||||
if (!$auth) {
|
||||
die("SKIP pam service file missing 'auth' directive");
|
||||
}
|
||||
if (!$account) {
|
||||
die("SKIP pam service file missing 'account' directive");
|
||||
}
|
||||
|
||||
if (!posix_getpwnam('pamtest')) {
|
||||
die("SKIP no pamtest user");
|
||||
}
|
||||
/* Password of user 'pamtest' should be set to 'pamtest' */
|
||||
|
||||
mysqli_query($link, 'DROP USER pamtest');
|
||||
mysqli_query($link, 'DROP USER pamtest@localhost');
|
||||
|
||||
if (!mysqli_query($link, "CREATE USER pamtest@'%' IDENTIFIED WITH $have_pam") ||
|
||||
!mysqli_query($link, "CREATE USER pamtest@'localhost' IDENTIFIED WITH $have_pam")) {
|
||||
if (!mysqli_query($link, 'CREATE USER pamtest@"%" IDENTIFIED WITH mysql_clear_password') ||
|
||||
!mysqli_query($link, 'CREATE USER pamtest@"localhost" IDENTIFIED WITH mysql_clear_password')) {
|
||||
printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
|
||||
mysqli_close($link);
|
||||
die("skip CREATE USER failed");
|
||||
@@ -102,8 +60,8 @@ max_execution_time=240
|
||||
require_once('table.inc');
|
||||
|
||||
if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) {
|
||||
printf("[001] Cannot connect to the server using host=%s, user=pamtest, passwd=pamtest dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $db, $port, $socket);
|
||||
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
} else {
|
||||
|
||||
if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
|
||||
@@ -130,4 +88,6 @@ max_execution_time=240
|
||||
mysqli_query($link, 'DROP USER pamtest@localhost');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mysqli_real_connect(): (28000/1045): Access denied for user %s
|
||||
[001] Cannot connect to the server using host=%s
|
||||
done!
|
||||
@@ -110,7 +110,21 @@ if (!function_exists('mysqli_stmt_get_result'))
|
||||
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
// get_result can be used in PS cursor mode
|
||||
if (!$stmt = mysqli_stmt_init($link))
|
||||
printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
|
||||
printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
if (!mysqli_stmt_execute($stmt))
|
||||
printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
$id = NULL;
|
||||
$label = NULL;
|
||||
if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
|
||||
printf("[035] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
|
||||
|
||||
// get_result cannot be used in PS cursor mode
|
||||
if (!$stmt = mysqli_stmt_init($link))
|
||||
printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
@@ -123,11 +137,24 @@ if (!function_exists('mysqli_stmt_get_result'))
|
||||
if (!mysqli_stmt_execute($stmt))
|
||||
printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
$result = mysqli_stmt_get_result($stmt);
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
var_dump($row);
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
try {
|
||||
$res = mysqli_stmt_get_result($stmt);
|
||||
// we expect no segfault if we try to fetch a row because get_result should throw an error or return false
|
||||
mysqli_fetch_assoc($res);
|
||||
} catch (\mysqli_sql_exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
$res = $stmt->get_result();
|
||||
// we expect no segfault if we try to fetch a row because get_result should throw an error or return false
|
||||
$res->fetch_assoc();
|
||||
} catch (\mysqli_sql_exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
|
||||
if (!$stmt = mysqli_stmt_init($link))
|
||||
printf("[034] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
@@ -186,18 +213,8 @@ Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt
|
||||
|
||||
Warning: mysqli_stmt_get_result(): invalid object or resource mysqli_stmt
|
||||
in %s on line %d
|
||||
array(2) {
|
||||
["id"]=>
|
||||
int(1)
|
||||
["label"]=>
|
||||
string(1) "a"
|
||||
}
|
||||
array(2) {
|
||||
["id"]=>
|
||||
int(2)
|
||||
["label"]=>
|
||||
string(1) "b"
|
||||
}
|
||||
mysqli_stmt_get_result() cannot be used with cursors
|
||||
get_result() cannot be used with cursors
|
||||
[040] [2014] [Commands out of sync; you can't run this command now]
|
||||
[041] [0] []
|
||||
array(2) {
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
--TEST--
|
||||
PS using cursor and returning multiple result sets
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(__DIR__ . '/connect.inc');
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$db = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
$db->query('DROP PROCEDURE IF EXISTS testPs');
|
||||
$db->query(<<<'SQL'
|
||||
CREATE PROCEDURE testPs() BEGIN
|
||||
DECLARE testCursor CURSOR FOR SELECT 'stuff';
|
||||
OPEN testCursor;
|
||||
CLOSE testCursor;
|
||||
SELECT 1 as a, 2 as b;
|
||||
SELECT 3 as a, 4 as b;
|
||||
END
|
||||
SQL
|
||||
);
|
||||
|
||||
echo "use_result:\n";
|
||||
$stmt = $db->prepare("call testPs()");
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($v1, $v2);
|
||||
while ($stmt->fetch()) {
|
||||
var_dump($v1, $v2);
|
||||
}
|
||||
|
||||
$stmt->next_result();
|
||||
$stmt->bind_result($v1, $v2);
|
||||
while ($stmt->fetch()) {
|
||||
var_dump($v1, $v2);
|
||||
}
|
||||
$stmt->next_result();
|
||||
|
||||
echo "\nstore_result:\n";
|
||||
$stmt = $db->prepare("call testPs()");
|
||||
$stmt->execute();
|
||||
$stmt->store_result();
|
||||
$stmt->bind_result($v1, $v2);
|
||||
while ($stmt->fetch()) {
|
||||
var_dump($v1, $v2);
|
||||
}
|
||||
|
||||
$stmt->next_result();
|
||||
$stmt->store_result();
|
||||
$stmt->bind_result($v1, $v2);
|
||||
while ($stmt->fetch()) {
|
||||
var_dump($v1, $v2);
|
||||
}
|
||||
$stmt->next_result();
|
||||
|
||||
echo "\nget_result:\n";
|
||||
$stmt = $db->prepare("call testPs()");
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
$stmt->next_result();
|
||||
$result = $stmt->get_result();
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
var_dump($row);
|
||||
}
|
||||
$stmt->next_result();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
use_result:
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
int(4)
|
||||
|
||||
store_result:
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
int(4)
|
||||
|
||||
get_result:
|
||||
array(2) {
|
||||
["a"]=>
|
||||
int(1)
|
||||
["b"]=>
|
||||
int(2)
|
||||
}
|
||||
array(2) {
|
||||
["a"]=>
|
||||
int(3)
|
||||
["b"]=>
|
||||
int(4)
|
||||
}
|
||||
@@ -652,11 +652,7 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
|
||||
if (passwd && passwd_len) {
|
||||
ret = (zend_uchar*) zend_strndup(passwd, passwd_len);
|
||||
}
|
||||
/*
|
||||
Trailing null required. bug#78680
|
||||
https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_authentication_methods_clear_text_password.html
|
||||
*/
|
||||
*auth_data_len = passwd_len + 1;
|
||||
*auth_data_len = passwd_len;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
+59
-72
@@ -40,36 +40,6 @@ enum_func_status mysqlnd_stmt_execute_batch_generate_request(MYSQLND_STMT * cons
|
||||
static void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const stmt);
|
||||
static void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const stmt, const unsigned int param_no);
|
||||
|
||||
static enum_func_status mysqlnd_stmt_send_cursor_fetch_command(
|
||||
const MYSQLND_STMT_DATA *stmt, unsigned max_rows)
|
||||
{
|
||||
MYSQLND_CONN_DATA *conn = stmt->conn;
|
||||
zend_uchar buf[MYSQLND_STMT_ID_LENGTH /* statement id */ + 4 /* number of rows to fetch */];
|
||||
const MYSQLND_CSTRING payload = {(const char*) buf, sizeof(buf)};
|
||||
|
||||
int4store(buf, stmt->stmt_id);
|
||||
int4store(buf + MYSQLND_STMT_ID_LENGTH, max_rows);
|
||||
|
||||
if (conn->command->stmt_fetch(conn, payload) == FAIL) {
|
||||
COPY_CLIENT_ERROR(stmt->error_info, *conn->error_info);
|
||||
return FAIL;
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
static zend_bool mysqlnd_stmt_check_state(const MYSQLND_STMT_DATA *stmt)
|
||||
{
|
||||
const MYSQLND_CONN_DATA *conn = stmt->conn;
|
||||
if (stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE) {
|
||||
return 0;
|
||||
}
|
||||
if (stmt->cursor_exists) {
|
||||
return GET_CONNECTION_STATE(&conn->state) == CONN_READY;
|
||||
} else {
|
||||
return GET_CONNECTION_STATE(&conn->state) == CONN_FETCHING_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ mysqlnd_stmt::store_result */
|
||||
static MYSQLND_RES *
|
||||
MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s)
|
||||
@@ -90,9 +60,15 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s)
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
|
||||
if (stmt->cursor_exists) {
|
||||
/* Silently convert buffered to unbuffered, for now */
|
||||
DBG_RETURN(s->m->use_result(s));
|
||||
}
|
||||
|
||||
/* Nothing to store for UPSERT/LOAD DATA*/
|
||||
if (!mysqlnd_stmt_check_state(stmt)) {
|
||||
SET_CLIENT_ERROR(stmt->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
|
||||
if (GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_DATA || stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE)
|
||||
{
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
|
||||
@@ -102,12 +78,6 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s)
|
||||
SET_EMPTY_ERROR(conn->error_info);
|
||||
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_PS_BUFFERED_SETS);
|
||||
|
||||
if (stmt->cursor_exists) {
|
||||
if (mysqlnd_stmt_send_cursor_fetch_command(stmt, -1) == FAIL) {
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
result = stmt->result;
|
||||
result->type = MYSQLND_RES_PS_BUF;
|
||||
/* result->m.row_decoder = php_mysqlnd_rowp_read_binary_protocol; */
|
||||
@@ -182,8 +152,19 @@ MYSQLND_METHOD(mysqlnd_stmt, get_result)(MYSQLND_STMT * const s)
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
|
||||
if (stmt->cursor_exists) {
|
||||
/* Prepared statement cursors are not supported as of yet */
|
||||
char * msg;
|
||||
mnd_sprintf(&msg, 0, "%s() cannot be used with cursors", get_active_function_name());
|
||||
SET_CLIENT_ERROR(stmt->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, msg);
|
||||
if (msg) {
|
||||
mnd_sprintf_free(msg);
|
||||
}
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
|
||||
/* Nothing to store for UPSERT/LOAD DATA*/
|
||||
if (!mysqlnd_stmt_check_state(stmt)) {
|
||||
if (GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_DATA || stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE) {
|
||||
SET_CLIENT_ERROR(stmt->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
@@ -192,12 +173,6 @@ MYSQLND_METHOD(mysqlnd_stmt, get_result)(MYSQLND_STMT * const s)
|
||||
SET_EMPTY_ERROR(conn->error_info);
|
||||
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS);
|
||||
|
||||
if (stmt->cursor_exists) {
|
||||
if (mysqlnd_stmt_send_cursor_fetch_command(stmt, -1) == FAIL) {
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
result = conn->m->result_init(stmt->result->field_count);
|
||||
if (!result) {
|
||||
@@ -586,30 +561,28 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s, enum_mysqlnd_parse_e
|
||||
DBG_INF_FMT("server_status=%u cursor=%u", UPSERT_STATUS_GET_SERVER_STATUS(stmt->upsert_status),
|
||||
UPSERT_STATUS_GET_SERVER_STATUS(stmt->upsert_status) & SERVER_STATUS_CURSOR_EXISTS);
|
||||
|
||||
if (stmt->flags & CURSOR_TYPE_READ_ONLY) {
|
||||
if (UPSERT_STATUS_GET_SERVER_STATUS(stmt->upsert_status) & SERVER_STATUS_CURSOR_EXISTS) {
|
||||
DBG_INF("cursor exists");
|
||||
stmt->cursor_exists = TRUE;
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_READY);
|
||||
/* Only cursor read */
|
||||
stmt->default_rset_handler = s->m->use_result;
|
||||
DBG_INF("use_result");
|
||||
} else {
|
||||
DBG_INF("asked for cursor but got none");
|
||||
/*
|
||||
We have asked for CURSOR but got no cursor, because the condition
|
||||
above is not fulfilled. Then...
|
||||
if (UPSERT_STATUS_GET_SERVER_STATUS(stmt->upsert_status) & SERVER_STATUS_CURSOR_EXISTS) {
|
||||
DBG_INF("cursor exists");
|
||||
stmt->cursor_exists = TRUE;
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_READY);
|
||||
/* Only cursor read */
|
||||
stmt->default_rset_handler = s->m->use_result;
|
||||
DBG_INF("use_result");
|
||||
} else if (stmt->flags & CURSOR_TYPE_READ_ONLY) {
|
||||
DBG_INF("asked for cursor but got none");
|
||||
/*
|
||||
We have asked for CURSOR but got no cursor, because the condition
|
||||
above is not fulfilled. Then...
|
||||
|
||||
This is a single-row result set, a result set with no rows, EXPLAIN,
|
||||
SHOW VARIABLES, or some other command which either a) bypasses the
|
||||
cursors framework in the server and writes rows directly to the
|
||||
network or b) is more efficient if all (few) result set rows are
|
||||
precached on client and server's resources are freed.
|
||||
*/
|
||||
/* preferred is buffered read */
|
||||
stmt->default_rset_handler = s->m->store_result;
|
||||
DBG_INF("store_result");
|
||||
}
|
||||
This is a single-row result set, a result set with no rows, EXPLAIN,
|
||||
SHOW VARIABLES, or some other command which either a) bypasses the
|
||||
cursors framework in the server and writes rows directly to the
|
||||
network or b) is more efficient if all (few) result set rows are
|
||||
precached on client and server's resources are freed.
|
||||
*/
|
||||
/* preferred is buffered read */
|
||||
stmt->default_rset_handler = s->m->store_result;
|
||||
DBG_INF("store_result");
|
||||
} else {
|
||||
DBG_INF("no cursor");
|
||||
/* preferred is unbuffered read */
|
||||
@@ -967,7 +940,11 @@ MYSQLND_METHOD(mysqlnd_stmt, use_result)(MYSQLND_STMT * s)
|
||||
}
|
||||
DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
|
||||
|
||||
if (!stmt->field_count || !mysqlnd_stmt_check_state(stmt)) {
|
||||
if (!stmt->field_count ||
|
||||
(!stmt->cursor_exists && GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_DATA) ||
|
||||
(stmt->cursor_exists && GET_CONNECTION_STATE(&conn->state) != CONN_READY) ||
|
||||
(stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE))
|
||||
{
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
|
||||
DBG_ERR("command out of sync");
|
||||
DBG_RETURN(NULL);
|
||||
@@ -997,6 +974,7 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, const unsigned
|
||||
MYSQLND_STMT * s = (MYSQLND_STMT *) param;
|
||||
MYSQLND_STMT_DATA * stmt = s? s->data : NULL;
|
||||
MYSQLND_CONN_DATA * conn = stmt? stmt->conn : NULL;
|
||||
zend_uchar buf[MYSQLND_STMT_ID_LENGTH /* statement id */ + 4 /* number of rows to fetch */];
|
||||
MYSQLND_PACKET_ROW * row_packet;
|
||||
|
||||
DBG_ENTER("mysqlnd_fetch_stmt_row_cursor");
|
||||
@@ -1020,9 +998,18 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, const unsigned
|
||||
SET_EMPTY_ERROR(stmt->error_info);
|
||||
SET_EMPTY_ERROR(conn->error_info);
|
||||
|
||||
/* for now fetch only one row */
|
||||
if (mysqlnd_stmt_send_cursor_fetch_command(stmt, 1) == FAIL) {
|
||||
DBG_RETURN(FAIL);
|
||||
int4store(buf, stmt->stmt_id);
|
||||
int4store(buf + MYSQLND_STMT_ID_LENGTH, 1); /* for now fetch only one row */
|
||||
|
||||
{
|
||||
const MYSQLND_CSTRING payload = {(const char*) buf, sizeof(buf)};
|
||||
|
||||
ret = conn->command->stmt_fetch(conn, payload);
|
||||
if (ret == FAIL) {
|
||||
COPY_CLIENT_ERROR(stmt->error_info, *conn->error_info);
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
row_packet->skip_extraction = stmt->result_bind? FALSE:TRUE;
|
||||
|
||||
@@ -1216,9 +1216,8 @@ php_mysqlnd_rset_field_read(MYSQLND_CONN_DATA * conn, void * _packet)
|
||||
DBG_RETURN(PASS);
|
||||
} else if (EODATA_MARKER == *p && packet->header.size < 8) {
|
||||
/* Premature EOF. That should be COM_FIELD_LIST. But we don't support COM_FIELD_LIST anymore, thus this should not happen */
|
||||
DBG_ERR("Premature EOF. That should be COM_FIELD_LIST");
|
||||
php_error_docref(NULL, E_WARNING, "Premature EOF in result field metadata");
|
||||
DBG_RETURN(FAIL);
|
||||
DBG_INF("Premature EOF. That should be COM_FIELD_LIST");
|
||||
DBG_RETURN(PASS);
|
||||
}
|
||||
|
||||
meta = packet->metadata;
|
||||
@@ -1617,28 +1616,8 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_ROW_BUFFER * row_buffer, zval *
|
||||
}
|
||||
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_TEXT, len);
|
||||
}
|
||||
if (fields_metadata[i].type == MYSQL_TYPE_BIT) {
|
||||
/*
|
||||
BIT fields are specially handled. As they come as bit mask, they have
|
||||
to be converted to human-readable representation.
|
||||
*/
|
||||
ps_fetch_from_1_to_8_bytes(current_field, &(fields_metadata[i]), 0, (const zend_uchar **) &p, len);
|
||||
/*
|
||||
We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because
|
||||
later in this function there will be an advancement.
|
||||
*/
|
||||
p -= len;
|
||||
if (Z_TYPE_P(current_field) == IS_LONG && !as_int_or_float) {
|
||||
/* we are using the text protocol, so convert to string */
|
||||
char tmp[22];
|
||||
const size_t tmp_len = sprintf((char *)&tmp, ZEND_ULONG_FMT, Z_LVAL_P(current_field));
|
||||
ZVAL_STRINGL(current_field, tmp, tmp_len);
|
||||
} else if (Z_TYPE_P(current_field) == IS_STRING) {
|
||||
/* nothing to do here, as we want a string and ps_fetch_from_1_to_8_bytes() has given us one */
|
||||
}
|
||||
}
|
||||
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
|
||||
else if (as_int_or_float && perm_bind.php_type == IS_LONG) {
|
||||
if (as_int_or_float && perm_bind.php_type == IS_LONG) {
|
||||
zend_uchar save = *(p + len);
|
||||
/* We have to make it ASCIIZ temporarily */
|
||||
*(p + len) = '\0';
|
||||
@@ -1680,11 +1659,30 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_ROW_BUFFER * row_buffer, zval *
|
||||
zend_uchar save = *(p + len);
|
||||
/* We have to make it ASCIIZ temporarily */
|
||||
*(p + len) = '\0';
|
||||
ZVAL_DOUBLE(current_field, zend_strtod((char *) p, NULL));
|
||||
ZVAL_DOUBLE(current_field, atof((char *) p));
|
||||
*(p + len) = save;
|
||||
}
|
||||
} else
|
||||
#endif /* MYSQLND_STRING_TO_INT_CONVERSION */
|
||||
else if (len == 0) {
|
||||
if (fields_metadata[i].type == MYSQL_TYPE_BIT) {
|
||||
/*
|
||||
BIT fields are specially handled. As they come as bit mask, they have
|
||||
to be converted to human-readable representation.
|
||||
*/
|
||||
ps_fetch_from_1_to_8_bytes(current_field, &(fields_metadata[i]), 0, (const zend_uchar **) &p, len);
|
||||
/*
|
||||
We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because
|
||||
later in this function there will be an advancement.
|
||||
*/
|
||||
p -= len;
|
||||
if (Z_TYPE_P(current_field) == IS_LONG && !as_int_or_float) {
|
||||
/* we are using the text protocol, so convert to string */
|
||||
char tmp[22];
|
||||
const size_t tmp_len = sprintf((char *)&tmp, ZEND_ULONG_FMT, Z_LVAL_P(current_field));
|
||||
ZVAL_STRINGL(current_field, tmp, tmp_len);
|
||||
} else if (Z_TYPE_P(current_field) == IS_STRING) {
|
||||
/* nothing to do here, as we want a string and ps_fetch_from_1_to_8_bytes() has given us one */
|
||||
}
|
||||
} else if (len == 0) {
|
||||
ZVAL_EMPTY_STRING(current_field);
|
||||
} else if (len == 1) {
|
||||
ZVAL_INTERNED_STR(current_field, ZSTR_CHAR((zend_uchar)*(char *)p));
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2021 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2019 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -2141,7 +2141,7 @@ static uint32_t assign_dim_result_type(
|
||||
|
||||
/* For binary ops that have compound assignment operators */
|
||||
static uint32_t binary_op_result_type(
|
||||
zend_ssa *ssa, zend_uchar opcode, uint32_t t1, uint32_t t2, int result_var,
|
||||
zend_ssa *ssa, zend_uchar opcode, uint32_t t1, uint32_t t2, uint32_t result_var,
|
||||
zend_long optimization_level) {
|
||||
uint32_t tmp = 0;
|
||||
uint32_t t1_type = (t1 & MAY_BE_ANY) | (t1 & MAY_BE_UNDEF ? MAY_BE_NULL : 0);
|
||||
@@ -2159,8 +2159,7 @@ static uint32_t binary_op_result_type(
|
||||
switch (opcode) {
|
||||
case ZEND_ADD:
|
||||
if (t1_type == MAY_BE_LONG && t2_type == MAY_BE_LONG) {
|
||||
if (result_var < 0 ||
|
||||
!ssa->var_info[result_var].has_range ||
|
||||
if (!ssa->var_info[result_var].has_range ||
|
||||
ssa->var_info[result_var].range.underflow ||
|
||||
ssa->var_info[result_var].range.overflow) {
|
||||
/* may overflow */
|
||||
@@ -2186,8 +2185,7 @@ static uint32_t binary_op_result_type(
|
||||
case ZEND_SUB:
|
||||
case ZEND_MUL:
|
||||
if (t1_type == MAY_BE_LONG && t2_type == MAY_BE_LONG) {
|
||||
if (result_var < 0 ||
|
||||
!ssa->var_info[result_var].has_range ||
|
||||
if (!ssa->var_info[result_var].has_range ||
|
||||
ssa->var_info[result_var].range.underflow ||
|
||||
ssa->var_info[result_var].range.overflow) {
|
||||
/* may overflow */
|
||||
@@ -2629,8 +2627,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
|
||||
}
|
||||
|
||||
tmp |= binary_op_result_type(
|
||||
ssa, opline->extended_value, t1, t2,
|
||||
opline->opcode == ZEND_ASSIGN_OP ? ssa_ops[i].op1_def : -1, optimization_level);
|
||||
ssa, opline->extended_value, t1, t2, ssa_ops[i].op1_def, optimization_level);
|
||||
if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY)) {
|
||||
tmp |= MAY_BE_RC1;
|
||||
}
|
||||
|
||||
@@ -774,15 +774,14 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
|
||||
/* so that other process won't try to force while we are busy cleaning up */
|
||||
ZCSG(force_restart_time) = 0;
|
||||
while (mem_usage_check->l_pid > 0) {
|
||||
/* Try SIGTERM first, switch to SIGKILL if not successful. */
|
||||
int signal = SIGTERM;
|
||||
/* Clear previous errno, reset success and tries */
|
||||
errno = 0;
|
||||
success = 0;
|
||||
tries = 10;
|
||||
|
||||
while (tries--) {
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Attempting to kill locker %d", mem_usage_check->l_pid);
|
||||
if (kill(mem_usage_check->l_pid, signal)) {
|
||||
if (kill(mem_usage_check->l_pid, SIGKILL)) {
|
||||
if (errno == ESRCH) {
|
||||
/* Process died before the signal was sent */
|
||||
success = 1;
|
||||
@@ -801,8 +800,6 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
|
||||
break;
|
||||
}
|
||||
usleep(10000);
|
||||
/* If SIGTERM was not sufficient, use SIGKILL. */
|
||||
signal = SIGKILL;
|
||||
}
|
||||
if (!success) {
|
||||
/* errno is not ESRCH or we ran out of tries to kill the locker */
|
||||
|
||||
@@ -80,7 +80,7 @@ void zend_shared_alloc_create_lock(void)
|
||||
{
|
||||
memory_mutex = CreateMutex(NULL, FALSE, create_name_with_username(ACCEL_MUTEX_NAME));
|
||||
if (!memory_mutex) {
|
||||
zend_accel_error(ACCEL_LOG_FATAL, "Cannot create mutex (error %u)", GetLastError());
|
||||
zend_accel_error(ACCEL_LOG_FATAL, "Cannot create mutex");
|
||||
return;
|
||||
}
|
||||
ReleaseMutex(memory_mutex);
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80805: create simple class and get error in opcache.so
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public int $foo;
|
||||
public function __construct()
|
||||
{
|
||||
$this->foo = 2;
|
||||
}
|
||||
public function inc(): int
|
||||
{
|
||||
return $this->foo += 2;
|
||||
}
|
||||
}
|
||||
|
||||
$test = new Test();
|
||||
var_dump($test->foo);
|
||||
$test->inc();
|
||||
var_dump($test->foo);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
int(4)
|
||||
@@ -185,12 +185,10 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_PCRE_JIT_SUPPORT
|
||||
if (PCRE_G(jit)) {
|
||||
if (0 > pcre2_jit_compile(it->re, PCRE2_JIT_COMPLETE)) {
|
||||
/* Don't return here, even JIT could fail to compile, the pattern is still usable. */
|
||||
pcre2_get_error_message(errnumber, pcre_error, sizeof(pcre_error));
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Blacklist JIT compilation failed, %s\n", pcre_error);
|
||||
}
|
||||
if (0 > pcre2_jit_compile(it->re, PCRE2_JIT_COMPLETE)) {
|
||||
/* Don't return here, even JIT could fail to compile, the pattern is still usable. */
|
||||
pcre2_get_error_message(errnumber, pcre_error, sizeof(pcre_error));
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Blacklist JIT compilation failed, %s\n", pcre_error);
|
||||
}
|
||||
#endif
|
||||
/* prepare for the next iteration */
|
||||
|
||||
+26
-26
@@ -1064,17 +1064,6 @@ static inline int php_openssl_config_check_syntax(const char * section_label, co
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static char *php_openssl_conf_get_string(
|
||||
LHASH_OF(CONF_VALUE) *conf, const char *group, const char *name) {
|
||||
char *str = CONF_get_string(conf, group, name);
|
||||
if (str == NULL) {
|
||||
/* OpenSSL reports an error if a configuration value is not found.
|
||||
* However, we don't want to generate errors for optional configuration. */
|
||||
ERR_clear_error();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static int php_openssl_add_oid_section(struct php_x509_request * req) /* {{{ */
|
||||
{
|
||||
char * str;
|
||||
@@ -1082,8 +1071,9 @@ static int php_openssl_add_oid_section(struct php_x509_request * req) /* {{{ */
|
||||
CONF_VALUE * cnf;
|
||||
int i;
|
||||
|
||||
str = php_openssl_conf_get_string(req->req_config, NULL, "oid_section");
|
||||
str = CONF_get_string(req->req_config, NULL, "oid_section");
|
||||
if (str == NULL) {
|
||||
php_openssl_store_errors();
|
||||
return SUCCESS;
|
||||
}
|
||||
sktmp = CONF_get_section(req->req_config, str);
|
||||
@@ -1168,8 +1158,10 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
|
||||
}
|
||||
|
||||
/* read in the oids */
|
||||
str = php_openssl_conf_get_string(req->req_config, NULL, "oid_file");
|
||||
if (str != NULL && !php_openssl_open_base_dir_chk(str)) {
|
||||
str = CONF_get_string(req->req_config, NULL, "oid_file");
|
||||
if (str == NULL) {
|
||||
php_openssl_store_errors();
|
||||
} else if (!php_openssl_open_base_dir_chk(str)) {
|
||||
BIO *oid_bio = BIO_new_file(str, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
|
||||
if (oid_bio) {
|
||||
OBJ_create_objects(oid_bio);
|
||||
@@ -1181,11 +1173,11 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
|
||||
return FAILURE;
|
||||
}
|
||||
SET_OPTIONAL_STRING_ARG("digest_alg", req->digest_name,
|
||||
php_openssl_conf_get_string(req->req_config, req->section_name, "default_md"));
|
||||
CONF_get_string(req->req_config, req->section_name, "default_md"));
|
||||
SET_OPTIONAL_STRING_ARG("x509_extensions", req->extensions_section,
|
||||
php_openssl_conf_get_string(req->req_config, req->section_name, "x509_extensions"));
|
||||
CONF_get_string(req->req_config, req->section_name, "x509_extensions"));
|
||||
SET_OPTIONAL_STRING_ARG("req_extensions", req->request_extensions_section,
|
||||
php_openssl_conf_get_string(req->req_config, req->section_name, "req_extensions"));
|
||||
CONF_get_string(req->req_config, req->section_name, "req_extensions"));
|
||||
SET_OPTIONAL_LONG_ARG("private_key_bits", req->priv_key_bits,
|
||||
CONF_get_number(req->req_config, req->section_name, "default_bits"));
|
||||
|
||||
@@ -1194,9 +1186,11 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
|
||||
if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), "encrypt_key", sizeof("encrypt_key")-1)) != NULL) {
|
||||
req->priv_key_encrypt = Z_TYPE_P(item) == IS_TRUE ? 1 : 0;
|
||||
} else {
|
||||
str = php_openssl_conf_get_string(req->req_config, req->section_name, "encrypt_rsa_key");
|
||||
str = CONF_get_string(req->req_config, req->section_name, "encrypt_rsa_key");
|
||||
if (str == NULL) {
|
||||
str = php_openssl_conf_get_string(req->req_config, req->section_name, "encrypt_key");
|
||||
str = CONF_get_string(req->req_config, req->section_name, "encrypt_key");
|
||||
/* it is sure that there are some errrors as str was NULL for encrypt_rsa_key */
|
||||
php_openssl_store_errors();
|
||||
}
|
||||
if (str != NULL && strcmp(str, "no") == 0) {
|
||||
req->priv_key_encrypt = 0;
|
||||
@@ -1224,10 +1218,12 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
|
||||
|
||||
/* digest alg */
|
||||
if (req->digest_name == NULL) {
|
||||
req->digest_name = php_openssl_conf_get_string(req->req_config, req->section_name, "default_md");
|
||||
req->digest_name = CONF_get_string(req->req_config, req->section_name, "default_md");
|
||||
}
|
||||
if (req->digest_name != NULL) {
|
||||
req->digest = req->md_alg = EVP_get_digestbyname(req->digest_name);
|
||||
} else {
|
||||
php_openssl_store_errors();
|
||||
}
|
||||
if (req->md_alg == NULL) {
|
||||
req->md_alg = req->digest = EVP_sha1();
|
||||
@@ -1249,8 +1245,10 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
|
||||
#endif
|
||||
|
||||
/* set the string mask */
|
||||
str = php_openssl_conf_get_string(req->req_config, req->section_name, "string_mask");
|
||||
if (str != NULL && !ASN1_STRING_set_default_mask_asc(str)) {
|
||||
str = CONF_get_string(req->req_config, req->section_name, "string_mask");
|
||||
if (str == NULL) {
|
||||
php_openssl_store_errors();
|
||||
} else if (!ASN1_STRING_set_default_mask_asc(str)) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid global string mask setting %s", str);
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -3140,8 +3138,9 @@ static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, z
|
||||
php_openssl_store_errors();
|
||||
return FAILURE;
|
||||
}
|
||||
attr_sect = php_openssl_conf_get_string(req->req_config, req->section_name, "attributes");
|
||||
attr_sect = CONF_get_string(req->req_config, req->section_name, "attributes");
|
||||
if (attr_sect == NULL) {
|
||||
php_openssl_store_errors();
|
||||
attr_sk = NULL;
|
||||
} else {
|
||||
attr_sk = CONF_get_section(req->req_config, attr_sect);
|
||||
@@ -3995,7 +3994,10 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
|
||||
return NULL;
|
||||
}
|
||||
|
||||
randfile = php_openssl_conf_get_string(req->req_config, req->section_name, "RANDFILE");
|
||||
randfile = CONF_get_string(req->req_config, req->section_name, "RANDFILE");
|
||||
if (randfile == NULL) {
|
||||
php_openssl_store_errors();
|
||||
}
|
||||
php_openssl_load_rand_file(randfile, &egdsocket, &seeded);
|
||||
|
||||
if ((req->priv_key = EVP_PKEY_new()) != NULL) {
|
||||
@@ -4019,8 +4021,6 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
|
||||
PHP_OPENSSL_RAND_ADD_TIME();
|
||||
if (rsaparam == NULL || !RSA_generate_key_ex(rsaparam, req->priv_key_bits, bne, NULL)) {
|
||||
php_openssl_store_errors();
|
||||
RSA_free(rsaparam);
|
||||
rsaparam = NULL;
|
||||
}
|
||||
BN_free(bne);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80747: Providing RSA key size < 512 generates key that crash PHP
|
||||
--FILE--
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (OPENSSL_VERSION_NUMBER < 0x10100000) die("skip OpenSSL >= v1.1.0 required");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$conf = array(
|
||||
'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf',
|
||||
'private_key_bits' => 511,
|
||||
);
|
||||
var_dump(openssl_pkey_new($conf));
|
||||
while ($e = openssl_error_string()) {
|
||||
echo $e, "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
error:%s:key size too small
|
||||
@@ -14,8 +14,7 @@ $serverCode = <<<'CODE'
|
||||
$serverUri = "ssl://127.0.0.1:64321";
|
||||
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
|
||||
$serverCtx = stream_context_create(['ssl' => [
|
||||
'local_cert' => '%s',
|
||||
'security_level' => 1,
|
||||
'local_cert' => '%s'
|
||||
]]);
|
||||
|
||||
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
|
||||
@@ -37,7 +36,6 @@ $clientCode = <<<'CODE'
|
||||
'cafile' => '%s',
|
||||
'peer_name' => '%s',
|
||||
'capture_session_meta' => true,
|
||||
'security_level' => 1,
|
||||
]]);
|
||||
|
||||
phpt_wait();
|
||||
|
||||
@@ -14,8 +14,7 @@ $serverCode = <<<'CODE'
|
||||
$serverUri = "ssl://127.0.0.1:64321";
|
||||
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
|
||||
$serverCtx = stream_context_create(['ssl' => [
|
||||
'local_cert' => '%s',
|
||||
'security_level' => 1,
|
||||
'local_cert' => '%s'
|
||||
]]);
|
||||
|
||||
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
|
||||
@@ -35,7 +34,6 @@ $clientCode = <<<'CODE'
|
||||
'verify_peer' => true,
|
||||
'cafile' => '%s',
|
||||
'peer_name' => '%s',
|
||||
'security_level' => 1,
|
||||
]]);
|
||||
|
||||
phpt_wait();
|
||||
|
||||
@@ -14,8 +14,7 @@ $serverCode = <<<'CODE'
|
||||
$serverUri = "ssl://127.0.0.1:64321";
|
||||
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
|
||||
$serverCtx = stream_context_create(['ssl' => [
|
||||
'local_cert' => '%s',
|
||||
'security_level' => 1,
|
||||
'local_cert' => '%s'
|
||||
]]);
|
||||
|
||||
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
|
||||
@@ -36,7 +35,6 @@ $clientCode = <<<'CODE'
|
||||
'verify_peer' => true,
|
||||
'cafile' => '%s',
|
||||
'peer_name' => '%s',
|
||||
'security_level' => 1,
|
||||
]]);
|
||||
|
||||
phpt_wait();
|
||||
|
||||
@@ -17,9 +17,8 @@ $serverCode = <<<'CODE'
|
||||
$serverCtx = stream_context_create(['ssl' => [
|
||||
'local_cert' => '%s',
|
||||
|
||||
// Only accept TLSv1.0 and TLSv1.2 connections
|
||||
// Only accept TLSv1.2 connections
|
||||
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_0_SERVER | STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
|
||||
'security_level' => 1,
|
||||
]]);
|
||||
|
||||
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
|
||||
@@ -40,7 +39,6 @@ $clientCode = <<<'CODE'
|
||||
'verify_peer' => true,
|
||||
'cafile' => '%s',
|
||||
'peer_name' => '%s',
|
||||
'security_level' => 1,
|
||||
]]);
|
||||
|
||||
phpt_wait();
|
||||
|
||||
@@ -16,7 +16,6 @@ $serverCode = <<<'CODE'
|
||||
$serverCtx = stream_context_create(['ssl' => [
|
||||
'local_cert' => '%s',
|
||||
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_0_SERVER,
|
||||
'security_level' => 1,
|
||||
]]);
|
||||
|
||||
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
|
||||
@@ -37,7 +36,6 @@ $clientCode = <<<'CODE'
|
||||
'verify_peer' => true,
|
||||
'cafile' => '%s',
|
||||
'peer_name' => '%s',
|
||||
'security_level' => 1,
|
||||
]]);
|
||||
|
||||
phpt_wait();
|
||||
|
||||
@@ -2644,10 +2644,6 @@ matched:
|
||||
the match again at the same point. If this fails (picked up above) we
|
||||
advance to the next character. */
|
||||
if (start_offset == offsets[0]) {
|
||||
/* Get next piece if no limit or limit not yet reached and something matched*/
|
||||
if (limit_val != -1 && limit_val <= 1) {
|
||||
break;
|
||||
}
|
||||
count = pcre2_match(pce->re, (PCRE2_SPTR)subject, ZSTR_LEN(subject_str), start_offset,
|
||||
PCRE2_NO_UTF_CHECK | PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED, match_data, mctx);
|
||||
if (count >= 0) {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80866 preg_split ignores limit flag when pattern with \K has 0-width fullstring match
|
||||
--FILE--
|
||||
<?php
|
||||
var_export(preg_split('~.{3}\K~', 'abcdefghijklm', 3));
|
||||
?>
|
||||
--EXPECT--
|
||||
array (
|
||||
0 => 'abc',
|
||||
1 => 'def',
|
||||
2 => 'ghijklm',
|
||||
)
|
||||
+6
-9
@@ -1424,10 +1424,9 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
}
|
||||
pgsql = (PGconn *) le->ptr;
|
||||
#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
|
||||
/* consider to use php_version_compare() here */
|
||||
if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 7.2) {
|
||||
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 7.2) {
|
||||
#else
|
||||
if (zend_strtod(PG_VERSION, NULL) >= 7.2) {
|
||||
if (atof(PG_VERSION) >= 7.2) {
|
||||
#endif
|
||||
pg_result = PQexec(pgsql, "RESET ALL;");
|
||||
PQclear(pg_result);
|
||||
@@ -5327,10 +5326,9 @@ PHP_FUNCTION(pg_get_notify)
|
||||
add_index_string(return_value, 0, pgsql_notify->relname);
|
||||
add_index_long(return_value, 1, pgsql_notify->be_pid);
|
||||
#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
|
||||
/* consider to use php_version_compare() here */
|
||||
if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 9.0) {
|
||||
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
|
||||
#else
|
||||
if (zend_strtod(PG_VERSION) >= 9.0, NULL) {
|
||||
if (atof(PG_VERSION) >= 9.0) {
|
||||
#endif
|
||||
#if HAVE_PQPARAMETERSTATUS
|
||||
add_index_string(return_value, 2, pgsql_notify->extra);
|
||||
@@ -5341,10 +5339,9 @@ PHP_FUNCTION(pg_get_notify)
|
||||
add_assoc_string(return_value, "message", pgsql_notify->relname);
|
||||
add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
|
||||
#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
|
||||
/* consider to use php_version_compare() here */
|
||||
if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 9.0) {
|
||||
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
|
||||
#else
|
||||
if (zend_strtod(PG_VERSION, NULL) >= 9.0) {
|
||||
if (atof(PG_VERSION) >= 9.0) {
|
||||
#endif
|
||||
#if HAVE_PQPARAMETERSTATUS
|
||||
add_assoc_string(return_value, "payload", pgsql_notify->extra);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH PHAR 1 "2021" "The PHP Group" "User Commands"
|
||||
.TH PHAR 1 "2019" "The PHP Group" "User Commands"
|
||||
.SH NAME
|
||||
phar, phar.phar \- PHAR (PHP archive) command line tool
|
||||
.SH SYNOPSIS
|
||||
|
||||
+18
-42
@@ -2508,7 +2508,6 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
smart_str main_metadata_str = {0};
|
||||
int free_user_stub, free_fp = 1, free_ufp = 1;
|
||||
int manifest_hack = 0;
|
||||
php_stream *shared_cfp = NULL;
|
||||
|
||||
if (phar->is_persistent) {
|
||||
if (error) {
|
||||
@@ -2603,7 +2602,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
}
|
||||
php_stream_close(newfile);
|
||||
if (error) {
|
||||
spprintf(error, 0, "illegal stub for phar \"%s\" (__HALT_COMPILER(); is missing)", phar->fname);
|
||||
spprintf(error, 0, "illegal stub for phar \"%s\"", phar->fname);
|
||||
}
|
||||
if (free_user_stub) {
|
||||
zend_string_free(suser_stub);
|
||||
@@ -2789,13 +2788,10 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
return EOF;
|
||||
}
|
||||
|
||||
/* create new file that holds the compressed versions */
|
||||
/* create new file that holds the compressed version */
|
||||
/* work around inability to specify freedom in write and strictness
|
||||
in read count */
|
||||
if (shared_cfp == NULL) {
|
||||
shared_cfp = php_stream_fopen_tmpfile();
|
||||
}
|
||||
entry->cfp = shared_cfp;
|
||||
entry->cfp = php_stream_fopen_tmpfile();
|
||||
if (!entry->cfp) {
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to create temporary file");
|
||||
@@ -2804,11 +2800,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
php_stream_close(newfile);
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
/* for real phars, header_offset is unused; we misuse it here to store the offset in the temp file */
|
||||
ZEND_ASSERT(entry->header_offset == 0);
|
||||
entry->header_offset = php_stream_tell(entry->cfp);
|
||||
php_stream_flush(file);
|
||||
if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) {
|
||||
if (closeoldfile) {
|
||||
@@ -2818,7 +2811,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
|
||||
}
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
php_stream_filter_append((&entry->cfp->writefilters), filter);
|
||||
if (SUCCESS != php_stream_copy_to_stream_ex(file, entry->cfp, entry->uncompressed_filesize, NULL)) {
|
||||
@@ -2829,14 +2822,15 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to copy compressed file contents of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
|
||||
}
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
php_stream_filter_flush(filter, 1);
|
||||
php_stream_flush(entry->cfp);
|
||||
php_stream_filter_remove(filter, 1);
|
||||
php_stream_seek(entry->cfp, 0, SEEK_END);
|
||||
entry->compressed_filesize = ((uint32_t) php_stream_tell(entry->cfp)) - entry->header_offset;
|
||||
entry->compressed_filesize = (uint32_t) php_stream_tell(entry->cfp);
|
||||
/* generate crc on compressed file */
|
||||
php_stream_rewind(entry->cfp);
|
||||
entry->old_flags = entry->flags;
|
||||
entry->is_modified = 1;
|
||||
global_flags |= (entry->flags & PHAR_ENT_COMPRESSION_MASK);
|
||||
@@ -2892,7 +2886,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
spprintf(error, 0, "unable to write manifest header of new phar \"%s\"", phar->fname);
|
||||
}
|
||||
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
phar->alias_len = restore_alias_len;
|
||||
@@ -2913,7 +2907,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
spprintf(error, 0, "unable to write manifest meta-data of new phar \"%s\"", phar->fname);
|
||||
}
|
||||
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
smart_str_free(&main_metadata_str);
|
||||
|
||||
@@ -2948,7 +2942,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
spprintf(error, 0, "unable to write filename of file \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname);
|
||||
}
|
||||
}
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
/* set the manifest meta-data:
|
||||
@@ -2981,7 +2975,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
spprintf(error, 0, "unable to write temporary manifest of file \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname);
|
||||
}
|
||||
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
/* Hack - see bug #65028, add padding byte to the end of the manifest */
|
||||
@@ -2997,7 +2991,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
spprintf(error, 0, "unable to write manifest padding byte");
|
||||
}
|
||||
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3010,7 +3004,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
|
||||
if (entry->cfp) {
|
||||
file = entry->cfp;
|
||||
php_stream_seek(file, entry->header_offset, SEEK_SET);
|
||||
php_stream_rewind(file);
|
||||
} else {
|
||||
file = phar_get_efp(entry, 0);
|
||||
if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) {
|
||||
@@ -3021,7 +3015,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
|
||||
}
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3033,7 +3027,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
|
||||
}
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
/* this will have changed for all files that have either changed compression or been modified */
|
||||
@@ -3050,14 +3044,14 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
spprintf(error, 0, "unable to write contents of file \"%s\" to new phar \"%s\"", entry->filename, phar->fname);
|
||||
}
|
||||
|
||||
goto cleanup;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
entry->is_modified = 0;
|
||||
|
||||
if (entry->cfp) {
|
||||
php_stream_close(entry->cfp);
|
||||
entry->cfp = NULL;
|
||||
entry->header_offset = 0;
|
||||
}
|
||||
|
||||
if (entry->fp_type == PHAR_MOD) {
|
||||
@@ -3073,11 +3067,6 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
if (shared_cfp != NULL) {
|
||||
php_stream_close(shared_cfp);
|
||||
shared_cfp = NULL;
|
||||
}
|
||||
|
||||
/* append signature */
|
||||
if (global_flags & PHAR_HDR_SIGNATURE) {
|
||||
char sig_buf[4];
|
||||
@@ -3207,19 +3196,6 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
|
||||
return EOF;
|
||||
}
|
||||
|
||||
return EOF;
|
||||
|
||||
cleanup:
|
||||
if (shared_cfp != NULL) {
|
||||
php_stream_close(shared_cfp);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(&phar->manifest, entry) {
|
||||
if (entry->cfp) {
|
||||
entry->cfp = NULL;
|
||||
entry->header_offset = 0;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
return EOF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+20
-18
@@ -609,7 +609,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
if (NULL == (z_script_name = zend_hash_str_find(_server, "SCRIPT_NAME", sizeof("SCRIPT_NAME")-1)) ||
|
||||
IS_STRING != Z_TYPE_P(z_script_name) ||
|
||||
!strstr(Z_STRVAL_P(z_script_name), basename)) {
|
||||
goto finish;
|
||||
return;
|
||||
}
|
||||
|
||||
if (NULL != (z_path_info = zend_hash_str_find(_server, "PATH_INFO", sizeof("PATH_INFO")-1)) &&
|
||||
@@ -634,7 +634,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
testit = sapi_getenv("SCRIPT_NAME", sizeof("SCRIPT_NAME")-1);
|
||||
if (!(pt = strstr(testit, basename))) {
|
||||
efree(testit);
|
||||
goto finish;
|
||||
return;
|
||||
}
|
||||
|
||||
path_info = sapi_getenv("PATH_INFO", sizeof("PATH_INFO")-1);
|
||||
@@ -659,7 +659,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
|
||||
if (!(pt = strstr(path_info, basename))) {
|
||||
/* this can happen with rewrite rules - and we have no idea what to do then, so return */
|
||||
goto finish;
|
||||
return;
|
||||
}
|
||||
|
||||
entry_len = strlen(path_info);
|
||||
@@ -685,7 +685,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
}
|
||||
efree(pt);
|
||||
|
||||
goto finish;
|
||||
return;
|
||||
}
|
||||
|
||||
fci.param_count = 1;
|
||||
@@ -703,7 +703,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
}
|
||||
efree(pt);
|
||||
|
||||
goto finish;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(fci.retval) == IS_UNDEF || Z_TYPE(retval) == IS_UNDEF) {
|
||||
@@ -712,7 +712,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
}
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false");
|
||||
efree(pt);
|
||||
goto finish;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Z_TYPE(retval)) {
|
||||
@@ -731,7 +731,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
efree(pt);
|
||||
|
||||
zend_bailout();
|
||||
goto finish;
|
||||
return;
|
||||
default:
|
||||
if (free_pathinfo) {
|
||||
efree(path_info);
|
||||
@@ -739,7 +739,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
efree(pt);
|
||||
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false");
|
||||
goto finish;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,6 +812,9 @@ PHP_METHOD(Phar, webPhar)
|
||||
if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL) ||
|
||||
(info = phar_get_entry_info(phar, entry, entry_len, NULL, 0)) == NULL) {
|
||||
phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len);
|
||||
#ifdef PHP_WIN32
|
||||
efree(fname);
|
||||
#endif
|
||||
zend_bailout();
|
||||
}
|
||||
|
||||
@@ -835,8 +838,10 @@ PHP_METHOD(Phar, webPhar)
|
||||
}
|
||||
efree(pt);
|
||||
efree(entry);
|
||||
RETVAL_FALSE;
|
||||
goto finish;
|
||||
#ifdef PHP_WIN32
|
||||
efree(fname);
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
case IS_STRING:
|
||||
@@ -850,8 +855,10 @@ PHP_METHOD(Phar, webPhar)
|
||||
}
|
||||
efree(pt);
|
||||
efree(entry);
|
||||
RETVAL_FALSE;
|
||||
goto finish;
|
||||
#ifdef PHP_WIN32
|
||||
efree(fname);
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -861,11 +868,6 @@ PHP_METHOD(Phar, webPhar)
|
||||
code = phar_file_type(&PHAR_G(mime_types), entry, &mime_type);
|
||||
}
|
||||
phar_file_action(phar, info, mime_type, code, entry, entry_len, fname, pt, ru, ru_len);
|
||||
|
||||
finish: ;
|
||||
#ifdef PHP_WIN32
|
||||
efree(fname);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -4275,7 +4277,7 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if ((phar_get_fp_type(entry) == PHAR_FP && (entry->flags & PHAR_ENT_COMPRESSION_MASK)) || !phar_get_efp(entry, 0)) {
|
||||
if (!phar_get_efp(entry, 0)) {
|
||||
if (FAILURE == phar_open_entry_fp(entry, error, 1)) {
|
||||
if (error) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", unable to open internal file pointer: %s", entry->filename, fullpath, *error);
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69279 (Compressed ZIP Phar extractTo() creates garbage files)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('phar')) die('skip phar extension not available');
|
||||
if (!extension_loaded('zlib')) die('skip zlib extension not available');
|
||||
?>
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
--FILE--
|
||||
<?php
|
||||
$w = new Phar(__DIR__ . "/bug69279.phar.zip");
|
||||
$w["bug69279.txt"] = "Sample content.";
|
||||
$w->compressFiles(Phar::GZ);
|
||||
unset($w);
|
||||
|
||||
$r = new Phar(__DIR__ . "/bug69279.phar.zip");
|
||||
var_dump($r["bug69279.txt"]->isCompressed());
|
||||
|
||||
$r->extractTo(__DIR__, NULL, TRUE);
|
||||
var_dump(file_get_contents(__DIR__ . "/bug69279.txt"));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
string(15) "Sample content."
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . "/bug69279.txt");
|
||||
@unlink(__DIR__ . "/bug69279.phar.zip");
|
||||
?>
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69279 (Compressed ZIP Phar extractTo() creates garbage files)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('phar')) die('skip phar extension not available');
|
||||
if (!extension_loaded('zlib')) die('skip zlib extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$phar = new PharData(__DIR__ . '/bug69279a.zip');
|
||||
mkdir(__DIR__ . '/bug69279a');
|
||||
var_dump($phar->extractTo(__DIR__ . '/bug69279a', null, true));
|
||||
var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/1.txt'), 'Lorem ipsum', 11));
|
||||
var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/2.txt'), 'foo', 3));
|
||||
var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/3.txt'), 'Lorem ipsum', 11));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/bug69279a/1.txt');
|
||||
@unlink(__DIR__ . '/bug69279a/2.txt');
|
||||
@unlink(__DIR__ . '/bug69279a/3.txt');
|
||||
@rmdir(__DIR__ . '/bug69279a');
|
||||
Binary file not shown.
@@ -14,7 +14,7 @@ $r = new Phar($fname, 0);
|
||||
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
UnexpectedValueException: phar error: end of central directory not found in zip-based phar "%sbug69441.phar" in %sbug69441.php:%d
|
||||
UnexpectedValueException: phar error: corrupted central directory entry, no magic signature in zip-based phar "%sbug69441.phar" in %sbug69441.php:%d
|
||||
Stack trace:
|
||||
#0 %s%ebug69441.php(%d): Phar->__construct('%s', 0)
|
||||
#1 {main}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70091 (Phar does not mark UTF-8 filenames in ZIP archives)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('phar')) die('skip phar extension not available');
|
||||
if (!extension_loaded('zlib')) die('skip zlib extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$phar = new PharData(__DIR__ . '/bug70091.zip');
|
||||
$phar->addFromString('föö', '');
|
||||
$phar->addFromString('foo', '');
|
||||
unset($phar);
|
||||
|
||||
$stream = fopen(__DIR__ . '/bug70091.zip', 'r');
|
||||
|
||||
$data = fread($stream, 8);
|
||||
var_dump(unpack('H8sig/@6/nflags', $data));
|
||||
|
||||
fseek($stream, 53);
|
||||
$data = fread($stream, 8);
|
||||
var_dump(unpack('H8sig/@6/nflags', $data));
|
||||
|
||||
fseek($stream, 104);
|
||||
$data = fread($stream, 10);
|
||||
var_dump(unpack('H8sig/@8/nflags', $data));
|
||||
|
||||
fseek($stream, 173);
|
||||
$data = fread($stream, 10);
|
||||
var_dump(unpack('H8sig/@8/nflags', $data));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["sig"]=>
|
||||
string(8) "504b0304"
|
||||
["flags"]=>
|
||||
int(8)
|
||||
}
|
||||
array(2) {
|
||||
["sig"]=>
|
||||
string(8) "504b0304"
|
||||
["flags"]=>
|
||||
int(8)
|
||||
}
|
||||
array(2) {
|
||||
["sig"]=>
|
||||
string(8) "504b0102"
|
||||
["flags"]=>
|
||||
int(8)
|
||||
}
|
||||
array(2) {
|
||||
["sig"]=>
|
||||
string(8) "504b0102"
|
||||
["flags"]=>
|
||||
int(8)
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/bug70091.zip');
|
||||
?>
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #77565 (Incorrect locator detection in ZIP-based phars)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('phar')) die('skip phar extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$phar = new PharData(__DIR__ . '/bug77565.zip');
|
||||
var_dump($phar['1.zip']->getFilename());
|
||||
?>
|
||||
--EXPECT--
|
||||
string(5) "1.zip"
|
||||
Binary file not shown.
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79912 (Phar::decompressFiles not working)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('phar')) die('skip phar extension is not available');
|
||||
if (!extension_loaded('zlib')) die('skip zlib extension not available');
|
||||
?>
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
--FILE--
|
||||
<?php
|
||||
$phar = new Phar(__DIR__ . "/bug79912.phar");
|
||||
$phar->addFromString("test.txt", "This is a test file.This is a test file.This is a test file.");
|
||||
$file = $phar["test.txt"];
|
||||
var_dump($file->compress(Phar::GZ)); //true (success)
|
||||
var_dump($file->getContent());
|
||||
var_dump($file->isCompressed()); //true (the file is compressed)
|
||||
var_dump($phar->decompressFiles()); //true (success)
|
||||
var_dump($file->isCompressed()); //false (the file should not be compressed anymore)
|
||||
var_dump($phar->extractTo(__DIR__ . "/bug79912")); //true
|
||||
var_dump(file_get_contents(__DIR__ . "/bug79912/test.txt")); //the extracted file in the folder should be decompressed
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
string(60) "This is a test file.This is a test file.This is a test file."
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
string(60) "This is a test file.This is a test file.This is a test file."
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . "/bug79912/test.txt");
|
||||
@rmdir(__DIR__ . "/bug79912");
|
||||
@unlink(__DIR__ . "/bug79912.phar");
|
||||
?>
|
||||
@@ -48,7 +48,7 @@ __HALT_COMPILER();
|
||||
string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
|
||||
string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
|
||||
bool(true)
|
||||
Exception: illegal stub for phar "%sphar_stub_error.phar.php" (__HALT_COMPILER(); is missing)
|
||||
Exception: illegal stub for phar "%sphar_stub_error.phar.php"
|
||||
string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
|
||||
bool(true)
|
||||
string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
|
||||
|
||||
@@ -12,5 +12,5 @@ try {
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
phar error: end of central directory not found in zip-based phar "%sfilecomment.zip"
|
||||
phar error: corrupt zip archive, zip file comment truncated in zip-based phar "%sfilecomment.zip"
|
||||
===DONE===
|
||||
+45
-72
@@ -161,29 +161,6 @@ static void phar_zip_u2d_time(time_t time, char *dtime, char *ddate) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static char *phar_find_eocd(const char *s, size_t n)
|
||||
{
|
||||
const char *end = s + n + sizeof("PK\5\6") - 1 - sizeof(phar_zip_dir_end);
|
||||
|
||||
/* search backwards for end of central directory signatures */
|
||||
do {
|
||||
uint16_t comment_len;
|
||||
const char *eocd_start = zend_memnrstr(s, "PK\5\6", sizeof("PK\5\6") - 1, end);
|
||||
|
||||
if (eocd_start == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ZEND_ASSERT(eocd_start + sizeof(phar_zip_dir_end) <= s + n);
|
||||
comment_len = PHAR_GET_16(((phar_zip_dir_end *) eocd_start)->comment_len);
|
||||
if (eocd_start + sizeof(phar_zip_dir_end) + comment_len == s + n) {
|
||||
/* we can't be sure, but this looks like the proper EOCD signature */
|
||||
return (char *) eocd_start;
|
||||
}
|
||||
end = eocd_start;
|
||||
} while (end > s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does not check for a previously opened phar in the cache.
|
||||
*
|
||||
@@ -228,55 +205,57 @@ int phar_parse_zipfile(php_stream *fp, char *fname, size_t fname_len, char *alia
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if ((p = phar_find_eocd(buf, size)) != NULL) {
|
||||
memcpy((void *)&locator, (void *) p, sizeof(locator));
|
||||
if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) {
|
||||
/* split archives not handled */
|
||||
php_stream_close(fp);
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: split archives spanning multiple zips cannot be processed in zip-based phar \"%s\"", fname);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (PHAR_GET_16(locator.counthere) != PHAR_GET_16(locator.count)) {
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar \"%s\"", fname);
|
||||
}
|
||||
php_stream_close(fp);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
mydata = pecalloc(1, sizeof(phar_archive_data), PHAR_G(persist));
|
||||
mydata->is_persistent = PHAR_G(persist);
|
||||
|
||||
/* read in archive comment, if any */
|
||||
if (PHAR_GET_16(locator.comment_len)) {
|
||||
|
||||
metadata = p + sizeof(locator);
|
||||
|
||||
if (PHAR_GET_16(locator.comment_len) != size - (metadata - buf)) {
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: corrupt zip archive, zip file comment truncated in zip-based phar \"%s\"", fname);
|
||||
}
|
||||
while ((p=(char *) memchr(p + 1, 'P', (size_t) (size - (p + 1 - buf)))) != NULL) {
|
||||
if ((p - buf) + sizeof(locator) <= (size_t)size && !memcmp(p + 1, "K\5\6", 3)) {
|
||||
memcpy((void *)&locator, (void *) p, sizeof(locator));
|
||||
if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) {
|
||||
/* split archives not handled */
|
||||
php_stream_close(fp);
|
||||
pefree(mydata, mydata->is_persistent);
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: split archives spanning multiple zips cannot be processed in zip-based phar \"%s\"", fname);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
mydata->metadata_len = PHAR_GET_16(locator.comment_len);
|
||||
|
||||
if (phar_parse_metadata(&metadata, &mydata->metadata, PHAR_GET_16(locator.comment_len)) == FAILURE) {
|
||||
mydata->metadata_len = 0;
|
||||
/* if not valid serialized data, it is a regular string */
|
||||
|
||||
ZVAL_NEW_STR(&mydata->metadata, zend_string_init(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent));
|
||||
if (PHAR_GET_16(locator.counthere) != PHAR_GET_16(locator.count)) {
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar \"%s\"", fname);
|
||||
}
|
||||
php_stream_close(fp);
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
ZVAL_UNDEF(&mydata->metadata);
|
||||
}
|
||||
|
||||
goto foundit;
|
||||
mydata = pecalloc(1, sizeof(phar_archive_data), PHAR_G(persist));
|
||||
mydata->is_persistent = PHAR_G(persist);
|
||||
|
||||
/* read in archive comment, if any */
|
||||
if (PHAR_GET_16(locator.comment_len)) {
|
||||
|
||||
metadata = p + sizeof(locator);
|
||||
|
||||
if (PHAR_GET_16(locator.comment_len) != size - (metadata - buf)) {
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: corrupt zip archive, zip file comment truncated in zip-based phar \"%s\"", fname);
|
||||
}
|
||||
php_stream_close(fp);
|
||||
pefree(mydata, mydata->is_persistent);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
mydata->metadata_len = PHAR_GET_16(locator.comment_len);
|
||||
|
||||
if (phar_parse_metadata(&metadata, &mydata->metadata, PHAR_GET_16(locator.comment_len)) == FAILURE) {
|
||||
mydata->metadata_len = 0;
|
||||
/* if not valid serialized data, it is a regular string */
|
||||
|
||||
ZVAL_NEW_STR(&mydata->metadata, zend_string_init(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent));
|
||||
}
|
||||
} else {
|
||||
ZVAL_UNDEF(&mydata->metadata);
|
||||
}
|
||||
|
||||
goto foundit;
|
||||
}
|
||||
}
|
||||
|
||||
php_stream_close(fp);
|
||||
@@ -829,7 +808,6 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg) /* {{{
|
||||
zend_off_t offset;
|
||||
int not_really_modified = 0;
|
||||
p = (struct _phar_zip_pass*) arg;
|
||||
uint16_t general_purpose_flags;
|
||||
|
||||
if (entry->is_mounted) {
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
@@ -879,11 +857,6 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg) /* {{{
|
||||
memcpy(central.datestamp, local.datestamp, sizeof(local.datestamp));
|
||||
PHAR_SET_16(central.filename_len, entry->filename_len + (entry->is_dir ? 1 : 0));
|
||||
PHAR_SET_16(local.filename_len, entry->filename_len + (entry->is_dir ? 1 : 0));
|
||||
// set language encoding flag (all filenames have to be UTF-8 anyway)
|
||||
general_purpose_flags = PHAR_GET_16(central.flags);
|
||||
PHAR_SET_16(central.flags, general_purpose_flags | (1 << 11));
|
||||
general_purpose_flags = PHAR_GET_16(local.flags);
|
||||
PHAR_SET_16(local.flags, general_purpose_flags | (1 << 11));
|
||||
PHAR_SET_32(central.offset, php_stream_tell(p->filefp));
|
||||
|
||||
/* do extra field for perms later */
|
||||
|
||||
@@ -555,7 +555,6 @@ static char **_readline_completion_cb(const char *text, int start, int end)
|
||||
|
||||
if (call_user_function(NULL, NULL, &_readline_completion, &_readline_array, 3, params) == SUCCESS) {
|
||||
if (Z_TYPE(_readline_array) == IS_ARRAY) {
|
||||
SEPARATE_ARRAY(&_readline_array);
|
||||
if (zend_hash_num_elements(Z_ARRVAL(_readline_array))) {
|
||||
matches = rl_completion_matches(text,_readline_command_generator);
|
||||
} else {
|
||||
|
||||
@@ -1534,11 +1534,6 @@ ZEND_METHOD(reflection_function, __construct)
|
||||
}
|
||||
}
|
||||
|
||||
if (intern->ptr) {
|
||||
zval_ptr_dtor(&intern->obj);
|
||||
zval_ptr_dtor(reflection_prop_name(object));
|
||||
}
|
||||
|
||||
ZVAL_STR_COPY(reflection_prop_name(object), fptr->common.function_name);
|
||||
intern->ptr = fptr;
|
||||
intern->ref_type = REF_TYPE_FUNCTION;
|
||||
@@ -2078,10 +2073,6 @@ ZEND_METHOD(reflection_generator, __construct)
|
||||
return;
|
||||
}
|
||||
|
||||
if (intern->ce) {
|
||||
zval_ptr_dtor(&intern->obj);
|
||||
}
|
||||
|
||||
intern->ref_type = REF_TYPE_GENERATOR;
|
||||
Z_ADDREF_P(generator);
|
||||
ZVAL_OBJ(&intern->obj, Z_OBJ_P(generator));
|
||||
|
||||
+9
-11
@@ -1261,11 +1261,13 @@ static void php_session_remove_cookie(void) {
|
||||
zend_llist_element *next;
|
||||
zend_llist_element *current;
|
||||
char *session_cookie;
|
||||
zend_string *e_session_name;
|
||||
size_t session_cookie_len;
|
||||
size_t len = sizeof("Set-Cookie")-1;
|
||||
|
||||
ZEND_ASSERT(strpbrk(PS(session_name), "=,; \t\r\n\013\014") == NULL);
|
||||
spprintf(&session_cookie, 0, "Set-Cookie: %s=", PS(session_name));
|
||||
e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name)));
|
||||
spprintf(&session_cookie, 0, "Set-Cookie: %s=", ZSTR_VAL(e_session_name));
|
||||
zend_string_free(e_session_name);
|
||||
|
||||
session_cookie_len = strlen(session_cookie);
|
||||
current = l->head;
|
||||
@@ -1297,7 +1299,7 @@ static int php_session_send_cookie(void) /* {{{ */
|
||||
{
|
||||
smart_str ncookie = {0};
|
||||
zend_string *date_fmt = NULL;
|
||||
zend_string *e_id;
|
||||
zend_string *e_session_name, *e_id;
|
||||
|
||||
if (SG(headers_sent)) {
|
||||
const char *output_start_filename = php_output_get_start_filename();
|
||||
@@ -1311,20 +1313,16 @@ static int php_session_send_cookie(void) /* {{{ */
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Prevent broken Set-Cookie header, because the session_name might be user supplied */
|
||||
if (strpbrk(PS(session_name), "=,; \t\r\n\013\014") != NULL) { /* man isspace for \013 and \014 */
|
||||
php_error_docref(NULL, E_WARNING, "session.name cannot contain any of the following '=,; \\t\\r\\n\\013\\014'");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* URL encode id because it might be user supplied */
|
||||
/* URL encode session_name and id because they might be user supplied */
|
||||
e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name)));
|
||||
e_id = php_url_encode(ZSTR_VAL(PS(id)), ZSTR_LEN(PS(id)));
|
||||
|
||||
smart_str_appendl(&ncookie, "Set-Cookie: ", sizeof("Set-Cookie: ")-1);
|
||||
smart_str_appendl(&ncookie, PS(session_name), strlen(PS(session_name)));
|
||||
smart_str_appendl(&ncookie, ZSTR_VAL(e_session_name), ZSTR_LEN(e_session_name));
|
||||
smart_str_appendc(&ncookie, '=');
|
||||
smart_str_appendl(&ncookie, ZSTR_VAL(e_id), ZSTR_LEN(e_id));
|
||||
|
||||
zend_string_release_ex(e_session_name, 0);
|
||||
zend_string_release_ex(e_id, 0);
|
||||
|
||||
if (PS(cookie_lifetime) > 0) {
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80774 (session_name() problem with backslash)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('session')) die("skip session extension not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
session_name("foo\\bar");
|
||||
session_id('12345');
|
||||
session_start();
|
||||
?>
|
||||
--EXPECTHEADERS--
|
||||
Set-Cookie: foo\bar=12345; path=/
|
||||
--EXPECT--
|
||||
@@ -48,8 +48,6 @@ string(9) "PHPSESSID"
|
||||
bool(true)
|
||||
string(9) "PHPSESSID"
|
||||
string(9) "PHPSESSID"
|
||||
|
||||
Warning: session_start(): session.name cannot contain any of the following '=,; \t\r\n\013\014' in %s on line %d
|
||||
bool(true)
|
||||
string(1) " "
|
||||
bool(true)
|
||||
@@ -57,8 +55,6 @@ string(1) " "
|
||||
|
||||
Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d
|
||||
string(1) " "
|
||||
|
||||
Warning: session_start(): session.name cannot contain any of the following '=,; \t\r\n\013\014' in %s on line %d
|
||||
bool(true)
|
||||
string(1) " "
|
||||
bool(true)
|
||||
|
||||
+14
-15
@@ -315,8 +315,6 @@ void sdl_restore_uri_credentials(sdlCtx *ctx)
|
||||
ctx->context = NULL;
|
||||
}
|
||||
|
||||
#define SAFE_STR(a) ((a)?((const char *)a):"")
|
||||
|
||||
static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include)
|
||||
{
|
||||
sdlPtr tmpsdl = ctx->sdl;
|
||||
@@ -378,7 +376,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include)
|
||||
if (node_is_equal_ex(trav2, "schema", XSD_NAMESPACE)) {
|
||||
load_schema(ctx, trav2);
|
||||
} else if (is_wsdl_element(trav2) && !node_is_equal(trav2,"documentation")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav2->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name);
|
||||
}
|
||||
trav2 = trav2->next;
|
||||
}
|
||||
@@ -439,7 +437,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include)
|
||||
soap_error0(E_ERROR, "Parsing WSDL: <service> has no name attribute");
|
||||
}
|
||||
} else if (!node_is_equal(trav,"documentation")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name);
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
@@ -549,7 +547,7 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml
|
||||
}
|
||||
smart_str_free(&key);
|
||||
} else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name);
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
@@ -651,7 +649,7 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap
|
||||
}
|
||||
smart_str_free(&key);
|
||||
} else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name);
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
@@ -683,14 +681,14 @@ static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
|
||||
sdlParamPtr param;
|
||||
|
||||
if (trav->ns != NULL && strcmp((char*)trav->ns->href, WSDL_NAMESPACE) != 0) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected extensibility element <%s>", SAFE_STR(trav->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected extensibility element <%s>", trav->name);
|
||||
}
|
||||
if (node_is_equal(trav,"documentation")) {
|
||||
trav = trav->next;
|
||||
continue;
|
||||
}
|
||||
if (!node_is_equal(trav,"part")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name);
|
||||
}
|
||||
part = trav;
|
||||
param = emalloc(sizeof(sdlParam));
|
||||
@@ -699,7 +697,7 @@ static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
|
||||
|
||||
name = get_attribute(part->properties, "name");
|
||||
if (name == NULL) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: No name associated with <part> '%s'", SAFE_STR(message->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: No name associated with <part> '%s'", message->name);
|
||||
}
|
||||
|
||||
param->paramName = estrdup((char*)name->children->content);
|
||||
@@ -741,8 +739,9 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
|
||||
zend_hash_init(&ctx.portTypes, 0, NULL, NULL, 0);
|
||||
zend_hash_init(&ctx.services, 0, NULL, NULL, 0);
|
||||
|
||||
zend_try {
|
||||
load_wsdl_ex(this_ptr, struri, &ctx, 0);
|
||||
zend_try {
|
||||
|
||||
schema_pass2(&ctx);
|
||||
|
||||
n = zend_hash_num_elements(&ctx.services);
|
||||
@@ -769,7 +768,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
|
||||
continue;
|
||||
}
|
||||
if (!node_is_equal(trav,"port")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name);
|
||||
}
|
||||
|
||||
port = trav;
|
||||
@@ -808,7 +807,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
|
||||
}
|
||||
}
|
||||
if (trav2 != address && is_wsdl_element(trav2) && !node_is_equal(trav2,"documentation")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav2->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name);
|
||||
}
|
||||
trav2 = trav2->next;
|
||||
}
|
||||
@@ -910,7 +909,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
|
||||
continue;
|
||||
}
|
||||
if (!node_is_equal(trav2,"operation")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav2->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name);
|
||||
}
|
||||
|
||||
operation = trav2;
|
||||
@@ -929,7 +928,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
|
||||
!node_is_equal(trav3,"output") &&
|
||||
!node_is_equal(trav3,"fault") &&
|
||||
!node_is_equal(trav3,"documentation")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav3->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav3->name);
|
||||
}
|
||||
trav3 = trav3->next;
|
||||
}
|
||||
@@ -1107,7 +1106,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
|
||||
}
|
||||
}
|
||||
} else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) {
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name));
|
||||
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name);
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
|
||||
+2
-2
@@ -199,7 +199,7 @@ xmlNsPtr node_find_ns(xmlNodePtr node)
|
||||
|
||||
int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns)
|
||||
{
|
||||
if (name == NULL || ((node->name) && strcmp((char*)node->name, name) == 0)) {
|
||||
if (name == NULL || strcmp((char*)node->name, name) == 0) {
|
||||
if (ns) {
|
||||
xmlNsPtr nsPtr = attr_find_ns(node);
|
||||
if (nsPtr) {
|
||||
@@ -215,7 +215,7 @@ int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns)
|
||||
|
||||
int node_is_equal_ex(xmlNodePtr node, char *name, char *ns)
|
||||
{
|
||||
if (name == NULL || ((node->name) && strcmp((char*)node->name, name) == 0)) {
|
||||
if (name == NULL || strcmp((char*)node->name, name) == 0) {
|
||||
if (ns) {
|
||||
xmlNsPtr nsPtr = node_find_ns(node);
|
||||
if (nsPtr) {
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80672 Null Dereference in SoapClient
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
$client = new SoapClient(__DIR__ . "/bug80672.xml");
|
||||
$query = $soap->query(array('sXML' => 'something'));
|
||||
} catch(SoapFault $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<soap:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/">
|
||||
<![CDATA[test]]>
|
||||
</soap:definitions>
|
||||
+2
-2
@@ -1179,7 +1179,7 @@ SPL_METHOD(Array, __construct)
|
||||
spl_array_object *intern;
|
||||
zval *array;
|
||||
zend_long ar_flags = 0;
|
||||
zend_class_entry *ce_get_iterator = spl_ce_ArrayIterator;
|
||||
zend_class_entry *ce_get_iterator = spl_ce_Iterator;
|
||||
|
||||
if (ZEND_NUM_ARGS() == 0) {
|
||||
return; /* nothing to do */
|
||||
@@ -1232,7 +1232,7 @@ SPL_METHOD(Array, setIteratorClass)
|
||||
{
|
||||
zval *object = ZEND_THIS;
|
||||
spl_array_object *intern = Z_SPLARRAY_P(object);
|
||||
zend_class_entry *ce_get_iterator = spl_ce_ArrayIterator;
|
||||
zend_class_entry * ce_get_iterator = spl_ce_Iterator;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_CLASS(ce_get_iterator)
|
||||
|
||||
+19
-3
@@ -1677,7 +1677,15 @@ zend_object_iterator *spl_filesystem_dir_get_iterator(zend_class_entry *ce, zval
|
||||
static void spl_filesystem_dir_it_dtor(zend_object_iterator *iter)
|
||||
{
|
||||
spl_filesystem_iterator *iterator = (spl_filesystem_iterator *)iter;
|
||||
zval_ptr_dtor(&iterator->intern.data);
|
||||
|
||||
if (!Z_ISUNDEF(iterator->intern.data)) {
|
||||
zval *object = &iterator->intern.data;
|
||||
zval_ptr_dtor(object);
|
||||
}
|
||||
/* Otherwise we were called from the owning object free storage handler as
|
||||
* it sets iterator->intern.data to IS_UNDEF.
|
||||
* We don't even need to destroy iterator->current as we didn't add a
|
||||
* reference to it in move_forward or get_iterator */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1739,8 +1747,16 @@ static void spl_filesystem_dir_it_rewind(zend_object_iterator *iter)
|
||||
static void spl_filesystem_tree_it_dtor(zend_object_iterator *iter)
|
||||
{
|
||||
spl_filesystem_iterator *iterator = (spl_filesystem_iterator *)iter;
|
||||
zval_ptr_dtor(&iterator->intern.data);
|
||||
zval_ptr_dtor(&iterator->current);
|
||||
|
||||
if (!Z_ISUNDEF(iterator->intern.data)) {
|
||||
zval *object = &iterator->intern.data;
|
||||
zval_ptr_dtor(object);
|
||||
} else {
|
||||
if (!Z_ISUNDEF(iterator->current)) {
|
||||
zval_ptr_dtor(&iterator->current);
|
||||
ZVAL_UNDEF(&iterator->current);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@ try {
|
||||
?>
|
||||
--EXPECT--
|
||||
Bad iterator type:
|
||||
ArrayObject::__construct() expects parameter 3 to be a class name derived from ArrayIterator, 'Exception' given(6)
|
||||
ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'Exception' given(6)
|
||||
Non-existent class:
|
||||
ArrayObject::__construct() expects parameter 3 to be a class name derived from ArrayIterator, 'nonExistentClassName' given(13)
|
||||
ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClassName' given(13)
|
||||
@@ -43,14 +43,14 @@ try {
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from ArrayIterator, 'nonExistentClass' given in %s on line %d
|
||||
Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given in %s on line 4
|
||||
a=>1
|
||||
b=>2
|
||||
c=>3
|
||||
|
||||
Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from ArrayIterator, 'stdClass' given in %s on line %d
|
||||
Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given in %s on line 14
|
||||
a=>1
|
||||
b=>2
|
||||
c=>3
|
||||
string(118) "ArrayObject::__construct() expects parameter 3 to be a class name derived from ArrayIterator, 'nonExistentClass' given"
|
||||
string(110) "ArrayObject::__construct() expects parameter 3 to be a class name derived from ArrayIterator, 'stdClass' given"
|
||||
string(113) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClass' given"
|
||||
string(105) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'stdClass' given"
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80719: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = new ArrayObject([42]);
|
||||
$array->setIteratorClass(FilterIterator::class);
|
||||
foreach ($array as $v) {
|
||||
var_dump($v);
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from ArrayIterator, 'FilterIterator' given in %s on line %d
|
||||
int(42)
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Don't leak when breaking from FilesystemIterator
|
||||
--FILE--
|
||||
<?php
|
||||
$iterator = new FilesystemIterator(__DIR__);
|
||||
foreach ($iterator as $value) {
|
||||
break;
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
+9
-1
@@ -564,6 +564,10 @@ PHP_FUNCTION(file_get_contents)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (maxlen > INT_MAX) {
|
||||
php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
|
||||
maxlen = INT_MAX;
|
||||
}
|
||||
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) {
|
||||
RETVAL_STR(contents);
|
||||
} else {
|
||||
@@ -827,6 +831,10 @@ PHP_FUNCTION(tempnam)
|
||||
Z_PARAM_PATH(prefix, prefix_len)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (php_check_open_basedir(dir)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
p = php_basename(prefix, prefix_len, NULL, 0);
|
||||
if (ZSTR_LEN(p) > 64) {
|
||||
ZSTR_VAL(p)[63] = '\0';
|
||||
@@ -834,7 +842,7 @@ PHP_FUNCTION(tempnam)
|
||||
|
||||
RETVAL_FALSE;
|
||||
|
||||
if ((fd = php_open_temporary_fd_ex(dir, ZSTR_VAL(p), &opened_path, PHP_TMP_FILE_OPEN_BASEDIR_CHECK_ALWAYS)) >= 0) {
|
||||
if ((fd = php_open_temporary_fd_ex(dir, ZSTR_VAL(p), &opened_path, 1)) >= 0) {
|
||||
close(fd);
|
||||
RETVAL_STR(opened_path);
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ finish:
|
||||
/* status codes of 1xx are "informational", and will be followed by a real response
|
||||
* e.g "100 Continue". RFC 7231 states that unexpected 1xx status MUST be parsed,
|
||||
* and MAY be ignored. As such, we need to skip ahead to the "real" status*/
|
||||
if (response_code >= 100 && response_code < 200 && response_code != 101) {
|
||||
if (response_code >= 100 && response_code < 200) {
|
||||
/* consume lines until we find a line starting 'HTTP/1' */
|
||||
while (
|
||||
!php_stream_eof(stream)
|
||||
@@ -732,16 +732,24 @@ finish:
|
||||
|
||||
/* read past HTTP headers */
|
||||
|
||||
http_header_line = emalloc(HTTP_HEADER_BLOCK_SIZE);
|
||||
|
||||
while (!php_stream_eof(stream)) {
|
||||
size_t http_header_line_length;
|
||||
|
||||
if (http_header_line != NULL) {
|
||||
efree(http_header_line);
|
||||
}
|
||||
if ((http_header_line = php_stream_get_line(stream, NULL, 0, &http_header_line_length)) && *http_header_line != '\n' && *http_header_line != '\r') {
|
||||
if (php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) && *http_header_line != '\n' && *http_header_line != '\r') {
|
||||
char *e = http_header_line + http_header_line_length - 1;
|
||||
char *http_header_value;
|
||||
|
||||
if (*e != '\n') {
|
||||
do { /* partial header */
|
||||
if (php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) == NULL) {
|
||||
php_stream_wrapper_log_error(wrapper, options, "Failed to read HTTP headers");
|
||||
goto out;
|
||||
}
|
||||
e = http_header_line + http_header_line_length - 1;
|
||||
} while (*e != '\n');
|
||||
continue;
|
||||
}
|
||||
while (e >= http_header_line && (*e == '\n' || *e == '\r')) {
|
||||
e--;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1000,7 +1000,7 @@ PHPAPI ZEND_COLD void php_print_info(int flag)
|
||||
}
|
||||
|
||||
|
||||
if (flag & PHP_INFO_CREDITS) {
|
||||
if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) {
|
||||
php_info_print_hr();
|
||||
php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE);
|
||||
}
|
||||
|
||||
@@ -456,6 +456,10 @@ PHP_FUNCTION(stream_get_contents)
|
||||
}
|
||||
}
|
||||
|
||||
if (maxlen > INT_MAX) {
|
||||
php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
|
||||
maxlen = INT_MAX;
|
||||
}
|
||||
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0))) {
|
||||
RETURN_STR(contents);
|
||||
} else {
|
||||
|
||||
@@ -53,17 +53,17 @@ var_dump( $temp_array);
|
||||
|
||||
echo "\n-- Testing ksort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --\n";
|
||||
$temp_array = $unsorted_strings;
|
||||
var_dump( ksort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true)
|
||||
var_dump( sort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true)
|
||||
var_dump( $temp_array);
|
||||
|
||||
echo "\n-- Testing ksort() by supplying string array (natural), 'flag' = SORT_NATURAL --\n";
|
||||
$temp_array = $unsorted_strings;
|
||||
var_dump( ksort($temp_array, SORT_NATURAL) ); // expecting : bool(true)
|
||||
var_dump( sort($temp_array, SORT_NATURAL) ); // expecting : bool(true)
|
||||
var_dump( $temp_array);
|
||||
|
||||
echo "\n-- Testing ksort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --\n";
|
||||
$temp_array = $unsorted_strings;
|
||||
var_dump( ksort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true)
|
||||
var_dump( sort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true)
|
||||
var_dump( $temp_array);
|
||||
|
||||
echo "\n-- Testing ksort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n";
|
||||
@@ -168,63 +168,63 @@ array(8) {
|
||||
-- Testing ksort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --
|
||||
bool(true)
|
||||
array(8) {
|
||||
["b"]=>
|
||||
[0]=>
|
||||
string(6) "banana"
|
||||
["l"]=>
|
||||
[1]=>
|
||||
string(5) "lemon"
|
||||
["o"]=>
|
||||
[2]=>
|
||||
string(6) "orange"
|
||||
["O"]=>
|
||||
[3]=>
|
||||
string(6) "Orange"
|
||||
["O1"]=>
|
||||
[4]=>
|
||||
string(7) "Orange1"
|
||||
["o2"]=>
|
||||
[5]=>
|
||||
string(7) "orange2"
|
||||
["o20"]=>
|
||||
[6]=>
|
||||
string(8) "orange20"
|
||||
["O3"]=>
|
||||
[7]=>
|
||||
string(7) "Orange3"
|
||||
}
|
||||
|
||||
-- Testing ksort() by supplying string array (natural), 'flag' = SORT_NATURAL --
|
||||
bool(true)
|
||||
array(8) {
|
||||
["O"]=>
|
||||
[0]=>
|
||||
string(6) "Orange"
|
||||
["O1"]=>
|
||||
[1]=>
|
||||
string(7) "Orange1"
|
||||
["O3"]=>
|
||||
[2]=>
|
||||
string(7) "Orange3"
|
||||
["b"]=>
|
||||
[3]=>
|
||||
string(6) "banana"
|
||||
["l"]=>
|
||||
[4]=>
|
||||
string(5) "lemon"
|
||||
["o"]=>
|
||||
[5]=>
|
||||
string(6) "orange"
|
||||
["o2"]=>
|
||||
[6]=>
|
||||
string(7) "orange2"
|
||||
["o20"]=>
|
||||
[7]=>
|
||||
string(8) "orange20"
|
||||
}
|
||||
|
||||
-- Testing ksort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --
|
||||
bool(true)
|
||||
array(8) {
|
||||
["b"]=>
|
||||
[0]=>
|
||||
string(6) "banana"
|
||||
["l"]=>
|
||||
[1]=>
|
||||
string(5) "lemon"
|
||||
["o"]=>
|
||||
[2]=>
|
||||
string(6) "orange"
|
||||
["O"]=>
|
||||
[3]=>
|
||||
string(6) "Orange"
|
||||
["O1"]=>
|
||||
[4]=>
|
||||
string(7) "Orange1"
|
||||
["o2"]=>
|
||||
[5]=>
|
||||
string(7) "orange2"
|
||||
["O3"]=>
|
||||
[6]=>
|
||||
string(7) "Orange3"
|
||||
["o20"]=>
|
||||
[7]=>
|
||||
string(8) "orange20"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42560 Empty directory argument to tempnam yields open_basedir problems
|
||||
--FILE--
|
||||
<?php
|
||||
$tmpdir = sys_get_temp_dir();
|
||||
ini_set('open_basedir', $tmpdir);
|
||||
$tempnam = tempnam('', 'test');
|
||||
var_dump($tempnam !== false);
|
||||
var_dump(file_exists($tempnam));
|
||||
|
||||
if (file_exists($tempnam)) {
|
||||
unlink($tempnam);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI)
|
||||
--FILE--
|
||||
<?php
|
||||
ob_start();
|
||||
phpinfo(INFO_CREDITS);
|
||||
$info = ob_get_clean();
|
||||
|
||||
ob_start();
|
||||
phpcredits();
|
||||
$credits = ob_get_clean();
|
||||
|
||||
var_dump(strpos($info, $credits) !== false);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78719 (http wrapper silently ignores long Location headers)
|
||||
--SKIPIF--
|
||||
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$url = str_repeat('*', 2000);
|
||||
$responses = array(
|
||||
"data://text/plain,HTTP/1.0 302 Ok\r\nLocation: $url\r\n\r\nBody",
|
||||
);
|
||||
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
|
||||
|
||||
$context = stream_context_create(['http' => ['follow_location' => 0]]);
|
||||
$stream = fopen('http://127.0.0.1:12342/', 'r', false, $context);
|
||||
var_dump(stream_get_contents($stream));
|
||||
var_dump(stream_get_meta_data($stream)['wrapper_data'][1] === "Location: $url");
|
||||
|
||||
http_server_kill($pid);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(4) "Body"
|
||||
bool(true)
|
||||
@@ -1,41 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80838 (HTTP wrapper waits for HTTP 1 response after HTTP 101)
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--SKIPIF--
|
||||
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$responses = [
|
||||
"data://text/plain,HTTP/1.1 101 Switching Protocols\r\nHeader1: Value1\r\nHeader2: Value2\r\n\r\n"
|
||||
. "Hello from another protocol"
|
||||
];
|
||||
|
||||
$pid = http_server('tcp://127.0.0.1:12342', $responses);
|
||||
|
||||
$options = [
|
||||
'http' => [
|
||||
'ignore_errors' => true
|
||||
],
|
||||
];
|
||||
|
||||
$ctx = stream_context_create($options);
|
||||
|
||||
$fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx);
|
||||
fclose($fd);
|
||||
var_dump($http_response_header);
|
||||
|
||||
http_server_kill($pid);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(32) "HTTP/1.1 101 Switching Protocols"
|
||||
[1]=>
|
||||
string(15) "Header1: Value1"
|
||||
[2]=>
|
||||
string(15) "Header2: Value2"
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
--TEST--
|
||||
Bug #72964 (White space not unfolded for CC/Bcc headers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_OS_FAMILY !== 'Windows') die('skip Windows only test');
|
||||
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
|
||||
require_once __DIR__ . '/mail_skipif.inc';
|
||||
?>
|
||||
--INI--
|
||||
SMTP=localhost
|
||||
smtp_port=25
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/mail_include.inc';
|
||||
|
||||
function find_and_delete_message($username, $subject) {
|
||||
global $default_mailbox, $password;
|
||||
|
||||
$imap_stream = imap_open($default_mailbox, $username, $password);
|
||||
if ($imap_stream === false) {
|
||||
die("Cannot connect to IMAP server $server: " . imap_last_error() . "\n");
|
||||
}
|
||||
|
||||
$found = false;
|
||||
$repeat_count = 20; // we will repeat a max of 20 times
|
||||
while (!$found && $repeat_count > 0) {
|
||||
// sleep for a while to allow msg to be delivered
|
||||
sleep(1);
|
||||
|
||||
$num_messages = imap_check($imap_stream)->Nmsgs;
|
||||
for ($i = $num_messages; $i > 0; $i--) {
|
||||
$info = imap_headerinfo($imap_stream, $i);
|
||||
if ($info->subject === $subject) {
|
||||
$header = imap_fetchheader($imap_stream, $i);
|
||||
echo "X-Mailer header found: ";
|
||||
var_dump(strpos($header, 'X-Mailer: bug80706') !== false);
|
||||
imap_delete($imap_stream, $i);
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$repeat_count--;
|
||||
}
|
||||
|
||||
imap_close($imap_stream, CL_EXPUNGE);
|
||||
return $found;
|
||||
}
|
||||
|
||||
$to = "{$users[1]}@$domain";
|
||||
$subject = bin2hex(random_bytes(16));
|
||||
$message = 'hello';
|
||||
$headers = "From: webmaster@example.com\r\n"
|
||||
. "Bcc: {$users[2]}@$domain\r\n"
|
||||
. "X-Mailer: bug80706";
|
||||
|
||||
$res = mail($to, $subject, $message, $headers);
|
||||
if ($res !== true) {
|
||||
die("TEST FAILED : Unable to send test email\n");
|
||||
} else {
|
||||
echo "Message sent OK\n";
|
||||
}
|
||||
|
||||
foreach ([$users[1], $users[2]] as $user) {
|
||||
if (!find_and_delete_message("$user@$domain", $subject)) {
|
||||
echo "TEST FAILED: email not delivered\n";
|
||||
} else {
|
||||
echo "TEST PASSED: Message sent and deleted OK\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Message sent OK
|
||||
X-Mailer header found: bool(true)
|
||||
TEST PASSED: Message sent and deleted OK
|
||||
X-Mailer header found: bool(true)
|
||||
TEST PASSED: Message sent and deleted OK
|
||||
@@ -1,93 +0,0 @@
|
||||
--TEST--
|
||||
Bug #80751 (Comma in recipient name breaks email delivery)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_OS_FAMILY !== 'Windows') die('skip Windows only test');
|
||||
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
|
||||
require_once __DIR__ . '/mail_skipif.inc';
|
||||
?>
|
||||
--INI--
|
||||
SMTP=localhost
|
||||
smtp_port=25
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/mail_include.inc';
|
||||
|
||||
function find_and_delete_message($username, $subject) {
|
||||
global $default_mailbox, $password;
|
||||
|
||||
$imap_stream = imap_open($default_mailbox, $username, $password);
|
||||
if ($imap_stream === false) {
|
||||
die("Cannot connect to IMAP server $server: " . imap_last_error() . "\n");
|
||||
}
|
||||
|
||||
$found = false;
|
||||
$repeat_count = 20; // we will repeat a max of 20 times
|
||||
while (!$found && $repeat_count > 0) {
|
||||
// sleep for a while to allow msg to be delivered
|
||||
sleep(1);
|
||||
|
||||
$num_messages = imap_check($imap_stream)->Nmsgs;
|
||||
for ($i = $num_messages; $i > 0; $i--) {
|
||||
$info = imap_headerinfo($imap_stream, $i);
|
||||
if ($info->subject === $subject) {
|
||||
$header = imap_fetchheader($imap_stream, $i);
|
||||
echo "Return-Path header found: ";
|
||||
var_dump(strpos($header, 'Return-Path: joe@example.com') !== false);
|
||||
echo "To header found: ";
|
||||
var_dump(strpos($header, 'To: "<bob@example.com>" <info@mail.local>') !== false);
|
||||
echo "From header found: ";
|
||||
var_dump(strpos($header, 'From: "<bob@example.com>" <joe@example.com>') !== false);
|
||||
echo "Cc header found: ";
|
||||
var_dump(strpos($header, 'Cc: "Lastname, Firstname\\\\" <admin@mail.local>') !== false);
|
||||
imap_delete($imap_stream, $i);
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$repeat_count--;
|
||||
}
|
||||
|
||||
imap_close($imap_stream, CL_EXPUNGE);
|
||||
return $found;
|
||||
}
|
||||
|
||||
$to = "\"<bob@example.com>\" <{$users[1]}@$domain>";
|
||||
$subject = bin2hex(random_bytes(16));
|
||||
$message = 'hello';
|
||||
$headers = "From: \"<bob@example.com>\" <joe@example.com>\r\n"
|
||||
. "Cc: \"Lastname, Firstname\\\\\" <{$users[2]}@$domain>\r\n"
|
||||
. "Bcc: \"Firstname \\\"Ni,ck\\\" Lastname\" <{$users[3]}@$domain>\r\n";
|
||||
|
||||
$res = mail($to, $subject, $message, $headers);
|
||||
if ($res !== true) {
|
||||
die("TEST FAILED : Unable to send test email\n");
|
||||
} else {
|
||||
echo "Message sent OK\n";
|
||||
}
|
||||
|
||||
foreach ([$users[1], $users[2], $users[3]] as $user) {
|
||||
if (!find_and_delete_message("$user@$domain", $subject)) {
|
||||
echo "TEST FAILED: email not delivered\n";
|
||||
} else {
|
||||
echo "TEST PASSED: Message sent and deleted OK\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Message sent OK
|
||||
Return-Path header found: bool(true)
|
||||
To header found: bool(true)
|
||||
From header found: bool(true)
|
||||
Cc header found: bool(true)
|
||||
TEST PASSED: Message sent and deleted OK
|
||||
Return-Path header found: bool(true)
|
||||
To header found: bool(true)
|
||||
From header found: bool(true)
|
||||
Cc header found: bool(true)
|
||||
TEST PASSED: Message sent and deleted OK
|
||||
Return-Path header found: bool(true)
|
||||
To header found: bool(true)
|
||||
From header found: bool(true)
|
||||
Cc header found: bool(true)
|
||||
TEST PASSED: Message sent and deleted OK
|
||||
@@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Bug #75776 (Flushing streams with compression filter is broken)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('zlib')) die('skip zlib extension not available');
|
||||
if (!extension_loaded('bz2')) die('skip bz2 extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$compression = [
|
||||
'gz' => ['zlib.deflate', 'gzinflate'],
|
||||
'bz2' => ['bzip2.compress', 'bzdecompress']
|
||||
];
|
||||
foreach ($compression as $ext => [$filter, $function]) {
|
||||
$stream = fopen(__DIR__ . "/75776.$ext", 'w');
|
||||
stream_filter_append($stream, $filter);
|
||||
fwrite($stream,"sdfgdfg");
|
||||
fflush($stream);
|
||||
fclose($stream);
|
||||
|
||||
$compressed = file_get_contents(__DIR__ . "/75776.$ext");
|
||||
var_dump($function($compressed));
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
string(7) "sdfgdfg"
|
||||
string(7) "sdfgdfg"
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . "/75776.gz");
|
||||
@unlink(__DIR__ . "/75776.bz2");
|
||||
?>
|
||||
@@ -52,6 +52,6 @@ fclose($f2);
|
||||
--EXPECT--
|
||||
filter onCreate
|
||||
filtered 8192 bytes.
|
||||
filtered 128 bytes and closing. Stream has reached end-of-file.
|
||||
filtered 128 bytes and closing.
|
||||
int(8320)
|
||||
filter onClose
|
||||
@@ -575,15 +575,13 @@ $sample_urls = array (
|
||||
string(16) "some_page_ref123"
|
||||
}
|
||||
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
|
||||
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["host"]=>
|
||||
string(11) "www.php.net"
|
||||
string(26) "secret@hideout@www.php.net"
|
||||
["port"]=>
|
||||
int(80)
|
||||
["user"]=>
|
||||
string(14) "secret@hideout"
|
||||
["path"]=>
|
||||
string(10) "/index.php"
|
||||
["query"]=>
|
||||
|
||||
Loaded 100 of 125 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user