mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-26 10:25:41 +00:00
Compare commits
195
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82d537811c | ||
|
|
7eedb5bf11 | ||
|
|
932f707177 | ||
|
|
1ddf72180a | ||
|
|
f98ab19dc0 | ||
|
|
e78ac461db | ||
|
|
d698f0ae51 | ||
|
|
bb98ed600a | ||
|
|
a12cef979d | ||
|
|
ea807f9c07 | ||
|
|
51fca4b77d | ||
|
|
43c2dfa7b3 | ||
|
|
4aeff30337 | ||
|
|
1922c650ba | ||
|
|
32fe02c27d | ||
|
|
31b634bf7c | ||
|
|
0fac73a3bf | ||
|
|
7ceb0e3a18 | ||
|
|
53d274beb0 | ||
|
|
33d3acaae7 | ||
|
|
48cfd1160b | ||
|
|
7c31203935 | ||
|
|
e2291e4b1a | ||
|
|
1390a5812b | ||
|
|
3605d1baf5 | ||
|
|
906f19f136 | ||
|
|
6935058a98 | ||
|
|
c8f07ad477 | ||
|
|
259057b2a4 | ||
|
|
f06a069c46 | ||
|
|
e8429400d4 | ||
|
|
e201f01ac1 | ||
|
|
f9c2bf73ad | ||
|
|
ce2c67c8e8 | ||
|
|
03964892c0 | ||
|
|
64043cb9e5 | ||
|
|
fc8eff897b | ||
|
|
24dda816d0 | ||
|
|
df4bf28f9f | ||
|
|
1744be2d17 | ||
|
|
9ff3334397 | ||
|
|
dc72378ff0 | ||
|
|
15e9f4baf4 | ||
|
|
b221df5549 | ||
|
|
2425f88afd | ||
|
|
da5321013c | ||
|
|
f2f8ea9ac5 | ||
|
|
f1acac154a | ||
|
|
d52c485717 | ||
|
|
742c54aecf | ||
|
|
0a21b5d970 | ||
|
|
ee61c7175f | ||
|
|
69ed3969dd | ||
|
|
51f9a00b47 | ||
|
|
dda81f0505 | ||
|
|
0e09009753 | ||
|
|
4d2278143a | ||
|
|
863bf294fe | ||
|
|
7381b6accc | ||
|
|
c7d3c027d5 | ||
|
|
c2e197e4ef | ||
|
|
7fc04937f5 | ||
|
|
66edc15875 | ||
|
|
8f1baa6e1c | ||
|
|
ce5c4500cd | ||
|
|
16023f3e3b | ||
|
|
7a4584d3f6 | ||
|
|
b7fa67742c | ||
|
|
e488690d95 | ||
|
|
c96d08b272 | ||
|
|
daa0abaf77 | ||
|
|
34b624f122 | ||
|
|
496f291f3d | ||
|
|
b4b082e63e | ||
|
|
545eddba93 | ||
|
|
885edfef0a | ||
|
|
c8157619ef | ||
|
|
97aa752fee | ||
|
|
6dedeb40db | ||
|
|
bf58162ddf | ||
|
|
b6f5cb11a4 | ||
|
|
29533ae528 | ||
|
|
ed84af4b88 | ||
|
|
eda31f57fb | ||
|
|
09de64a58d | ||
|
|
61b0b80388 | ||
|
|
485b7c6981 | ||
|
|
c938d2f537 | ||
|
|
303d97feda | ||
|
|
0d2f147d80 | ||
|
|
3e88d610e5 | ||
|
|
452d30cf7d | ||
|
|
8f2e08239f | ||
|
|
cd9c39d77c | ||
|
|
80f9a9725c | ||
|
|
8e440dc1d7 | ||
|
|
cd068b1ed6 | ||
|
|
b03f743e7d | ||
|
|
8da8dc04b6 | ||
|
|
921544cad9 | ||
|
|
a621781fdb | ||
|
|
1cbcbcbc21 | ||
|
|
23e25f3319 | ||
|
|
eef6b10b7c | ||
|
|
75b2ce28aa | ||
|
|
a39beaa251 | ||
|
|
b0954ebb79 | ||
|
|
8877feaeec | ||
|
|
fdb580a5ad | ||
|
|
5fe078abba | ||
|
|
d263ecd864 | ||
|
|
dacea3f6fb | ||
|
|
6a8db93115 | ||
|
|
c0119ca7f3 | ||
|
|
a85156db7d | ||
|
|
1edb2e9a10 | ||
|
|
ca33ae3eb2 | ||
|
|
cc7194dd10 | ||
|
|
991b2cc37b | ||
|
|
189af22cf0 | ||
|
|
5f67caad54 | ||
|
|
d241711f44 | ||
|
|
61d58f2d9e | ||
|
|
7469c7e7d0 | ||
|
|
558342124e | ||
|
|
9026a66579 | ||
|
|
1d6f4891bd | ||
|
|
9e4d720825 | ||
|
|
7f4e1a0eef | ||
|
|
b60efdce9f | ||
|
|
7c0b8f872e | ||
|
|
44b09b80f2 | ||
|
|
a037b6de21 | ||
|
|
dcfd1153ec | ||
|
|
e711325ca6 | ||
|
|
cd927cca50 | ||
|
|
72b8a30c1a | ||
|
|
9d5ab7e22f | ||
|
|
9ba3a4c66a | ||
|
|
f14141aca2 | ||
|
|
60e181c20a | ||
|
|
0c8136654d | ||
|
|
82e5260104 | ||
|
|
741b949a6f | ||
|
|
aef5a02ebb | ||
|
|
36222eb4cc | ||
|
|
2ba9681e8e | ||
|
|
616b932ab0 | ||
|
|
2b8ba3e9f8 | ||
|
|
c2d4704744 | ||
|
|
f1ffb4b1ad | ||
|
|
e10af61862 | ||
|
|
9d168b863e | ||
|
|
6b53b7cd84 | ||
|
|
eee8b6c33f | ||
|
|
539738c438 | ||
|
|
4e2fb47092 | ||
|
|
8036758491 | ||
|
|
f7d7befae8 | ||
|
|
5f7c1917e3 | ||
|
|
531c306fe6 | ||
|
|
b347f2c47a | ||
|
|
6bb24823d0 | ||
|
|
78d1228ef6 | ||
|
|
f5bf7b6b27 | ||
|
|
eb7c33b204 | ||
|
|
b5d1530e4f | ||
|
|
33a9f01d36 | ||
|
|
7ced40e24e | ||
|
|
4cc46b2a99 | ||
|
|
90a8ea9827 | ||
|
|
17f2d1e8a7 | ||
|
|
b754e3ec4b | ||
|
|
b470d9a0d6 | ||
|
|
75c2aa9d3a | ||
|
|
9a0bdd9069 | ||
|
|
1cbd25ca15 | ||
|
|
9031a902e3 | ||
|
|
8746163153 | ||
|
|
0765623d69 | ||
|
|
f029a2856b | ||
|
|
b24fedbd24 | ||
|
|
e44b040faf | ||
|
|
1e9522021a | ||
|
|
31d59bf915 | ||
|
|
50d4ea90b3 | ||
|
|
7e731e4d9d | ||
|
|
05351f9ccb | ||
|
|
930fb8b1f3 | ||
|
|
f38ca75a3c | ||
|
|
88aab478bf | ||
|
|
593c4b9b00 | ||
|
|
3ee3066bd0 | ||
|
|
f93d24aa67 | ||
|
|
4ceb7b46ad |
No files matched your search
@@ -20,6 +20,9 @@
|
||||
*.tar.gz
|
||||
*.tar.bz2
|
||||
*.tar.xz
|
||||
*.tar.gz.asc
|
||||
*.tar.bz2.asc
|
||||
*.tar.xz.asc
|
||||
.FBCIndex
|
||||
.FBCLockFolder
|
||||
.deps
|
||||
|
||||
@@ -4,6 +4,8 @@ notifications:
|
||||
email:
|
||||
on_failure: change
|
||||
irc:
|
||||
template:
|
||||
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} - Change view : %{compare_url} - Build details : %{build_url}"
|
||||
channels:
|
||||
- "irc.efnet.org#php.pecl"
|
||||
on_success: change
|
||||
|
||||
@@ -1,6 +1,141 @@
|
||||
PHP NEWS
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2015, PHP 5.5.26
|
||||
** PHP 5.5 is in security-only mode , please do not commit to this branch **
|
||||
|
||||
01 Oct 2015, PHP 5.5.30
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()). (Stas)
|
||||
. FIxed bug #70433 (Uninitialized pointer in phar_make_dirstream when zip
|
||||
entry filename is "/"). (Stas)
|
||||
|
||||
03 Sep 2015, PHP 5.5.29
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()). (Stas)
|
||||
. Fixed bug #70219 (Use after free vulnerability in session deserializer).
|
||||
(taoguangchen at icloud dot com)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte
|
||||
value of 32 bytes). (Stas)
|
||||
|
||||
- hash:
|
||||
. Fixed bug #70312 (HAVAL gives wrong hashes in specific cases). (letsgolee
|
||||
at naver dot com)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #70345 (Multiple vulnerabilities related to PCRE functions).
|
||||
(Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70388 (SOAP serialize_function_call() type confusion / RCE).
|
||||
(Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70365 (Use-after-free vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70366 (Use-after-free vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
|
||||
- XSLT:
|
||||
. Fixed bug #69782 (NULL pointer dereference). (Stas)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #70350 (ZipArchive::extractTo allows for directory traversal when
|
||||
creating directories). (neal at fb dot com)
|
||||
|
||||
06 Aug 2015, PHP 5.5.28
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69793 (Remotely triggerable stack exhaustion via recursive
|
||||
method calls). (Stas)
|
||||
. Fixed bug #69892 (Different arrays compare indentical due to integer key
|
||||
truncation). (Nikita)
|
||||
. Fixed bug #70002 (TS issues with temporary dir handling). (Anatol)
|
||||
. Fixed bug #70121 (unserialize() could lead to unexpected methods execution
|
||||
/ NULL pointer deref). (Stas)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #70014 (openssl_random_pseudo_bytes() is not cryptographically
|
||||
secure). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Improved fix for bug #69441. (Anatol Belski)
|
||||
. Fixed bug #70019 (Files extracted from archive may be placed outside of
|
||||
destination directory). (Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70081 (SoapClient info leak / null pointer dereference via
|
||||
multiple type confusions). (Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70068 (Dangling pointer in the unserialization of ArrayObject
|
||||
items). (sean.heelan)
|
||||
. Fixed bug #70166 (Use After Free Vulnerability in unserialize() with
|
||||
SPLArrayObject). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70168 (Use After Free Vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70169 (Use After Free Vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
|
||||
9 Jul 2015, PHP 5.5.27
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69768 (escapeshell*() doesn't cater to !). (cmb)
|
||||
. Fixed bug #69703 (Use __builtin_clzl on PowerPC).
|
||||
(dja at axtens dot net, Kalle)
|
||||
. Fixed bug #69732 (can induce segmentation fault with basic php code).
|
||||
(Dmitry)
|
||||
. Fixed bug #69642 (Windows 10 reported as Windows 8).
|
||||
(Christian Wenz, Anatol Belski)
|
||||
. Fixed bug #69551 (parse_ini_file() and parse_ini_string() segmentation
|
||||
fault). (Christoph M. Becker)
|
||||
. Fixed bug #69781 (phpinfo() reports Professional Editions of Windows
|
||||
7/8/8.1/10 as "Business"). (Christian Wenz)
|
||||
. Fixed bug #69835 (phpinfo() does not report many Windows SKUs).
|
||||
(Christian Wenz)
|
||||
. Fixed bug #69892 (Different arrays compare indentical due to integer key
|
||||
truncation). (Nikita)
|
||||
. Fixed bug #69874 (Can't set empty additional_headers for mail()), regression
|
||||
from fix to bug #68776. (Yasuo)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #61221 (imagegammacorrect function loses alpha channel). (cmb)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #69669 (mysqlnd is vulnerable to BACKRONYM) (CVE-2015-3152).
|
||||
(Andrey)
|
||||
|
||||
- PCRE:
|
||||
. Fixed Bug #53823 (preg_replace: * qualifier on unicode replace garbles the
|
||||
string). (cmb)
|
||||
. Fixed bug #69864 (Segfault in preg_replace_callback) (cmb, ab)
|
||||
|
||||
- PDO_pgsql:
|
||||
. Fixed bug #69752 (PDOStatement::execute() leaks memory with DML
|
||||
Statements when closeCuror() is u). (Philip Hofstetter)
|
||||
. Fixed bug #69362 (PDO-pgsql fails to connect if password contains a
|
||||
leading single quote). (Matteo)
|
||||
. Fixed bug #69344 (PDO PgSQL Incorrect binding numeric array with gaps).
|
||||
(Matteo)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69958 (Segfault in Phar::convertToData on invalid file).
|
||||
(CVE-2015-5589) (Stas)
|
||||
. Fixed bug #69923 (Buffer overflow and stack smashing error in
|
||||
phar_fix_filepath). (CVE-2015-5590) (Stas)
|
||||
|
||||
- SimpleXML:
|
||||
. Refactored the fix for bug #66084 (simplexml_load_string() mangles empty
|
||||
node name). (Christoph Michael Becker)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #69737 (Segfault when SplMinHeap::compare produces fatal error).
|
||||
(Stas)
|
||||
. Fixed bug #67805 (SplFileObject setMaxLineLength). (Willian Gustavo Veiga).
|
||||
|
||||
11 Jun 2015, PHP 5.5.26
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69566 (Conditional jump or move depends on uninitialised value
|
||||
@@ -9,8 +144,11 @@
|
||||
(Julien)
|
||||
. Fixed bug #69628 (complex GLOB_BRACE fails on Windows).
|
||||
(Christoph M. Becker)
|
||||
. Fixed bug #69703 (Use __builtin_clzl on PowerPC).
|
||||
(dja at axtens dot net, Kalle)
|
||||
. Improved fix for bug #69545 (Integer overflow in ftp_genlist() resulting in
|
||||
heap overflow). (CVE-2015-4643) (Max Spelsberg)
|
||||
. Fixed bug #69646 (OS command injection vulnerability in escapeshellarg).
|
||||
(CVE-2015-4642) (Anatol Belski)
|
||||
. Fixed bug #69719 (Incorrect handling of paths with NULs). (Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #69479 (GD fails to build with newer libvpx). (Remi)
|
||||
@@ -18,6 +156,13 @@
|
||||
- Iconv:
|
||||
. Fixed bug #48147 (iconv with //IGNORE cuts the string). (Stas)
|
||||
|
||||
- Litespeed SAPI:
|
||||
. Fixed bug #68812 (Unchecked return value). (George Wang)
|
||||
|
||||
- Mail:
|
||||
. Fixed bug #68776 (mail() does not have mail header injection prevention for
|
||||
additional headers). (Yasuo)
|
||||
|
||||
- MCrypt:
|
||||
. Added file descriptor caching to mcrypt_create_iv() (Leigh)
|
||||
|
||||
@@ -29,15 +174,15 @@
|
||||
(Matteo Bernardini, Remi)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #69667 (segfault in php_pgsql_meta_data). (Remi)
|
||||
. Fixed bug #69667 (segfault in php_pgsql_meta_data). (CVE-2015-4644) (Remi)
|
||||
|
||||
- Opcache
|
||||
. Fixed bug #69549 (Memory leak with opcache.optimization_level=0xFFFFFFFF).
|
||||
(Laruence, Dmitry)
|
||||
|
||||
- SimpleXML:
|
||||
. Refactored the fix for bug #66084 (simplexml_load_string() mangles empty
|
||||
node name). (Christoph Michael Becker)
|
||||
- Sqlite3:
|
||||
. Upgrade bundled sqlite to 3.8.10.2. (CVE-2015-3414, CVE-2015-3415,
|
||||
CVE-2015-3416) (Kaplan)
|
||||
|
||||
14 May 2015, PHP 5.5.25
|
||||
|
||||
@@ -251,7 +396,8 @@
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #69085 (SoapClient's __call() type confusion through
|
||||
unserialize()). (andrea dot palazzo at truel dot it, Laruence)
|
||||
unserialize()). (CVE-2015-4147, CVE-2015-4148)
|
||||
(andrea dot palazzo at truel dot it, Laruence)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #69108 ("Segmentation fault" when (de)serializing
|
||||
|
||||
+6
-6
@@ -12,7 +12,7 @@ Collaboration is a Good Thing(tm), and Git lets us do this. Thus, following
|
||||
some basic rules with regards to Git usage will::
|
||||
|
||||
a. Make everybody happier, especially those responsible for maintaining
|
||||
Git itself.
|
||||
PHP itself.
|
||||
|
||||
b. Keep the changes consistently well documented and easily trackable.
|
||||
|
||||
@@ -48,11 +48,11 @@ Currently we have the following branches in use::
|
||||
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is an old
|
||||
stable version and is open for security fixes only.
|
||||
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is an old
|
||||
stable version and is open for security fixes only.
|
||||
|
||||
PHP-5.3 This branch is closed.
|
||||
|
||||
@@ -67,7 +67,7 @@ Currently we have the following branches in use::
|
||||
|
||||
The next few rules are more of a technical nature::
|
||||
|
||||
1. All changes should first go to the lowest branch (i.e. 5.4) and then
|
||||
1. All changes should first go to the lowest branch (i.e. 5.6) and then
|
||||
get merged up to all other branches. If a change is not needed for
|
||||
later branches (i.e. fixes for features which where dropped from later
|
||||
branches) an empty merge should be done.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #69551 - parse_ini_file() and parse_ini_string() segmentation fault
|
||||
--FILE--
|
||||
<?php
|
||||
$ini = <<<INI
|
||||
[Network.eth0]
|
||||
SubnetMask = "
|
||||
"
|
||||
INI;
|
||||
$settings = parse_ini_string($ini, false, INI_SCANNER_RAW);
|
||||
var_dump($settings);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: syntax error, unexpected '"' in Unknown on line %d
|
||||
in %s on line %d
|
||||
bool(false)
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #69732 (can induce segmentation fault with basic php code)
|
||||
--FILE--
|
||||
<?php
|
||||
class wpq {
|
||||
private $unreferenced;
|
||||
|
||||
public function __get($name) {
|
||||
return $this->$name . "XXX";
|
||||
}
|
||||
}
|
||||
|
||||
function ret_assoc() {
|
||||
$x = "XXX";
|
||||
return array('foo' => 'bar', $x);
|
||||
}
|
||||
|
||||
$wpq = new wpq;
|
||||
$wpq->interesting =& ret_assoc();
|
||||
$x = $wpq->interesting;
|
||||
printf("%s\n", $x);
|
||||
--EXPECTF--
|
||||
Notice: Undefined property: wpq::$interesting in %sbug69732.php on line 6
|
||||
|
||||
Notice: Indirect modification of overloaded property wpq::$interesting has no effect in %sbug69732.php on line 16
|
||||
|
||||
Strict Standards: Only variables should be assigned by reference in %sbug69732.php on line 16
|
||||
|
||||
Notice: Undefined property: wpq::$interesting in %sbug69732.php on line 6
|
||||
XXX
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #69892: Different arrays compare indentical due to integer key truncation
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump([0 => 0] === [0x100000000 => 0]);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
|
||||
--FILE--
|
||||
<?php
|
||||
unserialize('O:12:"DateInterval":1:{s:4:"days";O:9:"Exception":7:{s:10:"'."\0".'*'."\0".'message";s:1:"x";s:17:"'."\0".'Exception'."\0".'string";s:1:"A";s:7:"'."\0".'*'."\0".'code";i:0;s:7:"'."\0".'*'."\0".'file";s:1:"a";s:7:"'."\0".'*'."\0".'line";i:1337;s:16:"'."\0".'Exception'."\0".'trace";a:0:{}s:19:"'."\0".'Exception'."\0".'previous";O:8:"stdClass":0:{}}}');
|
||||
?>
|
||||
OK
|
||||
--EXPECT--
|
||||
OK
|
||||
+37
-8
@@ -41,7 +41,7 @@ void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
|
||||
if (exception == add_previous || !add_previous || !exception) {
|
||||
return;
|
||||
}
|
||||
if (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
|
||||
if (Z_TYPE_P(add_previous) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
|
||||
zend_error(E_ERROR, "Cannot set non exception as previous exception");
|
||||
return;
|
||||
}
|
||||
@@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto Exception::__wakeup()
|
||||
Exception unserialize checks */
|
||||
#define CHECK_EXC_TYPE(name, type) \
|
||||
value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
|
||||
if(value && Z_TYPE_P(value) != type) { \
|
||||
zval *tmp; \
|
||||
MAKE_STD_ZVAL(tmp); \
|
||||
ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
|
||||
Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
|
||||
zval_ptr_dtor(&tmp); \
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, __wakeup)
|
||||
{
|
||||
zval *value;
|
||||
zval *object = getThis();
|
||||
HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
|
||||
CHECK_EXC_TYPE("message", IS_STRING);
|
||||
CHECK_EXC_TYPE("string", IS_STRING);
|
||||
CHECK_EXC_TYPE("code", IS_LONG);
|
||||
CHECK_EXC_TYPE("file", IS_STRING);
|
||||
CHECK_EXC_TYPE("line", IS_LONG);
|
||||
CHECK_EXC_TYPE("trace", IS_ARRAY);
|
||||
CHECK_EXC_TYPE("previous", IS_OBJECT);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
|
||||
ErrorException constructor */
|
||||
ZEND_METHOD(error_exception, __construct)
|
||||
@@ -586,7 +613,7 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
int res_len = 0, *len = &res_len, num = 0;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(trace) != IS_ARRAY) {
|
||||
RETURN_FALSE;
|
||||
@@ -602,8 +629,8 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -640,15 +667,15 @@ ZEND_METHOD(exception, __toString)
|
||||
int len = 0;
|
||||
zend_fcall_info fci;
|
||||
zval fname;
|
||||
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
|
||||
str = estrndup("", 0);
|
||||
|
||||
exception = getThis();
|
||||
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1);
|
||||
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT) {
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(exception), default_exception_ce TSRMLS_CC)) {
|
||||
prev_str = str;
|
||||
_default_exception_get_entry(exception, "message", sizeof("message")-1, &message TSRMLS_CC);
|
||||
_default_exception_get_entry(exception, "file", sizeof("file")-1, &file TSRMLS_CC);
|
||||
@@ -658,6 +685,7 @@ ZEND_METHOD(exception, __toString)
|
||||
convert_to_string(&file);
|
||||
convert_to_long(&line);
|
||||
|
||||
trace = NULL;
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = &Z_OBJCE_P(exception)->function_table;
|
||||
fci.function_name = &fname;
|
||||
@@ -670,7 +698,7 @@ ZEND_METHOD(exception, __toString)
|
||||
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_P(trace) != IS_STRING) {
|
||||
if (trace && Z_TYPE_P(trace) != IS_STRING) {
|
||||
zval_ptr_dtor(&trace);
|
||||
trace = NULL;
|
||||
}
|
||||
@@ -727,6 +755,7 @@ ZEND_END_ARG_INFO()
|
||||
const static zend_function_entry default_exception_functions[] = {
|
||||
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
|
||||
+2
-3
@@ -1534,11 +1534,10 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
|
||||
}
|
||||
if (ordered) {
|
||||
if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
|
||||
result = p1->h - p2->h;
|
||||
if (result!=0) {
|
||||
if (p1->h != p2->h) {
|
||||
HASH_UNPROTECT_RECURSION(ht1);
|
||||
HASH_UNPROTECT_RECURSION(ht2);
|
||||
return result;
|
||||
return p1->h > p2->h ? 1 : -1;
|
||||
}
|
||||
} else { /* string indices */
|
||||
result = p1->nKeyLength - p2->nKeyLength;
|
||||
|
||||
@@ -1926,7 +1926,7 @@ end_raw_value_chars:
|
||||
}
|
||||
|
||||
/* Eat leading and trailing double quotes */
|
||||
if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
if (yyleng > 1 && yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
SCNG(yy_text)++;
|
||||
yyleng = yyleng - 2;
|
||||
} else if (sc) {
|
||||
|
||||
@@ -472,7 +472,7 @@ end_raw_value_chars:
|
||||
}
|
||||
|
||||
/* Eat leading and trailing double quotes */
|
||||
if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
if (yyleng > 1 && yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
SCNG(yy_text)++;
|
||||
yyleng = yyleng - 2;
|
||||
} else if (sc) {
|
||||
|
||||
+3
-1
@@ -1762,7 +1762,9 @@ ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV)
|
||||
}
|
||||
}
|
||||
|
||||
FREE_OP1_VAR_PTR();
|
||||
if (OP1_TYPE == IS_VAR && OP1_FREE) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
FREE_OP2_IF_VAR();
|
||||
|
||||
+28
-4
@@ -15307,7 +15307,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER
|
||||
}
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
@@ -17662,7 +17664,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
}
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
@@ -19923,7 +19927,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
}
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
@@ -23395,7 +23401,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
}
|
||||
}
|
||||
|
||||
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
@@ -32828,6 +32836,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR && 0) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
@@ -34948,6 +34960,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR && 0) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
@@ -37071,6 +37087,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR && 0) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
|
||||
@@ -40256,6 +40276,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR && 0) {
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=26
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=30
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
+785
-748
File diff suppressed because it is too large.
Load diff
+72
-62
@@ -593,7 +593,7 @@ static zend_object_handlers date_object_handlers_period;
|
||||
#define DATE_SET_CONTEXT \
|
||||
zval *object; \
|
||||
object = getThis(); \
|
||||
|
||||
|
||||
#define DATE_FETCH_OBJECT \
|
||||
php_date_obj *obj; \
|
||||
DATE_SET_CONTEXT; \
|
||||
@@ -762,7 +762,7 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
* RFC2822, Section 3.3: http://www.ietf.org/rfc/rfc2822.txt
|
||||
* FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
|
||||
* CFWS = *([FWS] comment) (([FWS] comment) / FWS)
|
||||
*
|
||||
*
|
||||
* date-time = [ day-of-week "," ] date FWS time [CFWS]
|
||||
* day-of-week = ([FWS] day-name)
|
||||
* day-name = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"
|
||||
@@ -784,19 +784,19 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
* date-fullyear = 4DIGIT
|
||||
* date-month = 2DIGIT ; 01-12
|
||||
* date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
|
||||
*
|
||||
*
|
||||
* time-hour = 2DIGIT ; 00-23
|
||||
* time-minute = 2DIGIT ; 00-59
|
||||
* time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules
|
||||
*
|
||||
*
|
||||
* time-secfrac = "." 1*DIGIT
|
||||
* time-numoffset = ("+" / "-") time-hour ":" time-minute
|
||||
* time-offset = "Z" / time-numoffset
|
||||
*
|
||||
*
|
||||
* partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
|
||||
* full-date = date-fullyear "-" date-month "-" date-mday
|
||||
* full-time = partial-time time-offset
|
||||
*
|
||||
*
|
||||
* date-time = full-date "T" full-time
|
||||
*/
|
||||
#define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP"
|
||||
@@ -877,6 +877,10 @@ PHP_MSHUTDOWN_FUNCTION(date)
|
||||
timelib_error_container_dtor(DATEG(last_errors));
|
||||
}
|
||||
|
||||
#ifndef ZTS
|
||||
DATEG(default_timezone) = NULL;
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -885,7 +889,7 @@ PHP_MSHUTDOWN_FUNCTION(date)
|
||||
PHP_MINFO_FUNCTION(date)
|
||||
{
|
||||
const timelib_tzdb *tzdb = DATE_TIMEZONEDB;
|
||||
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "date/time support", "enabled");
|
||||
php_info_print_table_row(2, "\"Olson\" Timezone Database Version", tzdb->version);
|
||||
@@ -1037,8 +1041,8 @@ char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
|
||||
char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
@@ -1046,8 +1050,8 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
return day_short_names[day_of_week];
|
||||
}
|
||||
return day_short_names[day_of_week];
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1079,7 +1083,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = 0;
|
||||
offset->abbr = malloc(9); /* GMT�xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
localtime ? abs(offset->offset / 3600) : 0,
|
||||
localtime ? abs((offset->offset % 3600) / 60) : 0 );
|
||||
@@ -1125,7 +1129,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break;
|
||||
case 'A': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "PM" : "AM"); break;
|
||||
case 'B': {
|
||||
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
while (retval < 0) {
|
||||
retval += 1000;
|
||||
}
|
||||
@@ -1225,7 +1229,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
|
||||
}
|
||||
|
||||
string = php_format_date(format, format_len, ts, localtime TSRMLS_CC);
|
||||
|
||||
|
||||
RETVAL_STRING(string, 0);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1249,7 +1253,7 @@ PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localt
|
||||
}
|
||||
|
||||
string = date_format(format, format_len, t, localtime);
|
||||
|
||||
|
||||
timelib_time_dtor(t);
|
||||
return string;
|
||||
}
|
||||
@@ -1290,7 +1294,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = t->dst;
|
||||
offset->abbr = malloc(9); /* GMT�xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
!localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
!localtime ? abs(offset->offset / 3600) : 0,
|
||||
!localtime ? abs((offset->offset % 3600) / 60) : 0 );
|
||||
@@ -1322,7 +1326,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
|
||||
/* Swatch Beat a.k.a. Internet Time */
|
||||
case 'B':
|
||||
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
while (retval < 0) {
|
||||
retval += 1000;
|
||||
}
|
||||
@@ -1374,7 +1378,7 @@ PHP_FUNCTION(idate)
|
||||
char *format;
|
||||
int format_len;
|
||||
long ts = 0;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -1402,7 +1406,7 @@ PHP_FUNCTION(idate)
|
||||
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
|
||||
{
|
||||
const timelib_tzdb *builtin = timelib_builtin_db();
|
||||
|
||||
|
||||
if (php_version_compare(tzdb->version, builtin->version) > 0) {
|
||||
php_date_global_timezone_db = tzdb;
|
||||
php_date_global_timezone_db_enabled = 1;
|
||||
@@ -1473,7 +1477,7 @@ PHP_FUNCTION(strtotime)
|
||||
}
|
||||
|
||||
if (!time_len) {
|
||||
timelib_time_dtor(now);
|
||||
timelib_time_dtor(now);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1922,7 +1926,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data
|
||||
if (it_time->tz_info) {
|
||||
newdateobj->time->tz_info = it_time->tz_info;
|
||||
}
|
||||
|
||||
|
||||
*data = &iterator->current;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2116,13 +2120,13 @@ static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_
|
||||
if (ptr) {
|
||||
*ptr = intern;
|
||||
}
|
||||
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_date;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2136,12 +2140,12 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = (php_date_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_date_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->time) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
|
||||
/* this should probably moved to a new `timelib_time *timelime_time_clone(timelib_time *)` */
|
||||
new_obj->time = timelib_time_ctor();
|
||||
*new_obj->time = *old_obj->time;
|
||||
@@ -2151,7 +2155,7 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
if (old_obj->time->tz_info) {
|
||||
new_obj->time->tz_info = old_obj->time->tz_info;
|
||||
}
|
||||
|
||||
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
@@ -2268,10 +2272,10 @@ static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *cl
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_timezone;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2285,12 +2289,12 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
php_timezone_obj *new_obj = NULL;
|
||||
php_timezone_obj *old_obj = (php_timezone_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->initialized) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
|
||||
new_obj->type = old_obj->type;
|
||||
new_obj->initialized = 1;
|
||||
switch (new_obj->type) {
|
||||
@@ -2306,7 +2310,7 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
new_obj->tzi.z.abbr = strdup(old_obj->tzi.z.abbr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
@@ -2367,10 +2371,10 @@ static inline zend_object_value date_object_new_interval_ex(zend_class_entry *cl
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_interval, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_interval;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2384,7 +2388,7 @@ static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC)
|
||||
php_interval_obj *new_obj = NULL;
|
||||
php_interval_obj *old_obj = (php_interval_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_interval_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
|
||||
/** FIX ME ADD CLONE STUFF **/
|
||||
@@ -2456,10 +2460,10 @@ static inline zend_object_value date_object_new_period_ex(zend_class_entry *clas
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_period, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_period;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2473,7 +2477,7 @@ static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC)
|
||||
php_period_obj *new_obj = NULL;
|
||||
php_period_obj *old_obj = (php_period_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_period_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
|
||||
/** FIX ME ADD CLONE STUFF **/
|
||||
@@ -2559,7 +2563,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
|
||||
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
|
||||
char *new_abbr = NULL;
|
||||
timelib_sll new_offset;
|
||||
|
||||
|
||||
if (dateobj->time) {
|
||||
timelib_time_dtor(dateobj->time);
|
||||
}
|
||||
@@ -2938,7 +2942,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(hour, h);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
|
||||
|
||||
|
||||
if (parsed_time->f == -99999) {
|
||||
add_assoc_bool(return_value, "fraction", 0);
|
||||
} else {
|
||||
@@ -3005,7 +3009,7 @@ PHP_FUNCTION(date_parse)
|
||||
int date_len;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3024,7 +3028,7 @@ PHP_FUNCTION(date_parse_from_format)
|
||||
int date_len, format_len;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &format, &format_len, &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3508,7 +3512,7 @@ static void php_date_isodate_set(zval *object, long y, long w, long d, zval *ret
|
||||
memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
|
||||
dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
|
||||
dateobj->time->have_relative = 1;
|
||||
|
||||
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
}
|
||||
|
||||
@@ -3697,7 +3701,7 @@ PHP_METHOD(DateTimeZone, __construct)
|
||||
int tz_len;
|
||||
php_timezone_obj *tzobj;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
|
||||
tzobj = zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
@@ -3975,7 +3979,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
|
||||
if (errors->error_count > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
|
||||
retval = FAILURE;
|
||||
@@ -4134,7 +4138,7 @@ PHP_METHOD(DateInterval, __construct)
|
||||
php_interval_obj *diobj;
|
||||
timelib_rel_time *reltime;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &interval_string, &interval_string_length) == SUCCESS) {
|
||||
if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) {
|
||||
@@ -4157,8 +4161,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
#define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \
|
||||
do { \
|
||||
zval **z_arg = NULL; \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
|
||||
convert_to_long(*z_arg); \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS && Z_TYPE_PP(z_arg) == IS_LONG) { \
|
||||
(*intobj)->diff->member = (itype)Z_LVAL_PP(z_arg); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = (itype)def; \
|
||||
@@ -4169,8 +4172,15 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
do { \
|
||||
zval **z_arg = NULL; \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
|
||||
convert_to_string(*z_arg); \
|
||||
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
|
||||
if (Z_TYPE_PP(z_arg) == IS_STRING) { \
|
||||
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
|
||||
} else if (Z_TYPE_PP(z_arg) == IS_LONG || Z_TYPE_PP(z_arg) == IS_BOOL) { \
|
||||
(*intobj)->diff->member = (timelib_sll)Z_LVAL_PP(z_arg); \
|
||||
} else if (Z_TYPE_PP(z_arg) == IS_DOUBLE) { \
|
||||
(*intobj)->diff->member = (timelib_sll)Z_DVAL_PP(z_arg); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
@@ -4348,7 +4358,7 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
|
||||
if (errors->error_count > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
|
||||
retval = FAILURE;
|
||||
@@ -4377,7 +4387,7 @@ PHP_METHOD(DatePeriod, __construct)
|
||||
int isostr_len = 0;
|
||||
timelib_time *clone;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) {
|
||||
@@ -4492,7 +4502,7 @@ PHP_FUNCTION(timezone_identifiers_list)
|
||||
tzdb = DATE_TIMEZONEDB;
|
||||
item_count = tzdb->index_size;
|
||||
table = tzdb->index;
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
for (i = 0; i < item_count; ++i) {
|
||||
@@ -4526,7 +4536,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
|
||||
{
|
||||
const timelib_tz_lookup_table *table, *entry;
|
||||
zval *element, **abbr_array_pp, *abbr_array;
|
||||
|
||||
|
||||
table = timelib_timezone_abbreviations_list();
|
||||
array_init(return_value);
|
||||
entry = table;
|
||||
@@ -4602,11 +4612,11 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
timelib_time *t;
|
||||
timelib_tzinfo *tzi;
|
||||
char *retstr;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 1:
|
||||
retformat = SUNFUNCS_RET_STRING;
|
||||
@@ -4650,7 +4660,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
timelib_unixtime2local(t, time);
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude, 1, &h_rise, &h_set, &rise, &set, &transit);
|
||||
timelib_time_dtor(t);
|
||||
|
||||
|
||||
if (rs != 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -4704,7 +4714,7 @@ PHP_FUNCTION(date_sun_info)
|
||||
timelib_sll rise, set, transit;
|
||||
int dummy;
|
||||
double ddummy;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -4718,7 +4728,7 @@ PHP_FUNCTION(date_sun_info)
|
||||
/* Setup */
|
||||
t2 = timelib_time_ctor();
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
/* Get sun up/down and transit */
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
|
||||
switch (rs) {
|
||||
@@ -4862,7 +4872,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC)
|
||||
ZVAL_NULL(zv);
|
||||
}
|
||||
zend_hash_update(props, "interval", sizeof("interval"), &zv, sizeof(zv), NULL);
|
||||
|
||||
|
||||
/* converted to larger type (int->long); must check when unserializing */
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_LONG(zv, (long) period_obj->recurrences);
|
||||
@@ -4945,7 +4955,7 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
|
||||
}
|
||||
|
||||
period_obj->initialized = 1;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -4962,7 +4972,7 @@ PHP_METHOD(DatePeriod, __set_state)
|
||||
}
|
||||
|
||||
myht = Z_ARRVAL_P(array);
|
||||
|
||||
|
||||
object_init_ex(return_value, date_ce_period);
|
||||
period_obj = zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
if (!php_date_period_initialize_from_hash(period_obj, myht TSRMLS_CC)) {
|
||||
|
||||
@@ -14,17 +14,17 @@ var_dump($di);
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (15) {
|
||||
["y"]=>
|
||||
int(2)
|
||||
int(-1)
|
||||
["m"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["d"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["h"]=>
|
||||
int(6)
|
||||
int(-1)
|
||||
["i"]=>
|
||||
int(8)
|
||||
int(-1)
|
||||
["s"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["weekday"]=>
|
||||
int(10)
|
||||
["weekday_behavior"]=>
|
||||
|
||||
@@ -14,17 +14,17 @@ var_dump($di);
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (15) {
|
||||
["y"]=>
|
||||
int(2)
|
||||
int(-1)
|
||||
["m"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["d"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["h"]=>
|
||||
int(6)
|
||||
int(-1)
|
||||
["i"]=>
|
||||
int(8)
|
||||
int(-1)
|
||||
["s"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["weekday"]=>
|
||||
int(10)
|
||||
["weekday_behavior"]=>
|
||||
|
||||
+17
-5
@@ -1761,7 +1761,7 @@ PHP_FUNCTION(dom_document_save)
|
||||
char *file;
|
||||
long options = 0;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1991,7 +1991,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
int is_valid;
|
||||
char resolved_path[MAXPATHLEN + 1];
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2004,6 +2004,10 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
|
||||
switch (type) {
|
||||
case DOM_LOAD_FILE:
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (!valid_file) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
|
||||
@@ -2087,7 +2091,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
int is_valid;
|
||||
char resolved_path[MAXPATHLEN + 1];
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2100,6 +2104,10 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
|
||||
switch (type) {
|
||||
case DOM_LOAD_FILE:
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (!valid_file) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
|
||||
@@ -2180,7 +2188,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
|
||||
id = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &source, &source_len, &options) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2190,6 +2198,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
}
|
||||
|
||||
if (mode == DOM_LOAD_FILE) {
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ctxt = htmlCreateFileParserCtxt(source, NULL);
|
||||
} else {
|
||||
source_len = xmlStrlen(source);
|
||||
@@ -2278,7 +2290,7 @@ PHP_FUNCTION(dom_document_save_html_file)
|
||||
char *file;
|
||||
const char *encoding;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ $result = $doc->loadHTMLFile("");
|
||||
assert('$result === false');
|
||||
$doc = new DOMDocument();
|
||||
$result = $doc->loadHTMLFile("text.html\0something");
|
||||
assert('$result === null');
|
||||
assert('$result === false');
|
||||
?>
|
||||
--EXPECTF--
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Empty string supplied as input %s
|
||||
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile() expects parameter 1 to be a valid path, string given %s
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Invalid file source %s
|
||||
+106
-106
@@ -74,7 +74,7 @@
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "ext/standard/php_image.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
/* needed for ssize_t definition */
|
||||
#include <sys/types.h>
|
||||
@@ -161,7 +161,7 @@ ZEND_BEGIN_MODULE_GLOBALS(exif)
|
||||
char * encode_jis;
|
||||
char * decode_jis_be;
|
||||
char * decode_jis_le;
|
||||
ZEND_END_MODULE_GLOBALS(exif)
|
||||
ZEND_END_MODULE_GLOBALS(exif)
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(exif)
|
||||
|
||||
@@ -170,7 +170,7 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
|
||||
#else
|
||||
#define EXIF_G(v) (exif_globals.v)
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ PHP_INI
|
||||
*/
|
||||
|
||||
@@ -213,7 +213,7 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("exif.decode_jis_intel", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_le, zend_exif_globals, exif_globals)
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ PHP_GINIT_FUNCTION
|
||||
*/
|
||||
static PHP_GINIT_FUNCTION(exif)
|
||||
@@ -233,9 +233,9 @@ PHP_MINIT_FUNCTION(exif)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
if (zend_hash_exists(&module_registry, "mbstring", sizeof("mbstring"))) {
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
|
||||
} else {
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ zend_module_entry exif_module_entry = {
|
||||
exif_module_deps,
|
||||
"exif",
|
||||
exif_functions,
|
||||
PHP_MINIT(exif),
|
||||
PHP_MINIT(exif),
|
||||
PHP_MSHUTDOWN(exif),
|
||||
NULL, NULL,
|
||||
PHP_MINFO(exif),
|
||||
@@ -278,7 +278,7 @@ zend_module_entry exif_module_entry = {
|
||||
NULL,
|
||||
NULL,
|
||||
STANDARD_MODULE_PROPERTIES_EX
|
||||
#else
|
||||
#else
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
#endif
|
||||
};
|
||||
@@ -667,73 +667,73 @@ static tag_info_array tag_table_IFD = {
|
||||
{ 0x0213, "YCbCrPositioning"},
|
||||
{ 0x0214, "ReferenceBlackWhite"},
|
||||
{ 0x02BC, "ExtensibleMetadataPlatform"}, /* XAP: Extensible Authoring Publishing, obsoleted by XMP: Extensible Metadata Platform */
|
||||
{ 0x0301, "Gamma"},
|
||||
{ 0x0302, "ICCProfileDescriptor"},
|
||||
{ 0x0303, "SRGBRenderingIntent"},
|
||||
{ 0x0320, "ImageTitle"},
|
||||
{ 0x5001, "ResolutionXUnit"},
|
||||
{ 0x5002, "ResolutionYUnit"},
|
||||
{ 0x5003, "ResolutionXLengthUnit"},
|
||||
{ 0x5004, "ResolutionYLengthUnit"},
|
||||
{ 0x5005, "PrintFlags"},
|
||||
{ 0x5006, "PrintFlagsVersion"},
|
||||
{ 0x5007, "PrintFlagsCrop"},
|
||||
{ 0x5008, "PrintFlagsBleedWidth"},
|
||||
{ 0x5009, "PrintFlagsBleedWidthScale"},
|
||||
{ 0x500A, "HalftoneLPI"},
|
||||
{ 0x500B, "HalftoneLPIUnit"},
|
||||
{ 0x500C, "HalftoneDegree"},
|
||||
{ 0x500D, "HalftoneShape"},
|
||||
{ 0x500E, "HalftoneMisc"},
|
||||
{ 0x500F, "HalftoneScreen"},
|
||||
{ 0x5010, "JPEGQuality"},
|
||||
{ 0x5011, "GridSize"},
|
||||
{ 0x5012, "ThumbnailFormat"},
|
||||
{ 0x5013, "ThumbnailWidth"},
|
||||
{ 0x5014, "ThumbnailHeight"},
|
||||
{ 0x5015, "ThumbnailColorDepth"},
|
||||
{ 0x5016, "ThumbnailPlanes"},
|
||||
{ 0x5017, "ThumbnailRawBytes"},
|
||||
{ 0x5018, "ThumbnailSize"},
|
||||
{ 0x5019, "ThumbnailCompressedSize"},
|
||||
{ 0x501A, "ColorTransferFunction"},
|
||||
{ 0x501B, "ThumbnailData"},
|
||||
{ 0x5020, "ThumbnailImageWidth"},
|
||||
{ 0x5021, "ThumbnailImageHeight"},
|
||||
{ 0x5022, "ThumbnailBitsPerSample"},
|
||||
{ 0x5023, "ThumbnailCompression"},
|
||||
{ 0x5024, "ThumbnailPhotometricInterp"},
|
||||
{ 0x5025, "ThumbnailImageDescription"},
|
||||
{ 0x5026, "ThumbnailEquipMake"},
|
||||
{ 0x5027, "ThumbnailEquipModel"},
|
||||
{ 0x5028, "ThumbnailStripOffsets"},
|
||||
{ 0x5029, "ThumbnailOrientation"},
|
||||
{ 0x502A, "ThumbnailSamplesPerPixel"},
|
||||
{ 0x502B, "ThumbnailRowsPerStrip"},
|
||||
{ 0x502C, "ThumbnailStripBytesCount"},
|
||||
{ 0x502D, "ThumbnailResolutionX"},
|
||||
{ 0x502E, "ThumbnailResolutionY"},
|
||||
{ 0x502F, "ThumbnailPlanarConfig"},
|
||||
{ 0x5030, "ThumbnailResolutionUnit"},
|
||||
{ 0x5031, "ThumbnailTransferFunction"},
|
||||
{ 0x5032, "ThumbnailSoftwareUsed"},
|
||||
{ 0x5033, "ThumbnailDateTime"},
|
||||
{ 0x5034, "ThumbnailArtist"},
|
||||
{ 0x5035, "ThumbnailWhitePoint"},
|
||||
{ 0x5036, "ThumbnailPrimaryChromaticities"},
|
||||
{ 0x5037, "ThumbnailYCbCrCoefficients"},
|
||||
{ 0x5038, "ThumbnailYCbCrSubsampling"},
|
||||
{ 0x5039, "ThumbnailYCbCrPositioning"},
|
||||
{ 0x503A, "ThumbnailRefBlackWhite"},
|
||||
{ 0x503B, "ThumbnailCopyRight"},
|
||||
{ 0x5090, "LuminanceTable"},
|
||||
{ 0x5091, "ChrominanceTable"},
|
||||
{ 0x5100, "FrameDelay"},
|
||||
{ 0x5101, "LoopCount"},
|
||||
{ 0x5110, "PixelUnit"},
|
||||
{ 0x5111, "PixelPerUnitX"},
|
||||
{ 0x5112, "PixelPerUnitY"},
|
||||
{ 0x5113, "PaletteHistogram"},
|
||||
{ 0x0301, "Gamma"},
|
||||
{ 0x0302, "ICCProfileDescriptor"},
|
||||
{ 0x0303, "SRGBRenderingIntent"},
|
||||
{ 0x0320, "ImageTitle"},
|
||||
{ 0x5001, "ResolutionXUnit"},
|
||||
{ 0x5002, "ResolutionYUnit"},
|
||||
{ 0x5003, "ResolutionXLengthUnit"},
|
||||
{ 0x5004, "ResolutionYLengthUnit"},
|
||||
{ 0x5005, "PrintFlags"},
|
||||
{ 0x5006, "PrintFlagsVersion"},
|
||||
{ 0x5007, "PrintFlagsCrop"},
|
||||
{ 0x5008, "PrintFlagsBleedWidth"},
|
||||
{ 0x5009, "PrintFlagsBleedWidthScale"},
|
||||
{ 0x500A, "HalftoneLPI"},
|
||||
{ 0x500B, "HalftoneLPIUnit"},
|
||||
{ 0x500C, "HalftoneDegree"},
|
||||
{ 0x500D, "HalftoneShape"},
|
||||
{ 0x500E, "HalftoneMisc"},
|
||||
{ 0x500F, "HalftoneScreen"},
|
||||
{ 0x5010, "JPEGQuality"},
|
||||
{ 0x5011, "GridSize"},
|
||||
{ 0x5012, "ThumbnailFormat"},
|
||||
{ 0x5013, "ThumbnailWidth"},
|
||||
{ 0x5014, "ThumbnailHeight"},
|
||||
{ 0x5015, "ThumbnailColorDepth"},
|
||||
{ 0x5016, "ThumbnailPlanes"},
|
||||
{ 0x5017, "ThumbnailRawBytes"},
|
||||
{ 0x5018, "ThumbnailSize"},
|
||||
{ 0x5019, "ThumbnailCompressedSize"},
|
||||
{ 0x501A, "ColorTransferFunction"},
|
||||
{ 0x501B, "ThumbnailData"},
|
||||
{ 0x5020, "ThumbnailImageWidth"},
|
||||
{ 0x5021, "ThumbnailImageHeight"},
|
||||
{ 0x5022, "ThumbnailBitsPerSample"},
|
||||
{ 0x5023, "ThumbnailCompression"},
|
||||
{ 0x5024, "ThumbnailPhotometricInterp"},
|
||||
{ 0x5025, "ThumbnailImageDescription"},
|
||||
{ 0x5026, "ThumbnailEquipMake"},
|
||||
{ 0x5027, "ThumbnailEquipModel"},
|
||||
{ 0x5028, "ThumbnailStripOffsets"},
|
||||
{ 0x5029, "ThumbnailOrientation"},
|
||||
{ 0x502A, "ThumbnailSamplesPerPixel"},
|
||||
{ 0x502B, "ThumbnailRowsPerStrip"},
|
||||
{ 0x502C, "ThumbnailStripBytesCount"},
|
||||
{ 0x502D, "ThumbnailResolutionX"},
|
||||
{ 0x502E, "ThumbnailResolutionY"},
|
||||
{ 0x502F, "ThumbnailPlanarConfig"},
|
||||
{ 0x5030, "ThumbnailResolutionUnit"},
|
||||
{ 0x5031, "ThumbnailTransferFunction"},
|
||||
{ 0x5032, "ThumbnailSoftwareUsed"},
|
||||
{ 0x5033, "ThumbnailDateTime"},
|
||||
{ 0x5034, "ThumbnailArtist"},
|
||||
{ 0x5035, "ThumbnailWhitePoint"},
|
||||
{ 0x5036, "ThumbnailPrimaryChromaticities"},
|
||||
{ 0x5037, "ThumbnailYCbCrCoefficients"},
|
||||
{ 0x5038, "ThumbnailYCbCrSubsampling"},
|
||||
{ 0x5039, "ThumbnailYCbCrPositioning"},
|
||||
{ 0x503A, "ThumbnailRefBlackWhite"},
|
||||
{ 0x503B, "ThumbnailCopyRight"},
|
||||
{ 0x5090, "LuminanceTable"},
|
||||
{ 0x5091, "ChrominanceTable"},
|
||||
{ 0x5100, "FrameDelay"},
|
||||
{ 0x5101, "LoopCount"},
|
||||
{ 0x5110, "PixelUnit"},
|
||||
{ 0x5111, "PixelPerUnitX"},
|
||||
{ 0x5112, "PixelPerUnitY"},
|
||||
{ 0x5113, "PaletteHistogram"},
|
||||
{ 0x1000, "RelatedImageFileFormat"},
|
||||
{ 0x800D, "ImageID"},
|
||||
{ 0x80E3, "Matteing"}, /* obsoleted by ExtraSamples */
|
||||
@@ -939,7 +939,7 @@ static tag_info_array tag_table_VND_NIKON = {
|
||||
{ 0x000b, "Converter"},
|
||||
TAG_TABLE_END
|
||||
};
|
||||
|
||||
|
||||
static tag_info_array tag_table_VND_NIKON_990 = {
|
||||
{ 0x0001, "Version"},
|
||||
{ 0x0002, "ISOSetting"},
|
||||
@@ -958,7 +958,7 @@ static tag_info_array tag_table_VND_NIKON_990 = {
|
||||
{ 0x0010, "DataDump"},
|
||||
TAG_TABLE_END
|
||||
};
|
||||
|
||||
|
||||
static tag_info_array tag_table_VND_OLYMPUS = {
|
||||
{ 0x0200, "SpecialMode"},
|
||||
{ 0x0201, "JPEGQuality"},
|
||||
@@ -1224,7 +1224,7 @@ char * exif_dump_data(int *dump_free, int format, int components, int length, in
|
||||
if (components > 0) {
|
||||
dump = erealloc(dump, len + 2 + 1);
|
||||
snprintf(dump + len, 2 + 1, ", ");
|
||||
len += 2;
|
||||
len += 2;
|
||||
components--;
|
||||
} else{
|
||||
break;
|
||||
@@ -1574,7 +1574,7 @@ typedef struct {
|
||||
static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type *ImageInfo, int type, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
|
||||
va_start(args, format);
|
||||
#ifdef EXIF_DEBUG
|
||||
{
|
||||
@@ -2627,7 +2627,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
*pszEncoding = estrdup((const char*)szValuePtr);
|
||||
szValuePtr = szValuePtr+8;
|
||||
ByteCount -= 8;
|
||||
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
|
||||
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
|
||||
* since we have no encoding support for the BOM yet we skip that.
|
||||
*/
|
||||
if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
|
||||
@@ -2645,8 +2645,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
}
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
@@ -2666,8 +2666,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
ByteCount -= 8;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
|
||||
@@ -2701,12 +2701,12 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
* Process unicode field in IFD. */
|
||||
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
|
||||
{
|
||||
xp_field->tag = tag;
|
||||
xp_field->tag = tag;
|
||||
xp_field->value = NULL;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)&xp_field->value,
|
||||
&xp_field->size,
|
||||
(unsigned char**)&xp_field->value,
|
||||
&xp_field->size,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
@@ -2731,7 +2731,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
|
||||
return FALSE;
|
||||
maker_note = maker_note_array+i;
|
||||
|
||||
|
||||
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/
|
||||
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
|
||||
continue;
|
||||
@@ -2852,9 +2852,9 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
|
||||
/* If its bigger than 4 bytes, the dir entry contains an offset. */
|
||||
value_ptr = offset_base+offset_val;
|
||||
/*
|
||||
/*
|
||||
dir_entry is ImageInfo->file.list[sn].data+2+i*12
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
dir_entry - offset_base is dir_offset+2+i*12
|
||||
*/
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
|
||||
@@ -2925,18 +2925,18 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
case TAG_COMP_IMAGE_WIDTH:
|
||||
ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_IMAGEHEIGHT:
|
||||
case TAG_COMP_IMAGE_HEIGHT:
|
||||
ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_STRIP_OFFSETS:
|
||||
case TAG_JPEG_INTERCHANGE_FORMAT:
|
||||
/* accept both formats */
|
||||
ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_STRIP_BYTE_COUNTS:
|
||||
if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) {
|
||||
ImageInfo->Thumbnail.filetype = ImageInfo->FileType;
|
||||
@@ -2946,7 +2946,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
}
|
||||
ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_JPEG_INTERCHANGE_FORMAT_LEN:
|
||||
if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) {
|
||||
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG;
|
||||
@@ -2964,16 +2964,16 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
if (length<byte_count-1) {
|
||||
/* When there are any characters after the first NUL */
|
||||
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
|
||||
ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
|
||||
ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1);
|
||||
spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
|
||||
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
|
||||
/* but we are not supposed to change this */
|
||||
/* keep in mind that image_info does not store editor value */
|
||||
} else {
|
||||
ImageInfo->Copyright = estrdup(value_ptr);
|
||||
ImageInfo->Copyright = estrndup(value_ptr, byte_count);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case TAG_USERCOMMENT:
|
||||
ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC);
|
||||
@@ -3061,10 +3061,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
break;
|
||||
|
||||
case TAG_MAKE:
|
||||
ImageInfo->make = estrdup(value_ptr);
|
||||
ImageInfo->make = estrndup(value_ptr, byte_count);
|
||||
break;
|
||||
case TAG_MODEL:
|
||||
ImageInfo->model = estrdup(value_ptr);
|
||||
ImageInfo->model = estrndup(value_ptr, byte_count);
|
||||
break;
|
||||
|
||||
case TAG_MAKER_NOTE:
|
||||
@@ -3414,7 +3414,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
|
||||
if ((itemlen - 2) < 6) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
exif_process_SOFn(Data, marker, &sof_info);
|
||||
ImageInfo->Width = sof_info.width;
|
||||
ImageInfo->Height = sof_info.height;
|
||||
@@ -3459,21 +3459,21 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC)
|
||||
}
|
||||
for (;;) {
|
||||
pos += length;
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
c = data[pos++];
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
if (c != 0xFF) {
|
||||
return FALSE;
|
||||
}
|
||||
n = 8;
|
||||
while ((c = data[pos++]) == 0xFF && n--) {
|
||||
if (pos+3>=ImageInfo->Thumbnail.size)
|
||||
if (pos+3>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
/* +3 = pos++ of next check when reaching marker + 2 bytes for length */
|
||||
}
|
||||
if (c == 0xFF)
|
||||
if (c == 0xFF)
|
||||
return FALSE;
|
||||
marker = c;
|
||||
length = php_jpg_get16(data+pos);
|
||||
@@ -3787,7 +3787,7 @@ static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC)
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/II format");
|
||||
#endif
|
||||
ImageInfo->sections_found |= FOUND_IFD0;
|
||||
if (exif_process_IFD_in_TIFF(ImageInfo,
|
||||
if (exif_process_IFD_in_TIFF(ImageInfo,
|
||||
php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
|
||||
SECTION_IFD0 TSRMLS_CC)) {
|
||||
ret = TRUE;
|
||||
@@ -3967,7 +3967,7 @@ PHP_FUNCTION(exif_read_data)
|
||||
sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC);
|
||||
|
||||
#ifdef EXIF_DEBUG
|
||||
if (sections_str)
|
||||
if (sections_str)
|
||||
exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections found: %s", sections_str[0] ? sections_str : "None");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1663,8 +1663,6 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
|
||||
if (*ptr == '\n' && lastch == '\r') {
|
||||
lines++;
|
||||
} else {
|
||||
size++;
|
||||
}
|
||||
lastch = *ptr;
|
||||
}
|
||||
|
||||
+9
-8
@@ -1735,7 +1735,7 @@ PHP_FUNCTION(imagefilledarc)
|
||||
long cx, cy, w, h, ST, E, col, style;
|
||||
gdImagePtr im;
|
||||
int e, st;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1976,7 +1976,7 @@ PHP_FUNCTION(imagegrabwindow)
|
||||
if ( handle == 0 ) {
|
||||
goto clean;
|
||||
}
|
||||
pPrintWindow = (tPrintWindow) GetProcAddress(handle, "PrintWindow");
|
||||
pPrintWindow = (tPrintWindow) GetProcAddress(handle, "PrintWindow");
|
||||
|
||||
if ( pPrintWindow ) {
|
||||
pPrintWindow(window, memDC, (UINT) client_area);
|
||||
@@ -3045,10 +3045,11 @@ PHP_FUNCTION(imagegammacorrect)
|
||||
for (x = 0; x < gdImageSX(im); x++) {
|
||||
c = gdImageGetPixel(im, x, y);
|
||||
gdImageSetPixel(im, x, y,
|
||||
gdTrueColor(
|
||||
gdTrueColorAlpha(
|
||||
(int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5),
|
||||
(int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5),
|
||||
(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5)
|
||||
(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5),
|
||||
gdTrueColorGetAlpha(c)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -3845,7 +3846,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
|
||||
if (zend_hash_get_current_data_ex(HASH_OF(EXT), (void **) &item, &pos) == FAILURE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp("linespacing", key) == 0) {
|
||||
convert_to_double_ex(item);
|
||||
strex.flags |= gdFTEX_LINESPACE;
|
||||
@@ -3924,7 +3925,7 @@ PHP_FUNCTION(imagepsloadfont)
|
||||
struct stat st;
|
||||
#endif
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4264,11 +4265,11 @@ PHP_FUNCTION(imagepsbbox)
|
||||
if (argc != 3 && argc != 6) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srl|lld", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 6) {
|
||||
space = sp;
|
||||
add_width = wd;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #61221 - imagegammacorrect function loses alpha channel
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$imagew = 50;
|
||||
$imageh = 50;
|
||||
$img = imagecreatetruecolor($imagew, $imageh);
|
||||
$blacktransparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
|
||||
$redsolid = imagecolorallocate($img, 255, 0, 0);
|
||||
imagefill($img, 0, 0, $blacktransparent);
|
||||
imageline($img, $imagew / 2, 0, $imagew / 2, $imageh - 1, $redsolid);
|
||||
imageline($img, 0, $imageh / 2, $imagew - 1, $imageh / 2, $redsolid);
|
||||
imagegammacorrect($img, 1, 1);
|
||||
$color = imagecolorat($img, 0, 0);
|
||||
var_dump($color === $blacktransparent);
|
||||
imagedestroy($img);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -336,7 +336,7 @@ PHP_HASH_API void PHP_HAVAL128Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -390,7 +390,7 @@ PHP_HASH_API void PHP_HAVAL160Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -444,7 +444,7 @@ PHP_HASH_API void PHP_HAVAL192Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -484,7 +484,7 @@ PHP_HASH_API void PHP_HAVAL224Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -525,7 +525,7 @@ PHP_HASH_API void PHP_HAVAL256Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #70312 HAVAL gives wrong hashes in specific cases
|
||||
--SKIPIF--
|
||||
<?php if(!extension_loaded("hash")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(hash('haval128,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval160,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval192,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval224,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval256,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(32) "f3f0d23819b87228b4b70ee350afaa9d"
|
||||
string(40) "aded6485e137f11d7292212ba3fa961714df0564"
|
||||
string(48) "e53da2b16269fe732e9a898a96707a9f28404d7333b02286"
|
||||
string(56) "c574fb307f0817b514b9bb2e7c4bfaffb7ad667aca3c8b523fefcf10"
|
||||
string(64) "fb73c19300b14d5cb393d929bf005e6c2d459a4c9c009e9813af1d2d3637ee8f"
|
||||
@@ -64,7 +64,7 @@ unlink($file);
|
||||
adler32: ff87222e
|
||||
crc32: 61664d33
|
||||
gost: d9e65f0c0c2ef944e4f8a01f4a46365c4f33a2853756878182a7f03e1490a4cd
|
||||
haval128,3: 8bb81269aca8b7f87829020d76a4e841
|
||||
haval128,3: c25962b13383c3ed9f13817c8f2ae7d6
|
||||
md2: 70f791c0d8fa9edd7d08e32fcba8c354
|
||||
md4: a9d034b16bb290c57a645afd6f14cd3b
|
||||
md5: 704bf818448f5bbb94061332d2c889aa
|
||||
|
||||
@@ -45,7 +45,7 @@ echo "sha256(raw): " . bin2hex(hash_hmac('sha256', $content, $key, TRUE)) . "\n"
|
||||
adler32: 12c803f7
|
||||
crc32: 96859101
|
||||
gost: a4a3c80bdf3f8665bf07376a34dc9c1b11af7c813f4928f62e39f0c0dc564dad
|
||||
haval128,3: 82cd0f4bd36729b5c80c33efa8c13ac5
|
||||
haval128,3: 4d1318607f0406bd1b7bd50907772672
|
||||
md2: 6d111dab563025e4cb5f4425c991fa12
|
||||
md4: 10cdbfe843000c623f8b8da0d5d20b0b
|
||||
md5: 2a632783e2812cf23de100d7d6a463ae
|
||||
|
||||
@@ -73,7 +73,7 @@ unlink($file);
|
||||
adler32: 0f8c02f9
|
||||
crc32: f2a60b9c
|
||||
gost: 94c39a40d5db852a8dc3d24e37eebf2d53e3d711457c59cd02b614f792a9d918
|
||||
haval128,3: e8fcff647f1a675acb429130fb94a17e
|
||||
haval128,3: f1cea637451097d790354a86de3f54a3
|
||||
md2: a685475e600314bb549ab4f33c3b27cb
|
||||
md4: cbc6bff781f48f57378d3effa27553e4
|
||||
md5: 8bddf39dd1c566c27acc7fa85ec36acf
|
||||
|
||||
+2
-2
@@ -186,8 +186,8 @@ int main() {
|
||||
AC_DEFINE([ICONV_BROKEN_IGNORE],1,[Whether iconv supports IGNORE])
|
||||
],[
|
||||
AC_MSG_RESULT(no, cross-compiling)
|
||||
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0,[ext/iconv])
|
||||
AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports IGNORE])
|
||||
PHP_DEFINE([ICONV_BROKEN_IGNORE],0,[ext/iconv])
|
||||
AC_DEFINE([ICONV_BROKEN_IGNORE],0,[Whether iconv supports IGNORE])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([if your cpp allows macro usage in include lines])
|
||||
|
||||
+37
-23
@@ -400,7 +400,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_server_option)(MYSQLND_CONN_DATA * const c
|
||||
|
||||
int2store(buffer, (unsigned int) option);
|
||||
ret = conn->m->simple_command(conn, COM_SET_OPTION, buffer, sizeof(buffer), PROT_EOF_PACKET, FALSE, TRUE TSRMLS_CC);
|
||||
|
||||
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
}
|
||||
DBG_RETURN(ret);
|
||||
@@ -464,27 +464,41 @@ mysqlnd_switch_to_ssl_if_needed(
|
||||
}
|
||||
|
||||
#ifdef MYSQLND_SSL_SUPPORTED
|
||||
if ((greet_packet->server_capabilities & CLIENT_SSL) && (mysql_flags & CLIENT_SSL)) {
|
||||
zend_bool verify = mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT? TRUE:FALSE;
|
||||
DBG_INF("Switching to SSL");
|
||||
if (!PACKET_WRITE(auth_packet, conn)) {
|
||||
CONN_SET_STATE(conn, CONN_QUIT_SENT);
|
||||
conn->m->send_close(conn TSRMLS_CC);
|
||||
SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);
|
||||
goto end;
|
||||
}
|
||||
if (mysql_flags & CLIENT_SSL) {
|
||||
zend_bool server_has_ssl = (greet_packet->server_capabilities & CLIENT_SSL)? TRUE:FALSE;
|
||||
if (server_has_ssl == FALSE) {
|
||||
goto close_conn;
|
||||
} else {
|
||||
zend_bool verify = mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT? TRUE:FALSE;
|
||||
DBG_INF("Switching to SSL");
|
||||
if (!PACKET_WRITE(auth_packet, conn)) {
|
||||
goto close_conn;
|
||||
}
|
||||
|
||||
conn->net->data->m.set_client_option(conn->net, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (const char *) &verify TSRMLS_CC);
|
||||
conn->net->data->m.set_client_option(conn->net, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (const char *) &verify TSRMLS_CC);
|
||||
|
||||
if (FAIL == conn->net->data->m.enable_ssl(conn->net TSRMLS_CC)) {
|
||||
goto end;
|
||||
if (FAIL == conn->net->data->m.enable_ssl(conn->net TSRMLS_CC)) {
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
auth_packet->client_flags &= ~CLIENT_SSL;
|
||||
if (!PACKET_WRITE(auth_packet, conn)) {
|
||||
goto close_conn;
|
||||
}
|
||||
#endif
|
||||
ret = PASS;
|
||||
end:
|
||||
PACKET_FREE(auth_packet);
|
||||
DBG_RETURN(ret);
|
||||
|
||||
close_conn:
|
||||
CONN_SET_STATE(conn, CONN_QUIT_SENT);
|
||||
conn->m->send_close(conn TSRMLS_CC);
|
||||
SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);
|
||||
PACKET_FREE(auth_packet);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1563,7 +1577,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn
|
||||
|
||||
|
||||
/* {{{ mysqlnd_old_escape_string */
|
||||
PHPAPI ulong
|
||||
PHPAPI ulong
|
||||
mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC)
|
||||
{
|
||||
DBG_ENTER("mysqlnd_old_escape_string");
|
||||
@@ -1725,7 +1739,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, statistic)(MYSQLND_CONN_DATA * conn, char **me
|
||||
|
||||
if (PASS == (ret = PACKET_READ(stats_header, conn))) {
|
||||
/* will be freed by Zend, thus don't use the mnd_ allocator */
|
||||
*message = estrndup(stats_header->message, stats_header->message_len);
|
||||
*message = estrndup(stats_header->message, stats_header->message_len);
|
||||
*message_len = stats_header->message_len;
|
||||
DBG_INF(*message);
|
||||
}
|
||||
@@ -1851,7 +1865,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, shutdown)(MYSQLND_CONN_DATA * const conn, uint
|
||||
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
}
|
||||
DBG_RETURN(ret);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2350,7 +2364,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c
|
||||
ret = FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
new_charset_name = mnd_pestrdup(value, conn->persistent);
|
||||
if (!new_charset_name) {
|
||||
goto oom;
|
||||
@@ -2429,11 +2443,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c
|
||||
default:
|
||||
ret = FAIL;
|
||||
}
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
DBG_RETURN(ret);
|
||||
oom:
|
||||
SET_OOM_ERROR(*conn->error_info);
|
||||
conn->m->local_tx_end(conn, this_func, FAIL TSRMLS_CC);
|
||||
conn->m->local_tx_end(conn, this_func, FAIL TSRMLS_CC);
|
||||
end:
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
@@ -2510,7 +2524,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons
|
||||
DBG_RETURN(ret);
|
||||
oom:
|
||||
SET_OOM_ERROR(*conn->error_info);
|
||||
conn->m->local_tx_end(conn, this_func, FAIL TSRMLS_CC);
|
||||
conn->m->local_tx_end(conn, this_func, FAIL TSRMLS_CC);
|
||||
end:
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
@@ -2551,7 +2565,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, use_result)(MYSQLND_CONN_DATA * const conn TSR
|
||||
conn->current_result = NULL;
|
||||
} while (0);
|
||||
|
||||
conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS TSRMLS_CC);
|
||||
conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS TSRMLS_CC);
|
||||
}
|
||||
|
||||
DBG_RETURN(result);
|
||||
@@ -2591,7 +2605,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, store_result)(MYSQLND_CONN_DATA * const conn T
|
||||
conn->current_result = NULL;
|
||||
} while (0);
|
||||
|
||||
conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS TSRMLS_CC);
|
||||
conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS TSRMLS_CC);
|
||||
}
|
||||
DBG_RETURN(result);
|
||||
}
|
||||
@@ -2620,7 +2634,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_autocommit)(MYSQLND_CONN_DATA * conn, unsi
|
||||
|
||||
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
|
||||
ret = conn->m->query(conn, (mode) ? "SET AUTOCOMMIT=1":"SET AUTOCOMMIT=0", sizeof("SET AUTOCOMMIT=1") - 1 TSRMLS_CC);
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
}
|
||||
|
||||
DBG_RETURN(ret);
|
||||
|
||||
@@ -5136,7 +5136,6 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
long buffer_length;
|
||||
unsigned char *buffer = NULL;
|
||||
zval *zstrong_result_returned = NULL;
|
||||
int strong_result = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z", &buffer_length, &zstrong_result_returned) == FAILURE) {
|
||||
return;
|
||||
@@ -5154,7 +5153,6 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
buffer = emalloc(buffer_length + 1);
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
strong_result = 1;
|
||||
/* random/urandom equivalent on Windows */
|
||||
if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){
|
||||
efree(buffer);
|
||||
@@ -5164,7 +5162,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#else
|
||||
if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) {
|
||||
if (RAND_bytes(buffer, buffer_length) <= 0) {
|
||||
efree(buffer);
|
||||
if (zstrong_result_returned) {
|
||||
ZVAL_BOOL(zstrong_result_returned, 0);
|
||||
@@ -5177,7 +5175,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
RETVAL_STRINGL((char *)buffer, buffer_length, 0);
|
||||
|
||||
if (zstrong_result_returned) {
|
||||
ZVAL_BOOL(zstrong_result_returned, strong_result);
|
||||
ZVAL_BOOL(zstrong_result_returned, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -314,7 +314,7 @@ them both to 0; an emulation function will be used. */
|
||||
#define PACKAGE_NAME "PCRE"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "PCRE 8.36"
|
||||
#define PACKAGE_STRING "PCRE 8.37"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "pcre"
|
||||
@@ -323,7 +323,7 @@ them both to 0; an emulation function will be used. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "8.36"
|
||||
#define PACKAGE_VERSION "8.37"
|
||||
|
||||
/* to make a symbol visible */
|
||||
/* #undef PCRECPP_EXP_DECL */
|
||||
@@ -439,7 +439,7 @@ them both to 0; an emulation function will be used. */
|
||||
|
||||
/* Version number of package */
|
||||
#ifndef VERSION
|
||||
#define VERSION "8.36"
|
||||
#define VERSION "8.37"
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
|
||||
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
/* The current PCRE version information. */
|
||||
|
||||
#define PCRE_MAJOR 8
|
||||
#define PCRE_MINOR 36
|
||||
#define PCRE_MINOR 37
|
||||
#define PCRE_PRERELEASE
|
||||
#define PCRE_DATE 2014-09-26
|
||||
#define PCRE_DATE 2015-04-28
|
||||
|
||||
/* When an application links to a PCRE DLL in Windows, the symbols that are
|
||||
imported have to be identified as such. When building PCRE, the appropriate
|
||||
|
||||
+119
-84
@@ -136,7 +136,7 @@ static PHP_MINFO_FUNCTION(pcre)
|
||||
static PHP_MINIT_FUNCTION(pcre)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
|
||||
REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -169,13 +169,14 @@ static PHP_MSHUTDOWN_FUNCTION(pcre)
|
||||
/* {{{ static pcre_clean_cache */
|
||||
static int pcre_clean_cache(void *data, void *arg TSRMLS_DC)
|
||||
{
|
||||
pcre_cache_entry *pce = (pcre_cache_entry *) data;
|
||||
int *num_clean = (int *)arg;
|
||||
|
||||
if (*num_clean > 0) {
|
||||
if (*num_clean > 0 && !pce->refcount) {
|
||||
(*num_clean)--;
|
||||
return 1;
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
} else {
|
||||
return 0;
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -224,6 +225,25 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce TSRMLS_D
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ static calculate_unit_length */
|
||||
/* Calculates the byte length of the next character. Assumes valid UTF-8 for PCRE_UTF8. */
|
||||
static zend_always_inline int calculate_unit_length(pcre_cache_entry *pce, char *start)
|
||||
{
|
||||
int unit_len;
|
||||
|
||||
if (pce->compile_options & PCRE_UTF8) {
|
||||
char *end = start;
|
||||
|
||||
/* skip continuation bytes */
|
||||
while ((*++end & 0xC0) == 0x80);
|
||||
unit_len = end - start;
|
||||
} else {
|
||||
unit_len = 1;
|
||||
}
|
||||
return unit_len;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ pcre_get_compiled_regex_cache
|
||||
*/
|
||||
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC)
|
||||
@@ -276,18 +296,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p = regex;
|
||||
|
||||
|
||||
/* Parse through the leading whitespace, and display a warning if we
|
||||
get to the end without encountering a delimiter. */
|
||||
while (isspace((int)*(unsigned char *)p)) p++;
|
||||
if (*p == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
p < regex + regex_len ? "Null byte in regex" : "Empty regular expression");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Get the delimiter and display a warning if it is alphanumeric
|
||||
or a backslash. */
|
||||
delimiter = *p++;
|
||||
@@ -340,7 +360,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Make a copy of the actual pattern. */
|
||||
pattern = estrndup(p, pp-p);
|
||||
|
||||
@@ -348,7 +368,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
pp++;
|
||||
|
||||
/* Parse through the options, setting appropriate flags. Display
|
||||
a warning if we encounter an unknown modifier. */
|
||||
a warning if we encounter an unknown modifier. */
|
||||
while (pp < regex + regex_len) {
|
||||
switch (*pp++) {
|
||||
/* Perl compatible options */
|
||||
@@ -356,7 +376,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
case 'm': coptions |= PCRE_MULTILINE; break;
|
||||
case 's': coptions |= PCRE_DOTALL; break;
|
||||
case 'x': coptions |= PCRE_EXTENDED; break;
|
||||
|
||||
|
||||
/* PCRE specific options */
|
||||
case 'A': coptions |= PCRE_ANCHORED; break;
|
||||
case 'D': coptions |= PCRE_DOLLAR_ENDONLY;break;
|
||||
@@ -369,12 +389,12 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
the PCRE_UCP option. */
|
||||
#ifdef PCRE_UCP
|
||||
coptions |= PCRE_UCP;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
/* Custom preg options */
|
||||
case 'e': poptions |= PREG_REPLACE_EVAL; break;
|
||||
|
||||
|
||||
case ' ':
|
||||
case '\n':
|
||||
break;
|
||||
@@ -446,6 +466,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
new_entry.locale = pestrdup(locale, 1);
|
||||
new_entry.tables = tables;
|
||||
#endif
|
||||
new_entry.refcount = 0;
|
||||
|
||||
/*
|
||||
* Interned strings are not duplicated when stored in HashTable,
|
||||
@@ -453,7 +474,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
* at end of request. However PCRE_G(pcre_cache) must be consistent
|
||||
* on the next request as well. So we disable usage of interned strings
|
||||
* as hash keys especually for this table.
|
||||
* See bug #63180
|
||||
* See bug #63180
|
||||
*/
|
||||
if (IS_INTERNED(regex)) {
|
||||
regex = tmp = estrndup(regex, regex_len);
|
||||
@@ -482,7 +503,7 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_
|
||||
if (preg_options) {
|
||||
*preg_options = pce ? pce->preg_options : 0;
|
||||
}
|
||||
|
||||
|
||||
return pce ? pce->re : NULL;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -492,7 +513,7 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_
|
||||
PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *compile_options TSRMLS_DC)
|
||||
{
|
||||
pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex, strlen(regex) TSRMLS_CC);
|
||||
|
||||
|
||||
if (extra) {
|
||||
*extra = pce ? pce->extra : NULL;
|
||||
}
|
||||
@@ -502,7 +523,7 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr
|
||||
if (compile_options) {
|
||||
*compile_options = pce ? pce->compile_options : 0;
|
||||
}
|
||||
|
||||
|
||||
return pce ? pce->re : NULL;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -519,7 +540,7 @@ static inline void add_offset_pair(zval *result, char *str, int len, int offset,
|
||||
/* Add (match, offset) to the return value */
|
||||
add_next_index_stringl(match_pair, str, len, 1);
|
||||
add_next_index_long(match_pair, offset);
|
||||
|
||||
|
||||
if (name) {
|
||||
zval_add_ref(&match_pair);
|
||||
zend_hash_update(Z_ARRVAL_P(result), name, strlen(name)+1, &match_pair, sizeof(zval *), NULL);
|
||||
@@ -544,14 +565,16 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
|
||||
&subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_pcre_match_impl(pce, subject, subject_len, return_value, subpats,
|
||||
pce->refcount++;
|
||||
php_pcre_match_impl(pce, subject, subject_len, return_value, subpats,
|
||||
global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC);
|
||||
pce->refcount--;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -653,7 +676,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
|
||||
matched = 0;
|
||||
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
|
||||
|
||||
|
||||
do {
|
||||
/* Execute the regular expression. */
|
||||
count = pcre_exec(pce->re, extra, subject, subject_len, start_offset,
|
||||
@@ -675,7 +698,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
/* If subpatterns array has been passed, fill it in with values. */
|
||||
if (subpats != NULL) {
|
||||
/* Try to get the list of substrings and display a warning if failed. */
|
||||
if (pcre_get_substring_list(subject, offsets, count, &stringlist) < 0) {
|
||||
if ((offsets[1] - offsets[0] < 0) || pcre_get_substring_list(subject, offsets, count, &stringlist) < 0) {
|
||||
efree(subpat_names);
|
||||
efree(offsets);
|
||||
if (match_sets) efree(match_sets);
|
||||
@@ -710,7 +733,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
ALLOC_ZVAL(result_set);
|
||||
array_init(result_set);
|
||||
INIT_PZVAL(result_set);
|
||||
|
||||
|
||||
/* Add all the subpatterns to it */
|
||||
for (i = 0; i < count; i++) {
|
||||
if (offset_capture) {
|
||||
@@ -754,21 +777,23 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
the start offset, and continue. Fudge the offset values
|
||||
to achieve this, unless we're already at the end of the string. */
|
||||
if (g_notempty != 0 && start_offset < subject_len) {
|
||||
int unit_len = calculate_unit_length(pce, subject + start_offset);
|
||||
|
||||
offsets[0] = start_offset;
|
||||
offsets[1] = start_offset + 1;
|
||||
offsets[1] = start_offset + unit_len;
|
||||
} else
|
||||
break;
|
||||
} else {
|
||||
pcre_handle_exec_error(count TSRMLS_CC);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* If we have matched an empty string, mimic what Perl's /g options does.
|
||||
This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
|
||||
the match again at the same point. If this fails (picked up above) we
|
||||
advance to the next character. */
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
|
||||
|
||||
|
||||
/* Advance to the position right after the last full match */
|
||||
start_offset = offsets[1];
|
||||
} while (global);
|
||||
@@ -785,7 +810,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
efree(match_sets);
|
||||
}
|
||||
|
||||
|
||||
efree(offsets);
|
||||
efree(subpat_names);
|
||||
|
||||
@@ -835,7 +860,7 @@ static int preg_get_backref(char **str, int *backref)
|
||||
walk++;
|
||||
} else
|
||||
return 0;
|
||||
|
||||
|
||||
if (*walk && *walk >= '0' && *walk <= '9') {
|
||||
*backref = *backref * 10 + *walk - '0';
|
||||
walk++;
|
||||
@@ -847,9 +872,9 @@ static int preg_get_backref(char **str, int *backref)
|
||||
else
|
||||
walk++;
|
||||
}
|
||||
|
||||
|
||||
*str = walk;
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -859,7 +884,7 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char *
|
||||
{
|
||||
zval *retval_ptr; /* Function return value */
|
||||
zval **args[1]; /* Argument to pass to function */
|
||||
zval *subpats; /* Captured subpatterns */
|
||||
zval *subpats; /* Captured subpatterns */
|
||||
int result_len; /* Return value length */
|
||||
int i;
|
||||
|
||||
@@ -910,11 +935,11 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
|
||||
int backref; /* Current backref */
|
||||
char *compiled_string_description;
|
||||
smart_str code = {0};
|
||||
|
||||
|
||||
eval_str_end = eval_str + eval_str_len;
|
||||
walk = segment = eval_str;
|
||||
walk_last = 0;
|
||||
|
||||
|
||||
while (walk < eval_str_end) {
|
||||
/* If found a backreference.. */
|
||||
if ('\\' == *walk || '$' == *walk) {
|
||||
@@ -967,15 +992,15 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
|
||||
}
|
||||
efree(compiled_string_description);
|
||||
convert_to_string(&retval);
|
||||
|
||||
|
||||
/* Save the return value and its length */
|
||||
*result = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
|
||||
result_len = Z_STRLEN(retval);
|
||||
|
||||
|
||||
/* Clean up */
|
||||
zval_dtor(&retval);
|
||||
smart_str_free(&code);
|
||||
|
||||
|
||||
return result_len;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -988,19 +1013,23 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
int *result_len, int limit, int *replace_count TSRMLS_DC)
|
||||
{
|
||||
pcre_cache_entry *pce; /* Compiled regular expression */
|
||||
char *result; /* Function result */
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return php_pcre_replace_impl(pce, subject, subject_len, replace_val,
|
||||
pce->refcount++;
|
||||
result = php_pcre_replace_impl(pce, subject, subject_len, replace_val,
|
||||
is_callable_replace, result_len, limit, replace_count TSRMLS_CC);
|
||||
pce->refcount--;
|
||||
|
||||
return result;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_pcre_replace_impl() */
|
||||
PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *replace_val,
|
||||
PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *replace_val,
|
||||
int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC)
|
||||
{
|
||||
pcre_extra *extra = pce->extra;/* Holds results of studying */
|
||||
@@ -1076,7 +1105,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
}
|
||||
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
|
||||
alloc_len = 2 * subject_len + 1;
|
||||
result = safe_emalloc(alloc_len, sizeof(char), 0);
|
||||
|
||||
@@ -1085,7 +1114,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
*result_len = 0;
|
||||
start_offset = 0;
|
||||
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
|
||||
|
||||
|
||||
while (1) {
|
||||
/* Execute the regular expression. */
|
||||
count = pcre_exec(pce->re, extra, subject, subject_len, start_offset,
|
||||
@@ -1102,7 +1131,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
|
||||
piece = subject + start_offset;
|
||||
|
||||
if (count > 0 && (limit == -1 || limit > 0)) {
|
||||
if (count > 0 && (offsets[1] - offsets[0] >= 0) && (limit == -1 || limit > 0)) {
|
||||
if (replace_count) {
|
||||
++*replace_count;
|
||||
}
|
||||
@@ -1110,7 +1139,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
match = subject + offsets[0];
|
||||
|
||||
new_len = *result_len + offsets[0] - start_offset; /* part before the match */
|
||||
|
||||
|
||||
/* If evaluating, do it and add the return string's length */
|
||||
if (eval) {
|
||||
eval_result_len = preg_do_eval(replace, replace_len, subject,
|
||||
@@ -1155,7 +1184,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
|
||||
/* copy replacement and backrefs */
|
||||
walkbuf = result + *result_len;
|
||||
|
||||
|
||||
/* If evaluating or using custom function, copy result to the buffer
|
||||
* and clean up. */
|
||||
if (eval || is_callable_replace) {
|
||||
@@ -1198,10 +1227,12 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
the start offset, and continue. Fudge the offset values
|
||||
to achieve this, unless we're already at the end of the string. */
|
||||
if (g_notempty != 0 && start_offset < subject_len) {
|
||||
int unit_len = calculate_unit_length(pce, piece);
|
||||
|
||||
offsets[0] = start_offset;
|
||||
offsets[1] = start_offset + 1;
|
||||
memcpy(&result[*result_len], piece, 1);
|
||||
(*result_len)++;
|
||||
offsets[1] = start_offset + unit_len;
|
||||
memcpy(&result[*result_len], piece, unit_len);
|
||||
*result_len += unit_len;
|
||||
} else {
|
||||
new_len = *result_len + subject_len - start_offset;
|
||||
if (new_len + 1 > alloc_len) {
|
||||
@@ -1223,13 +1254,13 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
result = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* If we have matched an empty string, mimic what Perl's /g options does.
|
||||
This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
|
||||
the match again at the same point. If this fails (picked up above) we
|
||||
advance to the next character. */
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
|
||||
|
||||
|
||||
/* Advance to the next piece. */
|
||||
start_offset = offsets[1];
|
||||
}
|
||||
@@ -1253,18 +1284,18 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
|
||||
*result;
|
||||
int subject_len;
|
||||
|
||||
/* Make sure we're dealing with strings. */
|
||||
/* Make sure we're dealing with strings. */
|
||||
convert_to_string_ex(subject);
|
||||
/* FIXME: This might need to be changed to STR_EMPTY_ALLOC(). Check if this zval could be dtor()'ed somehow */
|
||||
ZVAL_STRINGL(&empty_replace, "", 0, 0);
|
||||
|
||||
|
||||
/* If regex is an array */
|
||||
if (Z_TYPE_P(regex) == IS_ARRAY) {
|
||||
/* Duplicate subject string for repeated replacement */
|
||||
subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject));
|
||||
subject_len = Z_STRLEN_PP(subject);
|
||||
*result_len = subject_len;
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(regex));
|
||||
|
||||
replace_value = replace;
|
||||
@@ -1273,9 +1304,9 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
|
||||
|
||||
/* For each entry in the regex array, get the entry */
|
||||
while (zend_hash_get_current_data(Z_ARRVAL_P(regex), (void **)®ex_entry) == SUCCESS) {
|
||||
/* Make sure we're dealing with strings. */
|
||||
/* Make sure we're dealing with strings. */
|
||||
convert_to_string_ex(regex_entry);
|
||||
|
||||
|
||||
/* If replace is an array and not a callable construct */
|
||||
if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace) {
|
||||
/* Get current entry */
|
||||
@@ -1290,7 +1321,7 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
|
||||
replace_value = &empty_replace;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Do the actual replacement and put the result back into subject_value
|
||||
for further replacements. */
|
||||
if ((result = php_pcre_replace(Z_STRVAL_PP(regex_entry),
|
||||
@@ -1346,12 +1377,12 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
ulong num_key;
|
||||
char *callback_name;
|
||||
int replace_count=0, old_replace_count;
|
||||
|
||||
|
||||
/* Get function parameters and do error-checking. */
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|lZ", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!is_callable_replace && Z_TYPE_PP(replace) == IS_ARRAY && Z_TYPE_PP(regex) != IS_ARRAY) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter mismatch, pattern is a string while replacement is an array");
|
||||
RETURN_FALSE;
|
||||
@@ -1377,10 +1408,10 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
if (ZEND_NUM_ARGS() > 3) {
|
||||
limit_val = limit;
|
||||
}
|
||||
|
||||
|
||||
if (Z_TYPE_PP(regex) != IS_ARRAY)
|
||||
convert_to_string_ex(regex);
|
||||
|
||||
|
||||
/* if subject is an array */
|
||||
if (Z_TYPE_PP(subject) == IS_ARRAY) {
|
||||
array_init(return_value);
|
||||
@@ -1408,7 +1439,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
efree(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
zend_hash_move_forward(Z_ARRVAL_PP(subject));
|
||||
}
|
||||
} else { /* if subject is not an array */
|
||||
@@ -1425,7 +1456,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
zval_dtor(*zcount);
|
||||
ZVAL_LONG(*zcount, replace_count);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1453,7 +1484,7 @@ static PHP_FUNCTION(preg_filter)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array preg_split(string pattern, string subject [, int limit [, int flags]])
|
||||
/* {{{ proto array preg_split(string pattern, string subject [, int limit [, int flags]])
|
||||
Split string into an array using a perl-style regular expression as a delimiter */
|
||||
static PHP_FUNCTION(preg_split)
|
||||
{
|
||||
@@ -1465,18 +1496,20 @@ static PHP_FUNCTION(preg_split)
|
||||
long flags = 0; /* Match control flags */
|
||||
pcre_cache_entry *pce; /* Compiled regular expression */
|
||||
|
||||
/* Get function parameters and do error checking */
|
||||
/* Get function parameters and do error checking */
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", ®ex, ®ex_len,
|
||||
&subject, &subject_len, &limit_val, &flags) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
pce->refcount++;
|
||||
php_pcre_split_impl(pce, subject, subject_len, return_value, limit_val, flags TSRMLS_CC);
|
||||
pce->refcount--;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1505,7 +1538,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
no_empty = flags & PREG_SPLIT_NO_EMPTY;
|
||||
delim_capture = flags & PREG_SPLIT_DELIM_CAPTURE;
|
||||
offset_capture = flags & PREG_SPLIT_OFFSET_CAPTURE;
|
||||
|
||||
|
||||
if (limit_val == 0) {
|
||||
limit_val = -1;
|
||||
}
|
||||
@@ -1516,7 +1549,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
extra->match_limit = PCRE_G(backtrack_limit);
|
||||
extra->match_limit_recursion = PCRE_G(recursion_limit);
|
||||
|
||||
|
||||
/* Initialize return value */
|
||||
array_init(return_value);
|
||||
|
||||
@@ -1528,13 +1561,13 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
|
||||
/* Start at the beginning of the string */
|
||||
start_offset = 0;
|
||||
next_offset = 0;
|
||||
last_match = subject;
|
||||
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
|
||||
|
||||
|
||||
/* Get next piece if no limit or limit not yet reached and something matched*/
|
||||
while ((limit_val == -1 || limit_val > 1)) {
|
||||
count = pcre_exec(pce->re, extra, subject,
|
||||
@@ -1549,9 +1582,9 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
php_error_docref(NULL TSRMLS_CC,E_NOTICE, "Matched, but too many substrings");
|
||||
count = size_offsets/3;
|
||||
}
|
||||
|
||||
|
||||
/* If something matched */
|
||||
if (count > 0) {
|
||||
if (count > 0 && (offsets[1] - offsets[0] >= 0)) {
|
||||
if (!no_empty || &subject[offsets[0]] != last_match) {
|
||||
|
||||
if (offset_capture) {
|
||||
@@ -1567,7 +1600,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
if (limit_val != -1)
|
||||
limit_val--;
|
||||
}
|
||||
|
||||
|
||||
last_match = &subject[offsets[1]];
|
||||
next_offset = offsets[1];
|
||||
|
||||
@@ -1624,7 +1657,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
the match again at the same point. If this fails (picked up above) we
|
||||
advance to the next character. */
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
|
||||
|
||||
|
||||
/* Advance to the position right after the last full match */
|
||||
start_offset = offsets[1];
|
||||
}
|
||||
@@ -1643,7 +1676,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Clean up */
|
||||
efree(offsets);
|
||||
}
|
||||
@@ -1664,13 +1697,13 @@ static PHP_FUNCTION(preg_quote)
|
||||
delim_char=0, /* Delimiter character to be quoted */
|
||||
c; /* Current character */
|
||||
zend_bool quote_delim = 0; /* Whether to quote additional delim char */
|
||||
|
||||
|
||||
/* Get the arguments and check for errors */
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &in_str, &in_str_len,
|
||||
&delim, &delim_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
in_str_end = in_str + in_str_len;
|
||||
|
||||
/* Nothing to do if we got an empty string */
|
||||
@@ -1682,11 +1715,11 @@ static PHP_FUNCTION(preg_quote)
|
||||
delim_char = delim[0];
|
||||
quote_delim = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate enough memory so that even if each character
|
||||
is quoted, we won't run out of room */
|
||||
out_str = safe_emalloc(4, in_str_len, 1);
|
||||
|
||||
|
||||
/* Go through the string and quote necessary characters */
|
||||
for(p = in_str, q = out_str; p != in_str_end; p++) {
|
||||
c = *p;
|
||||
@@ -1730,7 +1763,7 @@ static PHP_FUNCTION(preg_quote)
|
||||
}
|
||||
}
|
||||
*q = '\0';
|
||||
|
||||
|
||||
/* Reallocate string and return it */
|
||||
RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str, 0);
|
||||
}
|
||||
@@ -1751,13 +1784,15 @@ static PHP_FUNCTION(preg_grep)
|
||||
&input, &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
pce->refcount++;
|
||||
php_pcre_grep_impl(pce, input, return_value, flags TSRMLS_CC);
|
||||
pce->refcount--;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1774,9 +1809,9 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
|
||||
zend_bool invert; /* Whether to return non-matching
|
||||
entries */
|
||||
int rc;
|
||||
|
||||
|
||||
invert = flags & PREG_GREP_INVERT ? 1 : 0;
|
||||
|
||||
|
||||
if (extra == NULL) {
|
||||
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
||||
extra = &extra_data;
|
||||
@@ -1792,7 +1827,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
|
||||
/* Initialize return array */
|
||||
array_init(return_value);
|
||||
|
||||
@@ -1905,7 +1940,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_split, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, pattern)
|
||||
ZEND_ARG_INFO(0, subject)
|
||||
ZEND_ARG_INFO(0, limit)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_quote, 0, 0, 1)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #53823 - preg_replace: * qualifier on unicode replace garbles the string
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(preg_replace('/[^\pL\pM]*/iu', '', 'áéíóú'));
|
||||
// invalid UTF-8
|
||||
var_dump(preg_replace('/[^\pL\pM]*/iu', '', "\xFCáéíóú"));
|
||||
var_dump(preg_replace('/[^\pL\pM]*/iu', '', "áéíóú\xFC"));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(10) "áéíóú"
|
||||
NULL
|
||||
NULL
|
||||
@@ -0,0 +1,47 @@
|
||||
--TEST--
|
||||
Bug #66121 - UTF-8 lookbehinds match bytes instead of characters
|
||||
--FILE--
|
||||
<?php
|
||||
// Sinhala characters
|
||||
var_dump(preg_replace('/(?<!ක)/u', '*', 'ක'));
|
||||
var_dump(preg_replace('/(?<!ක)/u', '*', 'ම'));
|
||||
// English characters
|
||||
var_dump(preg_replace('/(?<!k)/u', '*', 'k'));
|
||||
var_dump(preg_replace('/(?<!k)/u', '*', 'm'));
|
||||
// Sinhala characters
|
||||
preg_match_all('/(?<!ක)/u', 'ම', $matches, PREG_OFFSET_CAPTURE);
|
||||
var_dump($matches);
|
||||
// invalid UTF-8
|
||||
var_dump(preg_replace('/(?<!ක)/u', '*', "\xFCක"));
|
||||
var_dump(preg_replace('/(?<!ක)/u', '*', "ක\xFC"));
|
||||
var_dump(preg_match_all('/(?<!ක)/u', "\xFCම", $matches, PREG_OFFSET_CAPTURE));
|
||||
var_dump(preg_match_all('/(?<!ක)/u', "\xFCම", $matches, PREG_OFFSET_CAPTURE));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "*ක"
|
||||
string(5) "*ම*"
|
||||
string(2) "*k"
|
||||
string(3) "*m*"
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
}
|
||||
}
|
||||
NULL
|
||||
NULL
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #69864 (Segfault in preg_replace_callback)
|
||||
--FILE--
|
||||
<?php
|
||||
const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
|
||||
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #70345 (Multiple vulnerabilities related to PCRE functions)
|
||||
--FILE--
|
||||
<?php
|
||||
$regex = '/(?=xyz\K)/';
|
||||
$subject = "aaaaxyzaaaa";
|
||||
|
||||
$v = preg_split($regex, $subject);
|
||||
print_r($v);
|
||||
|
||||
$regex = '/(a(?=xyz\K))/';
|
||||
$subject = "aaaaxyzaaaa";
|
||||
preg_match($regex, $subject, $matches);
|
||||
|
||||
var_dump($matches);
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[0] => aaaaxyzaaaa
|
||||
)
|
||||
|
||||
Warning: preg_match(): Get subpatterns list failed in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "pdo/php_pdo.h"
|
||||
#include "pdo/php_pdo_driver.h"
|
||||
#include "ext/standard/file.h"
|
||||
@@ -60,6 +61,17 @@ static char * _pdo_pgsql_trim_message(const char *message, int persistent)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static char * _pdo_pgsql_escape_credentials(char *str TSRMLS_DC)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (str) {
|
||||
return php_addcslashes(str, strlen(str), &len, 0, "\\'", sizeof("\\'") TSRMLS_CC);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *sqlstate, const char *file, int line TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
|
||||
@@ -1055,7 +1067,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
pdo_pgsql_db_handle *H;
|
||||
int ret = 0;
|
||||
char *conn_str, *p, *e;
|
||||
char *tmp_pass;
|
||||
char *tmp_user, *tmp_pass;
|
||||
long connect_timeout = 30;
|
||||
|
||||
H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent);
|
||||
@@ -1063,7 +1075,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
|
||||
H->einfo.errcode = 0;
|
||||
H->einfo.errmsg = NULL;
|
||||
|
||||
|
||||
/* PostgreSQL wants params in the connect string to be separated by spaces,
|
||||
* if the PDO standard semicolons are used, we convert them to spaces
|
||||
*/
|
||||
@@ -1077,42 +1089,27 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (dbh->password) {
|
||||
if (dbh->password[0] != '\'' && dbh->password[strlen(dbh->password) - 1] != '\'') {
|
||||
char *pwd = dbh->password;
|
||||
int pos = 1;
|
||||
|
||||
tmp_pass = safe_emalloc(2, strlen(dbh->password), 3);
|
||||
tmp_pass[0] = '\'';
|
||||
|
||||
while (*pwd != '\0') {
|
||||
if (*pwd == '\\' || *pwd == '\'') {
|
||||
tmp_pass[pos++] = '\\';
|
||||
}
|
||||
|
||||
tmp_pass[pos++] = *pwd++;
|
||||
}
|
||||
|
||||
tmp_pass[pos++] = '\'';
|
||||
tmp_pass[pos] = '\0';
|
||||
} else {
|
||||
tmp_pass = dbh->password;
|
||||
}
|
||||
}
|
||||
/* escape username and password, if provided */
|
||||
tmp_user = _pdo_pgsql_escape_credentials(dbh->username TSRMLS_CC);
|
||||
tmp_pass = _pdo_pgsql_escape_credentials(dbh->password TSRMLS_CC);
|
||||
|
||||
/* support both full connection string & connection string + login and/or password */
|
||||
if (dbh->username && dbh->password) {
|
||||
spprintf(&conn_str, 0, "%s user=%s password=%s connect_timeout=%ld", dbh->data_source, dbh->username, tmp_pass, connect_timeout);
|
||||
} else if (dbh->username) {
|
||||
spprintf(&conn_str, 0, "%s user=%s connect_timeout=%ld", dbh->data_source, dbh->username, connect_timeout);
|
||||
} else if (dbh->password) {
|
||||
spprintf(&conn_str, 0, "%s password=%s connect_timeout=%ld", dbh->data_source, tmp_pass, connect_timeout);
|
||||
if (tmp_user && tmp_pass) {
|
||||
spprintf(&conn_str, 0, "%s user='%s' password='%s' connect_timeout=%ld", dbh->data_source, tmp_user, tmp_pass, connect_timeout);
|
||||
} else if (tmp_user) {
|
||||
spprintf(&conn_str, 0, "%s user='%s' connect_timeout=%ld", dbh->data_source, tmp_user, connect_timeout);
|
||||
} else if (tmp_pass) {
|
||||
spprintf(&conn_str, 0, "%s password='%s' connect_timeout=%ld", dbh->data_source, tmp_pass, connect_timeout);
|
||||
} else {
|
||||
spprintf(&conn_str, 0, "%s connect_timeout=%ld", (char *) dbh->data_source, connect_timeout);
|
||||
}
|
||||
|
||||
H->server = PQconnectdb(conn_str);
|
||||
if (dbh->password && tmp_pass != dbh->password) {
|
||||
|
||||
if (tmp_user) {
|
||||
efree(tmp_user);
|
||||
}
|
||||
if (tmp_pass) {
|
||||
efree(tmp_pass);
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ stmt_retry:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!stmt->executed && !stmt->column_count) {
|
||||
if (!stmt->executed && (!stmt->column_count || S->cols == NULL)) {
|
||||
stmt->column_count = (int) PQnfields(S->result);
|
||||
S->cols = ecalloc(stmt->column_count, sizeof(pdo_pgsql_column));
|
||||
}
|
||||
@@ -294,8 +294,8 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
|
||||
sizeof(Oid));
|
||||
}
|
||||
if (param->paramno >= 0) {
|
||||
if (param->paramno >= zend_hash_num_elements(stmt->bound_param_map)) {
|
||||
pdo_pgsql_error_stmt(stmt, PGRES_FATAL_ERROR, "HY105");
|
||||
if (param->paramno >= zend_hash_num_elements(stmt->bound_params)) {
|
||||
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined" TSRMLS_CC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -614,6 +614,12 @@ done:
|
||||
|
||||
static int pdo_pgsql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
|
||||
{
|
||||
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
|
||||
|
||||
if (S->cols != NULL){
|
||||
efree(S->cols);
|
||||
S->cols = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
PDO PgSQL Bug #69344 (PDO PgSQL Incorrect binding numeric array with gaps)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||
require dirname(__FILE__) . '/config.inc';
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
$pdo->setAttribute (\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
|
||||
|
||||
$test = function () use ($pdo) {
|
||||
$arr = [
|
||||
0 => "a",
|
||||
2 => "b",
|
||||
];
|
||||
|
||||
$stmt = $pdo->prepare("SELECT (?)::text AS a, (?)::text AS b");
|
||||
|
||||
try {
|
||||
$stmt->execute($arr);
|
||||
var_dump($stmt->fetch());
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
};
|
||||
|
||||
$test();
|
||||
|
||||
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
|
||||
|
||||
$test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
|
||||
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
--TEST--
|
||||
PDO PgSQL Bug #69362 (PDO-pgsql fails to connect if password contains a leading single quote)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||
require dirname(__FILE__) . '/config.inc';
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
|
||||
$dsn = getenv('PDOTEST_DSN');
|
||||
if (empty($dsn)) die('skip no dsn found in env');
|
||||
|
||||
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
|
||||
$user = 'pdo_test_'.rand(5, 400);
|
||||
$pass = 'testpass';
|
||||
|
||||
// Assume that if we can't create or drop a user, this test needs to be skipped
|
||||
try {
|
||||
$db->exec("DROP USER IF EXISTS $user");
|
||||
$db->exec("CREATE USER $user WITH PASSWORD '$pass'");
|
||||
} catch (PDOException $e) {
|
||||
die("skip You need CREATEUSER permissions to run the test");
|
||||
}
|
||||
|
||||
// Peer authentication might prevent the test from properly running
|
||||
try {
|
||||
$testConn = new PDO($dsn, $user, $pass);
|
||||
} catch (PDOException $e) {
|
||||
echo "skip ".$e->getMessage();
|
||||
}
|
||||
|
||||
$db->exec("DROP USER $user");
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
|
||||
$rand = rand(5, 400);
|
||||
$user = "pdo_test_$rand";
|
||||
$template = "CREATE USER $user WITH PASSWORD '%s'";
|
||||
$dropUser = "DROP USER $user";
|
||||
$testQuery = 'SELECT 1 as verification';
|
||||
|
||||
// Create temp user with leading single quote
|
||||
$sql = sprintf($template, "''mypassword");
|
||||
$pdo->query($sql);
|
||||
$testConn = new PDO($conf['ENV']['PDOTEST_DSN'], $user, "'mypassword");
|
||||
$result = $testConn->query($testQuery)->fetch();
|
||||
$check = $result[0];
|
||||
var_dump($check);
|
||||
|
||||
// Remove the user
|
||||
$pdo->query($dropUser);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
--TEST--
|
||||
PDO PgSQL Bug #69752 (memory leak with closeCursor)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||
require dirname(__FILE__) . '/config.inc';
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
|
||||
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$pdo->beginTransaction();
|
||||
|
||||
$pdo->exec("
|
||||
create table foo (
|
||||
id bigserial not null primary key,
|
||||
field1 text not null,
|
||||
field2 text not null,
|
||||
field3 text not null,
|
||||
field4 int4 not null
|
||||
)
|
||||
");
|
||||
$stmt = $pdo->prepare("insert into foo (field1, field2, field3, field4) values (:field1, :field2, :field3, :field4)");
|
||||
$max = 1000;
|
||||
$first_time_usage = null;
|
||||
|
||||
for($i = 0; $i < $max; $i++) {
|
||||
$data = array(
|
||||
'field1' => "field1: $i",
|
||||
'field2' => "field2: $i",
|
||||
'field3' => "field3: $i",
|
||||
'field4' => $i
|
||||
);
|
||||
$stmt->execute($data);
|
||||
$stmt->closeCursor();
|
||||
$usage = intval(floor(memory_get_usage() / 1024));
|
||||
|
||||
if ($first_time_usage === null) $first_time_usage = $usage;
|
||||
|
||||
/* Use delta instead of direct comparison here */
|
||||
if (abs($first_time_usage - $usage) > 3){
|
||||
printf("Memory Leak Detected: %d != %d\n", $usage, $first_time_usage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$pdo->rollBack();
|
||||
echo "done\n"
|
||||
?>
|
||||
--EXPECTF--
|
||||
done
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
PostgreSQL pg_select() - basic test using schema
|
||||
PostgreSQL pg_insert() - test for CVE-2015-1532
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
|
||||
+8
-2
@@ -2141,7 +2141,7 @@ char *tsrm_strtok_r(char *s, const char *delim, char **last) /* {{{ */
|
||||
*/
|
||||
char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char newpath[MAXPATHLEN];
|
||||
char *newpath;
|
||||
int newpath_len;
|
||||
char *ptr;
|
||||
char *tok;
|
||||
@@ -2149,8 +2149,10 @@ char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC) /* {{{
|
||||
|
||||
if (PHAR_G(cwd_len) && use_cwd && path_length > 2 && path[0] == '.' && path[1] == '/') {
|
||||
newpath_len = PHAR_G(cwd_len);
|
||||
newpath = emalloc(strlen(path) + newpath_len + 1);
|
||||
memcpy(newpath, PHAR_G(cwd), newpath_len);
|
||||
} else {
|
||||
newpath = emalloc(strlen(path) + 2);
|
||||
newpath[0] = '/';
|
||||
newpath_len = 1;
|
||||
}
|
||||
@@ -2173,6 +2175,7 @@ char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC) /* {{{
|
||||
if (*tok == '.') {
|
||||
efree(path);
|
||||
*new_len = 1;
|
||||
efree(newpath);
|
||||
return estrndup("/", 1);
|
||||
}
|
||||
break;
|
||||
@@ -2180,9 +2183,11 @@ char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC) /* {{{
|
||||
if (tok[0] == '.' && tok[1] == '.') {
|
||||
efree(path);
|
||||
*new_len = 1;
|
||||
efree(newpath);
|
||||
return estrndup("/", 1);
|
||||
}
|
||||
}
|
||||
efree(newpath);
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -2231,7 +2236,8 @@ last_time:
|
||||
|
||||
efree(path);
|
||||
*new_len = newpath_len;
|
||||
return estrndup(newpath, newpath_len);
|
||||
newpath[newpath_len] = '\0';
|
||||
return erealloc(newpath, newpath_len + 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -561,13 +561,16 @@ static inline void phar_set_inode(phar_entry_info *entry TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char tmp[MAXPATHLEN];
|
||||
int tmp_len;
|
||||
size_t len;
|
||||
size_t len1, len2;
|
||||
|
||||
tmp_len = MIN(MAXPATHLEN, entry->filename_len + entry->phar->fname_len);
|
||||
len = MIN(entry->phar->fname_len, tmp_len);
|
||||
memcpy(tmp, entry->phar->fname, len);
|
||||
len = MIN(tmp_len - len, entry->filename_len);
|
||||
memcpy(tmp + entry->phar->fname_len, entry->filename, len);
|
||||
|
||||
len1 = MIN(entry->phar->fname_len, tmp_len);
|
||||
memcpy(tmp, entry->phar->fname, len1);
|
||||
|
||||
len2 = MIN(tmp_len - len1, entry->filename_len);
|
||||
memcpy(tmp + len1, entry->filename, len2);
|
||||
|
||||
entry->inode = (unsigned short)zend_get_hash_value(tmp, tmp_len);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+94
-45
@@ -1252,7 +1252,7 @@ PHP_METHOD(Phar, __construct)
|
||||
INIT_PZVAL(&arg2);
|
||||
ZVAL_LONG(&arg2, flags);
|
||||
|
||||
zend_call_method_with_2_params(&zobj, Z_OBJCE_P(zobj),
|
||||
zend_call_method_with_2_params(&zobj, Z_OBJCE_P(zobj),
|
||||
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2);
|
||||
|
||||
if (!phar_data->is_persistent) {
|
||||
@@ -1276,7 +1276,7 @@ PHP_METHOD(Phar, getSupportedSignatures)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
add_next_index_stringl(return_value, "MD5", 3, 1);
|
||||
@@ -1303,7 +1303,7 @@ PHP_METHOD(Phar, getSupportedCompression)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
phar_request_initialize(TSRMLS_C);
|
||||
|
||||
@@ -1548,7 +1548,7 @@ phar_spl_fileinfo:
|
||||
}
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
|
||||
base = temp;
|
||||
base_len = strlen(base);
|
||||
|
||||
@@ -1737,7 +1737,7 @@ after_open_fp:
|
||||
/* {{{ proto array Phar::buildFromDirectory(string base_dir[, string regex])
|
||||
* Construct a phar archive from an existing directory, recursively.
|
||||
* Optional second parameter is a regular expression for filtering directory contents.
|
||||
*
|
||||
*
|
||||
* Return value is an array mapping phar index to actual files added.
|
||||
*/
|
||||
PHP_METHOD(Phar, buildFromDirectory)
|
||||
@@ -1773,7 +1773,7 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
INIT_PZVAL(&arg2);
|
||||
ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS);
|
||||
|
||||
zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator,
|
||||
zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator,
|
||||
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2);
|
||||
|
||||
if (EG(exception)) {
|
||||
@@ -1790,7 +1790,7 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
zend_call_method_with_1_params(&iteriter, spl_ce_RecursiveIteratorIterator,
|
||||
zend_call_method_with_1_params(&iteriter, spl_ce_RecursiveIteratorIterator,
|
||||
&spl_ce_RecursiveIteratorIterator->constructor, "__construct", NULL, iter);
|
||||
|
||||
if (EG(exception)) {
|
||||
@@ -1815,7 +1815,7 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
INIT_PZVAL(&arg2);
|
||||
ZVAL_STRINGL(&arg2, regex, regex_len, 0);
|
||||
|
||||
zend_call_method_with_2_params(®exiter, spl_ce_RegexIterator,
|
||||
zend_call_method_with_2_params(®exiter, spl_ce_RegexIterator,
|
||||
&spl_ce_RegexIterator->constructor, "__construct", NULL, iteriter, &arg2);
|
||||
}
|
||||
|
||||
@@ -1936,7 +1936,7 @@ PHP_METHOD(Phar, buildFromIterator)
|
||||
PHP_METHOD(Phar, count)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2017,9 +2017,10 @@ static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zval *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress TSRMLS_DC) /* {{{ */
|
||||
static zval *phar_rename_archive(phar_archive_data **sphar, char *ext, zend_bool compress TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
const char *oldname = NULL;
|
||||
phar_archive_data *phar = *sphar;
|
||||
char *oldpath = NULL;
|
||||
char *basename = NULL, *basepath = NULL;
|
||||
char *newname = NULL, *newpath = NULL;
|
||||
@@ -2101,7 +2102,7 @@ static zval *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool c
|
||||
spprintf(&newname, 0, "%s.%s", strtok(basename, "."), ext);
|
||||
efree(basename);
|
||||
|
||||
|
||||
|
||||
|
||||
basepath = estrndup(oldpath, (strlen(oldpath) - oldname_len));
|
||||
phar->fname_len = spprintf(&newpath, 0, "%s%s", basepath, newname);
|
||||
@@ -2126,7 +2127,9 @@ static zval *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool c
|
||||
(*pphar)->fp = phar->fp;
|
||||
phar->fp = NULL;
|
||||
phar_destroy_phar_data(phar TSRMLS_CC);
|
||||
*sphar = NULL;
|
||||
phar = *pphar;
|
||||
*sphar = NULL;
|
||||
phar->refcount++;
|
||||
newpath = oldpath;
|
||||
goto its_ok;
|
||||
@@ -2333,15 +2336,19 @@ no_copy:
|
||||
phar_add_virtual_dirs(phar, newentry.filename, newentry.filename_len TSRMLS_CC);
|
||||
}
|
||||
|
||||
if ((ret = phar_rename_archive(phar, ext, 0 TSRMLS_CC))) {
|
||||
if ((ret = phar_rename_archive(&phar, ext, 0 TSRMLS_CC))) {
|
||||
return ret;
|
||||
} else {
|
||||
zend_hash_destroy(&(phar->manifest));
|
||||
zend_hash_destroy(&(phar->mounted_dirs));
|
||||
zend_hash_destroy(&(phar->virtual_dirs));
|
||||
php_stream_close(phar->fp);
|
||||
efree(phar->fname);
|
||||
efree(phar);
|
||||
if(phar != NULL) {
|
||||
zend_hash_destroy(&(phar->manifest));
|
||||
zend_hash_destroy(&(phar->mounted_dirs));
|
||||
zend_hash_destroy(&(phar->virtual_dirs));
|
||||
if (phar->fp) {
|
||||
php_stream_close(phar->fp);
|
||||
}
|
||||
efree(phar->fname);
|
||||
efree(phar);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -2559,7 +2566,7 @@ PHP_METHOD(Phar, convertToData)
|
||||
PHP_METHOD(Phar, isCompressed)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2583,7 +2590,7 @@ PHP_METHOD(Phar, isWritable)
|
||||
{
|
||||
php_stream_statbuf ssb;
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2661,7 +2668,7 @@ PHP_METHOD(Phar, delete)
|
||||
PHP_METHOD(Phar, getAlias)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2678,7 +2685,7 @@ PHP_METHOD(Phar, getAlias)
|
||||
PHP_METHOD(Phar, getPath)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2794,7 +2801,7 @@ valid_alias:
|
||||
PHP_METHOD(Phar, getVersion)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2809,7 +2816,7 @@ PHP_METHOD(Phar, getVersion)
|
||||
PHP_METHOD(Phar, startBuffering)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2824,7 +2831,7 @@ PHP_METHOD(Phar, startBuffering)
|
||||
PHP_METHOD(Phar, isBuffering)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2841,7 +2848,7 @@ PHP_METHOD(Phar, stopBuffering)
|
||||
char *error;
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3076,7 +3083,7 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
|
||||
PHP_METHOD(Phar, getSignature)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3120,7 +3127,7 @@ PHP_METHOD(Phar, getSignature)
|
||||
PHP_METHOD(Phar, getModified)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3382,7 +3389,7 @@ PHP_METHOD(Phar, decompressFiles)
|
||||
{
|
||||
char *error;
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3899,7 +3906,7 @@ PHP_METHOD(Phar, getStub)
|
||||
phar_entry_info *stub;
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4002,7 +4009,7 @@ PHP_METHOD(Phar, hasMetadata)
|
||||
PHP_METHOD(Phar, getMetadata)
|
||||
{
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4110,6 +4117,9 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
char *fullpath;
|
||||
const char *slash;
|
||||
mode_t mode;
|
||||
cwd_state new_state;
|
||||
char *filename;
|
||||
size_t filename_len;
|
||||
|
||||
if (entry->is_mounted) {
|
||||
/* silently ignore mounted entries */
|
||||
@@ -4119,8 +4129,39 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
if (entry->filename_len >= sizeof(".phar")-1 && !memcmp(entry->filename, ".phar", sizeof(".phar")-1)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
/* strip .. from path and restrict it to be under dest directory */
|
||||
new_state.cwd = (char*)malloc(2);
|
||||
new_state.cwd[0] = DEFAULT_SLASH;
|
||||
new_state.cwd[1] = '\0';
|
||||
new_state.cwd_length = 1;
|
||||
if (virtual_file_ex(&new_state, entry->filename, NULL, CWD_EXPAND TSRMLS_CC) != 0 ||
|
||||
new_state.cwd_length <= 1) {
|
||||
if (EINVAL == errno && entry->filename_len > 50) {
|
||||
char *tmp = estrndup(entry->filename, 50);
|
||||
spprintf(error, 4096, "Cannot extract \"%s...\" to \"%s...\", extracted filename is too long for filesystem", tmp, dest);
|
||||
efree(tmp);
|
||||
} else {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\", internal error", entry->filename);
|
||||
}
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
filename = new_state.cwd + 1;
|
||||
filename_len = new_state.cwd_length - 1;
|
||||
#ifdef PHP_WIN32
|
||||
/* unixify the path back, otherwise non zip formats might be broken */
|
||||
{
|
||||
int cnt = filename_len;
|
||||
|
||||
len = spprintf(&fullpath, 0, "%s/%s", dest, entry->filename);
|
||||
do {
|
||||
if ('\\' == filename[cnt]) {
|
||||
filename[cnt] = '/';
|
||||
}
|
||||
} while (cnt-- >= 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
len = spprintf(&fullpath, 0, "%s/%s", dest, filename);
|
||||
|
||||
if (len >= MAXPATHLEN) {
|
||||
char *tmp;
|
||||
@@ -4134,18 +4175,21 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s...\", extracted filename is too long for filesystem", entry->filename, fullpath);
|
||||
}
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!len) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\", internal error", entry->filename);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (PHAR_OPENBASEDIR_CHECKPATH(fullpath)) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", openbasedir/safe mode restrictions in effect", entry->filename, fullpath);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -4153,14 +4197,15 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
if (!overwrite && SUCCESS == php_stream_stat_path(fullpath, &ssb)) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", path already exists", entry->filename, fullpath);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* perform dirname */
|
||||
slash = zend_memrchr(entry->filename, '/', entry->filename_len);
|
||||
slash = zend_memrchr(filename, '/', filename_len);
|
||||
|
||||
if (slash) {
|
||||
fullpath[dest_len + (slash - entry->filename) + 1] = '\0';
|
||||
fullpath[dest_len + (slash - filename) + 1] = '\0';
|
||||
} else {
|
||||
fullpath[dest_len] = '\0';
|
||||
}
|
||||
@@ -4170,23 +4215,27 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
if (!php_stream_mkdir(fullpath, entry->flags & PHAR_ENT_PERM_MASK, PHP_STREAM_MKDIR_RECURSIVE, NULL)) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\", could not create directory \"%s\"", entry->filename, fullpath);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
if (!php_stream_mkdir(fullpath, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL)) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\", could not create directory \"%s\"", entry->filename, fullpath);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slash) {
|
||||
fullpath[dest_len + (slash - entry->filename) + 1] = '/';
|
||||
fullpath[dest_len + (slash - filename) + 1] = '/';
|
||||
} else {
|
||||
fullpath[dest_len] = '/';
|
||||
}
|
||||
|
||||
filename = NULL;
|
||||
free(new_state.cwd);
|
||||
/* it is a standalone directory, job done */
|
||||
if (entry->is_dir) {
|
||||
efree(fullpath);
|
||||
@@ -4450,7 +4499,7 @@ PHP_METHOD(PharFileInfo, __construct)
|
||||
INIT_PZVAL(&arg1);
|
||||
ZVAL_STRINGL(&arg1, fname, fname_len, 0);
|
||||
|
||||
zend_call_method_with_1_params(&zobj, Z_OBJCE_P(zobj),
|
||||
zend_call_method_with_1_params(&zobj, Z_OBJCE_P(zobj),
|
||||
&spl_ce_SplFileInfo->constructor, "__construct", NULL, &arg1);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -4488,7 +4537,7 @@ PHP_METHOD(PharFileInfo, __destruct)
|
||||
PHP_METHOD(PharFileInfo, getCompressedSize)
|
||||
{
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4530,7 +4579,7 @@ PHP_METHOD(PharFileInfo, isCompressed)
|
||||
PHP_METHOD(PharFileInfo, getCRC32)
|
||||
{
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4556,7 +4605,7 @@ PHP_METHOD(PharFileInfo, getCRC32)
|
||||
PHP_METHOD(PharFileInfo, isCRCChecked)
|
||||
{
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4571,7 +4620,7 @@ PHP_METHOD(PharFileInfo, isCRCChecked)
|
||||
PHP_METHOD(PharFileInfo, getPharFlags)
|
||||
{
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4649,7 +4698,7 @@ PHP_METHOD(PharFileInfo, chmod)
|
||||
PHP_METHOD(PharFileInfo, hasMetadata)
|
||||
{
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4664,7 +4713,7 @@ PHP_METHOD(PharFileInfo, hasMetadata)
|
||||
PHP_METHOD(PharFileInfo, getMetadata)
|
||||
{
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4745,7 +4794,7 @@ PHP_METHOD(PharFileInfo, delMetadata)
|
||||
char *error;
|
||||
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4803,7 +4852,7 @@ PHP_METHOD(PharFileInfo, getContent)
|
||||
phar_entry_info *link;
|
||||
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -4977,7 +5026,7 @@ PHP_METHOD(PharFileInfo, decompress)
|
||||
{
|
||||
char *error;
|
||||
PHAR_ENTRY_OBJECT();
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Phar - bug #69720 - Null pointer dereference in phar_get_fp_offset()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
// open an existing phar
|
||||
$p = new Phar(__DIR__."/bug69720.phar",0);
|
||||
// Phar extends SPL's DirectoryIterator class
|
||||
echo $p->getMetadata();
|
||||
foreach (new RecursiveIteratorIterator($p) as $file) {
|
||||
// $file is a PharFileInfo class, and inherits from SplFileInfo
|
||||
$temp="";
|
||||
$temp= $file->getFileName() . "\n";
|
||||
$temp.=file_get_contents($file->getPathName()) . "\n"; // display contents
|
||||
var_dump($file->getMetadata());
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo 'Could not open Phar: ', $e;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
MY_METADATA_NULL
|
||||
|
||||
Warning: file_get_contents(phar:///%s): failed to open stream: phar error: "test.php" is not a file in phar "%s.phar" in %s.php on line %d
|
||||
array(1) {
|
||||
["whatever"]=>
|
||||
int(123)
|
||||
}
|
||||
object(DateTime)#2 (3) {
|
||||
["date"]=>
|
||||
string(26) "2000-01-01 00:00:00.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Phar: bug #69958: Segfault in Phar::convertToData on invalid file
|
||||
--XFAIL--
|
||||
Still has memory leaks, see https://bugs.php.net/bug.php?id=70005
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$tarphar = new PharData(__DIR__.'/bug69958.tar');
|
||||
$phar = $tarphar->convertToData(Phar::TAR);
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'BadMethodCallException' with message 'phar "%s/bug69958.tar" exists and must be unlinked prior to conversion' in %s/bug69958.php:%d
|
||||
Stack trace:
|
||||
#0 %s/bug69958.php(%d): PharData->convertToData(%d)
|
||||
#1 {main}
|
||||
thrown in %s/bug69958.php on line %d
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #70019 Files extracted from archive may be placed outside of destination directory
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar") || !extension_loaded('zlib')) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dir = __DIR__."/bug70019";
|
||||
$phar = new PharData(__DIR__."/bug70019.zip");
|
||||
if(!is_dir($dir)) {
|
||||
mkdir($dir);
|
||||
}
|
||||
$phar->extractTo($dir);
|
||||
var_dump(file_exists("$dir/ThisIsATestFile.txt"));
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir = __DIR__."/bug70019";
|
||||
unlink("$dir/ThisIsATestFile.txt");
|
||||
rmdir($dir);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Phar - bug #70433 - Uninitialized pointer in phar_make_dirstream when zip entry filename is "/"
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar") || !extension_loaded("zlib")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$phar = new PharData(__DIR__."/bug70433.zip");
|
||||
var_dump($phar);
|
||||
$meta = $phar->getMetadata();
|
||||
var_dump($meta);
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
object(PharData)#1 (3) {
|
||||
["pathName":"SplFileInfo":private]=>
|
||||
string(0) ""
|
||||
["glob":"DirectoryIterator":private]=>
|
||||
bool(false)
|
||||
["subPathName":"RecursiveDirectoryIterator":private]=>
|
||||
string(0) ""
|
||||
}
|
||||
NULL
|
||||
DONE
|
||||
Executable
BIN
Binary file not shown.
+7
-2
@@ -494,7 +494,12 @@ really_get_entry:
|
||||
(*ret)->is_tar = entry->is_tar;
|
||||
(*ret)->fp = phar_get_efp(entry, 1 TSRMLS_CC);
|
||||
if (entry->link) {
|
||||
(*ret)->zero = phar_get_fp_offset(phar_get_link_source(entry TSRMLS_CC) TSRMLS_CC);
|
||||
phar_entry_info *link = phar_get_link_source(entry TSRMLS_CC);
|
||||
if(!link) {
|
||||
efree(*ret);
|
||||
return FAILURE;
|
||||
}
|
||||
(*ret)->zero = phar_get_fp_offset(link TSRMLS_CC);
|
||||
} else {
|
||||
(*ret)->zero = phar_get_fp_offset(entry TSRMLS_CC);
|
||||
}
|
||||
@@ -1972,7 +1977,7 @@ void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename
|
||||
|
||||
while ((s = zend_memrchr(filename, '/', filename_len))) {
|
||||
filename_len = s - filename;
|
||||
if (FAILURE == zend_hash_add_empty_element(&phar->virtual_dirs, filename, filename_len)) {
|
||||
if (!filename_len || FAILURE == zend_hash_add_empty_element(&phar->virtual_dirs, filename, filename_len)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -396,7 +396,9 @@ foundit:
|
||||
|
||||
if (entry.filename[entry.filename_len - 1] == '/') {
|
||||
entry.is_dir = 1;
|
||||
entry.filename_len--;
|
||||
if(entry.filename_len > 1) {
|
||||
entry.filename_len--;
|
||||
}
|
||||
entry.flags |= PHAR_ENT_PERM_DEF_DIR;
|
||||
} else {
|
||||
entry.is_dir = 0;
|
||||
|
||||
+27
-16
@@ -216,16 +216,18 @@ static char *php_session_encode(int *newlen TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void php_session_decode(const char *val, int vallen TSRMLS_DC) /* {{{ */
|
||||
static int php_session_decode(const char *val, int vallen TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (!PS(serializer)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown session.serialize_handler. Failed to decode session object");
|
||||
return;
|
||||
return FAILURE;
|
||||
}
|
||||
if (PS(serializer)->decode(val, vallen TSRMLS_CC) == FAILURE) {
|
||||
php_session_destroy(TSRMLS_C);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to decode session object. Session has been destroyed");
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -419,7 +421,7 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
|
||||
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ini setting hash_bits_per_character is out of range (should be 4, 5, or 6) - using 4 for now");
|
||||
}
|
||||
|
||||
|
||||
outid = emalloc((size_t)((digest_len + 2) * ((8.0f / PS(hash_bits_per_character)) + 0.5)));
|
||||
j = (int) (bin_to_readable((char *)digest, digest_len, outid, (char)PS(hash_bits_per_character)) - outid);
|
||||
efree(digest);
|
||||
@@ -861,7 +863,10 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
|
||||
|
||||
PHP_VAR_UNSERIALIZE_INIT(var_hash);
|
||||
ALLOC_INIT_ZVAL(session_vars);
|
||||
php_var_unserialize(&session_vars, &val, endptr, &var_hash TSRMLS_CC);
|
||||
if (php_var_unserialize(&session_vars, &val, endptr, &var_hash TSRMLS_CC)) {
|
||||
var_push_dtor(&var_hash, &session_vars);
|
||||
}
|
||||
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
if (PS(http_session_vars)) {
|
||||
zval_ptr_dtor(&PS(http_session_vars));
|
||||
@@ -870,7 +875,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
|
||||
array_init(session_vars);
|
||||
}
|
||||
PS(http_session_vars) = session_vars;
|
||||
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
|
||||
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), Z_REFCOUNT_P(PS(http_session_vars)) + 1, 1);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -946,8 +951,11 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */
|
||||
ALLOC_INIT_ZVAL(current);
|
||||
if (php_var_unserialize(¤t, (const unsigned char **) &p, (const unsigned char *) endptr, &var_hash TSRMLS_CC)) {
|
||||
php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
|
||||
} else {
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
return FAILURE;
|
||||
}
|
||||
zval_ptr_dtor(¤t);
|
||||
var_push_dtor_no_addref(&var_hash, ¤t);
|
||||
}
|
||||
PS_ADD_VARL(name, namelen);
|
||||
efree(name);
|
||||
@@ -1038,8 +1046,13 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */
|
||||
ALLOC_INIT_ZVAL(current);
|
||||
if (php_var_unserialize(¤t, (const unsigned char **) &q, (const unsigned char *) endptr, &var_hash TSRMLS_CC)) {
|
||||
php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
|
||||
} else {
|
||||
var_push_dtor_no_addref(&var_hash, ¤t);
|
||||
efree(name);
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
return FAILURE;
|
||||
}
|
||||
zval_ptr_dtor(¤t);
|
||||
var_push_dtor_no_addref(&var_hash, ¤t);
|
||||
}
|
||||
PS_ADD_VARL(name, namelen);
|
||||
skip:
|
||||
@@ -1863,7 +1876,7 @@ static PHP_FUNCTION(session_set_save_handler)
|
||||
}
|
||||
efree(name);
|
||||
}
|
||||
|
||||
|
||||
if (PS(mod) && PS(mod) != &ps_mod_user) {
|
||||
zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
}
|
||||
@@ -2043,9 +2056,7 @@ static PHP_FUNCTION(session_decode)
|
||||
return;
|
||||
}
|
||||
|
||||
php_session_decode(str, str_len TSRMLS_CC);
|
||||
|
||||
RETURN_TRUE;
|
||||
RETVAL_BOOL(php_session_decode(str, str_len TSRMLS_CC) == SUCCESS);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2660,12 +2671,12 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
|
||||
case MULTIPART_EVENT_FILE_START: {
|
||||
multipart_event_file_start *data = (multipart_event_file_start *) event_data;
|
||||
|
||||
/* Do nothing when $_POST["PHP_SESSION_UPLOAD_PROGRESS"] is not set
|
||||
/* Do nothing when $_POST["PHP_SESSION_UPLOAD_PROGRESS"] is not set
|
||||
* or when we have no session id */
|
||||
if (!Z_TYPE(progress->sid) || !progress->key.c) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* First FILE_START event, initializing data */
|
||||
if (!progress->data) {
|
||||
|
||||
@@ -2715,7 +2726,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
|
||||
add_assoc_zval_ex(progress->current_file, "bytes_processed", sizeof("bytes_processed"), progress->current_file_bytes_processed);
|
||||
|
||||
add_next_index_zval(progress->files, progress->current_file);
|
||||
|
||||
|
||||
Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
|
||||
|
||||
php_session_rfc1867_update(progress, 0 TSRMLS_CC);
|
||||
@@ -2727,7 +2738,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
|
||||
if (!Z_TYPE(progress->sid) || !progress->key.c) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Z_LVAL_P(progress->current_file_bytes_processed) = data->offset + data->length;
|
||||
Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
|
||||
|
||||
@@ -2740,7 +2751,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
|
||||
if (!Z_TYPE(progress->sid) || !progress->key.c) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (data->temp_filename) {
|
||||
add_assoc_string_ex(progress->current_file, "tmp_name", sizeof("tmp_name"), data->temp_filename, 1);
|
||||
}
|
||||
|
||||
@@ -53,563 +53,247 @@ array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
|
||||
Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s/session_decode_error2.php on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 27 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 28 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 29 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 30 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 31 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 32 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 33 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 34 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 35 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 36 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 37 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 38 --
|
||||
bool(true)
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 39 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 40 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 41 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 42 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 43 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 44 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 45 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 46 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 47 --
|
||||
bool(true)
|
||||
array(2) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 48 --
|
||||
bool(true)
|
||||
array(3) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["blah"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 49 --
|
||||
bool(true)
|
||||
array(3) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["blah"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 50 --
|
||||
bool(true)
|
||||
array(3) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["blah"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 51 --
|
||||
bool(true)
|
||||
array(3) {
|
||||
["foo"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["guff"]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
["blah"]=>
|
||||
NULL
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
bool(true)
|
||||
Done
|
||||
|
||||
Warning: session_destroy(): Trying to destroy uninitialized session in %s/session_decode_error2.php on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -49,7 +49,7 @@ array(3) {
|
||||
}
|
||||
|
||||
Warning: session_decode(): Unknown session.serialize_handler. Failed to decode session object in %s on line %d
|
||||
bool(true)
|
||||
bool(false)
|
||||
array(3) {
|
||||
["foo"]=>
|
||||
int(1234567890)
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
Testing xpath() with invalid XML
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = @simplexml_load_string("XXXXXXX^",$x,0x6000000000000001);
|
||||
// gracefully recover from parsing of invalid XML; not available in PHP
|
||||
const XML_PARSE_RECOVER = 1;
|
||||
|
||||
// we're not interested in checking concrete warnings regarding invalid XML
|
||||
$xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER);
|
||||
|
||||
// $xml is supposed to hold a SimpleXMLElement, but not FALSE/NULL
|
||||
var_dump($xml->xpath("BBBB"));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Testing xpath() with invalid XML
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_MAJOR_VERSION != 5) die("skip this test is for PHP 5 only");
|
||||
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = simplexml_load_string("XXXXXXX^",$x,0x6000000000000001);
|
||||
var_dump($xml->xpath("BBBB"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: x in %s on line %d
|
||||
|
||||
Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in %s on line %d
|
||||
|
||||
Warning: simplexml_load_string(): XXXXXXX^ in %s on line %d
|
||||
|
||||
Warning: simplexml_load_string(): ^ in %s on line %d
|
||||
|
||||
Fatal error: Call to a member function xpath() on a non-object in %s on line %d
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Testing xpath() with invalid XML
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_MAJOR_VERSION != 5) die("skip this test is for PHP 5 only");
|
||||
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = simplexml_load_string("XXXXXXX^",$x,0x6000000000000001);
|
||||
var_dump($xml->xpath("BBBB"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: x in %s on line %d
|
||||
|
||||
Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in %s on line %d
|
||||
|
||||
Warning: simplexml_load_string(): XXXXXXX^ in %s on line %d
|
||||
|
||||
Warning: simplexml_load_string(): ^ in %s on line %d
|
||||
bool(false)
|
||||
|
||||
+13
-10
@@ -375,7 +375,7 @@ int make_http_soap_request(zval *this_ptr,
|
||||
int kind = Z_LVAL_PP(tmp) & SOAP_COMPRESSION_DEFLATE;
|
||||
|
||||
if (level > 9) {level = 9;}
|
||||
|
||||
|
||||
if ((Z_LVAL_PP(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) {
|
||||
smart_str_append_const(&soap_headers_z,"Accept-Encoding: gzip, deflate\r\n");
|
||||
}
|
||||
@@ -434,7 +434,7 @@ int make_http_soap_request(zval *this_ptr,
|
||||
context = php_stream_context_from_zval(*tmp, 0);
|
||||
}
|
||||
|
||||
if (context &&
|
||||
if (context &&
|
||||
php_stream_context_get_option(context, "http", "max_redirects", &tmp) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &redirect_max, NULL, 1)) {
|
||||
if (Z_TYPE_PP(tmp) == IS_LONG)
|
||||
@@ -532,7 +532,7 @@ try_again:
|
||||
add_property_resource(this_ptr, "httpurl", ret);
|
||||
/*zend_list_addref(ret);*/
|
||||
|
||||
if (context &&
|
||||
if (context &&
|
||||
php_stream_context_get_option(context, "http", "protocol_version", &tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_DOUBLE &&
|
||||
Z_DVAL_PP(tmp) == 1.0) {
|
||||
@@ -590,7 +590,7 @@ try_again:
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
}
|
||||
} else if (context &&
|
||||
} else if (context &&
|
||||
php_stream_context_get_option(context, "http", "user_agent", &tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if (Z_STRLEN_PP(tmp) > 0) {
|
||||
@@ -732,7 +732,7 @@ try_again:
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)HA2, 32);
|
||||
PHP_MD5Final(hash, &md5ctx);
|
||||
make_digest(response, hash);
|
||||
|
||||
|
||||
smart_str_append_const(&soap_headers, "Authorization: Digest username=\"");
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "realm", sizeof("realm"), (void **)&tmp) == SUCCESS &&
|
||||
@@ -750,7 +750,7 @@ try_again:
|
||||
smart_str_appends(&soap_headers, phpurl->path);
|
||||
} else {
|
||||
smart_str_appendc(&soap_headers, '/');
|
||||
}
|
||||
}
|
||||
if (phpurl->query) {
|
||||
smart_str_appendc(&soap_headers, '?');
|
||||
smart_str_appends(&soap_headers, phpurl->query);
|
||||
@@ -821,18 +821,21 @@ try_again:
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(cookies));
|
||||
smart_str_append_const(&soap_headers, "Cookie: ");
|
||||
for (i = 0; i < n; i++) {
|
||||
ulong numindx;
|
||||
int res = zend_hash_get_current_key(Z_ARRVAL_PP(cookies), &key, &numindx, FALSE);
|
||||
zend_hash_get_current_data(Z_ARRVAL_PP(cookies), (void **)&data);
|
||||
zend_hash_get_current_key(Z_ARRVAL_PP(cookies), &key, NULL, FALSE);
|
||||
|
||||
if (Z_TYPE_PP(data) == IS_ARRAY) {
|
||||
if (res == HASH_KEY_IS_STRING && Z_TYPE_PP(data) == IS_ARRAY) {
|
||||
zval** value;
|
||||
|
||||
if (zend_hash_index_find(Z_ARRVAL_PP(data), 0, (void**)&value) == SUCCESS &&
|
||||
Z_TYPE_PP(value) == IS_STRING) {
|
||||
zval **tmp;
|
||||
if ((zend_hash_index_find(Z_ARRVAL_PP(data), 1, (void**)&tmp) == FAILURE ||
|
||||
Z_TYPE_PP(tmp) != IS_STRING ||
|
||||
strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0) &&
|
||||
(zend_hash_index_find(Z_ARRVAL_PP(data), 2, (void**)&tmp) == FAILURE ||
|
||||
Z_TYPE_PP(tmp) != IS_STRING ||
|
||||
in_domain(phpurl->host,Z_STRVAL_PP(tmp))) &&
|
||||
(use_ssl || zend_hash_index_find(Z_ARRVAL_PP(data), 3, (void**)&tmp) == FAILURE)) {
|
||||
smart_str_appendl(&soap_headers, key, strlen(key));
|
||||
@@ -1059,7 +1062,7 @@ try_again:
|
||||
efree(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!get_http_body(stream, http_close, http_headers, &http_body, &http_body_size TSRMLS_CC)) {
|
||||
if (request != buf) {efree(request);}
|
||||
@@ -1110,7 +1113,7 @@ try_again:
|
||||
strcat(s, new_url->path);
|
||||
efree(new_url->path);
|
||||
new_url->path = s;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
char *s = emalloc(strlen(new_url->path) + 2);
|
||||
s[0] = '/'; s[1] = 0;
|
||||
|
||||
+52
-44
@@ -995,7 +995,7 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht TSRMLS_DC)
|
||||
HashTable *ht2;
|
||||
HashPosition pos1, pos2;
|
||||
HashTable *typemap = NULL;
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(ht, &pos1);
|
||||
while (zend_hash_get_current_data_ex(ht, (void**)&tmp, &pos1) == SUCCESS) {
|
||||
char *type_name = NULL;
|
||||
@@ -1039,7 +1039,7 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
zend_hash_move_forward_ex(ht2, &pos2);
|
||||
}
|
||||
}
|
||||
|
||||
if (type_name) {
|
||||
smart_str nscat = {0};
|
||||
@@ -1069,7 +1069,7 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht TSRMLS_DC)
|
||||
new_enc->to_xml = enc->to_xml;
|
||||
new_enc->to_zval = enc->to_zval;
|
||||
new_enc->details.map = emalloc(sizeof(soapMapping));
|
||||
memset(new_enc->details.map, 0, sizeof(soapMapping));
|
||||
memset(new_enc->details.map, 0, sizeof(soapMapping));
|
||||
if (to_xml) {
|
||||
zval_add_ref(&to_xml);
|
||||
new_enc->details.map->to_xml = to_xml;
|
||||
@@ -1126,7 +1126,7 @@ PHP_METHOD(SoapServer, SoapServer)
|
||||
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
|
||||
}
|
||||
|
||||
|
||||
service = emalloc(sizeof(soapService));
|
||||
memset(service, 0, sizeof(soapService));
|
||||
service->send_errors = 1;
|
||||
@@ -1161,7 +1161,7 @@ PHP_METHOD(SoapServer, SoapServer)
|
||||
if (zend_hash_find(ht, "encoding", sizeof("encoding"), (void**)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
xmlCharEncodingHandlerPtr encoding;
|
||||
|
||||
|
||||
encoding = xmlFindCharEncodingHandler(Z_STRVAL_PP(tmp));
|
||||
if (encoding == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_PP(tmp));
|
||||
@@ -1221,7 +1221,7 @@ PHP_METHOD(SoapServer, SoapServer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (typemap_ht) {
|
||||
service->typemap = soap_create_typemap(service->sdl, typemap_ht TSRMLS_CC);
|
||||
}
|
||||
@@ -1351,7 +1351,7 @@ PHP_METHOD(SoapServer, getFunctions)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FETCH_THIS_SERVICE(service);
|
||||
|
||||
array_init(return_value);
|
||||
@@ -1511,7 +1511,7 @@ PHP_METHOD(SoapServer, handle)
|
||||
|
||||
FETCH_THIS_SERVICE(service);
|
||||
SOAP_GLOBAL(soap_version) = service->version;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1936,7 +1936,7 @@ PHP_METHOD(SoapServer, handle)
|
||||
|
||||
if (size == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Dump memory failed");
|
||||
}
|
||||
}
|
||||
|
||||
if (soap_version == SOAP_1_2) {
|
||||
sapi_add_header("Content-Type: application/soap+xml; charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 1);
|
||||
@@ -2152,10 +2152,10 @@ static void soap_error_handler(int error_num, const char *error_filename, const
|
||||
use_exceptions = 1;
|
||||
}
|
||||
|
||||
if ((error_num == E_USER_ERROR ||
|
||||
error_num == E_COMPILE_ERROR ||
|
||||
if ((error_num == E_USER_ERROR ||
|
||||
error_num == E_COMPILE_ERROR ||
|
||||
error_num == E_CORE_ERROR ||
|
||||
error_num == E_ERROR ||
|
||||
error_num == E_ERROR ||
|
||||
error_num == E_PARSE) &&
|
||||
use_exceptions) {
|
||||
zval *fault, *exception;
|
||||
@@ -2224,10 +2224,10 @@ static void soap_error_handler(int error_num, const char *error_filename, const
|
||||
va_list argcopy;
|
||||
#endif
|
||||
|
||||
if (error_num == E_USER_ERROR ||
|
||||
error_num == E_COMPILE_ERROR ||
|
||||
if (error_num == E_USER_ERROR ||
|
||||
error_num == E_COMPILE_ERROR ||
|
||||
error_num == E_CORE_ERROR ||
|
||||
error_num == E_ERROR ||
|
||||
error_num == E_ERROR ||
|
||||
error_num == E_PARSE) {
|
||||
|
||||
char* code = SOAP_GLOBAL(error_code);
|
||||
@@ -2457,13 +2457,13 @@ PHP_METHOD(SoapClient, SoapClient)
|
||||
if (zend_hash_find(ht, "encoding", sizeof("encoding"), (void**)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
xmlCharEncodingHandlerPtr encoding;
|
||||
|
||||
|
||||
encoding = xmlFindCharEncodingHandler(Z_STRVAL_PP(tmp));
|
||||
if (encoding == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_PP(tmp));
|
||||
} else {
|
||||
xmlCharEncCloseFunc(encoding);
|
||||
add_property_stringl(this_ptr, "_encoding", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
||||
add_property_stringl(this_ptr, "_encoding", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
||||
}
|
||||
}
|
||||
if (zend_hash_find(ht, "classmap", sizeof("classmap"), (void**)&tmp) == SUCCESS &&
|
||||
@@ -2498,7 +2498,7 @@ PHP_METHOD(SoapClient, SoapClient)
|
||||
if (context) {
|
||||
add_property_resource(this_ptr, "_stream_context", context->rsrc_id);
|
||||
}
|
||||
|
||||
|
||||
if (zend_hash_find(ht, "cache_wsdl", sizeof("cache_wsdl"), (void**)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
cache_wsdl = Z_LVAL_PP(tmp);
|
||||
@@ -2508,7 +2508,7 @@ PHP_METHOD(SoapClient, SoapClient)
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
||||
}
|
||||
|
||||
|
||||
if (zend_hash_find(ht, "keep_alive", sizeof("keep_alive"), (void**)&tmp) == SUCCESS &&
|
||||
(Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) && Z_LVAL_PP(tmp) == 0) {
|
||||
add_property_long(this_ptr, "_keep_alive", 0);
|
||||
@@ -2616,7 +2616,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
|
||||
xmlFree(buf);
|
||||
if (ret && zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2922,8 +2922,10 @@ PHP_METHOD(SoapClient, __call)
|
||||
}
|
||||
zend_hash_internal_pointer_reset(default_headers);
|
||||
while (zend_hash_get_current_data(default_headers, (void**)&tmp) == SUCCESS) {
|
||||
Z_ADDREF_PP(tmp);
|
||||
zend_hash_next_index_insert(soap_headers, tmp, sizeof(zval *), NULL);
|
||||
if(Z_TYPE_PP(tmp) == IS_OBJECT) {
|
||||
Z_ADDREF_PP(tmp);
|
||||
zend_hash_next_index_insert(soap_headers, tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
zend_hash_move_forward(default_headers);
|
||||
}
|
||||
} else {
|
||||
@@ -2931,7 +2933,7 @@ PHP_METHOD(SoapClient, __call)
|
||||
free_soap_headers = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
arg_count = zend_hash_num_elements(Z_ARRVAL_P(args));
|
||||
|
||||
if (arg_count > 0) {
|
||||
@@ -2997,7 +2999,7 @@ PHP_METHOD(SoapClient, __getTypes)
|
||||
HashPosition pos;
|
||||
|
||||
FETCH_THIS_SDL(sdl);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3026,7 +3028,7 @@ PHP_METHOD(SoapClient, __getTypes)
|
||||
PHP_METHOD(SoapClient, __getLastRequest)
|
||||
{
|
||||
zval **tmp;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3049,7 +3051,7 @@ PHP_METHOD(SoapClient, __getLastResponse)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
||||
@@ -3064,11 +3066,11 @@ PHP_METHOD(SoapClient, __getLastResponse)
|
||||
PHP_METHOD(SoapClient, __getLastRequestHeaders)
|
||||
{
|
||||
zval **tmp;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request_headers", sizeof("__last_request_headers"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
||||
@@ -3083,7 +3085,7 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
|
||||
PHP_METHOD(SoapClient, __getLastResponseHeaders)
|
||||
{
|
||||
zval **tmp;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3228,10 +3230,10 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
|
||||
|
||||
|
||||
/* {{{ proto string SoapClient::__setLocation([string new_location])
|
||||
Sets the location option (the endpoint URL that will be touched by the
|
||||
Sets the location option (the endpoint URL that will be touched by the
|
||||
following SOAP requests).
|
||||
If new_location is not specified or null then SoapClient will use endpoint
|
||||
from WSDL file.
|
||||
from WSDL file.
|
||||
The function returns old value of location options. */
|
||||
PHP_METHOD(SoapClient, __setLocation)
|
||||
{
|
||||
@@ -3280,10 +3282,10 @@ static void set_soap_fault(zval *obj, char *fault_code_ns, char *fault_code, cha
|
||||
if (Z_TYPE_P(obj) != IS_OBJECT) {
|
||||
object_init_ex(obj, soap_fault_class_entry);
|
||||
}
|
||||
|
||||
|
||||
add_property_string(obj, "faultstring", fault_string ? fault_string : "", 1);
|
||||
zend_update_property_string(zend_exception_get_default(TSRMLS_C), obj, "message", sizeof("message")-1, (fault_string ? fault_string : "") TSRMLS_CC);
|
||||
|
||||
|
||||
if (fault_code != NULL) {
|
||||
int soap_version = SOAP_GLOBAL(soap_version);
|
||||
|
||||
@@ -3708,7 +3710,7 @@ ignore_header:
|
||||
func = func->children;
|
||||
}
|
||||
deserialize_parameters(func, function, num_params, parameters TSRMLS_CC);
|
||||
|
||||
|
||||
encode_finish();
|
||||
|
||||
return function;
|
||||
@@ -3990,8 +3992,8 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
}
|
||||
|
||||
if (fault_ns == NULL &&
|
||||
fault &&
|
||||
fault->details &&
|
||||
fault &&
|
||||
fault->details &&
|
||||
zend_hash_num_elements(fault->details) == 1) {
|
||||
sdlParamPtr sparam;
|
||||
|
||||
@@ -4015,7 +4017,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
xmlChar *code = xmlBuildQName(BAD_CAST(str), nsptr->prefix, NULL, 0);
|
||||
xmlNodeSetContent(node, code);
|
||||
xmlFree(code);
|
||||
} else {
|
||||
} else {
|
||||
xmlNodeSetContentLen(node, BAD_CAST(str), (int)new_len);
|
||||
}
|
||||
efree(str);
|
||||
@@ -4041,7 +4043,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
xmlChar *code = xmlBuildQName(BAD_CAST(str), nsptr->prefix, NULL, 0);
|
||||
xmlNodeSetContent(node, code);
|
||||
xmlFree(code);
|
||||
} else {
|
||||
} else {
|
||||
xmlNodeSetContentLen(node, BAD_CAST(str), (int)new_len);
|
||||
}
|
||||
efree(str);
|
||||
@@ -4213,7 +4215,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
|
||||
encode_finish();
|
||||
|
||||
if (function && function->responseName == NULL &&
|
||||
if (function && function->responseName == NULL &&
|
||||
body->children == NULL && head == NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
return NULL;
|
||||
@@ -4347,11 +4349,18 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
|
||||
if (head) {
|
||||
zval** header;
|
||||
|
||||
zend_hash_internal_pointer_reset(soap_headers);
|
||||
while (zend_hash_get_current_data(soap_headers,(void**)&header) == SUCCESS) {
|
||||
HashTable *ht = Z_OBJPROP_PP(header);
|
||||
for(zend_hash_internal_pointer_reset(soap_headers);
|
||||
zend_hash_get_current_data(soap_headers,(void**)&header) == SUCCESS;
|
||||
zend_hash_move_forward(soap_headers)
|
||||
) {
|
||||
HashTable *ht;
|
||||
zval **name, **ns, **tmp;
|
||||
|
||||
if (Z_TYPE_PP(header) != IS_OBJECT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ht = Z_OBJPROP_PP(header);
|
||||
if (zend_hash_find(ht, "name", sizeof("name"), (void**)&name) == SUCCESS &&
|
||||
Z_TYPE_PP(name) == IS_STRING &&
|
||||
zend_hash_find(ht, "namespace", sizeof("namespace"), (void**)&ns) == SUCCESS &&
|
||||
@@ -4390,7 +4399,6 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
|
||||
xmlSetNs(h, nsptr);
|
||||
set_soap_header_attributes(h, ht, version);
|
||||
}
|
||||
zend_hash_move_forward(soap_headers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4501,7 +4509,7 @@ static sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int inde
|
||||
return *tmp;
|
||||
} else {
|
||||
HashPosition pos;
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(ht, &pos);
|
||||
while (zend_hash_get_current_data_ex(ht, (void **)&tmp, &pos) != FAILURE) {
|
||||
if ((*tmp)->paramName && strcmp(param_name, (*tmp)->paramName) == 0) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #70388 (SOAP serialize_function_call() type confusion / RCE)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dummy = unserialize('O:10:"SoapClient":3:{s:3:"uri";s:1:"X";s:8:"location";s:22:"http://localhost/a.xml";s:17:"__default_headers";a:1:{i:1;s:1337:"'.str_repeat("X", 1337).'";}}');
|
||||
try {
|
||||
var_dump($dummy->notexisting());
|
||||
} catch(Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
var_dump(get_class($e));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
string(9) "SoapFault"
|
||||
@@ -910,8 +910,8 @@ static void from_zval_write_control(const zval *arr,
|
||||
if (space_left < req_space) {
|
||||
*control_buf = safe_erealloc(*control_buf, 2, req_space, *control_len);
|
||||
*control_len += 2 * req_space;
|
||||
memset(*control_buf, '\0', *control_len - *offset);
|
||||
memcpy(&alloc->data, *control_buf, sizeof *control_buf);
|
||||
memset((char *)*control_buf + *offset, '\0', *control_len - *offset);
|
||||
memcpy(&alloc->data, control_buf, sizeof *control_buf);
|
||||
}
|
||||
|
||||
cmsghdr = (struct cmsghdr*)(((char*)*control_buf) + *offset);
|
||||
|
||||
+9
-2
@@ -1762,13 +1762,12 @@ SPL_METHOD(Array, unserialize)
|
||||
|
||||
ALLOC_INIT_ZVAL(pflags);
|
||||
if (!php_var_unserialize(&pflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pflags) != IS_LONG) {
|
||||
zval_ptr_dtor(&pflags);
|
||||
goto outexcept;
|
||||
}
|
||||
|
||||
var_push_dtor(&var_hash, &pflags);
|
||||
--p; /* for ';' */
|
||||
flags = Z_LVAL_P(pflags);
|
||||
zval_ptr_dtor(&pflags);
|
||||
/* flags needs to be verified and we also need to verify whether the next
|
||||
* thing we get is ';'. After that we require an 'm' or somethign else
|
||||
* where 'm' stands for members and anything else should be an array. If
|
||||
@@ -1790,6 +1789,7 @@ SPL_METHOD(Array, unserialize)
|
||||
if (!php_var_unserialize(&intern->array, &p, s + buf_len, &var_hash TSRMLS_CC)) {
|
||||
goto outexcept;
|
||||
}
|
||||
var_push_dtor(&var_hash, &intern->array);
|
||||
}
|
||||
if (*p != ';') {
|
||||
goto outexcept;
|
||||
@@ -1808,6 +1808,7 @@ SPL_METHOD(Array, unserialize)
|
||||
goto outexcept;
|
||||
}
|
||||
|
||||
var_push_dtor(&var_hash, &pmembers);
|
||||
/* copy members */
|
||||
if (!intern->std.properties) {
|
||||
rebuild_object_properties(&intern->std);
|
||||
@@ -1818,10 +1819,16 @@ SPL_METHOD(Array, unserialize)
|
||||
/* done reading $serialized */
|
||||
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
if (pflags) {
|
||||
zval_ptr_dtor(&pflags);
|
||||
}
|
||||
return;
|
||||
|
||||
outexcept:
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
if (pflags) {
|
||||
zval_ptr_dtor(&pflags);
|
||||
}
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %ld of %d bytes", (long)((char*)p - buf), buf_len);
|
||||
return;
|
||||
|
||||
|
||||
@@ -2068,7 +2068,7 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS
|
||||
|
||||
if (intern->u.file.max_line_len > 0) {
|
||||
buf = safe_emalloc((intern->u.file.max_line_len + 1), sizeof(char), 0);
|
||||
if (php_stream_get_line(intern->u.file.stream, buf, intern->u.file.max_line_len, &line_len) == NULL) {
|
||||
if (php_stream_get_line(intern->u.file.stream, buf, intern->u.file.max_line_len + 1, &line_len) == NULL) {
|
||||
efree(buf);
|
||||
buf = NULL;
|
||||
} else {
|
||||
|
||||
+14
-12
@@ -500,7 +500,7 @@ static int spl_dllist_object_count_elements(zval *object, long *count TSRMLS_DC)
|
||||
|
||||
*count = spl_ptr_llist_count(intern->llist);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{{ */
|
||||
@@ -571,7 +571,7 @@ SPL_METHOD(SplDoublyLinkedList, push)
|
||||
spl_ptr_llist_push(intern->llist, value TSRMLS_CC);
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool SplDoublyLinkedList::unshift(mixed $value) U
|
||||
@@ -614,7 +614,7 @@ SPL_METHOD(SplDoublyLinkedList, pop)
|
||||
}
|
||||
|
||||
RETURN_ZVAL(value, 1, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto mixed SplDoublyLinkedList::shift() U
|
||||
@@ -637,7 +637,7 @@ SPL_METHOD(SplDoublyLinkedList, shift)
|
||||
}
|
||||
|
||||
RETURN_ZVAL(value, 1, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto mixed SplDoublyLinkedList::top() U
|
||||
@@ -1050,7 +1050,7 @@ static void spl_dllist_it_move_forward(zend_object_iterator *iter TSRMLS_DC) /*
|
||||
SPL_METHOD(SplDoublyLinkedList, key)
|
||||
{
|
||||
spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1064,7 +1064,7 @@ SPL_METHOD(SplDoublyLinkedList, key)
|
||||
SPL_METHOD(SplDoublyLinkedList, prev)
|
||||
{
|
||||
spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ SPL_METHOD(SplDoublyLinkedList, prev)
|
||||
SPL_METHOD(SplDoublyLinkedList, next)
|
||||
{
|
||||
spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ SPL_METHOD(SplDoublyLinkedList, next)
|
||||
SPL_METHOD(SplDoublyLinkedList, valid)
|
||||
{
|
||||
spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1106,7 +1106,7 @@ SPL_METHOD(SplDoublyLinkedList, valid)
|
||||
SPL_METHOD(SplDoublyLinkedList, rewind)
|
||||
{
|
||||
spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1121,7 +1121,7 @@ SPL_METHOD(SplDoublyLinkedList, current)
|
||||
{
|
||||
spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
spl_ptr_llist_element *element = intern->traverse_pointer;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1176,7 +1176,7 @@ SPL_METHOD(SplDoublyLinkedList, serialize)
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void SplDoublyLinkedList::unserialize(string serialized)
|
||||
@@ -1189,7 +1189,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
|
||||
int buf_len;
|
||||
const unsigned char *p, *s;
|
||||
php_unserialize_data_t var_hash;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1208,6 +1208,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
|
||||
zval_ptr_dtor(&flags);
|
||||
goto error;
|
||||
}
|
||||
var_push_dtor(&var_hash, &flags);
|
||||
intern->flags = Z_LVAL_P(flags);
|
||||
zval_ptr_dtor(&flags);
|
||||
|
||||
@@ -1219,6 +1220,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
|
||||
zval_ptr_dtor(&elem);
|
||||
goto error;
|
||||
}
|
||||
var_push_dtor(&var_hash, &elem);
|
||||
|
||||
spl_ptr_llist_push(intern->llist, elem TSRMLS_CC);
|
||||
}
|
||||
|
||||
+2
-1
@@ -249,9 +249,10 @@ static void spl_ptr_heap_insert(spl_ptr_heap *heap, spl_ptr_heap_element elem, v
|
||||
heap->ctor(elem TSRMLS_CC);
|
||||
|
||||
/* sifting up */
|
||||
for(i = heap->count++; i > 0 && heap->cmp(heap->elements[(i-1)/2], elem, cmp_userdata TSRMLS_CC) < 0; i = (i-1)/2) {
|
||||
for(i = heap->count; i > 0 && heap->cmp(heap->elements[(i-1)/2], elem, cmp_userdata TSRMLS_CC) < 0; i = (i-1)/2) {
|
||||
heap->elements[i] = heap->elements[(i-1)/2];
|
||||
}
|
||||
heap->count++;
|
||||
|
||||
if (EG(exception)) {
|
||||
/* exception thrown during comparison */
|
||||
|
||||
+36
-32
@@ -101,9 +101,9 @@ void spl_SplOjectStorage_free_storage(void *object TSRMLS_DC) /* {{{ */
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage *)object;
|
||||
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
|
||||
|
||||
zend_hash_destroy(&intern->storage);
|
||||
|
||||
|
||||
if (intern->debug_info != NULL) {
|
||||
zend_hash_destroy(intern->debug_info);
|
||||
efree(intern->debug_info);
|
||||
@@ -202,7 +202,7 @@ spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern
|
||||
void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *obj, zval *inf TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
spl_SplObjectStorageElement *pelement, element;
|
||||
|
||||
|
||||
int hash_len;
|
||||
char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC);
|
||||
if (!hash) {
|
||||
@@ -238,7 +238,7 @@ int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, zval *ob
|
||||
}
|
||||
ret = zend_hash_del(&intern->storage, hash, hash_len);
|
||||
spl_object_storage_free_hash(intern, hash);
|
||||
|
||||
|
||||
return ret;
|
||||
} /* }}}*/
|
||||
|
||||
@@ -481,7 +481,7 @@ SPL_METHOD(SplObjectStorage, getHash)
|
||||
|
||||
hash = emalloc(33);
|
||||
php_spl_object_hash(obj, hash TSRMLS_CC);
|
||||
|
||||
|
||||
RETVAL_STRING(hash, 0);
|
||||
|
||||
} /* }}} */
|
||||
@@ -610,11 +610,11 @@ SPL_METHOD(SplObjectStorage, contains)
|
||||
SPL_METHOD(SplObjectStorage, count)
|
||||
{
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RETURN_LONG(zend_hash_num_elements(&intern->storage));
|
||||
} /* }}} */
|
||||
|
||||
@@ -623,11 +623,11 @@ SPL_METHOD(SplObjectStorage, count)
|
||||
SPL_METHOD(SplObjectStorage, rewind)
|
||||
{
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
|
||||
intern->index = 0;
|
||||
} /* }}} */
|
||||
@@ -637,11 +637,11 @@ SPL_METHOD(SplObjectStorage, rewind)
|
||||
SPL_METHOD(SplObjectStorage, valid)
|
||||
{
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RETURN_BOOL(zend_hash_has_more_elements_ex(&intern->storage, &intern->pos) == SUCCESS);
|
||||
} /* }}} */
|
||||
|
||||
@@ -650,11 +650,11 @@ SPL_METHOD(SplObjectStorage, valid)
|
||||
SPL_METHOD(SplObjectStorage, key)
|
||||
{
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RETURN_LONG(intern->index);
|
||||
} /* }}} */
|
||||
|
||||
@@ -664,11 +664,11 @@ SPL_METHOD(SplObjectStorage, current)
|
||||
{
|
||||
spl_SplObjectStorageElement *element;
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (zend_hash_get_current_data_ex(&intern->storage, (void**)&element, &intern->pos) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ SPL_METHOD(SplObjectStorage, getInfo)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (zend_hash_get_current_data_ex(&intern->storage, (void**)&element, &intern->pos) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -699,7 +699,7 @@ SPL_METHOD(SplObjectStorage, setInfo)
|
||||
spl_SplObjectStorageElement *element;
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
zval *inf;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &inf) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -717,11 +717,11 @@ SPL_METHOD(SplObjectStorage, setInfo)
|
||||
SPL_METHOD(SplObjectStorage, next)
|
||||
{
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
|
||||
intern->index++;
|
||||
} /* }}} */
|
||||
@@ -743,7 +743,7 @@ SPL_METHOD(SplObjectStorage, serialize)
|
||||
}
|
||||
|
||||
PHP_VAR_SERIALIZE_INIT(var_hash);
|
||||
|
||||
|
||||
/* storage */
|
||||
smart_str_appendl(&buf, "x:", 2);
|
||||
MAKE_STD_ZVAL(flags);
|
||||
@@ -783,7 +783,7 @@ SPL_METHOD(SplObjectStorage, serialize)
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void SplObjectStorage::unserialize(string serialized)
|
||||
@@ -798,7 +798,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
|
||||
php_unserialize_data_t var_hash;
|
||||
zval *pentry, *pmembers, *pcount = NULL, *pinf;
|
||||
long count;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -822,14 +822,15 @@ SPL_METHOD(SplObjectStorage, unserialize)
|
||||
goto outexcept;
|
||||
}
|
||||
|
||||
var_push_dtor(&var_hash, &pcount);
|
||||
--p; /* for ';' */
|
||||
count = Z_LVAL_P(pcount);
|
||||
|
||||
|
||||
while(count-- > 0) {
|
||||
spl_SplObjectStorageElement *pelement;
|
||||
char *hash;
|
||||
int hash_len;
|
||||
|
||||
|
||||
if (*p != ';') {
|
||||
goto outexcept;
|
||||
}
|
||||
@@ -842,6 +843,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
|
||||
zval_ptr_dtor(&pentry);
|
||||
goto outexcept;
|
||||
}
|
||||
var_push_dtor(&var_hash, &pentry);
|
||||
if(Z_TYPE_P(pentry) != IS_OBJECT) {
|
||||
zval_ptr_dtor(&pentry);
|
||||
goto outexcept;
|
||||
@@ -853,6 +855,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
|
||||
zval_ptr_dtor(&pinf);
|
||||
goto outexcept;
|
||||
}
|
||||
var_push_dtor(&var_hash, &pinf);
|
||||
}
|
||||
|
||||
hash = spl_object_storage_get_hash(intern, getThis(), pentry, &hash_len TSRMLS_CC);
|
||||
@@ -870,7 +873,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
|
||||
if(pelement->obj) {
|
||||
var_push_dtor(&var_hash, &pelement->obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
spl_object_storage_attach(intern, getThis(), pentry, pinf TSRMLS_CC);
|
||||
zval_ptr_dtor(&pentry);
|
||||
zval_ptr_dtor(&pinf);
|
||||
@@ -893,6 +896,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
|
||||
goto outexcept;
|
||||
}
|
||||
|
||||
var_push_dtor(&var_hash, &pmembers);
|
||||
/* copy members */
|
||||
if (!intern->std.properties) {
|
||||
rebuild_object_properties(&intern->std);
|
||||
@@ -1010,7 +1014,7 @@ SPL_METHOD(MultipleIterator, __construct)
|
||||
SPL_METHOD(MultipleIterator, getFlags)
|
||||
{
|
||||
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1077,7 +1081,7 @@ SPL_METHOD(MultipleIterator, rewind)
|
||||
zval *it;
|
||||
|
||||
intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1100,7 +1104,7 @@ SPL_METHOD(MultipleIterator, next)
|
||||
zval *it;
|
||||
|
||||
intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1124,7 +1128,7 @@ SPL_METHOD(MultipleIterator, valid)
|
||||
long expect, valid;
|
||||
|
||||
intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1170,7 +1174,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
|
||||
}
|
||||
|
||||
array_init_size(return_value, num_elements);
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
|
||||
while (zend_hash_get_current_data_ex(&intern->storage, (void**)&element, &intern->pos) == SUCCESS && !EG(exception)) {
|
||||
it = element->obj;
|
||||
@@ -1232,7 +1236,7 @@ SPL_METHOD(MultipleIterator, current)
|
||||
{
|
||||
spl_SplObjectStorage *intern;
|
||||
intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1247,7 +1251,7 @@ SPL_METHOD(MultipleIterator, key)
|
||||
{
|
||||
spl_SplObjectStorage *intern;
|
||||
intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #67805 SplFileObject setMaxLineLength
|
||||
--CREDITS--
|
||||
Willian Gustavo Veiga <contact@willianveiga.com>
|
||||
--FILE--
|
||||
<?php
|
||||
$splFileObject = new SplFileObject(__FILE__);
|
||||
$splFileObject->setMaxLineLen(3);
|
||||
$line = $splFileObject->getCurrentLine();
|
||||
var_dump($line === '<?p');
|
||||
var_dump(strlen($line) === 3);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #69737 (Segfault when SplMinHeap::compare produces fatal error)
|
||||
--FILE--
|
||||
<?php
|
||||
class SplMinHeap1 extends SplMinHeap {
|
||||
public function compare($a, $b) {
|
||||
return -parent::notexist($a, $b);
|
||||
}
|
||||
}
|
||||
$h = new SplMinHeap1();
|
||||
$h->insert(1);
|
||||
$h->insert(6);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Fatal error: Call to undefined method SplMinHeap::notexist() in %s/bug69737.php on line %d
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
|
||||
--FILE--
|
||||
<?php
|
||||
$a = unserialize('a:3:{i:0;C:11:"ArrayObject":20:{x:i:0;r:3;;m:a:0:{};}i:1;d:11;i:2;S:31:"AAAAAAAABBBBCCCC\01\00\00\00\04\00\00\00\00\00\00\00\00\00\00";}');
|
||||
?>
|
||||
OK
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
SPL: Bug #70155 Use After Free Vulnerability in unserialize() with SPLArrayObject
|
||||
--FILE--
|
||||
<?php
|
||||
$inner = 'x:i:0;O:12:"DateInterval":1:{s:1:"y";i:3;};m:a:1:{i:0;R:2;}';
|
||||
$exploit = 'C:11:"ArrayObject":'.strlen($inner).':{'.$inner.'}';
|
||||
$data = unserialize($exploit);
|
||||
|
||||
var_dump($data);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(ArrayObject)#1 (2) {
|
||||
[0]=>
|
||||
int(0)
|
||||
["storage":"ArrayObject":private]=>
|
||||
object(DateInterval)#2 (15) {
|
||||
["y"]=>
|
||||
int(3)
|
||||
["m"]=>
|
||||
int(-1)
|
||||
["d"]=>
|
||||
int(-1)
|
||||
["h"]=>
|
||||
int(-1)
|
||||
["i"]=>
|
||||
int(-1)
|
||||
["s"]=>
|
||||
int(-1)
|
||||
["weekday"]=>
|
||||
int(-1)
|
||||
["weekday_behavior"]=>
|
||||
int(-1)
|
||||
["first_last_day_of"]=>
|
||||
int(-1)
|
||||
["invert"]=>
|
||||
int(0)
|
||||
["days"]=>
|
||||
int(-1)
|
||||
["special_type"]=>
|
||||
int(0)
|
||||
["special_amount"]=>
|
||||
int(-1)
|
||||
["have_weekday_relative"]=>
|
||||
int(0)
|
||||
["have_special_relative"]=>
|
||||
int(0)
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
SPL: Bug #70166 Use After Free Vulnerability in unserialize() with SPLArrayObject
|
||||
--FILE--
|
||||
<?php
|
||||
$inner = 'x:i:1;a:0:{};m:a:0:{}';
|
||||
$exploit = 'a:2:{i:0;C:11:"ArrayObject":'.strlen($inner).':{'.$inner.'}i:1;R:5;}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
for($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = 'hi'.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(ArrayObject)#%d (1) {
|
||||
["storage":"ArrayObject":private]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
SPL: Bug #70168 Use After Free Vulnerability in unserialize() with SplObjectStorage
|
||||
--FILE--
|
||||
<?php
|
||||
$inner = 'x:i:1;O:8:"stdClass":0:{};m:a:0:{}';
|
||||
$exploit = 'a:2:{i:0;C:16:"SplObjectStorage":'.strlen($inner).':{'.$inner.'}i:1;R:3;}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
for($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = 'hi'.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(SplObjectStorage)#%d (1) {
|
||||
["storage":"SplObjectStorage":private]=>
|
||||
array(1) {
|
||||
["%s"]=>
|
||||
array(2) {
|
||||
["obj"]=>
|
||||
object(stdClass)#2 (0) {
|
||||
}
|
||||
["inf"]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
int(1)
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
SPL: Bug #70169 Use After Free Vulnerability in unserialize() with SplDoublyLinkedList
|
||||
--FILE--
|
||||
<?php
|
||||
$inner = 'i:1;';
|
||||
$exploit = 'a:2:{i:0;C:19:"SplDoublyLinkedList":'.strlen($inner).':{'.$inner.'}i:1;R:3;}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
for($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = 'hi'.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(SplDoublyLinkedList)#%d (2) {
|
||||
["flags":"SplDoublyLinkedList":private]=>
|
||||
int(1)
|
||||
["dllist":"SplDoublyLinkedList":private]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
int(1)
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
SPL: Bug #70365 use-after-free vulnerability in unserialize() with SplObjectStorage
|
||||
--FILE--
|
||||
<?php
|
||||
class obj {
|
||||
var $ryat;
|
||||
function __wakeup() {
|
||||
$this->ryat = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$fakezval = ptr2str(1122334455);
|
||||
$fakezval .= ptr2str(0);
|
||||
$fakezval .= "\x00\x00\x00\x00";
|
||||
$fakezval .= "\x01";
|
||||
$fakezval .= "\x00";
|
||||
$fakezval .= "\x00\x00";
|
||||
|
||||
$inner = 'x:i:1;O:8:"stdClass":0:{},i:1;;m:a:0:{}';
|
||||
$exploit = 'a:5:{i:0;i:1;i:1;C:16:"SplObjectStorage":'.strlen($inner).':{'.$inner.'}i:2;O:3:"obj":1:{s:4:"ryat";R:3;}i:3;R:6;i:4;s:'.strlen($fakezval).':"'.$fakezval.'";}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
var_dump($data);
|
||||
|
||||
function ptr2str($ptr)
|
||||
{
|
||||
$out = '';
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$out .= chr($ptr & 0xff);
|
||||
$ptr >>= 8;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
&int(1)
|
||||
[2]=>
|
||||
object(obj)#%d (1) {
|
||||
["ryat"]=>
|
||||
&int(1)
|
||||
}
|
||||
[3]=>
|
||||
int(1)
|
||||
[4]=>
|
||||
string(24) "%s"
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
SPL: Bug #70366 use-after-free vulnerability in unserialize() with SplDoublyLinkedList
|
||||
--FILE--
|
||||
<?php
|
||||
class obj {
|
||||
var $ryat;
|
||||
function __wakeup() {
|
||||
$this->ryat = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$fakezval = ptr2str(1122334455);
|
||||
$fakezval .= ptr2str(0);
|
||||
$fakezval .= "\x00\x00\x00\x00";
|
||||
$fakezval .= "\x01";
|
||||
$fakezval .= "\x00";
|
||||
$fakezval .= "\x00\x00";
|
||||
|
||||
$inner = 'i:1234;:i:1;';
|
||||
$exploit = 'a:5:{i:0;i:1;i:1;C:19:"SplDoublyLinkedList":'.strlen($inner).':{'.$inner.'}i:2;O:3:"obj":1:{s:4:"ryat";R:3;}i:3;a:1:{i:0;R:5;}i:4;s:'.strlen($fakezval).':"'.$fakezval.'";}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
var_dump($data);
|
||||
|
||||
function ptr2str($ptr)
|
||||
{
|
||||
$out = '';
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$out .= chr($ptr & 0xff);
|
||||
$ptr >>= 8;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
&int(1)
|
||||
[2]=>
|
||||
object(obj)#%d (1) {
|
||||
["ryat"]=>
|
||||
&int(1)
|
||||
}
|
||||
[3]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
[4]=>
|
||||
string(24) "%s"
|
||||
}
|
||||
@@ -12,4 +12,4 @@ $s->setMaxLineLen( 3);
|
||||
echo $s->getCurrentLine();
|
||||
?>
|
||||
--EXPECT--
|
||||
<?
|
||||
<?p
|
||||
+4414
-1919
File diff suppressed because it is too large.
Load diff
+407
-291
File diff suppressed because it is too large.
Load diff
+11
-1
@@ -281,9 +281,10 @@ PHPAPI char *php_escape_shell_cmd(char *str)
|
||||
break;
|
||||
#else
|
||||
/* % is Windows specific for enviromental variables, ^%PATH% will
|
||||
output PATH whil ^%PATH^% not. escapeshellcmd will escape all %.
|
||||
output PATH while ^%PATH^% will not. escapeshellcmd will escape all % and !.
|
||||
*/
|
||||
case '%':
|
||||
case '!':
|
||||
case '"':
|
||||
case '\'':
|
||||
#endif
|
||||
@@ -366,6 +367,7 @@ PHPAPI char *php_escape_shell_arg(char *str)
|
||||
#ifdef PHP_WIN32
|
||||
case '"':
|
||||
case '%':
|
||||
case '!':
|
||||
cmd[y++] = ' ';
|
||||
break;
|
||||
#else
|
||||
@@ -380,6 +382,14 @@ PHPAPI char *php_escape_shell_arg(char *str)
|
||||
}
|
||||
}
|
||||
#ifdef PHP_WIN32
|
||||
if (y > 0 && '\\' == cmd[y - 1]) {
|
||||
int k = 0, n = y - 1;
|
||||
for (; n >= 0 && '\\' == cmd[n]; n--, k++);
|
||||
if (k % 2) {
|
||||
cmd[y++] = '\\';
|
||||
}
|
||||
}
|
||||
|
||||
cmd[y++] = '"';
|
||||
#else
|
||||
cmd[y++] = '\'';
|
||||
|
||||
+225
-19
@@ -320,6 +320,17 @@ char* php_get_windows_name()
|
||||
}
|
||||
|
||||
if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) {
|
||||
|
||||
if (osvi.dwMajorVersion == 10) {
|
||||
if( osvi.dwMinorVersion == 0 ) {
|
||||
if( osvi.wProductType == VER_NT_WORKSTATION ) {
|
||||
major = "Windows 10";
|
||||
} else {
|
||||
major = "Windows Server 2016";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (osvi.dwMajorVersion == 6) {
|
||||
if( osvi.dwMinorVersion == 0 ) {
|
||||
if( osvi.wProductType == VER_NT_WORKSTATION ) {
|
||||
@@ -366,6 +377,12 @@ char* php_get_windows_name()
|
||||
major = "Windows Server 2012";
|
||||
}
|
||||
}
|
||||
} else if (osvi.dwMinorVersion == 3) {
|
||||
if( osvi.wProductType == VER_NT_WORKSTATION ) {
|
||||
major = "Windows 8.1";
|
||||
} else {
|
||||
major = "Windows Server 2012 R2";
|
||||
}
|
||||
} else {
|
||||
major = "Unknown Windows version";
|
||||
}
|
||||
@@ -377,53 +394,242 @@ char* php_get_windows_name()
|
||||
case PRODUCT_ULTIMATE:
|
||||
sub = "Ultimate Edition";
|
||||
break;
|
||||
case PRODUCT_HOME_PREMIUM:
|
||||
sub = "Home Premium Edition";
|
||||
break;
|
||||
case PRODUCT_HOME_BASIC:
|
||||
sub = "Home Basic Edition";
|
||||
break;
|
||||
case PRODUCT_HOME_PREMIUM:
|
||||
sub = "Home Premium Edition";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE:
|
||||
sub = "Enterprise Edition";
|
||||
break;
|
||||
case PRODUCT_HOME_BASIC_N:
|
||||
sub = "Home Basic N Edition";
|
||||
break;
|
||||
case PRODUCT_BUSINESS:
|
||||
sub = "Business Edition";
|
||||
if ((osvi.dwMajorVersion > 6) || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion > 0)) {
|
||||
sub = "Professional Edition";
|
||||
} else {
|
||||
sub = "Business Edition";
|
||||
}
|
||||
break;
|
||||
case PRODUCT_STARTER:
|
||||
sub = "Starter Edition";
|
||||
break;
|
||||
case PRODUCT_CLUSTER_SERVER:
|
||||
sub = "Cluster Server Edition";
|
||||
case PRODUCT_STANDARD_SERVER:
|
||||
sub = "Standard Edition";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER:
|
||||
sub = "Datacenter Edition";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER_CORE:
|
||||
sub = "Datacenter Edition (core installation)";
|
||||
case PRODUCT_SMALLBUSINESS_SERVER:
|
||||
sub = "Small Business Server";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER:
|
||||
sub = "Enterprise Edition";
|
||||
break;
|
||||
case PRODUCT_STARTER:
|
||||
if ((osvi.dwMajorVersion > 6) || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion > 0)) {
|
||||
sub = "Starter N Edition";
|
||||
} else {
|
||||
sub = "Starter Edition";
|
||||
}
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER_CORE:
|
||||
sub = "Datacenter Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_CORE:
|
||||
sub = "Standard Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER_CORE:
|
||||
sub = "Enterprise Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER_IA64:
|
||||
sub = "Enterprise Edition for Itanium-based Systems";
|
||||
break;
|
||||
case PRODUCT_SMALLBUSINESS_SERVER:
|
||||
sub = "Small Business Server";
|
||||
case PRODUCT_BUSINESS_N:
|
||||
if ((osvi.dwMajorVersion > 6) || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion > 0)) {
|
||||
sub = "Professional N Edition";
|
||||
} else {
|
||||
sub = "Business N Edition";
|
||||
}
|
||||
break;
|
||||
case PRODUCT_WEB_SERVER:
|
||||
sub = "Web Server Edition";
|
||||
break;
|
||||
case PRODUCT_CLUSTER_SERVER:
|
||||
sub = "HPC Edition";
|
||||
break;
|
||||
case PRODUCT_HOME_SERVER:
|
||||
sub = "Storage Server Essentials Edition";
|
||||
break;
|
||||
case PRODUCT_STORAGE_EXPRESS_SERVER:
|
||||
sub = "Storage Server Express Edition";
|
||||
break;
|
||||
case PRODUCT_STORAGE_STANDARD_SERVER:
|
||||
sub = "Storage Server Standard Edition";
|
||||
break;
|
||||
case PRODUCT_STORAGE_WORKGROUP_SERVER:
|
||||
sub = "Storage Server Workgroup Edition";
|
||||
break;
|
||||
case PRODUCT_STORAGE_ENTERPRISE_SERVER:
|
||||
sub = "Storage Server Enterprise Edition";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOR_SMALLBUSINESS:
|
||||
sub = "Essential Server Solutions Edition";
|
||||
break;
|
||||
case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
|
||||
sub = "Small Business Server Premium Edition";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER:
|
||||
sub = "Standard Edition";
|
||||
case PRODUCT_HOME_PREMIUM_N:
|
||||
sub = "Home Premium N Edition";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_CORE:
|
||||
sub = "Standard Edition (core installation)";
|
||||
case PRODUCT_ENTERPRISE_N:
|
||||
sub = "Enterprise N Edition";
|
||||
break;
|
||||
case PRODUCT_WEB_SERVER:
|
||||
sub = "Web Server Edition";
|
||||
case PRODUCT_ULTIMATE_N:
|
||||
sub = "Ultimate N Edition";
|
||||
break;
|
||||
case PRODUCT_WEB_SERVER_CORE:
|
||||
sub = "Web Server Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT:
|
||||
sub = "Essential Business Server Management Server Edition";
|
||||
break;
|
||||
case PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY:
|
||||
sub = "Essential Business Server Management Security Edition";
|
||||
break;
|
||||
case PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING:
|
||||
sub = "Essential Business Server Management Messaging Edition";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOUNDATION:
|
||||
sub = "Foundation Edition";
|
||||
break;
|
||||
case PRODUCT_HOME_PREMIUM_SERVER:
|
||||
sub = "Home Server 2011 Edition";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOR_SMALLBUSINESS_V:
|
||||
sub = "Essential Server Solutions Edition (without Hyper-V)";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_V:
|
||||
sub = "Standard Edition (without Hyper-V)";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER_V:
|
||||
sub = "Datacenter Edition (without Hyper-V)";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER_V:
|
||||
sub = "Enterprise Edition (without Hyper-V)";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER_CORE_V:
|
||||
sub = "Datacenter Edition (core installation, without Hyper-V)";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_CORE_V:
|
||||
sub = "Standard Edition (core installation, without Hyper-V)";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER_CORE_V:
|
||||
sub = "Enterprise Edition (core installation, without Hyper-V)";
|
||||
break;
|
||||
case PRODUCT_HYPERV:
|
||||
sub = "Hyper-V Server";
|
||||
break;
|
||||
case PRODUCT_STORAGE_EXPRESS_SERVER_CORE:
|
||||
sub = "Storage Server Express Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_STORAGE_STANDARD_SERVER_CORE:
|
||||
sub = "Storage Server Standard Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_STORAGE_WORKGROUP_SERVER_CORE:
|
||||
sub = "Storage Server Workgroup Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE:
|
||||
sub = "Storage Server Enterprise Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_STARTER_N:
|
||||
sub = "Starter N Edition";
|
||||
break;
|
||||
case PRODUCT_PROFESSIONAL:
|
||||
sub = "Professional Edition";
|
||||
break;
|
||||
case PRODUCT_PROFESSIONAL_N:
|
||||
sub = "Professional N Edition";
|
||||
break;
|
||||
case PRODUCT_SB_SOLUTION_SERVER:
|
||||
sub = "Small Business Server 2011 Essentials Edition";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOR_SB_SOLUTIONS:
|
||||
sub = "Server For SB Solutions Edition";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_SOLUTIONS:
|
||||
sub = "Solutions Premium Edition";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE:
|
||||
sub = "Solutions Premium Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_SB_SOLUTION_SERVER_EM:
|
||||
sub = "Server For SB Solutions EM Edition";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM:
|
||||
sub = "Server For SB Solutions EM Edition";
|
||||
break;
|
||||
case PRODUCT_SOLUTION_EMBEDDEDSERVER:
|
||||
sub = "MultiPoint Server Edition";
|
||||
break;
|
||||
case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT:
|
||||
sub = "Essential Server Solution Management Edition";
|
||||
break;
|
||||
case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL:
|
||||
sub = "Essential Server Solution Additional Edition";
|
||||
break;
|
||||
case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC:
|
||||
sub = "Essential Server Solution Management SVC Edition";
|
||||
break;
|
||||
case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC:
|
||||
sub = "Essential Server Solution Additional SVC Edition";
|
||||
break;
|
||||
case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE:
|
||||
sub = "Small Business Server Premium Edition (core installation)";
|
||||
break;
|
||||
case PRODUCT_CLUSTER_SERVER_V:
|
||||
sub = "Hyper Core V Edition";
|
||||
break;
|
||||
case PRODUCT_STARTER_E:
|
||||
sub = "Hyper Core V Edition";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_EVALUATION:
|
||||
sub = "Enterprise Edition (evaluation installation)";
|
||||
break;
|
||||
case PRODUCT_MULTIPOINT_STANDARD_SERVER:
|
||||
sub = "MultiPoint Server Standard Edition (full installation)";
|
||||
break;
|
||||
case PRODUCT_MULTIPOINT_PREMIUM_SERVER:
|
||||
sub = "MultiPoint Server Premium Edition (full installation)";
|
||||
break;
|
||||
case PRODUCT_STANDARD_EVALUATION_SERVER:
|
||||
sub = "Standard Edition (evaluation installation)";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_EVALUATION_SERVER:
|
||||
sub = "Datacenter Edition (evaluation installation)";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_N_EVALUATION:
|
||||
sub = "Enterprise N Edition (evaluation installation)";
|
||||
break;
|
||||
case PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER:
|
||||
sub = "Storage Server Workgroup Edition (evaluation installation)";
|
||||
break;
|
||||
case PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER:
|
||||
sub = "Storage Server Standard Edition (evaluation installation)";
|
||||
break;
|
||||
case PRODUCT_CORE_N:
|
||||
sub = "Windows 8 N Edition";
|
||||
break;
|
||||
case PRODUCT_CORE_COUNTRYSPECIFIC:
|
||||
sub = "Windows 8 China Edition";
|
||||
break;
|
||||
case PRODUCT_CORE_SINGLELANGUAGE:
|
||||
sub = "Windows 8 Single Language Edition";
|
||||
break;
|
||||
case PRODUCT_CORE:
|
||||
sub = "Windows 8 Edition";
|
||||
break;
|
||||
case PRODUCT_PROFESSIONAL_WMC:
|
||||
sub = "Professional with Media Center Edition";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+45
-2
@@ -223,6 +223,43 @@ void php_mail_log_to_file(char *filename, char *message, size_t message_size TSR
|
||||
}
|
||||
|
||||
|
||||
static int php_mail_detect_multiple_crlf(char *hdr) {
|
||||
/* This function detects multiple/malformed multiple newlines. */
|
||||
|
||||
if (!hdr || !strlen(hdr)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Should not have any newlines at the beginning. */
|
||||
/* RFC 2822 2.2. Header Fields */
|
||||
if (*hdr < 33 || *hdr > 126 || *hdr == ':') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while(*hdr) {
|
||||
if (*hdr == '\r') {
|
||||
if (*(hdr+1) == '\0' || *(hdr+1) == '\r' || (*(hdr+1) == '\n' && (*(hdr+2) == '\0' || *(hdr+2) == '\n' || *(hdr+2) == '\r'))) {
|
||||
/* Malformed or multiple newlines. */
|
||||
return 1;
|
||||
} else {
|
||||
hdr += 2;
|
||||
}
|
||||
} else if (*hdr == '\n') {
|
||||
if (*(hdr+1) == '\0' || *(hdr+1) == '\r' || *(hdr+1) == '\n') {
|
||||
/* Malformed or multiple newlines. */
|
||||
return 1;
|
||||
} else {
|
||||
hdr += 2;
|
||||
}
|
||||
} else {
|
||||
hdr++;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* {{{ php_mail
|
||||
*/
|
||||
PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC)
|
||||
@@ -276,6 +313,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
|
||||
|
||||
efree(tmp);
|
||||
}
|
||||
|
||||
if (PG(mail_x_header)) {
|
||||
const char *tmp = zend_get_executed_filename(TSRMLS_C);
|
||||
char *f;
|
||||
@@ -283,7 +321,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
|
||||
|
||||
php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len TSRMLS_CC);
|
||||
|
||||
if (headers != NULL) {
|
||||
if (headers != NULL && *headers) {
|
||||
spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(TSRMLS_C), f, headers);
|
||||
} else {
|
||||
spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s", php_getuid(TSRMLS_C), f);
|
||||
@@ -291,6 +329,11 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
|
||||
efree(f);
|
||||
}
|
||||
|
||||
if (hdr && php_mail_detect_multiple_crlf(hdr)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Multiple or malformed newlines found in additional_header");
|
||||
MAIL_RET(0);
|
||||
}
|
||||
|
||||
if (!sendmail_path) {
|
||||
#if (defined PHP_WIN32 || defined NETWARE)
|
||||
/* handle old style win smtp sending */
|
||||
@@ -386,7 +429,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program '%s'", sendmail_path);
|
||||
#if PHP_SIGCHILD
|
||||
if (sig_handler) {
|
||||
signal(SIGCHLD, sig_handler);
|
||||
signal(SIGCHLD, sig_handler);
|
||||
}
|
||||
#endif
|
||||
MAIL_RET(0);
|
||||
|
||||
@@ -2749,7 +2749,7 @@ PHP_FUNCTION(lcfirst)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string ucwords(string str)
|
||||
/* {{{ proto string ucwords(string str [, string delims])
|
||||
Uppercase the first character of every word in a string */
|
||||
PHP_FUNCTION(ucwords)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ try {
|
||||
?>
|
||||
==DONE==
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
before
|
||||
in catch: DirectoryIterator::__construct(c:\not\exists\here,c:\not\exists\here): The system cannot find the path specified. (code: 3)
|
||||
in catch: DirectoryIterator::__construct(c:\not\exists\here,c:\not\exists\here): %s (code: 3)
|
||||
==DONE==
|
||||
@@ -0,0 +1,47 @@
|
||||
--TEST--
|
||||
Bug #69646 OS command injection vulnerability in escapeshellarg()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if( substr(PHP_OS, 0, 3) != "WIN" )
|
||||
die("skip.. Windows only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = 'a\\';
|
||||
$b = 'b -c d\\';
|
||||
var_dump( $a, escapeshellarg($a) );
|
||||
var_dump( $b, escapeshellarg($b) );
|
||||
|
||||
$helper_script = <<<SCRIPT
|
||||
<?php
|
||||
|
||||
print( "--- ARG INFO ---\n" );
|
||||
var_dump( \$argv );
|
||||
|
||||
SCRIPT;
|
||||
|
||||
$script = dirname(__FILE__) . DIRECTORY_SEPARATOR . "arginfo.php";
|
||||
file_put_contents($script, $helper_script);
|
||||
|
||||
$cmd = PHP_BINARY . " " . $script . " " . escapeshellarg($a) . " " . escapeshellarg($b);
|
||||
|
||||
system($cmd);
|
||||
|
||||
unlink($script);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(2) "a\"
|
||||
string(5) ""a\\""
|
||||
string(7) "b -c d\"
|
||||
string(10) ""b -c d\\""
|
||||
--- ARG INFO ---
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(%d) "%sarginfo.php"
|
||||
[1]=>
|
||||
string(2) "a\"
|
||||
[2]=>
|
||||
string(7) "b -c d\"
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ echo "Simple testcase for escapeshellarg() function\n";
|
||||
var_dump(escapeshellarg("Mr O'Neil"));
|
||||
var_dump(escapeshellarg("Mr O\'Neil"));
|
||||
var_dump(escapeshellarg("%FILENAME"));
|
||||
var_dump(escapeshellarg("!FILENAME"));
|
||||
var_dump(escapeshellarg(""));
|
||||
|
||||
echo "Done\n";
|
||||
@@ -27,5 +28,6 @@ Simple testcase for escapeshellarg() function
|
||||
string(11) ""Mr O'Neil""
|
||||
string(12) ""Mr O\'Neil""
|
||||
string(11) "" FILENAME""
|
||||
string(11) "" FILENAME""
|
||||
string(2) """"
|
||||
Done
|
||||
@@ -17,7 +17,8 @@ $data = array(
|
||||
'%^',
|
||||
'#&;`|*?',
|
||||
'~<>\\',
|
||||
'%NOENV%'
|
||||
'%NOENV%',
|
||||
'!NOENV!'
|
||||
);
|
||||
|
||||
$count = 1;
|
||||
@@ -46,4 +47,6 @@ string(14) "^#^&^;^`^|^*^?"
|
||||
string(8) "^~^<^>^\"
|
||||
-- Test 8 --
|
||||
string(9) "^%NOENV^%"
|
||||
-- Test 9 --
|
||||
string(9) "^!NOENV^!"
|
||||
Done
|
||||
@@ -0,0 +1,42 @@
|
||||
--TEST--
|
||||
Bug #69874: Null addtional_headers does not send mail
|
||||
--INI--
|
||||
sendmail_path=tee mailBasic.out >/dev/null
|
||||
mail.add_x_header = Off
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(substr(PHP_OS, 0, 3) == "WIN")
|
||||
die("skip Won't run on Windows");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
|
||||
* Description: Send an email message
|
||||
* Source code: ext/standard/mail.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mail() : send email without additional headers ***\n";
|
||||
|
||||
// Initialise all required variables
|
||||
$to = 'user@company.com';
|
||||
$subject = 'Test Subject';
|
||||
$message = 'A Message';
|
||||
|
||||
$outFile = "mailBasic.out";
|
||||
@unlink($outFile);
|
||||
|
||||
var_dump( mail($to, $subject, $message) );
|
||||
echo file_get_contents($outFile);
|
||||
unlink($outFile);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mail() : send email without additional headers ***
|
||||
bool(true)
|
||||
To: user@company.com
|
||||
Subject: Test Subject
|
||||
|
||||
A Message
|
||||
===DONE===
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Bug #69874: Null addtional_headers does not send mail
|
||||
--INI--
|
||||
sendmail_path=tee mailBasic.out >/dev/null
|
||||
mail.add_x_header = On
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(substr(PHP_OS, 0, 3) == "WIN")
|
||||
die("skip Won't run on Windows");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
|
||||
* Description: Send an email message
|
||||
* Source code: ext/standard/mail.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mail() : send email without additional headers ***\n";
|
||||
|
||||
// Initialise all required variables
|
||||
$to = 'user@company.com';
|
||||
$subject = 'Test Subject';
|
||||
$message = 'A Message';
|
||||
|
||||
$outFile = "mailBasic.out";
|
||||
@unlink($outFile);
|
||||
|
||||
var_dump( mail($to, $subject, $message, '') );
|
||||
echo file_get_contents($outFile);
|
||||
unlink($outFile);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mail() : send email without additional headers ***
|
||||
bool(true)
|
||||
To: user@company.com
|
||||
Subject: Test Subject
|
||||
X-PHP-Originating-Script: %d:bug69874_2.php
|
||||
|
||||
A Message
|
||||
===DONE===
|
||||
@@ -0,0 +1,329 @@
|
||||
--TEST--
|
||||
Test mail() function : basic functionality
|
||||
--INI--
|
||||
sendmail_path=tee mailBasic.out >/dev/null
|
||||
mail.add_x_header = Off
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(substr(PHP_OS, 0, 3) == "WIN")
|
||||
die("skip Won't run on Windows");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
|
||||
* Description: Send an email message with invalid addtional_headers
|
||||
* Source code: ext/standard/mail.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mail() : basic functionality ***\n";
|
||||
|
||||
|
||||
// Valid header
|
||||
$to = 'user@example.com';
|
||||
$subject = 'Test Subject';
|
||||
$message = 'A Message';
|
||||
$additional_headers = "HEAD1: a\r\nHEAD2: b\r\n";
|
||||
$outFile = "mailBasic.out";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Valid Header --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo file_get_contents($outFile);
|
||||
unlink($outFile);
|
||||
|
||||
// Valid header
|
||||
$additional_headers = "HEAD1: a\nHEAD2: b\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Valid Header --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Valid header
|
||||
// \r is accepted as valid. This may be changed to invalid.
|
||||
$additional_headers = "HEAD1: a\rHEAD2: b\r";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Valid Header --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
//===============================================================================
|
||||
// Invalid header
|
||||
$additional_headers = "\nHEAD1: a\nHEAD2: b\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - preceeding newline--\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "\rHEAD1: a\nHEAD2: b\r";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - preceeding newline--\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "\r\nHEAD1: a\r\nHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - preceeding newline--\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "\r\n\r\nHEAD1: a\r\nHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - preceeding newline--\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "\n\nHEAD1: a\r\nHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - preceeding newline--\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "\r\rHEAD1: a\r\nHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - preceeding newline--\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "HEAD1: a\r\n\r\nHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - multiple newlines in the middle --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "HEAD1: a\r\n\nHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - multiple newlines in the middle --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "HEAD1: a\n\nHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - multiple newlines in the middle --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "HEAD1: a\r\rHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - multiple newlines in the middle --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "HEAD1: a\n\rHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - multiple newlines in the middle --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
$additional_headers = "HEAD1: a\n\r\nHEAD2: b\r\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - multiple newlines in the middle --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
// Invalid, but PHP_FUNCTION(mail) trims newlines
|
||||
$additional_headers = "HEAD1: a\r\nHEAD2: b\r\n\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - trailing newlines --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
// Invalid, but PHP_FUNCTION(mail) trims newlines
|
||||
$additional_headers = "HEAD1: a\r\nHEAD2: b\n\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - trailing newlines --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
// Invalid, but PHP_FUNCTION(mail) trims newlines
|
||||
$additional_headers = "HEAD1: a\r\nHEAD2: b\n";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - trailing newlines --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
// Invalid header
|
||||
// Invalid, but PHP_FUNCTION(mail) trims newlines
|
||||
$additional_headers = "HEAD1: a\r\nHEAD2: b\r";
|
||||
@unlink($outFile);
|
||||
|
||||
echo "-- Invalid Header - trailing newlines --\n";
|
||||
// Calling mail() with all additional headers
|
||||
var_dump( mail($to, $subject, $message, $additional_headers) );
|
||||
echo @file_get_contents($outFile);
|
||||
@unlink($outFile);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mail() : basic functionality ***
|
||||
-- Valid Header --
|
||||
bool(true)
|
||||
To: user@example.com
|
||||
Subject: Test Subject
|
||||
HEAD1: a
|
||||
HEAD2: b
|
||||
|
||||
A Message
|
||||
-- Valid Header --
|
||||
bool(true)
|
||||
To: user@example.com
|
||||
Subject: Test Subject
|
||||
HEAD1: a
|
||||
HEAD2: b
|
||||
|
||||
A Message
|
||||
-- Valid Header --
|
||||
bool(true)
|
||||
To: user@example.com
|
||||
Subject: Test Subject
|
||||
HEAD1: a
HEAD2: b
|
||||
|
||||
A Message
|
||||
-- Invalid Header - preceeding newline--
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - preceeding newline--
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - preceeding newline--
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - preceeding newline--
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - preceeding newline--
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - preceeding newline--
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - multiple newlines in the middle --
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - multiple newlines in the middle --
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - multiple newlines in the middle --
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - multiple newlines in the middle --
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - multiple newlines in the middle --
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - multiple newlines in the middle --
|
||||
|
||||
Warning: mail(): Multiple or malformed newlines found in additional_header in %s/mail_basic6.php on line %d
|
||||
bool(false)
|
||||
-- Invalid Header - trailing newlines --
|
||||
bool(true)
|
||||
To: user@example.com
|
||||
Subject: Test Subject
|
||||
HEAD1: a
|
||||
HEAD2: b
|
||||
|
||||
A Message
|
||||
-- Invalid Header - trailing newlines --
|
||||
bool(true)
|
||||
To: user@example.com
|
||||
Subject: Test Subject
|
||||
HEAD1: a
|
||||
HEAD2: b
|
||||
|
||||
A Message
|
||||
-- Invalid Header - trailing newlines --
|
||||
bool(true)
|
||||
To: user@example.com
|
||||
Subject: Test Subject
|
||||
HEAD1: a
|
||||
HEAD2: b
|
||||
|
||||
A Message
|
||||
-- Invalid Header - trailing newlines --
|
||||
bool(true)
|
||||
To: user@example.com
|
||||
Subject: Test Subject
|
||||
HEAD1: a
|
||||
HEAD2: b
|
||||
|
||||
A Message
|
||||
===DONE===
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Check that windows version constants are initialized
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip.. Windows only');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(PHP_WINDOWS_VERSION_MAJOR > 0, PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR);
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
int(%d)
|
||||
int(%d)
|
||||
==DONE==
|
||||
@@ -9,6 +9,7 @@ $x->test();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined property: Exception::$previous in %s on line %d
|
||||
exception 'Exception' in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #69793: Remotely triggerable stack exhaustion via recursive method calls
|
||||
--FILE--
|
||||
<?php
|
||||
$e = unserialize('O:9:"Exception":7:{s:17:"'."\0".'Exception'."\0".'string";s:1:"a";s:7:"'."\0".'*'."\0".'code";i:0;s:7:"'."\0".'*'."\0".'file";R:1;s:7:"'."\0".'*'."\0".'line";i:1337;s:16:"'."\0".'Exception'."\0".'trace";a:0:{}s:19:"'."\0".'Exception'."\0".'previous";i:10;s:10:"'."\0".'*'."\0".'message";N;}');
|
||||
|
||||
var_dump($e."");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined property: Exception::$message in %s/bug69793.php on line %d
|
||||
|
||||
Notice: Undefined property: Exception::$file in %s/bug69793.php on line %d
|
||||
|
||||
Notice: Undefined property: Exception::$previous in %s/bug69793.php on line %d
|
||||
string(53) "exception 'Exception' in :1337
|
||||
Stack trace:
|
||||
#0 {main}"
|
||||
Loaded 100 of 121 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user