mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-22 00:16:38 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0d7ba2fe9 | ||
|
|
44e1c60e97 | ||
|
|
63998d3512 | ||
|
|
c65a552288 | ||
|
|
2242d15b5d | ||
|
|
122ad9c5c9 | ||
|
|
6bc7370532 | ||
|
|
8cd6acd69b | ||
|
|
3938bfb564 | ||
|
|
eedc988a4e | ||
|
|
6c3896b1e9 | ||
|
|
66c3a174f5 | ||
|
|
0bff67c0ab | ||
|
|
c446d68f7c | ||
|
|
f0736631d9 | ||
|
|
a75a4a4a70 | ||
|
|
fb86a176ba | ||
|
|
5c164a2223 | ||
|
|
ead72aabfb | ||
|
|
574b551567 | ||
|
|
6afbb74194 | ||
|
|
c455f49a6a | ||
|
|
28e7addb9d | ||
|
|
b300c6b87f | ||
|
|
f6c15e2caf | ||
|
|
63c558bcbb | ||
|
|
23a3bbb468 | ||
|
|
e96b984026 | ||
|
|
6fa4493f7b | ||
|
|
33a93b5ed7 | ||
|
|
ef3e0ee08a | ||
|
|
6ccbaa12e0 | ||
|
|
2558acbd66 | ||
|
|
04078a597c | ||
|
|
0c57ebb116 | ||
|
|
7fbfcfa851 | ||
|
|
090627048c | ||
|
|
c2b5284734 | ||
|
|
d2d227e547 | ||
|
|
1c2e7b4ea0 | ||
|
|
ab3052ab26 | ||
|
|
57918b1a1b | ||
|
|
f547bddcc0 | ||
|
|
af948ae24c | ||
|
|
54e2ef0b81 | ||
|
|
e8361eb0e3 | ||
|
|
a3c38c2596 | ||
|
|
12118d592a | ||
|
|
0413cf3c20 | ||
|
|
9bf1224d07 | ||
|
|
674b884c7a | ||
|
|
bcea74fd13 | ||
|
|
8deadfa31b | ||
|
|
fb2bf8bd58 | ||
|
|
f95f8a3c1e | ||
|
|
d87d2f006c | ||
|
|
dd3e56ba24 | ||
|
|
178bbe3478 | ||
|
|
bf9dc53435 | ||
|
|
068c8db276 | ||
|
|
9e51b487f3 | ||
|
|
896e4d3428 | ||
|
|
8294ad3295 | ||
|
|
125fc0b8d4 | ||
|
|
bb0107b63d | ||
|
|
f020d537b0 | ||
|
|
d1c0cbdcb1 | ||
|
|
0cafd53d18 | ||
|
|
398cfb982e | ||
|
|
5ce0fa2129 | ||
|
|
0328ff49cc | ||
|
|
c2a06f5d9a | ||
|
|
42c72ef463 | ||
|
|
30d3062c9b | ||
|
|
645815c5b7 | ||
|
|
272df442f5 | ||
|
|
7bc9df4af2 | ||
|
|
b8e49fe872 | ||
|
|
47bed58a53 | ||
|
|
2ceef24f4a | ||
|
|
028dd891f9 | ||
|
|
5acab7ebb4 | ||
|
|
220ffb90d0 | ||
|
|
67c4d1f5b9 | ||
|
|
76d1120a48 | ||
|
|
af9fadc55a | ||
|
|
c340f97ab0 | ||
|
|
4a5bda6a8d | ||
|
|
c7387ab92f | ||
|
|
98a071e880 | ||
|
|
9ce5776922 | ||
|
|
3f71ba2611 | ||
|
|
4c80e439a8 | ||
|
|
7f83976200 | ||
|
|
606b2c39fc | ||
|
|
66308af539 | ||
|
|
98c8ad9218 | ||
|
|
e1f8763a2c | ||
|
|
20b62ade29 | ||
|
|
096f148c61 | ||
|
|
3e518e069d | ||
|
|
12e15be921 | ||
|
|
60a68a45c3 | ||
|
|
7544f66da9 | ||
|
|
310c0561a9 | ||
|
|
a4d9ccbcd6 | ||
|
|
568df31698 | ||
|
|
37962c61d2 | ||
|
|
eed03fce59 | ||
|
|
2b3346208a | ||
|
|
1b88c85cd8 | ||
|
|
6de2d54425 | ||
|
|
76637017ac | ||
|
|
9f7e8b777c | ||
|
|
d1e590fe72 | ||
|
|
2bce26f2aa | ||
|
|
c0ae3a7fb7 | ||
|
|
bc6fc61c04 | ||
|
|
7f9183ce20 | ||
|
|
361df6d39c | ||
|
|
33d49551d1 | ||
|
|
09696eee9d | ||
|
|
97f8ca52fa | ||
|
|
418fcd22e8 | ||
|
|
fe219d912e | ||
|
|
a2771296c0 | ||
|
|
cb84e5c332 | ||
|
|
23a192d12d | ||
|
|
39ddf6b89c | ||
|
|
b0f030509a | ||
|
|
054fad6d63 | ||
|
|
3c6480552d | ||
|
|
1fcea24efb | ||
|
|
0f40426450 | ||
|
|
263f14ac60 | ||
|
|
ffb1ff371c | ||
|
|
8a7b786b7f | ||
|
|
cb262cd974 | ||
|
|
ea3c992bff | ||
|
|
d4a206b276 | ||
|
|
d918c1443e | ||
|
|
0071c7ed7e | ||
|
|
ecc4bf14f0 | ||
|
|
09f55604ec | ||
|
|
c0b1bdcdc3 | ||
|
|
d0fd118f9b | ||
|
|
46f9fed0d8 | ||
|
|
f40c8fdf67 | ||
|
|
a3e6735999 | ||
|
|
7c6cf09463 | ||
|
|
80f921d7e0 | ||
|
|
976e71a2fa | ||
|
|
6fd13d0afd | ||
|
|
ec24f14820 | ||
|
|
5ccb5fd91e | ||
|
|
f20ca94b1c | ||
|
|
f99926f554 | ||
|
|
79872ac9c2 |
No files matched your search
@@ -68,12 +68,6 @@ env:
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- env: ENABLE_ZTS=0 ENABLE_DEBUG=0
|
||||
arch: amd64
|
||||
if: type = cron
|
||||
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1
|
||||
arch: amd64
|
||||
if: type = cron
|
||||
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
|
||||
arch: arm64
|
||||
if: type = cron
|
||||
|
||||
@@ -1,6 +1,70 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2021, PHP 8.0.5
|
||||
03 Jun 2021, PHP 8.0.7
|
||||
|
||||
- Core:
|
||||
. Fixed bug #80960 (opendir() warning wrong info when failed on Windows).
|
||||
(cmb)
|
||||
. Fixed bug #67792 (HTTP Authorization schemes are treated as case-sensitive).
|
||||
(cmb)
|
||||
. Fixed bug #80972 (Memory exhaustion on invalid string offset). (girgias)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #65800 (Events port mechanism). (psumbera)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #80901 (Info leak in ftp extension). (cmb)
|
||||
. Fixed bug #79100 (Wrong FTP error messages). (cmb)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #81032 (GD install is affected by external libgd installation).
|
||||
(Flavio Heleno, cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #81019 (Unable to clone NumberFormatter after failed parse()).
|
||||
(Nikita)
|
||||
|
||||
- MBString:
|
||||
. Fixed bug #81011 (mb_convert_encoding removes references from arrays). (cmb)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #80460 (ODBC doesn't account for SQL_NO_TOTAL indicator). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #81007 (JIT "not supported" on 32-bit x86 -- build problem?).
|
||||
(Nikita)
|
||||
. Fixed bug #81015 (Opcache optimization assumes wrong part of ternary
|
||||
operator in if-condition). (Nikita)
|
||||
. Fixed bug #81046 (Literal compaction merges non-equal related literals).
|
||||
(Nikita)
|
||||
|
||||
- PDO_MySQL:
|
||||
. Fixed bug #81037 (PDO discards error message text from prepared
|
||||
statement). (Kamil Tekiela)
|
||||
|
||||
- PDO_ODBC:
|
||||
. Fixed bug #44643 (bound parameters ignore explicit type definitions). (cmb)
|
||||
|
||||
- pgsql:
|
||||
. Fixed php_pgsql_fd_cast() wrt. php_stream_can_cast(). (cmb)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #80933 (SplFileObject::DROP_NEW_LINE is broken for NUL and CR).
|
||||
(cmb, Nikita)
|
||||
|
||||
- XMLReader:
|
||||
. Fixed bug #73246 (XMLReader: encoding length not checked). (cmb)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #80863 (ZipArchive::extractTo() ignores references). (cmb)
|
||||
|
||||
06 May 2021, PHP 8.0.6
|
||||
|
||||
- PDO_pgsql:
|
||||
. Revert "Fixed bug #80892 (PDO::PARAM_INT is treated the same as PDO::PARAM_STR)"
|
||||
from PHP 8.0.5.
|
||||
|
||||
29 Apr 2021, PHP 8.0.5
|
||||
|
||||
- Core:
|
||||
. Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
|
||||
@@ -22,6 +86,9 @@ PHP NEWS
|
||||
. Fixed bug #80880 (SSL_read on shutdown, ftp/proc_open). (cmb, Jakub
|
||||
Zelenka)
|
||||
|
||||
- Imap:
|
||||
. Fixed bug #80710 (imap_mail_compose() header injection). (cmb, Stas)
|
||||
|
||||
- LibXML:
|
||||
. Fixed bug #73533 (Invalid memory access in php_libxml_xmlCheckUTF8). (cmb)
|
||||
|
||||
@@ -702,4 +769,3 @@ PHP NEWS
|
||||
. Fixed bug #71417 (fread() does not report zlib.inflate errors). (cmb)
|
||||
. Fixed bug #78792 (zlib.output_compression disabled by Content-Type: image/).
|
||||
(cmb)
|
||||
|
||||
@@ -35,11 +35,12 @@ try {
|
||||
}
|
||||
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
|
||||
try {
|
||||
/* This must not affect the string value */
|
||||
$simpleString["wrong"] = "f";
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
echo $simpleString["0"] === "f"?"ok\n":"bug\n";
|
||||
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
|
||||
@@ -58,7 +58,7 @@ Warning: Illegal string offset -1 in %s on line %d
|
||||
NULL
|
||||
string(0) ""
|
||||
Cannot access offset of type string on string
|
||||
string(1) "a"
|
||||
string(0) ""
|
||||
Error: [] operator not supported for strings
|
||||
string(0) ""
|
||||
Error: Cannot use assign-op operators with string offsets
|
||||
|
||||
@@ -39,7 +39,7 @@ string(36) "#0 [internal function]: ()
|
||||
|
||||
Array of array of NULL values:
|
||||
|
||||
Warning: Function name is not a string in %s on line %d
|
||||
Warning: File name is not a string in %s on line %d
|
||||
|
||||
Warning: Value for class is not a string in %s on line %d
|
||||
|
||||
@@ -48,5 +48,5 @@ Warning: Value for type is not a string in %s on line %d
|
||||
Warning: Value for function is not a string in %s on line %d
|
||||
|
||||
Warning: args element is not an array in %s on line %d
|
||||
string(60) "#0 [unknown function][unknown][unknown][unknown]()
|
||||
string(58) "#0 [unknown file]: [unknown][unknown][unknown]()
|
||||
#1 {main}"
|
||||
@@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
Bug #80972: Memory exhaustion on invalid string offset
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function exceptions_error_handler($severity, $message, $filename, $lineno) {
|
||||
if (error_reporting() & $severity) {
|
||||
throw new ErrorException($message, 0, $severity, $filename, $lineno);
|
||||
}
|
||||
}
|
||||
set_error_handler('exceptions_error_handler');
|
||||
|
||||
$float = 10e120;
|
||||
$string_float = (string) $float;
|
||||
|
||||
$string = 'Here is some text for good measure';
|
||||
|
||||
try {
|
||||
echo 'Float casted to string compile', \PHP_EOL;
|
||||
$string[(string) 10e120] = 'E';
|
||||
var_dump($string);
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage(), \PHP_EOL;
|
||||
}
|
||||
|
||||
/* This same bug also permits to modify the first byte of a string even if
|
||||
* the offset is invalid */
|
||||
try {
|
||||
/* This must not affect the string value */
|
||||
$string["wrong"] = "f";
|
||||
} catch (\Throwable $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
var_dump($string);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Float casted to string compile
|
||||
Cannot access offset of type string on string
|
||||
Cannot access offset of type string on string
|
||||
string(34) "Here is some text for good measure"
|
||||
@@ -0,0 +1,56 @@
|
||||
--TEST--
|
||||
Bug #80929: Method name corruption related to zend_closure_call_magic
|
||||
--FILE--
|
||||
<?php
|
||||
class DefaultListener
|
||||
{
|
||||
public function handleDefaultEvent($event) { }
|
||||
}
|
||||
|
||||
class SubscriberProxy
|
||||
{
|
||||
private array $subscribedEvents;
|
||||
private object $subscriber;
|
||||
private Closure $listener;
|
||||
|
||||
public function __construct(array $subscribedEvents, object $subscriber)
|
||||
{
|
||||
$this->subscribedEvents = $subscribedEvents;
|
||||
$this->subscriber = $subscriber;
|
||||
foreach ($this->subscribedEvents as $eventName => $params) {
|
||||
$this->listener = Closure::fromCallable([$this, $params]);
|
||||
}
|
||||
}
|
||||
|
||||
public function __call(string $name, array $arguments)
|
||||
{
|
||||
return $this->subscriber->$name(...$arguments);
|
||||
}
|
||||
|
||||
public function dispatch($event, string $eventName)
|
||||
{
|
||||
($this->listener)($event, $eventName, null);
|
||||
}
|
||||
}
|
||||
|
||||
$proxy = new SubscriberProxy(
|
||||
['defaultEvent' => 'handleDefaultEvent'],
|
||||
new DefaultListener()
|
||||
);
|
||||
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
echo $i . PHP_EOL;
|
||||
$proxy->dispatch(null, 'defaultEvent');
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
@@ -52,7 +52,7 @@ foreach ($testvalues as $testvalue) {
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
*** Indexing - Testing value assignment with key ***
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
@@ -74,12 +74,8 @@ array(1) {
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
|
||||
Warning: Array to string conversion in %s on line %d
|
||||
Cannot access offset of type string on string
|
||||
string(0) ""
|
||||
|
||||
Warning: Array to string conversion in %s on line %d
|
||||
Cannot access offset of type string on string
|
||||
string(1) " "
|
||||
Cannot use a scalar value as an array
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Iterator::key() with by-ref return
|
||||
--FILE--
|
||||
<?php
|
||||
class Test extends ArrayIterator {
|
||||
function &key() {
|
||||
return $foo;
|
||||
}
|
||||
}
|
||||
foreach (new Test([0]) as $k => $v) {
|
||||
var_dump($k);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
NULL
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
A failed assignment should not be considered an initialization
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public int $prop;
|
||||
|
||||
public function __get($name) {
|
||||
echo "__get() called\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$test = new Test;
|
||||
try {
|
||||
$test->prop;
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
$test->prop = "foo";
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
$test->prop;
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Typed property Test::$prop must not be accessed before initialization
|
||||
Cannot assign string to property Test::$prop of type int
|
||||
Typed property Test::$prop must not be accessed before initialization
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Everything is trivially a subtype of mixed
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($class) {
|
||||
echo "Loading $class\n";
|
||||
});
|
||||
|
||||
class A {
|
||||
public function test(): mixed {}
|
||||
}
|
||||
class B extends A {
|
||||
public function test(): X {}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "4.0.5-dev"
|
||||
#define ZEND_VERSION "4.0.7"
|
||||
|
||||
#define ZEND_ENGINE_3
|
||||
|
||||
|
||||
@@ -288,7 +288,6 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
|
||||
|
||||
zend_call_function(&fci, &fcc);
|
||||
|
||||
zval_ptr_dtor(&fci.params[0]);
|
||||
zval_ptr_dtor(&fci.params[1]);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -485,6 +484,8 @@ static void zend_closure_free_storage(zend_object *object) /* {{{ */
|
||||
|
||||
if (closure->func.type == ZEND_USER_FUNCTION) {
|
||||
destroy_op_array(&closure->func.op_array);
|
||||
} else if (closure->orig_internal_handler == zend_closure_call_magic) {
|
||||
zend_string_release(closure->func.common.function_name);
|
||||
}
|
||||
|
||||
if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {
|
||||
|
||||
@@ -543,20 +543,17 @@ static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num) /*
|
||||
file = zend_hash_find_ex(ht, ZSTR_KNOWN(ZEND_STR_FILE), 1);
|
||||
if (file) {
|
||||
if (Z_TYPE_P(file) != IS_STRING) {
|
||||
zend_error(E_WARNING, "Function name is not a string");
|
||||
smart_str_appends(str, "[unknown function]");
|
||||
zend_error(E_WARNING, "File name is not a string");
|
||||
smart_str_appends(str, "[unknown file]: ");
|
||||
} else{
|
||||
zend_long line;
|
||||
zend_long line = 0;
|
||||
tmp = zend_hash_find_ex(ht, ZSTR_KNOWN(ZEND_STR_LINE), 1);
|
||||
if (tmp) {
|
||||
if (Z_TYPE_P(tmp) == IS_LONG) {
|
||||
line = Z_LVAL_P(tmp);
|
||||
} else {
|
||||
zend_error(E_WARNING, "Line is not an int");
|
||||
line = 0;
|
||||
}
|
||||
} else {
|
||||
line = 0;
|
||||
}
|
||||
smart_str_append(str, Z_STR_P(file));
|
||||
smart_str_appendc(str, '(');
|
||||
|
||||
@@ -1525,6 +1525,14 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
|
||||
zend_long offset;
|
||||
|
||||
offset = zend_check_string_offset(dim, BP_VAR_W EXECUTE_DATA_CC);
|
||||
/* Illegal offset assignment */
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset < -(zend_long)Z_STRLEN_P(str)) {
|
||||
/* Error on negative offset */
|
||||
zend_error(E_WARNING, "Illegal string offset " ZEND_LONG_FMT, offset);
|
||||
|
||||
@@ -429,6 +429,13 @@ static inheritance_status zend_perform_covariant_type_check(
|
||||
{
|
||||
ZEND_ASSERT(ZEND_TYPE_IS_SET(fe_type) && ZEND_TYPE_IS_SET(proto_type));
|
||||
|
||||
/* Apart from void, everything is trivially covariant to the mixed type.
|
||||
* Handle this case separately to ensure it never requires class loading. */
|
||||
if (ZEND_TYPE_PURE_MASK(proto_type) == MAY_BE_ANY &&
|
||||
!ZEND_TYPE_CONTAINS_CODE(fe_type, IS_VOID)) {
|
||||
return INHERITANCE_SUCCESS;
|
||||
}
|
||||
|
||||
/* Builtin types may be removed, but not added */
|
||||
uint32_t fe_type_mask = ZEND_TYPE_PURE_MASK(fe_type);
|
||||
uint32_t proto_type_mask = ZEND_TYPE_PURE_MASK(proto_type);
|
||||
|
||||
@@ -154,6 +154,9 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
|
||||
zend_user_iterator *iter = (zend_user_iterator*)_iter;
|
||||
zval *object = &iter->it.data;
|
||||
zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, "key", key);
|
||||
if (UNEXPECTED(Z_ISREF_P(key))) {
|
||||
zend_unwrap_reference(key);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -728,7 +728,6 @@ found:
|
||||
}
|
||||
if (Z_PROP_FLAG_P(variable_ptr) == IS_PROP_UNINIT) {
|
||||
/* Writes to uninitializde typed properties bypass __set(). */
|
||||
Z_PROP_FLAG_P(variable_ptr) = 0;
|
||||
goto write_std_property;
|
||||
}
|
||||
} else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))) {
|
||||
@@ -783,6 +782,7 @@ write_std_property:
|
||||
goto exit;
|
||||
}
|
||||
value = &tmp;
|
||||
Z_PROP_FLAG_P(variable_ptr) = 0;
|
||||
goto found; /* might have been updated via e.g. __toString() */
|
||||
}
|
||||
|
||||
|
||||
@@ -1061,6 +1061,11 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
}
|
||||
#endif
|
||||
if (path_length + state_cwd_length + 1 >= MAXPATHLEN-1) {
|
||||
#ifdef ZEND_WIN32
|
||||
SET_ERRNO_FROM_WIN32_CODE(ERROR_BUFFER_OVERFLOW);
|
||||
#else
|
||||
errno = ENAMETOOLONG;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
memcpy(resolved_path, state->cwd, state_cwd_length);
|
||||
@@ -1089,6 +1094,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
#ifdef ZEND_WIN32
|
||||
if (memchr(resolved_path, '*', path_length) ||
|
||||
memchr(resolved_path, '?', path_length)) {
|
||||
SET_ERRNO_FROM_WIN32_CODE(ERROR_INVALID_NAME);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -102,6 +102,6 @@ nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --show-slow 1000 --set
|
||||
|
||||
set EXIT_CODE=%errorlevel%
|
||||
|
||||
powershell -Command "$wc = New-Object 'System.Net.WebClient'; $wc.UploadFile('https://ci.appveyor.com/api/testresults/junit/%APPVEYOR_JOB_ID%', 'c:\junit.out.xml')"
|
||||
appveyor PushArtifact %TEST_PHP_JUNIT%
|
||||
|
||||
exit /b %EXIT_CODE%
|
||||
+6
-11
@@ -16,21 +16,11 @@ jobs:
|
||||
- job: ${{ parameters.configurationName }}
|
||||
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
vmImage: 'ubuntu-20.04'
|
||||
variables:
|
||||
ubsan_options: 'print_stacktrace=1'
|
||||
steps:
|
||||
- template: apt.yml
|
||||
- script: |
|
||||
# Compile a newer version of curl, otherwise there will be an asan warning
|
||||
# when running symfony tests.
|
||||
wget https://curl.haxx.se/download/curl-7.65.3.tar.gz
|
||||
tar xzf curl-7.65.3.tar.gz
|
||||
cd curl-7.65.3/
|
||||
./configure
|
||||
make -j2
|
||||
sudo make install
|
||||
displayName: 'Build Curl'
|
||||
- template: configure.yml
|
||||
parameters:
|
||||
configurationParameters: ${{ parameters.configurationParameters }}
|
||||
@@ -51,6 +41,7 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/laravel/framework.git --branch=master --depth=1
|
||||
cd framework
|
||||
git rev-parse HEAD
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
# Hack to disable a test that hangs on azure
|
||||
sed -i 's/PHP_OS/"Darwin"/' tests/Filesystem/FilesystemTest.php
|
||||
@@ -64,6 +55,7 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/symfony/symfony.git --depth=1
|
||||
cd symfony
|
||||
git rev-parse HEAD
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
php7.4 ./phpunit install
|
||||
export USE_ZEND_ALLOC=0
|
||||
@@ -83,6 +75,7 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/amphp/amp.git --branch=master --depth=1
|
||||
cd amp
|
||||
git rev-parse HEAD
|
||||
php /usr/bin/composer install --no-progress --ignore-platform-reqs
|
||||
export USE_ZEND_ALLOC=0
|
||||
sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php
|
||||
@@ -92,6 +85,7 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/sebastianbergmann/phpunit.git --branch=master --depth=1
|
||||
cd phpunit
|
||||
git rev-parse HEAD
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
export ASAN_OPTIONS=exitcode=139
|
||||
@@ -104,6 +98,7 @@ jobs:
|
||||
- script: |
|
||||
php7.4 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
|
||||
cd symfony_demo
|
||||
git rev-parse HEAD
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php
|
||||
|
||||
@@ -8,7 +8,7 @@ jobs:
|
||||
- job: ${{ parameters.configurationName }}
|
||||
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
vmImage: 'ubuntu-20.04'
|
||||
steps:
|
||||
- template: apt.yml
|
||||
- script: |
|
||||
|
||||
@@ -8,7 +8,7 @@ jobs:
|
||||
- job: ${{ parameters.configurationName }}
|
||||
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
vmImage: 'ubuntu-20.04'
|
||||
steps:
|
||||
- template: apt.yml
|
||||
- template: configure.yml
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ jobs:
|
||||
- job: ${{ parameters.configurationName }}
|
||||
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
vmImage: 'ubuntu-20.04'
|
||||
steps:
|
||||
- template: apt.yml
|
||||
- script: |
|
||||
|
||||
@@ -12,7 +12,6 @@ steps:
|
||||
export TEST_PHP_JUNIT=junit.xml
|
||||
export REPORT_EXIT_STATUS=no
|
||||
export SKIP_IO_CAPTURE_TESTS=1
|
||||
export MSAN_SYMBOLIZER_PATH=/usr/lib/llvm-6.0/bin/llvm-symbolizer
|
||||
rm -rf junit.xml | true
|
||||
php run-tests.php -P -q \
|
||||
-j$(/usr/bin/nproc) \
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([PHP],[8.0.5-dev],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_INIT([PHP],[8.0.7],[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
|
||||
|
||||
+29
-22
@@ -59,6 +59,11 @@
|
||||
#include "ftp.h"
|
||||
#include "ext/standard/fsock.h"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
# undef ETIMEDOUT
|
||||
# define ETIMEDOUT WSAETIMEDOUT
|
||||
#endif
|
||||
|
||||
/* sends an ftp command, returns true on success, false on error.
|
||||
* it sends the string "cmd args\r\n" if args is non-null, or
|
||||
* "cmd\r\n" if args is null
|
||||
@@ -1260,7 +1265,8 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const size_t cmd_len, const char *arg
|
||||
|
||||
data = ftp->outbuf;
|
||||
|
||||
/* Clear the extra-lines buffer */
|
||||
/* Clear the inbuf and extra-lines buffer */
|
||||
ftp->inbuf[0] = '\0';
|
||||
ftp->extra = NULL;
|
||||
|
||||
if (my_send(ftp, ftp->fd, data, size) != size) {
|
||||
@@ -1313,10 +1319,12 @@ ftp_readline(ftpbuf_t *ftp)
|
||||
|
||||
data = eol;
|
||||
if ((rcvd = my_recv(ftp, ftp->fd, data, size)) < 1) {
|
||||
*data = 0;
|
||||
return 0;
|
||||
}
|
||||
} while (size);
|
||||
|
||||
*data = 0;
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1428,15 +1436,15 @@ my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
|
||||
n = php_pollfd_for_ms(s, POLLOUT, ftp->timeout_sec * 1000);
|
||||
|
||||
if (n < 1) {
|
||||
char buf[256];
|
||||
if (n == 0) {
|
||||
#ifdef PHP_WIN32
|
||||
if (n == 0) {
|
||||
_set_errno(ETIMEDOUT);
|
||||
}
|
||||
#else
|
||||
if (n == 0) {
|
||||
errno = ETIMEDOUT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1464,18 +1472,17 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
|
||||
SSL *handle = NULL;
|
||||
php_socket_t fd;
|
||||
#endif
|
||||
|
||||
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, ftp->timeout_sec * 1000);
|
||||
if (n < 1) {
|
||||
char buf[256];
|
||||
if (n == 0) {
|
||||
#ifdef PHP_WIN32
|
||||
if (n == 0) {
|
||||
_set_errno(ETIMEDOUT);
|
||||
}
|
||||
#else
|
||||
if (n == 0) {
|
||||
errno = ETIMEDOUT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1541,15 +1548,15 @@ data_available(ftpbuf_t *ftp, php_socket_t s)
|
||||
|
||||
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, 1000);
|
||||
if (n < 1) {
|
||||
char buf[256];
|
||||
if (n == 0) {
|
||||
#ifdef PHP_WIN32
|
||||
if (n == 0) {
|
||||
_set_errno(ETIMEDOUT);
|
||||
}
|
||||
#else
|
||||
if (n == 0) {
|
||||
errno = ETIMEDOUT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1564,15 +1571,15 @@ data_writeable(ftpbuf_t *ftp, php_socket_t s)
|
||||
|
||||
n = php_pollfd_for_ms(s, POLLOUT, 1000);
|
||||
if (n < 1) {
|
||||
char buf[256];
|
||||
if (n == 0) {
|
||||
#ifdef PHP_WIN32
|
||||
if (n == 0) {
|
||||
_set_errno(ETIMEDOUT);
|
||||
}
|
||||
#else
|
||||
if (n == 0) {
|
||||
errno = ETIMEDOUT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1588,15 +1595,15 @@ my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrl
|
||||
|
||||
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, ftp->timeout_sec * 1000);
|
||||
if (n < 1) {
|
||||
char buf[256];
|
||||
if (n == 0) {
|
||||
#ifdef PHP_WIN32
|
||||
if (n == 0) {
|
||||
_set_errno(ETIMEDOUT);
|
||||
}
|
||||
#else
|
||||
if (n == 0) {
|
||||
errno = ETIMEDOUT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+60
-20
@@ -200,7 +200,9 @@ PHP_FUNCTION(ftp_login)
|
||||
|
||||
/* log in */
|
||||
if (!ftp_login(ftp, user, user_len, pass, pass_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -224,7 +226,9 @@ PHP_FUNCTION(ftp_pwd)
|
||||
}
|
||||
|
||||
if (!(pwd = ftp_pwd(ftp))) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -247,7 +251,9 @@ PHP_FUNCTION(ftp_cdup)
|
||||
}
|
||||
|
||||
if (!ftp_cdup(ftp)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -273,7 +279,9 @@ PHP_FUNCTION(ftp_chdir)
|
||||
|
||||
/* change directories */
|
||||
if (!ftp_chdir(ftp, dir, dir_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -299,7 +307,9 @@ PHP_FUNCTION(ftp_exec)
|
||||
|
||||
/* execute serverside command */
|
||||
if (!ftp_exec(ftp, cmd, cmd_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -347,7 +357,9 @@ PHP_FUNCTION(ftp_mkdir)
|
||||
|
||||
/* create directory */
|
||||
if (NULL == (tmp = ftp_mkdir(ftp, dir, dir_len))) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -373,7 +385,9 @@ PHP_FUNCTION(ftp_rmdir)
|
||||
|
||||
/* remove directorie */
|
||||
if (!ftp_rmdir(ftp, dir, dir_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -399,7 +413,9 @@ PHP_FUNCTION(ftp_chmod)
|
||||
}
|
||||
|
||||
if (!ftp_chmod(ftp, mode, filename, filename_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -548,7 +564,9 @@ PHP_FUNCTION(ftp_systype)
|
||||
}
|
||||
|
||||
if (NULL == (syst = ftp_syst(ftp))) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -593,7 +611,9 @@ PHP_FUNCTION(ftp_fget)
|
||||
}
|
||||
|
||||
if (!ftp_get(ftp, stream, file, file_len, xtype, resumepos)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -642,7 +662,9 @@ PHP_FUNCTION(ftp_nb_fget)
|
||||
ftp->closestream = 0; /* do not close */
|
||||
|
||||
if ((ret = ftp_nb_get(ftp, stream, file, file_len, xtype, resumepos)) == PHP_FTP_FAILED) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_LONG(ret);
|
||||
}
|
||||
|
||||
@@ -728,7 +750,9 @@ PHP_FUNCTION(ftp_get)
|
||||
if (!ftp_get(ftp, outstream, remote, remote_len, xtype, resumepos)) {
|
||||
php_stream_close(outstream);
|
||||
VCWD_UNLINK(local);
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -796,7 +820,9 @@ PHP_FUNCTION(ftp_nb_get)
|
||||
php_stream_close(outstream);
|
||||
ftp->stream = NULL;
|
||||
VCWD_UNLINK(local);
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_LONG(PHP_FTP_FAILED);
|
||||
}
|
||||
|
||||
@@ -888,7 +914,9 @@ PHP_FUNCTION(ftp_fput)
|
||||
}
|
||||
|
||||
if (!ftp_put(ftp, remote, remote_len, stream, xtype, startpos)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -941,7 +969,9 @@ PHP_FUNCTION(ftp_nb_fput)
|
||||
ftp->closestream = 0; /* do not close */
|
||||
|
||||
if (((ret = ftp_nb_put(ftp, remote, remote_len, stream, xtype, startpos)) == PHP_FTP_FAILED)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_LONG(ret);
|
||||
}
|
||||
|
||||
@@ -994,7 +1024,9 @@ PHP_FUNCTION(ftp_put)
|
||||
|
||||
if (!ftp_put(ftp, remote, remote_len, instream, xtype, startpos)) {
|
||||
php_stream_close(instream);
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
php_stream_close(instream);
|
||||
@@ -1029,7 +1061,9 @@ PHP_FUNCTION(ftp_append)
|
||||
|
||||
if (!ftp_append(ftp, remote, remote_len, instream, xtype)) {
|
||||
php_stream_close(instream);
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
php_stream_close(instream);
|
||||
@@ -1159,7 +1193,9 @@ PHP_FUNCTION(ftp_rename)
|
||||
|
||||
/* rename the file */
|
||||
if (!ftp_rename(ftp, src, src_len, dest, dest_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1185,7 +1221,9 @@ PHP_FUNCTION(ftp_delete)
|
||||
|
||||
/* delete the file */
|
||||
if (!ftp_delete(ftp, file, file_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1211,7 +1249,9 @@ PHP_FUNCTION(ftp_site)
|
||||
|
||||
/* send the site command */
|
||||
if (!ftp_site(ftp, cmd, cmd_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
if (*ftp->inbuf) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #79100 (Wrong FTP error messages)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$bug79100 = true;
|
||||
require 'server.inc';
|
||||
|
||||
$ftp = ftp_connect("127.0.0.1", $port);
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
var_dump(ftp_login($ftp, 'user', 'pass'));
|
||||
var_dump(ftp_set_option($ftp, FTP_TIMEOUT_SEC, 1));
|
||||
ftp_systype($ftp);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: ftp_systype(): %rConnection|Operation%r timed out in %s on line %d
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #80901 (Info leak in ftp extension)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
?>
|
||||
--INI--
|
||||
log_errors_max_len=0
|
||||
--FILE--
|
||||
<?php
|
||||
$bug80901 = true;
|
||||
require 'server.inc';
|
||||
|
||||
$ftp = ftp_connect("127.0.0.1", $port);
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
var_dump(ftp_login($ftp, 'user', 'pass'));
|
||||
ftp_systype($ftp);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: ftp_systype(): **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** in %s on line %d
|
||||
@@ -107,6 +107,7 @@ if ($pid) {
|
||||
fputs($s, "234 auth type accepted\r\n");
|
||||
} else {
|
||||
fputs($s, "666 dummy\r\n");
|
||||
sleep(1);
|
||||
fputs($s, "666 bogus msg\r\n");
|
||||
exit;
|
||||
}
|
||||
@@ -197,6 +198,10 @@ if ($pid) {
|
||||
} elseif ($buf === "SYST\r\n") {
|
||||
if (isset($bug27809)) {
|
||||
fputs($s, "215 OS/400 is the remote operating system. The TCP/IP version is \"V5R2M0\"\r\n");
|
||||
} elseif (isset($bug79100)) {
|
||||
// do nothing so test hits timeout
|
||||
} elseif (isset($bug80901)) {
|
||||
fputs($s, "\r\n" . str_repeat("*", 4096) . "\r\n");
|
||||
} else {
|
||||
fputs($s, "215 UNIX Type: L8.\r\n");
|
||||
}
|
||||
|
||||
+17
-7
@@ -59,13 +59,23 @@
|
||||
|
||||
static int le_gd_font;
|
||||
|
||||
#include <gd.h>
|
||||
#include <gd_errors.h>
|
||||
#include <gdfontt.h> /* 1 Tiny font */
|
||||
#include <gdfonts.h> /* 2 Small font */
|
||||
#include <gdfontmb.h> /* 3 Medium bold font */
|
||||
#include <gdfontl.h> /* 4 Large font */
|
||||
#include <gdfontg.h> /* 5 Giant font */
|
||||
#ifdef HAVE_GD_BUNDLED
|
||||
# include "libgd/gd.h"
|
||||
# include "libgd/gd_errors.h"
|
||||
# include "libgd/gdfontt.h" /* 1 Tiny font */
|
||||
# include "libgd/gdfonts.h" /* 2 Small font */
|
||||
# include "libgd/gdfontmb.h" /* 3 Medium bold font */
|
||||
# include "libgd/gdfontl.h" /* 4 Large font */
|
||||
# include "libgd/gdfontg.h" /* 5 Giant font */
|
||||
#else
|
||||
# include <gd.h>
|
||||
# include <gd_errors.h>
|
||||
# include <gdfontt.h> /* 1 Tiny font */
|
||||
# include <gdfonts.h> /* 2 Small font */
|
||||
# include <gdfontmb.h> /* 3 Medium bold font */
|
||||
# include <gdfontl.h> /* 4 Large font */
|
||||
# include <gdfontg.h> /* 5 Giant font */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GD_FREETYPE) && defined(HAVE_GD_BUNDLED)
|
||||
# include <ft2build.h>
|
||||
|
||||
@@ -19,11 +19,12 @@
|
||||
* (end code)
|
||||
**/
|
||||
|
||||
#include <gd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "gd.h"
|
||||
|
||||
static int gdGuessBackgroundColorFromCorners(gdImagePtr im, int *color);
|
||||
static int gdColorMatch(gdImagePtr im, int col1, int col2, float threshold);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ TODO:
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <gd.h>
|
||||
#include "gd.h"
|
||||
#include "gdhelpers.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@@ -51,13 +51,13 @@
|
||||
----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <gd.h>
|
||||
#include <gdfonts.h>
|
||||
#include <gd_errors.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "gd.h"
|
||||
#include "gdfonts.h"
|
||||
#include "gd_errors.h"
|
||||
#include "wbmp.h"
|
||||
|
||||
|
||||
|
||||
@@ -3063,6 +3063,23 @@ PHP_FUNCTION(imap_fetch_overview)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_bool header_injection(zend_string *str, zend_bool adrlist)
|
||||
{
|
||||
char *p = ZSTR_VAL(str);
|
||||
|
||||
while ((p = strpbrk(p, "\r\n")) != NULL) {
|
||||
if (!(p[0] == '\r' && p[1] == '\n')
|
||||
/* adrlists do not support folding, but swallow trailing line breaks */
|
||||
&& !((adrlist && p[1] == '\0')
|
||||
/* other headers support folding */
|
||||
|| (!adrlist && (p[1] == ' ' || p[1] == '\t')))) {
|
||||
return 1;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* {{{ Create a MIME message based on given envelope and body sections */
|
||||
PHP_FUNCTION(imap_mail_compose)
|
||||
{
|
||||
@@ -3086,6 +3103,13 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
zend_argument_value_error(2, "cannot be empty");
|
||||
}
|
||||
|
||||
#define CHECK_HEADER_INJECTION(zstr, adrlist, header) \
|
||||
if (header_injection(zstr, adrlist)) { \
|
||||
php_error_docref(NULL, E_WARNING, "header injection attempt in " header); \
|
||||
RETVAL_FALSE; \
|
||||
goto done; \
|
||||
}
|
||||
|
||||
#define PHP_RFC822_PARSE_ADRLIST(target, value) \
|
||||
str_copy = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); \
|
||||
rfc822_parse_adrlist(target, str_copy, "NO HOST"); \
|
||||
@@ -3094,46 +3118,57 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
env = mail_newenvelope();
|
||||
if ((pvalue = zend_hash_str_find(envelope, "remail", sizeof("remail") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "remail");
|
||||
env->remail = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "return_path", sizeof("return_path") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "return_path");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->return_path, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "date", sizeof("date") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "date");
|
||||
env->date = (unsigned char*)cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "from", sizeof("from") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "from");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->from, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "reply_to", sizeof("reply_to") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "reply_to");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->reply_to, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "in_reply_to", sizeof("in_reply_to") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "in_reply_to");
|
||||
env->in_reply_to = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "subject", sizeof("subject") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "subject");
|
||||
env->subject = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "to", sizeof("to") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "to");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->to, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "cc", sizeof("cc") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "cc");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->cc, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "bcc", sizeof("bcc") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "bcc");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->bcc, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "message_id", sizeof("message_id") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "message_id");
|
||||
env->message_id=cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
|
||||
@@ -3144,6 +3179,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) {
|
||||
custom_headers_param = mail_newbody_parameter();
|
||||
convert_to_string_ex(env_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(env_data), 0, "custom_headers");
|
||||
custom_headers_param->value = (char *) fs_get(Z_STRLEN_P(env_data) + 1);
|
||||
custom_headers_param->attribute = NULL;
|
||||
memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRLEN_P(env_data) + 1);
|
||||
@@ -3186,6 +3222,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body charset");
|
||||
tmp_param = mail_newbody_parameter();
|
||||
tmp_param->value = cpystr(Z_STRVAL_P(pvalue));
|
||||
tmp_param->attribute = cpystr("CHARSET");
|
||||
@@ -3198,9 +3235,11 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
CHECK_HEADER_INJECTION(key, 0, "body disposition key");
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body disposition value");
|
||||
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
|
||||
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
|
||||
disp_param->next = tmp_param;
|
||||
@@ -3211,18 +3250,22 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "subtype", sizeof("subtype") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body subtype");
|
||||
bod->subtype = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "id", sizeof("id") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body id");
|
||||
bod->id = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "description", sizeof("description") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body description");
|
||||
bod->description = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body disposition.type");
|
||||
bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
|
||||
}
|
||||
@@ -3232,9 +3275,11 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
CHECK_HEADER_INJECTION(key, 0, "body type.parameters key");
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body type.parameters value");
|
||||
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
|
||||
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
|
||||
disp_param->next = tmp_param;
|
||||
@@ -3265,6 +3310,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body md5");
|
||||
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
} else if (Z_TYPE_P(data) == IS_ARRAY && topbod->type == TYPEMULTIPART) {
|
||||
@@ -3297,6 +3343,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body charset");
|
||||
tmp_param = mail_newbody_parameter();
|
||||
tmp_param->value = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
|
||||
@@ -3310,9 +3357,11 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
CHECK_HEADER_INJECTION(key, 0, "body type.parameters key");
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body type.parameters value");
|
||||
disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1);
|
||||
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
|
||||
disp_param->next = tmp_param;
|
||||
@@ -3323,18 +3372,22 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "subtype", sizeof("subtype") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body subtype");
|
||||
bod->subtype = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "id", sizeof("id") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body id");
|
||||
bod->id = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "description", sizeof("description") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body description");
|
||||
bod->description = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body disposition.type");
|
||||
bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
|
||||
}
|
||||
@@ -3344,9 +3397,11 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
CHECK_HEADER_INJECTION(key, 0, "body disposition key");
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body disposition value");
|
||||
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
|
||||
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
|
||||
disp_param->next = tmp_param;
|
||||
@@ -3377,6 +3432,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body md5");
|
||||
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
Bug #80710 (imap_mail_compose() header injection) - MIME Splitting Attack
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("imap")) die("skip imap extension not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$envelope["from"]= "joe@example.com\n From : X-INJECTED";
|
||||
$envelope["to"] = "foo@example.com\nFrom: X-INJECTED";
|
||||
$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED";
|
||||
$envelope["x-remail"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
$envelope["something"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
|
||||
$part1["type"] = TYPEMULTIPART;
|
||||
$part1["subtype"] = "mixed";
|
||||
|
||||
$part2["type"] = TYPEAPPLICATION;
|
||||
$part2["encoding"] = ENCBINARY;
|
||||
$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED";
|
||||
$part2["description"] = "some file\nContent-Type: X-INJECTED";
|
||||
$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED";
|
||||
|
||||
$part3["type"] = TYPETEXT;
|
||||
$part3["subtype"] = "plain";
|
||||
$part3["description"] = "description3";
|
||||
$part3["contents.data"] = "contents.data3\n\n\n\t";
|
||||
|
||||
$body[1] = $part1;
|
||||
$body[2] = $part2;
|
||||
$body[3] = $part3;
|
||||
|
||||
echo imap_mail_compose($envelope, $body);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imap_mail_compose(): header injection attempt in from in %s on line %d
|
||||
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
Bug #80710 (imap_mail_compose() header injection) - Remail
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("imap")) die("skip imap extension not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$envelope["from"]= "joe@example.com\n From : X-INJECTED";
|
||||
$envelope["to"] = "foo@example.com\nFrom: X-INJECTED";
|
||||
$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED";
|
||||
$envelope["remail"] = "X-INJECTED-REMAIL: X-INJECTED\nFrom: X-INJECTED-REMAIL-FROM"; //<--- Injected as first hdr
|
||||
$envelope["something"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
|
||||
$part1["type"] = TYPEMULTIPART;
|
||||
$part1["subtype"] = "mixed";
|
||||
|
||||
$part2["type"] = TYPEAPPLICATION;
|
||||
$part2["encoding"] = ENCBINARY;
|
||||
$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED";
|
||||
$part2["description"] = "some file\nContent-Type: X-INJECTED";
|
||||
$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED";
|
||||
|
||||
$part3["type"] = TYPETEXT;
|
||||
$part3["subtype"] = "plain";
|
||||
$part3["description"] = "description3";
|
||||
$part3["contents.data"] = "contents.data3\n\n\n\t";
|
||||
|
||||
$body[1] = $part1;
|
||||
$body[2] = $part2;
|
||||
$body[3] = $part3;
|
||||
|
||||
echo imap_mail_compose($envelope, $body);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imap_mail_compose(): header injection attempt in remail in %s on line %d
|
||||
@@ -11,7 +11,7 @@ class UConverter
|
||||
|
||||
/**
|
||||
* @param int $error
|
||||
* @return string|null
|
||||
* @return string|int|array|null
|
||||
*/
|
||||
public function fromUCallback(int $reason, array $source, int $codePoint, &$error) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ class UConverter
|
||||
|
||||
/**
|
||||
* @param int $error
|
||||
* @return string|null
|
||||
* @return string|int|array|null
|
||||
*/
|
||||
public function toUCallback(int $reason, string $source, string $codeUnits, &$error) {}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: e33e2614c969c59b79c6062f7a347a8e8e486d85 */
|
||||
* Stub hash: 07a152ecebadf8f1766fb231cd60bfefda0dd6a6 */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter___construct, 0, 0, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, destination_encoding, IS_STRING, 1, "null")
|
||||
|
||||
@@ -77,6 +77,7 @@ zend_object *IntlDateFormatter_object_clone(zend_object *object)
|
||||
zend_object *new_obj;
|
||||
|
||||
dfo = php_intl_dateformatter_fetch_object(object);
|
||||
intl_error_reset(INTL_DATA_ERROR_P(dfo));
|
||||
|
||||
new_obj = IntlDateFormatter_ce_ptr->create_object(object->ce);
|
||||
new_dfo = php_intl_dateformatter_fetch_object(new_obj);
|
||||
|
||||
@@ -64,6 +64,8 @@ zend_object *NumberFormatter_object_clone(zend_object *object)
|
||||
zend_object *new_obj;
|
||||
|
||||
nfo = php_intl_number_format_fetch_object(object);
|
||||
intl_error_reset(INTL_DATA_ERROR_P(nfo));
|
||||
|
||||
new_obj = NumberFormatter_ce_ptr->create_object(object->ce);
|
||||
new_nfo = php_intl_number_format_fetch_object(new_obj);
|
||||
/* clone standard parts */
|
||||
|
||||
@@ -62,6 +62,8 @@ zend_object *MessageFormatter_object_clone(zend_object *object)
|
||||
zend_object *new_obj;
|
||||
|
||||
mfo = php_intl_messageformatter_fetch_object(object);
|
||||
intl_error_reset(INTL_DATA_ERROR_P(mfo));
|
||||
|
||||
new_obj = MessageFormatter_ce_ptr->create_object(object->ce);
|
||||
new_mfo = php_intl_messageformatter_fetch_object(new_obj);
|
||||
/* clone standard parts */
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #81019: Unable to clone NumberFormatter after failed parse()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$fmt = new NumberFormatter('en_US', NumberFormatter::DECIMAL);
|
||||
$fmt->parse('abc');
|
||||
$fmt2 = clone $fmt;
|
||||
|
||||
$datefmt = new IntlDateFormatter('en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL);
|
||||
$datefmt->parse('abc');
|
||||
$datefmt2 = clone $datefmt;
|
||||
|
||||
$msgfmt = new MessageFormatter('en_US', '{0,number,integer}');
|
||||
$msgfmt->parse('abc');
|
||||
$msgfmt2 = clone $msgfmt;
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -2451,6 +2451,7 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
|
||||
}
|
||||
/* convert value */
|
||||
ZEND_ASSERT(entry);
|
||||
try_again:
|
||||
switch(Z_TYPE_P(entry)) {
|
||||
case IS_STRING:
|
||||
cval = php_mb_convert_encoding(
|
||||
@@ -2475,6 +2476,9 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
|
||||
ZVAL_EMPTY_ARRAY(&entry_tmp);
|
||||
}
|
||||
break;
|
||||
case IS_REFERENCE:
|
||||
entry = Z_REFVAL_P(entry);
|
||||
goto try_again;
|
||||
case IS_OBJECT:
|
||||
default:
|
||||
if (key) {
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
--TEST--
|
||||
Bug #81011 (mb_convert_encoding removes references from arrays)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('mbstring')) die("skip mbstring extension not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$array = [
|
||||
'ads' => [
|
||||
123 => ['name' => 'this', 'id' => 444],
|
||||
234 => ['name' => 'that', 'id' => 555],
|
||||
],
|
||||
'other' => ['one', 'two']
|
||||
];
|
||||
|
||||
// we modify array elements using reference
|
||||
foreach( $array['ads'] as &$ad ){
|
||||
$ad['premium'] = (int)($ad['id'] == 555);
|
||||
}
|
||||
|
||||
var_dump($array);
|
||||
var_dump(mb_convert_encoding($array, 'UTF-8', 'UTF-8'));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["ads"]=>
|
||||
array(2) {
|
||||
[123]=>
|
||||
array(3) {
|
||||
["name"]=>
|
||||
string(4) "this"
|
||||
["id"]=>
|
||||
int(444)
|
||||
["premium"]=>
|
||||
int(0)
|
||||
}
|
||||
[234]=>
|
||||
&array(3) {
|
||||
["name"]=>
|
||||
string(4) "that"
|
||||
["id"]=>
|
||||
int(555)
|
||||
["premium"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
["other"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "one"
|
||||
[1]=>
|
||||
string(3) "two"
|
||||
}
|
||||
}
|
||||
array(2) {
|
||||
["ads"]=>
|
||||
array(2) {
|
||||
[123]=>
|
||||
array(3) {
|
||||
["name"]=>
|
||||
string(4) "this"
|
||||
["id"]=>
|
||||
int(444)
|
||||
["premium"]=>
|
||||
int(0)
|
||||
}
|
||||
[234]=>
|
||||
array(3) {
|
||||
["name"]=>
|
||||
string(4) "that"
|
||||
["id"]=>
|
||||
int(555)
|
||||
["premium"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
["other"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "one"
|
||||
[1]=>
|
||||
string(3) "two"
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class mysqli
|
||||
public function get_warnings() {}
|
||||
|
||||
/**
|
||||
* @return mysqli|false
|
||||
* @return null|false
|
||||
*/
|
||||
public function init() {}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 36c7ee22aa4c5bb5e0174031a3defcaaadde0dbd */
|
||||
* Stub hash: c2ab263780902447855ecb0d8a9e3432577a32d1 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
|
||||
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
|
||||
|
||||
@@ -22,8 +22,11 @@ function oci_bind_by_name($statement, string $param, mixed &$var, int $max_lengt
|
||||
*/
|
||||
function ocibindbyname($statement, string $param, mixed &$var, int $max_length = -1, int $type = 0): bool {}
|
||||
|
||||
/** @param resource $statement */
|
||||
function oci_bind_array_by_name($statement, string $param, mixed &$var, int $max_array_length, int $max_item_length = -1, int $type = SQLT_AFC): bool {}
|
||||
/**
|
||||
* @param resource $statement
|
||||
* @param array $var
|
||||
*/
|
||||
function oci_bind_array_by_name($statement, string $param, &$var, int $max_array_length, int $max_item_length = -1, int $type = SQLT_AFC): bool {}
|
||||
|
||||
function oci_free_descriptor(OCILob $lob): bool {}
|
||||
|
||||
@@ -247,7 +250,7 @@ function oci_fetch_all($statement, &$output, int $offset = 0, int $limit = -1, i
|
||||
function ocifetchstatement($statement, &$output, int $offset = 0, int $limit = -1, int $flags = 0): int {}
|
||||
|
||||
/** @param resource $statement */
|
||||
function oci_fetch_object($statement, int $mode = PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS): stdClass|null|false {}
|
||||
function oci_fetch_object($statement, int $mode = PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS): stdClass|false {}
|
||||
|
||||
/** @param resource $statement */
|
||||
function oci_fetch_row($statement): array|false {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: e7a7a9402b2668136f9f47d6e547e3af46a78a50 */
|
||||
* Stub hash: 7355ccbef6b490db7ddec94d485fbfb4597c3150 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
|
||||
ZEND_ARG_INFO(0, statement)
|
||||
@@ -23,7 +23,7 @@ ZEND_END_ARG_INFO()
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_bind_array_by_name, 0, 4, _IS_BOOL, 0)
|
||||
ZEND_ARG_INFO(0, statement)
|
||||
ZEND_ARG_TYPE_INFO(0, param, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(1, var, IS_MIXED, 0)
|
||||
ZEND_ARG_INFO(1, var)
|
||||
ZEND_ARG_TYPE_INFO(0, max_array_length, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_item_length, IS_LONG, 0, "-1")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "SQLT_AFC")
|
||||
@@ -221,7 +221,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_ocifetchstatement arginfo_oci_fetch_all
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_fetch_object, 0, 1, stdClass, MAY_BE_NULL|MAY_BE_FALSE)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_fetch_object, 0, 1, stdClass, MAY_BE_FALSE)
|
||||
ZEND_ARG_INFO(0, statement)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
+36
-1
@@ -1447,6 +1447,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
|
||||
} else if (result->values[i].vallen == SQL_NULL_DATA) {
|
||||
ZVAL_NULL(&tmp);
|
||||
break;
|
||||
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", i + 1);
|
||||
ZVAL_FALSE(&tmp);
|
||||
} else {
|
||||
ZVAL_STRINGL(&tmp, buf, result->values[i].vallen);
|
||||
}
|
||||
@@ -1456,6 +1459,10 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
|
||||
if (result->values[i].vallen == SQL_NULL_DATA) {
|
||||
ZVAL_NULL(&tmp);
|
||||
break;
|
||||
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", i + 1);
|
||||
ZVAL_FALSE(&tmp);
|
||||
break;
|
||||
}
|
||||
ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen);
|
||||
break;
|
||||
@@ -1600,6 +1607,9 @@ PHP_FUNCTION(odbc_fetch_into)
|
||||
} else if (result->values[i].vallen == SQL_NULL_DATA) {
|
||||
ZVAL_NULL(&tmp);
|
||||
break;
|
||||
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", i + 1);
|
||||
ZVAL_FALSE(&tmp);
|
||||
} else {
|
||||
ZVAL_STRINGL(&tmp, buf, result->values[i].vallen);
|
||||
}
|
||||
@@ -1609,6 +1619,10 @@ PHP_FUNCTION(odbc_fetch_into)
|
||||
if (result->values[i].vallen == SQL_NULL_DATA) {
|
||||
ZVAL_NULL(&tmp);
|
||||
break;
|
||||
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", i + 1);
|
||||
ZVAL_FALSE(&tmp);
|
||||
break;
|
||||
}
|
||||
ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen);
|
||||
break;
|
||||
@@ -1836,6 +1850,10 @@ PHP_FUNCTION(odbc_result)
|
||||
} else if (result->values[field_ind].vallen == SQL_NULL_DATA) {
|
||||
zend_string_efree(field_str);
|
||||
RETURN_NULL();
|
||||
} else if (result->values[field_ind].vallen == SQL_NO_TOTAL) {
|
||||
zend_string_efree(field_str);
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", field_ind + 1);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* Reduce fieldlen by 1 if we have char data. One day we might
|
||||
have binary strings... */
|
||||
@@ -1859,6 +1877,9 @@ PHP_FUNCTION(odbc_result)
|
||||
default:
|
||||
if (result->values[field_ind].vallen == SQL_NULL_DATA) {
|
||||
RETURN_NULL();
|
||||
} else if (result->values[field_ind].vallen == SQL_NO_TOTAL) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", field_ind + 1);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen);
|
||||
}
|
||||
@@ -1890,6 +1911,10 @@ PHP_FUNCTION(odbc_result)
|
||||
if (result->values[field_ind].vallen == SQL_NULL_DATA) {
|
||||
efree(field);
|
||||
RETURN_NULL();
|
||||
} else if (result->values[field_ind].vallen == SQL_NO_TOTAL) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", field_ind + 1);
|
||||
efree(field);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* chop the trailing \0 by outputting only 4095 bytes */
|
||||
PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 : result->values[field_ind].vallen);
|
||||
@@ -1994,7 +2019,14 @@ PHP_FUNCTION(odbc_result_all)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (rc == SQL_SUCCESS_WITH_INFO) {
|
||||
PHPWRITE(buf, result->longreadlen);
|
||||
if (result->values[i].vallen == SQL_NO_TOTAL) {
|
||||
php_printf("</td></tr></table>");
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%zu (driver cannot determine length)", i + 1);
|
||||
efree(buf);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
PHPWRITE(buf, result->longreadlen);
|
||||
}
|
||||
} else if (rc != SQL_SUCCESS) {
|
||||
php_printf("</td></tr></table>");
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%zu (retcode %u)", i + 1, rc);
|
||||
@@ -2011,6 +2043,9 @@ PHP_FUNCTION(odbc_result_all)
|
||||
default:
|
||||
if (result->values[i].vallen == SQL_NULL_DATA) {
|
||||
php_printf("<td>NULL</td>");
|
||||
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%zu (driver cannot determine length)", i + 1);
|
||||
php_printf("<td>FALSE</td>");
|
||||
} else {
|
||||
php_printf("<td>%s</td>", result->values[i].value);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,41 @@ static uint32_t add_static_slot(HashTable *hash,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static zend_string *create_str_cache_key(zval *literal, uint32_t flags)
|
||||
{
|
||||
ZEND_ASSERT(Z_TYPE_P(literal) == IS_STRING);
|
||||
uint32_t num_related = LITERAL_NUM_RELATED(flags);
|
||||
if (num_related == 1) {
|
||||
return zend_string_copy(Z_STR_P(literal));
|
||||
}
|
||||
if ((flags & LITERAL_KIND_MASK) == LITERAL_VALUE) {
|
||||
/* Don't merge LITERAL_VALUE that has related literals */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Concatenate all the related literals for the cache key. */
|
||||
zend_string *key;
|
||||
if (num_related == 2) {
|
||||
ZEND_ASSERT(Z_TYPE_P(literal + 1) == IS_STRING);
|
||||
key = zend_string_concat2(
|
||||
Z_STRVAL_P(literal), Z_STRLEN_P(literal),
|
||||
Z_STRVAL_P(literal + 1), Z_STRLEN_P(literal + 1));
|
||||
} else if (num_related == 3) {
|
||||
ZEND_ASSERT(Z_TYPE_P(literal + 1) == IS_STRING && Z_TYPE_P(literal + 2) == IS_STRING);
|
||||
key = zend_string_concat3(
|
||||
Z_STRVAL_P(literal), Z_STRLEN_P(literal),
|
||||
Z_STRVAL_P(literal + 1), Z_STRLEN_P(literal + 1),
|
||||
Z_STRVAL_P(literal + 2), Z_STRLEN_P(literal + 2));
|
||||
} else {
|
||||
ZEND_ASSERT(0 && "Currently not needed");
|
||||
}
|
||||
|
||||
/* Add a bias to the hash so we can distinguish keys
|
||||
* that would otherwise be the same after concatenation. */
|
||||
ZSTR_H(key) = zend_string_hash_val(key) + num_related - 1;
|
||||
return key;
|
||||
}
|
||||
|
||||
void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx)
|
||||
{
|
||||
zend_op *opline, *end;
|
||||
@@ -407,16 +442,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
|
||||
}
|
||||
break;
|
||||
case IS_STRING: {
|
||||
if (LITERAL_NUM_RELATED(info[i].flags) == 1) {
|
||||
key = zend_string_copy(Z_STR(op_array->literals[i]));
|
||||
} else if ((info[i].flags & LITERAL_KIND_MASK) != LITERAL_VALUE) {
|
||||
key = zend_string_init(Z_STRVAL(op_array->literals[i]), Z_STRLEN(op_array->literals[i]), 0);
|
||||
ZSTR_H(key) = ZSTR_HASH(Z_STR(op_array->literals[i])) +
|
||||
LITERAL_NUM_RELATED(info[i].flags) - 1;
|
||||
} else {
|
||||
/* Don't merge LITERAL_VALUE that has related literals */
|
||||
key = NULL;
|
||||
}
|
||||
key = create_str_cache_key(&op_array->literals[i], info[i].flags);
|
||||
if (key && (pos = zend_hash_find(&hash, key)) != NULL &&
|
||||
Z_TYPE(op_array->literals[Z_LVAL_P(pos)]) == IS_STRING &&
|
||||
LITERAL_NUM_RELATED(info[i].flags) == LITERAL_NUM_RELATED(info[Z_LVAL_P(pos)].flags) &&
|
||||
|
||||
@@ -1983,7 +1983,7 @@ static void sccp_mark_feasible_successors(
|
||||
scdf_mark_edge_feasible(scdf, block_num, target);
|
||||
return;
|
||||
}
|
||||
s = 0;
|
||||
s = block->successors_count - 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -212,7 +212,7 @@ static const func_info_t func_infos[] = {
|
||||
F1("base64_decode", MAY_BE_FALSE | MAY_BE_STRING),
|
||||
F1("base64_encode", MAY_BE_STRING),
|
||||
F1("password_hash", MAY_BE_STRING),
|
||||
F1("password_get_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
|
||||
F1("password_get_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
|
||||
F1("convert_uuencode", MAY_BE_STRING),
|
||||
F1("convert_uudecode", MAY_BE_FALSE | MAY_BE_STRING),
|
||||
F1("pow", MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_OBJECT),
|
||||
@@ -382,7 +382,6 @@ static const func_info_t func_infos[] = {
|
||||
F1("array_count_values", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
|
||||
F1("array_column", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("array_reverse", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("array_reduce", UNKNOWN_INFO),
|
||||
F1("array_flip", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("array_change_key_case", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
|
||||
FN("array_rand", MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
|
||||
@@ -404,8 +403,6 @@ static const func_info_t func_infos[] = {
|
||||
F1("array_filter", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("array_chunk", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("array_combine", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("pos", UNKNOWN_INFO),
|
||||
F1("assert_options", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
|
||||
F1("str_rot13", MAY_BE_STRING),
|
||||
F1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_OBJECT),
|
||||
@@ -418,7 +415,7 @@ static const func_info_t func_infos[] = {
|
||||
F1("strftime", MAY_BE_FALSE | MAY_BE_STRING),
|
||||
F1("gmstrftime", MAY_BE_FALSE | MAY_BE_STRING),
|
||||
F1("localtime", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
|
||||
F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("date_create", MAY_BE_FALSE | MAY_BE_OBJECT),
|
||||
F1("date_create_immutable", MAY_BE_FALSE | MAY_BE_OBJECT),
|
||||
F1("date_create_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
|
||||
@@ -461,7 +458,7 @@ static const func_info_t func_infos[] = {
|
||||
F1("mysqli_query", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_OBJECT),
|
||||
F1("mysqli_get_charset", MAY_BE_NULL | MAY_BE_OBJECT),
|
||||
F1("mysqli_fetch_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("mysqli_fetch_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("mysqli_fetch_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("mysqli_fetch_all", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("mysqli_fetch_object", MAY_BE_NULL | MAY_BE_OBJECT),
|
||||
F1("mysqli_affected_rows", MAY_BE_LONG | MAY_BE_STRING),
|
||||
@@ -686,7 +683,7 @@ static const func_info_t func_infos[] = {
|
||||
F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
|
||||
|
||||
/* ext/pgsql */
|
||||
F1("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE),
|
||||
FN("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE),
|
||||
FN("pg_pconnect", MAY_BE_FALSE | MAY_BE_RESOURCE),
|
||||
F1("pg_dbname", MAY_BE_STRING),
|
||||
F1("pg_last_error", MAY_BE_STRING),
|
||||
@@ -707,7 +704,7 @@ static const func_info_t func_infos[] = {
|
||||
F1("pg_field_type_oid", MAY_BE_LONG | MAY_BE_STRING),
|
||||
F1("pg_fetch_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
|
||||
F1("pg_fetch_row", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("pg_fetch_assoc", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("pg_fetch_assoc", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("pg_fetch_array", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("pg_fetch_object", MAY_BE_FALSE | MAY_BE_OBJECT),
|
||||
F1("pg_fetch_all", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
|
||||
@@ -755,7 +752,7 @@ static const func_info_t func_infos[] = {
|
||||
FN("filter_input", UNKNOWN_INFO),
|
||||
FN("filter_var", UNKNOWN_INFO),
|
||||
F1("filter_input_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
|
||||
F1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
|
||||
|
||||
/* ext/gettext */
|
||||
|
||||
@@ -285,6 +285,14 @@ static void place_essa_pis(
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
/* The following patterns all inspect the opline directly before the JMPZ opcode.
|
||||
* Make sure that it is part of the same block, otherwise it might not be a dominating
|
||||
* assignment. */
|
||||
if (blocks[j].len == 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opline->op1_type == IS_TMP_VAR &&
|
||||
((opline-1)->opcode == ZEND_IS_EQUAL ||
|
||||
(opline-1)->opcode == ZEND_IS_NOT_EQUAL ||
|
||||
|
||||
@@ -29,7 +29,7 @@ if test "$PHP_OPCACHE" != "no"; then
|
||||
|
||||
if test "$PHP_OPCACHE_JIT" = "yes"; then
|
||||
case $host_cpu in
|
||||
x86*)
|
||||
i[[34567]]86*|x86*)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_WARN([JIT not supported by host architecture])
|
||||
|
||||
@@ -64,8 +64,7 @@ void zend_elf_load_symbols(void)
|
||||
}
|
||||
int fd = open(path, O_RDONLY);
|
||||
#elif defined(__sun)
|
||||
const char *path = getexecname();
|
||||
int fd = open(path, O_RDONLY);
|
||||
int fd = open("/proc/self/path/a.out", O_RDONLY);
|
||||
#elif defined(__HAIKU__)
|
||||
char path[PATH_MAX];
|
||||
if (find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH,
|
||||
|
||||
@@ -116,7 +116,7 @@ static const void *zend_jit_func_trace_counter_handler = NULL;
|
||||
static const void *zend_jit_ret_trace_counter_handler = NULL;
|
||||
static const void *zend_jit_loop_trace_counter_handler = NULL;
|
||||
|
||||
static void ZEND_FASTCALL zend_runtime_jit(void);
|
||||
static int ZEND_FASTCALL zend_runtime_jit(void);
|
||||
|
||||
static int zend_jit_trace_op_len(const zend_op *opline);
|
||||
static int zend_jit_trace_may_exit(const zend_op_array *op_array, const zend_op *opline);
|
||||
@@ -3625,7 +3625,7 @@ jit_failure:
|
||||
}
|
||||
|
||||
/* Run-time JIT handler */
|
||||
static void ZEND_FASTCALL zend_runtime_jit(void)
|
||||
static int ZEND_FASTCALL zend_runtime_jit(void)
|
||||
{
|
||||
zend_execute_data *execute_data = EG(current_execute_data);
|
||||
zend_op_array *op_array = &EX(func)->op_array;
|
||||
@@ -3657,6 +3657,7 @@ static void ZEND_FASTCALL zend_runtime_jit(void)
|
||||
zend_shared_alloc_unlock();
|
||||
|
||||
/* JIT-ed code is going to be called by VM */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void zend_jit_check_funcs(HashTable *function_table, zend_bool is_method) {
|
||||
@@ -4228,11 +4229,19 @@ ZEND_EXT_API int zend_jit_check_support(void)
|
||||
}
|
||||
|
||||
for (i = 0; i <= 256; i++) {
|
||||
if (zend_get_user_opcode_handler(i) != NULL) {
|
||||
zend_error(E_WARNING, "JIT is incompatible with third party extensions that setup user opcode handlers. JIT disabled.");
|
||||
JIT_G(enabled) = 0;
|
||||
JIT_G(on) = 0;
|
||||
return FAILURE;
|
||||
switch (i) {
|
||||
/* JIT has no effect on these opcodes */
|
||||
case ZEND_BEGIN_SILENCE:
|
||||
case ZEND_END_SILENCE:
|
||||
case ZEND_EXIT:
|
||||
break;
|
||||
default:
|
||||
if (zend_get_user_opcode_handler(i) != NULL) {
|
||||
zend_error(E_WARNING, "JIT is incompatible with third party extensions that setup user opcode handlers. JIT disabled.");
|
||||
JIT_G(enabled) = 0;
|
||||
JIT_G(on) = 0;
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,8 +136,7 @@ static void zend_jit_perf_jitdump_open(void)
|
||||
}
|
||||
fd = open(path, O_RDONLY);
|
||||
#elif defined(__sun)
|
||||
const char *path = getexecname();
|
||||
fd = open(path, O_RDONLY);
|
||||
fd = open("/proc/self/path/a.out", O_RDONLY);
|
||||
#elif defined(__HAIKU__)
|
||||
char path[PATH_MAX];
|
||||
if (find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH,
|
||||
|
||||
@@ -8780,7 +8780,7 @@ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, con
|
||||
| sub edx, dword [r0 + offsetof(zend_closure, func.op_array.last_var)]
|
||||
| sub edx, dword [r0 + offsetof(zend_closure, func.op_array.T)]
|
||||
}
|
||||
| shl edx, 5
|
||||
| shl edx, 4
|
||||
|.if X64
|
||||
| movsxd r2, edx
|
||||
|.endif
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
--TEST--
|
||||
Bug 80900: Switch constant with incorrect type
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function switchLong() {
|
||||
$var = 'foo';
|
||||
/* The number of case clauses needs to be greater than 5,
|
||||
* otherwise it will not be compiled into SWITCH_LONG. */
|
||||
switch ($var) {
|
||||
case 1:
|
||||
echo 'no1';
|
||||
break;
|
||||
case 2:
|
||||
echo 'no2';
|
||||
break;
|
||||
case 3:
|
||||
echo 'no3';
|
||||
break;
|
||||
case 4:
|
||||
echo 'no4';
|
||||
break;
|
||||
case 5:
|
||||
echo 'no5';
|
||||
break;
|
||||
default:
|
||||
echo 'yes';
|
||||
break;
|
||||
}
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
function switchString() {
|
||||
$var = false;
|
||||
switch ($var) {
|
||||
case 'string':
|
||||
echo 'no';
|
||||
break;
|
||||
default:
|
||||
echo 'yes';
|
||||
break;
|
||||
}
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
switchLong();
|
||||
switchString();
|
||||
?>
|
||||
--EXPECT--
|
||||
yes
|
||||
yes
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #81015: Opcache optimization assumes wrong part of ternary operator in if-condition
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function ternary(bool $enabled, ?string $value): void
|
||||
{
|
||||
// the "true" part is not as trivial in the real case
|
||||
if ($enabled ? true : $value === null) {
|
||||
echo ($value ?? 'NULL') . "\n";
|
||||
} else {
|
||||
echo "INVALID\n";
|
||||
}
|
||||
}
|
||||
|
||||
ternary(true, 'value');
|
||||
ternary(true, null);
|
||||
ternary(false, 'value');
|
||||
ternary(false, null);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
value
|
||||
NULL
|
||||
INVALID
|
||||
NULL
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #81046: Literal compaction merges non-equal related literals
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
static function methoD() {
|
||||
echo "Method called\n";
|
||||
}
|
||||
}
|
||||
|
||||
const methoD = 1;
|
||||
var_dump(methoD);
|
||||
test::methoD();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
Method called
|
||||
@@ -120,7 +120,7 @@ function openssl_pkcs7_sign(string $input_filename, string $output_filename, Ope
|
||||
function openssl_pkcs7_decrypt(string $input_filename, string $output_filename, $certificate, $private_key = null): bool {}
|
||||
|
||||
/** @param array $certificates */
|
||||
function openssl_pkcs7_read(string $input_filename, &$certificates): bool {}
|
||||
function openssl_pkcs7_read(string $data, &$certificates): bool {}
|
||||
|
||||
function openssl_cms_verify(string $input_filename, int $flags = 0, ?string $certificates = null, array $ca_info = [], ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7 = null, ?string $sigfile = null, int $encoding = OPENSSL_ENCODING_SMIME): bool {}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: d4f73f86e6f16a74ab5b60bb79c4a9f29e9bc4fb */
|
||||
* Stub hash: b58bd453ee5bedc500fe0e81c00c6a8e0eca85a0 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0)
|
||||
ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL)
|
||||
@@ -195,7 +195,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_decrypt, 0, 3, _IS
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_read, 0, 2, _IS_BOOL, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, input_filename, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
|
||||
ZEND_ARG_INFO(1, certificates)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -240,7 +240,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_decrypt, 0, 3, _IS_B
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_LONG, 0, "OPENSSL_ENCODING_SMIME")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_openssl_cms_read arginfo_openssl_pkcs7_read
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_cms_read, 0, 2, _IS_BOOL, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, input_filename, IS_STRING, 0)
|
||||
ZEND_ARG_INFO(1, certificates)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_private_encrypt, 0, 3, _IS_BOOL, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
|
||||
|
||||
@@ -1342,6 +1342,7 @@ void pdo_dbh_init(void)
|
||||
REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_POST", (zend_long)PDO_PARAM_EVT_FETCH_POST);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_NORMALIZE", (zend_long)PDO_PARAM_EVT_NORMALIZE);
|
||||
|
||||
REGISTER_PDO_CLASS_CONST_LONG("FETCH_DEFAULT", (zend_long)PDO_FETCH_USE_DEFAULT);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("FETCH_LAZY", (zend_long)PDO_FETCH_LAZY);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("FETCH_ASSOC", (zend_long)PDO_FETCH_ASSOC);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("FETCH_NUM", (zend_long)PDO_FETCH_NUM);
|
||||
|
||||
+6
-8
@@ -914,8 +914,8 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
|
||||
return 0;
|
||||
}
|
||||
if (!stmt->fetch.cls.fci.size) {
|
||||
if (!do_fetch_class_prepare(stmt))
|
||||
{
|
||||
if (!do_fetch_class_prepare(stmt)) {
|
||||
zval_ptr_dtor(return_value);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1266,12 +1266,10 @@ PHP_METHOD(PDOStatement, fetchObject)
|
||||
|
||||
do_fetch_opt_finish(stmt, 0);
|
||||
|
||||
if (ctor_args) {
|
||||
if (Z_TYPE_P(ctor_args) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(ctor_args))) {
|
||||
ZVAL_ARR(&stmt->fetch.cls.ctor_args, zend_array_dup(Z_ARRVAL_P(ctor_args)));
|
||||
} else {
|
||||
ZVAL_UNDEF(&stmt->fetch.cls.ctor_args);
|
||||
}
|
||||
if (ctor_args && zend_hash_num_elements(Z_ARRVAL_P(ctor_args))) {
|
||||
ZVAL_ARR(&stmt->fetch.cls.ctor_args, zend_array_dup(Z_ARRVAL_P(ctor_args)));
|
||||
} else {
|
||||
ZVAL_UNDEF(&stmt->fetch.cls.ctor_args);
|
||||
}
|
||||
if (ce) {
|
||||
stmt->fetch.cls.ce = ce;
|
||||
|
||||
@@ -32,16 +32,16 @@ class PDOStatement implements IteratorAggregate
|
||||
public function execute(?array $params = null) {}
|
||||
|
||||
/** @return mixed */
|
||||
public function fetch(int $mode = PDO::FETCH_BOTH, int $cursorOrientation = PDO::FETCH_ORI_NEXT, int $cursorOffset = 0) {}
|
||||
public function fetch(int $mode = PDO::FETCH_DEFAULT, int $cursorOrientation = PDO::FETCH_ORI_NEXT, int $cursorOffset = 0) {}
|
||||
|
||||
/** @return array */
|
||||
public function fetchAll(int $mode = PDO::FETCH_BOTH, mixed ...$args) {}
|
||||
public function fetchAll(int $mode = PDO::FETCH_DEFAULT, mixed ...$args) {}
|
||||
|
||||
/** @return mixed */
|
||||
public function fetchColumn(int $column = 0) {}
|
||||
|
||||
/** @return object|false */
|
||||
public function fetchObject(?string $class = "stdClass", ?array $ctorArgs = null) {}
|
||||
public function fetchObject(?string $class = "stdClass", array $constructorArgs = []) {}
|
||||
|
||||
/** @return mixed */
|
||||
public function getAttribute(int $name) {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 764dfcd532d90de147f5e4b17e8a56e1545e289c */
|
||||
* Stub hash: 2717622c27bdc6aac5ec83609c11dec6cbc9f5d7 */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindColumn, 0, 0, 2)
|
||||
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)
|
||||
@@ -39,13 +39,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_execute, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetch, 0, 0, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PDO::FETCH_BOTH")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PDO::FETCH_DEFAULT")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cursorOrientation, IS_LONG, 0, "PDO::FETCH_ORI_NEXT")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cursorOffset, IS_LONG, 0, "0")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchAll, 0, 0, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PDO::FETCH_BOTH")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PDO::FETCH_DEFAULT")
|
||||
ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -55,7 +55,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchObject, 0, 0, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, class, IS_STRING, 1, "\"stdClass\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ctorArgs, IS_ARRAY, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, constructorArgs, IS_ARRAY, 0, "[]")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_getAttribute, 0, 0, 1)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
firebird
|
||||
@@ -2,6 +2,8 @@
|
||||
Bug #47415 PDO_Firebird segfaults when passing lowercased column name to bindColumn()
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: bug 48877 The "bindValue" and "bindParam" do not work for PDO Firebird if we use named parameters (:parameter).
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: bug 53280 segfaults if query column count is less than param count
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Bug #62024 Cannot insert second row with null using parametrized query (Firebird PDO)
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Bug #64037 Firebird return wrong value for numeric field
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: Feature 72583 Fetch integers as php integers not as strings
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: Bug 72931 Insert returning fails on Firebird 3
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: bug 73087 segfault binding blob parameter
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: Bug #74462 Returns only NULLs for boolean fields
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: Bug #76488 Memory leak when fetching a BLOB field
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: Bug #76488 PDO Firebird does not support boolean datatype in input parameters
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Bug #80521 (Parameters with underscores no longer recognized)
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: cursor should not be marked as opened on singleton statements
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
|
||||
@@ -7,6 +7,7 @@ if (!extension_loaded('pdo_firebird')) print 'skip'; ?>
|
||||
# magic auto-configuration
|
||||
|
||||
$config = array(
|
||||
'ENV' => ['LSAN_OPTIONS' => 'detect_leaks=0'],
|
||||
'TESTS' => 'ext/pdo/tests'
|
||||
);
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: connect/disconnect
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require("testdb.inc");
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: DDL/transactions
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ if (strpos(getenv('PDO_FIREBIRD_TEST_DSN'), 'dialect=1')===false) {
|
||||
die('skip: PDO_FIREBIRD_TEST_DSN must contain a string "dialect=1"');
|
||||
}
|
||||
?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require("testdb.inc");
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: prepare/execute/binding
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require("testdb.inc");
|
||||
|
||||
@@ -3,6 +3,8 @@ PDO_Firebird: support EXECUTE BLOCK
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc');
|
||||
?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require("testdb.inc");
|
||||
|
||||
@@ -3,6 +3,8 @@ PDO_Firebird: ingnore parameter marks in comments
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc');
|
||||
?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require("testdb.inc");
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
function run_server(string $payloadFile): string {
|
||||
$cmd = [getenv("TEST_PHP_EXECUTABLE"), "-n", __DIR__ . "/payload_server.php", $payloadFile];
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => ['pipe', 'w'],
|
||||
);
|
||||
$proc = proc_open($cmd, $descriptorspec, $pipes);
|
||||
|
||||
// First, wait for the payload server to declare itself ready.
|
||||
$bound = null;
|
||||
stream_set_blocking($pipes[2], false);
|
||||
for ($i = 0; $i < 60; $i++) {
|
||||
usleep(50000); // 50ms per try
|
||||
$status = proc_get_status($proc);
|
||||
if (empty($status['running'])) {
|
||||
echo "Server is not running\n";
|
||||
proc_terminate($proc);
|
||||
exit(1);
|
||||
}
|
||||
while (($line = fgets($pipes[2])) !== false) {
|
||||
if (preg_match('/FB payload server listening on (.+)/', $line, $matches)) {
|
||||
$bound = $matches[1];
|
||||
// Now that we've identified the listen address, close STDERR.
|
||||
// Otherwise the pipe may clog up with unread log messages.
|
||||
fclose($pipes[2]);
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($bound === null) {
|
||||
echo "Server did not output startup message";
|
||||
proc_terminate($proc);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Now wait for a connection to succeed.
|
||||
// note: even when server prints 'FB payload server listening on localhost:12345'
|
||||
// it might not be listening yet...need to wait until fsockopen() call returns
|
||||
$error = "Unable to connect to server\n";
|
||||
for ($i=0; $i < 60; $i++) {
|
||||
usleep(50000); // 50ms per try
|
||||
$status = proc_get_status($proc);
|
||||
$fp = fsockopen("tcp://$bound");
|
||||
// Failure, the server is no longer running
|
||||
if (!($status && $status['running'])) {
|
||||
$error = "Server is not running\n";
|
||||
break;
|
||||
}
|
||||
// Success, Connected to servers
|
||||
if ($fp) {
|
||||
$error = '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($fp) {
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
echo $error;
|
||||
proc_terminate($proc);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
register_shutdown_function(
|
||||
function($proc) {
|
||||
proc_terminate($proc);
|
||||
/* Wait for server to shutdown */
|
||||
for ($i = 0; $i < 60; $i++) {
|
||||
$status = proc_get_status($proc);
|
||||
if (!($status && $status['running'])) {
|
||||
break;
|
||||
}
|
||||
usleep(50000);
|
||||
}
|
||||
},
|
||||
$proc
|
||||
);
|
||||
|
||||
return $bound;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$socket = stream_socket_server("tcp://localhost:0", $errno, $errstr);
|
||||
if (!$socket) {
|
||||
echo "Can't start server: $errstr ($errno)\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$filename = $argv[1];
|
||||
$payload = file_get_contents($filename);
|
||||
if ($payload === false) {
|
||||
echo "Can't read $filename\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fputs(STDERR, "FB payload server listening on " . stream_socket_get_name($socket, false) . "\n");
|
||||
|
||||
while ($conn = stream_socket_accept($socket)) {
|
||||
fwrite($conn, $payload);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
FB payload server satisfies connection attempt
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_firebird')) die("skip pdo_firebird extension not available");
|
||||
if (!extension_loaded('sockets')) die("skip sockets extension not available");
|
||||
?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
require_once "payload_server.inc";
|
||||
|
||||
$address = run_server(__DIR__ . "/payload_test.data");
|
||||
|
||||
// no need to change the credentials; we're running against a fake server
|
||||
$dsn = "firebird:dbname=inet://$address/test";
|
||||
$username = 'SYSDBA';
|
||||
$password = 'masterkey';
|
||||
|
||||
new PDO($dsn, $username, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
|
||||
?>
|
||||
--EXPECT--
|
||||
@@ -2,6 +2,8 @@
|
||||
PDO_Firebird: rowCount
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--ENV--
|
||||
LSAN_OPTIONS=detect_leaks=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -94,7 +94,11 @@ int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int lin
|
||||
dbh->is_persistent);
|
||||
|
||||
} else {
|
||||
einfo->errmsg = pestrdup(mysql_error(H->server), dbh->is_persistent);
|
||||
if (S && S->stmt) {
|
||||
einfo->errmsg = pestrdup(mysql_stmt_error(S->stmt), dbh->is_persistent);
|
||||
} else {
|
||||
einfo->errmsg = pestrdup(mysql_error(H->server), dbh->is_persistent);
|
||||
}
|
||||
}
|
||||
} else { /* no error */
|
||||
strcpy(*pdo_err, PDO_ERR_NONE);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Bug #81037 PDO discards error message text from prepared statement
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
|
||||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
|
||||
$pdo = MySQLPDOTest::factory();
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
||||
MySQLPDOTest::createTestTable($pdo);
|
||||
|
||||
$sql = "SELECT id FROM test WHERE label = :par";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
try {
|
||||
$stmt->execute();
|
||||
} catch (PDOException $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/mysql_pdo_test.inc';
|
||||
MySQLPDOTest::dropTestTable();
|
||||
?>
|
||||
--EXPECT--
|
||||
SQLSTATE[HY000]: General error: 2031 No data supplied for parameters in prepared statement
|
||||
@@ -0,0 +1,99 @@
|
||||
--TEST--
|
||||
MySQL PDO: PDOStatement->fetchObject() with $constructorArgs
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
$db = MySQLPDOTest::factory();
|
||||
|
||||
try {
|
||||
$query = "SELECT '', NULL, \"\" FROM DUAL";
|
||||
$stmt = $db->prepare($query);
|
||||
$ok = @$stmt->execute();
|
||||
} catch (PDOException $e) {
|
||||
die("skip: Test cannot be run with SQL mode ANSI");
|
||||
}
|
||||
if (!$ok)
|
||||
die("skip: Test cannot be run with SQL mode ANSI");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
/** @var PDO $db */
|
||||
$db = MySQLPDOTest::factory();
|
||||
MySQLPDOTest::createTestTable($db);
|
||||
|
||||
$query = "SELECT id FROM test ORDER BY id ASC LIMIT 1";
|
||||
$stmt = $db->prepare($query);
|
||||
|
||||
class Foo {
|
||||
public int $a;
|
||||
public int $id;
|
||||
|
||||
public function __construct($a) {
|
||||
$this->a = $a;
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public int $id;
|
||||
}
|
||||
|
||||
$stmt->execute();
|
||||
try {
|
||||
$obj = $stmt->fetchObject(Foo::class);
|
||||
} catch (ArgumentCountError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
$stmt->execute();
|
||||
try {
|
||||
$obj = $stmt->fetchObject(Foo::class, []);
|
||||
} catch (ArgumentCountError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
$stmt->execute();
|
||||
$obj = $stmt->fetchObject(Foo::class, ["a" => 123]);
|
||||
var_dump($obj);
|
||||
|
||||
$stmt->execute();
|
||||
$obj = $stmt->fetchObject(Bar::class);
|
||||
var_dump($obj);
|
||||
|
||||
$stmt->execute();
|
||||
$obj = $stmt->fetchObject(Bar::class, []);
|
||||
var_dump($obj);
|
||||
|
||||
try {
|
||||
$stmt->execute();
|
||||
$obj = $stmt->fetchObject(Bar::class, ["a" => 123]);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/mysql_pdo_test.inc';
|
||||
MySQLPDOTest::dropTestTable();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too few arguments to function Foo::__construct(), 0 passed and exactly 1 expected
|
||||
Too few arguments to function Foo::__construct(), 0 passed and exactly 1 expected
|
||||
object(Foo)#%d (2) {
|
||||
["a"]=>
|
||||
int(123)
|
||||
["id"]=>
|
||||
int(1)
|
||||
}
|
||||
object(Bar)#%d (1) {
|
||||
["id"]=>
|
||||
int(1)
|
||||
}
|
||||
object(Bar)#%d (1) {
|
||||
["id"]=>
|
||||
int(1)
|
||||
}
|
||||
User-supplied statement does not accept constructor arguments
|
||||
@@ -321,9 +321,16 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
|
||||
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
|
||||
/* MS Access, for instance, doesn't support SQLDescribeParam,
|
||||
* so we need to guess */
|
||||
sqltype = PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB ?
|
||||
SQL_LONGVARBINARY :
|
||||
SQL_LONGVARCHAR;
|
||||
switch (PDO_PARAM_TYPE(param->param_type)) {
|
||||
case PDO_PARAM_INT:
|
||||
sqltype = SQL_INTEGER;
|
||||
break;
|
||||
case PDO_PARAM_LOB:
|
||||
sqltype = SQL_LONGVARBINARY;
|
||||
break;
|
||||
default:
|
||||
sqltype = SQL_LONGVARCHAR;
|
||||
}
|
||||
precision = 4000;
|
||||
scale = 5;
|
||||
nullable = 1;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #44643 (bound parameters ignore explicit type definitions)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_odbc')) die('skip pdo_odbc extension not available');
|
||||
require 'ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
$sql = "SELECT * FROM (SELECT 'test' = :id1) a WHERE a.test = :id2";
|
||||
$stmt = $db->prepare($sql);
|
||||
$id1 = 1;
|
||||
$stmt->bindParam(':id1', $id1, PDO::PARAM_INT);
|
||||
$id2 = 1;
|
||||
$stmt->bindParam(':id2', $id2, PDO::PARAM_INT);
|
||||
var_dump($stmt->execute());
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Loaded 100 of 165 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user