mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 19:20:50 +00:00
Compare commits
180
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6dcb85e9e1 | ||
|
|
37d814b84c | ||
|
|
059dd18c37 | ||
|
|
43f6099ce4 | ||
|
|
a483a79c85 | ||
|
|
cc7140e8d9 | ||
|
|
71da4f1f7f | ||
|
|
c3fc65eb7c | ||
|
|
b89f128480 | ||
|
|
7b3616db77 | ||
|
|
debfc866d2 | ||
|
|
d47029167d | ||
|
|
aed225b7e4 | ||
|
|
fd94c92171 | ||
|
|
f9ece83994 | ||
|
|
43b26c7b21 | ||
|
|
dc1a8dd7f0 | ||
|
|
b2954c64ab | ||
|
|
b59ea797f5 | ||
|
|
c77f783777 | ||
|
|
4b1dff6f43 | ||
|
|
52b2a3ff25 | ||
|
|
3759de241f | ||
|
|
c65350cd4d | ||
|
|
bb98ed600a | ||
|
|
a12cef979d | ||
|
|
c07150cd1a | ||
|
|
ea807f9c07 | ||
|
|
51fca4b77d | ||
|
|
a6c063d663 | ||
|
|
3fe509443c | ||
|
|
43c2dfa7b3 | ||
|
|
4aeff30337 | ||
|
|
1922c650ba | ||
|
|
c19d59c550 | ||
|
|
45e7e79485 | ||
|
|
32fe02c27d | ||
|
|
31b634bf7c | ||
|
|
0fac73a3bf | ||
|
|
7ceb0e3a18 | ||
|
|
53d274beb0 | ||
|
|
33d3acaae7 | ||
|
|
48cfd1160b | ||
|
|
7c31203935 | ||
|
|
e2291e4b1a | ||
|
|
1390a5812b | ||
|
|
3605d1baf5 | ||
|
|
906f19f136 | ||
|
|
6935058a98 | ||
|
|
c8f07ad477 | ||
|
|
259057b2a4 | ||
|
|
f06a069c46 | ||
|
|
e8429400d4 | ||
|
|
e201f01ac1 | ||
|
|
9da99d8c5f | ||
|
|
ef1bd8f0e6 | ||
|
|
f9c2bf73ad | ||
|
|
ce2c67c8e8 | ||
|
|
9d816f1bcf | ||
|
|
03964892c0 | ||
|
|
64043cb9e5 | ||
|
|
fc8eff897b | ||
|
|
00eebd7a47 | ||
|
|
5d2294e8b8 | ||
|
|
ebdd9cf6e8 | ||
|
|
4ddc4af87c | ||
|
|
e872f4d9c1 | ||
|
|
a5864d9917 | ||
|
|
24dda816d0 | ||
|
|
c39336d1d8 | ||
|
|
e5adf2b427 | ||
|
|
fc203fa37e | ||
|
|
df4bf28f9f | ||
|
|
d735957cb5 | ||
|
|
78b2b1d6f7 | ||
|
|
b460b530d6 | ||
|
|
24e78ec1d8 | ||
|
|
5786f86656 | ||
|
|
272cccd175 | ||
|
|
2b9c7f881a | ||
|
|
aa23bc6d1d | ||
|
|
9e69ef4ce2 | ||
|
|
e8f37fe3dc | ||
|
|
c7c9858ba1 | ||
|
|
6c99cb2929 | ||
|
|
484b92919b | ||
|
|
b584b51398 | ||
|
|
c12aa3c7ce | ||
|
|
54bd91175d | ||
|
|
40befb943c | ||
|
|
3ed58fb5d7 | ||
|
|
bb057498f7 | ||
|
|
1744be2d17 | ||
|
|
b010a9d846 | ||
|
|
b0c5439b5f | ||
|
|
71daca28d4 | ||
|
|
0d7159d26d | ||
|
|
a4e0539188 | ||
|
|
23d0b93893 | ||
|
|
9c805a6cb3 | ||
|
|
0e51f9798c | ||
|
|
e66bf11638 | ||
|
|
cd18ba117c | ||
|
|
b9f23c2152 | ||
|
|
f94bcb1026 | ||
|
|
890204fa45 | ||
|
|
a1c06f10dd | ||
|
|
c173fef363 | ||
|
|
797e30f4fc | ||
|
|
87db2e4a91 | ||
|
|
8708fe7835 | ||
|
|
80bc2133cd | ||
|
|
79cd9a18b5 | ||
|
|
42ef2b500b | ||
|
|
48c71cd94b | ||
|
|
8bac087a79 | ||
|
|
eaf5beabf4 | ||
|
|
c1127c4de3 | ||
|
|
9ff3334397 | ||
|
|
dc72378ff0 | ||
|
|
36cbb7cc4c | ||
|
|
72976e2497 | ||
|
|
1b4a80332c | ||
|
|
1797a716ed | ||
|
|
362bbaa2dc | ||
|
|
15e9f4baf4 | ||
|
|
b221df5549 | ||
|
|
54187fa4b9 | ||
|
|
2425f88afd | ||
|
|
da5321013c | ||
|
|
eb7ba73079 | ||
|
|
568a35f84f | ||
|
|
f2f8ea9ac5 | ||
|
|
f1acac154a | ||
|
|
ed709d5aa0 | ||
|
|
d52c485717 | ||
|
|
742c54aecf | ||
|
|
0a21b5d970 | ||
|
|
ee61c7175f | ||
|
|
69ed3969dd | ||
|
|
51f9a00b47 | ||
|
|
dda81f0505 | ||
|
|
0e09009753 | ||
|
|
4d2278143a | ||
|
|
863bf294fe | ||
|
|
7381b6accc | ||
|
|
c7d3c027d5 | ||
|
|
c2e197e4ef | ||
|
|
7fc04937f5 | ||
|
|
8d31e463a0 | ||
|
|
12f099e7bc | ||
|
|
6576d809a5 | ||
|
|
cdabbd9542 | ||
|
|
d7f354fa57 | ||
|
|
66edc15875 | ||
|
|
8f1baa6e1c | ||
|
|
9fdb8c2ccd | ||
|
|
54bf6352fe | ||
|
|
ce5c4500cd | ||
|
|
1647ee7ef0 | ||
|
|
20e765b841 | ||
|
|
16023f3e3b | ||
|
|
7a4584d3f6 | ||
|
|
b7fa67742c | ||
|
|
e488690d95 | ||
|
|
c96d08b272 | ||
|
|
e4153e9144 | ||
|
|
daa0abaf77 | ||
|
|
5be8872f44 | ||
|
|
e42a29bf81 | ||
|
|
05ccc1f2d4 | ||
|
|
1a7db40a1f | ||
|
|
35e717e12e | ||
|
|
87829c09a1 | ||
|
|
91f985b2f9 | ||
|
|
3d38db3576 | ||
|
|
6aa44ac73a | ||
|
|
8560138274 | ||
|
|
3eee495570 | ||
|
|
496f291f3d |
No files matched your search
@@ -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,5 +1,117 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
17 Sep 2015, PHP 5.6.14RC1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70370 (Bundled libtool.m4 doesn't handle FreeBSD 10 when
|
||||
building extensions). (Adam)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #68291 (404 on urls with '+'). (cmb)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #70001 (Assigning to DOMNode::textContent does additional entity
|
||||
encoding). (cmb)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #70456 (mysqlnd doesn't activate TCP keep-alive when connecting to
|
||||
a server). (Sergei Turchanov)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #55259 (openssl extension does not get the DH parameters from
|
||||
DH key resource). (Jakub Zelenka)
|
||||
. Fixed bug #70395 (Missing ARG_INFO for openssl_seal()). (cmb)
|
||||
. Fixed bug #60632 (openssl_seal fails with AES). (Jakub Zelenka)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #70389 (PDO constructor changes unrelated variables). (Laruence)
|
||||
|
||||
- Phpdbg:
|
||||
. Fix phpdbg_break_next() sometimes not breaking. (Bob)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #67131 (setcookie() conditional for empty values not met). (cmb)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #70361 (HTTP stream wrapper doesn't close keep-alive connections).
|
||||
(Niklas Keller)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #70322 (ZipArchive::close() doesn't indicate errors). (cmb)
|
||||
|
||||
03 Sep 2015, PHP 5.6.13
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69900 (Too long timeout on pipes). (Anatol)
|
||||
. Fixed bug #69487 (SAPI may truncate POST data). (cmb)
|
||||
. Fixed bug #70198 (Checking liveness does not work as expected).
|
||||
(Shafreeck Sea, Anatol Belski)
|
||||
. 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)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE).
|
||||
(wusuopu, cmb)
|
||||
. Fixed bug #70264 (CLI server directory traversal). (cmb)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #70266 (DateInterval::__construct.interval_spec is not supposed to
|
||||
be optional). (cmb)
|
||||
. Fixed bug #70277 (new DateTimeZone($foo) is ignoring text after null byte).
|
||||
(cmb)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte
|
||||
value of 32 bytes). (Stas)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #70284 (Use after free vulnerability in unserialize() with GMP).
|
||||
(stas)
|
||||
|
||||
- hash:
|
||||
. Fixed bug #70312 (HAVAL gives wrong hashes in specific cases). (letsgolee
|
||||
at naver dot com)
|
||||
|
||||
- MCrypt:
|
||||
. Fixed bug #69833 (mcrypt fd caching not working). (Anatol)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #70237 (Empty while and do-while segmentation fault with opcode
|
||||
on CLI enabled). (Dmitry, Laruence)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #70232 (Incorrect bump-along behavior with \K and empty string
|
||||
match). (cmb)
|
||||
. 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 #70290 (Null pointer deref (segfault) in spl_autoload via
|
||||
ob_start). (hugh at allthethings dot co dot nz)
|
||||
. Fixed bug #70303 (Incorrect constructor reflection for ArrayObject). (cmb)
|
||||
. 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)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #70052 (getimagesize() fails for very large and very small WBMP).
|
||||
(cmb)
|
||||
. Fixed bug #70157 (parse_ini_string() segmentation fault with
|
||||
INI_SCANNER_TYPED). (Tjerk)
|
||||
|
||||
- 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.6.12
|
||||
|
||||
- Core:
|
||||
@@ -35,8 +147,8 @@ PHP NEWS
|
||||
columns). (cmb)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #69882 (OpenSSL error “key values mismatch” after
|
||||
openssl_pkcs12_read with extra cert) (Tomasz Sawicki)
|
||||
. Fixed bug #69882 (OpenSSL error "key values mismatch" after
|
||||
openssl_pkcs12_read with extra cert). (Tomasz Sawicki)
|
||||
. Fixed bug #70014 (openssl_random_pseudo_bytes() is not cryptographically
|
||||
secure). (Stas)
|
||||
|
||||
@@ -93,7 +205,7 @@ PHP NEWS
|
||||
number). (Nikita)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #69669 (mysqlnd is vulnerable to BACKRONYM) (CVE-2015-3152).
|
||||
. Fixed bug #69669 (mysqlnd is vulnerable to BACKRONYM). (CVE-2015-3152)
|
||||
(Andrey)
|
||||
|
||||
- PCRE:
|
||||
@@ -109,6 +221,12 @@ PHP NEWS
|
||||
. 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)
|
||||
@@ -401,7 +519,8 @@ PHP NEWS
|
||||
|
||||
- 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.
|
||||
|
||||
@@ -61,6 +61,9 @@ PHP 5.6 UPGRADE NOTES
|
||||
longer accept keys or IVs with incorrect sizes. Furthermore an IV is now
|
||||
required if the used block cipher mode requires it.
|
||||
|
||||
- cURL:
|
||||
Uploads using the @file syntax are now unsupported by default.
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
========================================
|
||||
|
||||
+18
-3
@@ -108,7 +108,18 @@ static void zend_ini_init_string(zval *result)
|
||||
*/
|
||||
static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
int length;
|
||||
|
||||
if (Z_TYPE_P(op1) != IS_STRING) {
|
||||
zval copy;
|
||||
MAKE_COPY_ZVAL(&op1, ©);
|
||||
convert_to_string(©);
|
||||
Z_STRVAL_P(op1) = zend_strndup(Z_STRVAL(copy), Z_STRLEN(copy));
|
||||
Z_STRLEN_P(op1) = Z_STRLEN(copy);
|
||||
zval_dtor(©);
|
||||
}
|
||||
|
||||
length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
|
||||
Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1);
|
||||
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
@@ -213,7 +224,7 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro
|
||||
zend_file_handle_dtor(fh TSRMLS_CC);
|
||||
|
||||
shutdown_ini_scanner(TSRMLS_C);
|
||||
|
||||
|
||||
if (retval == 0) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
@@ -303,7 +314,11 @@ statement:
|
||||
#endif
|
||||
ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
|
||||
free(Z_STRVAL($1));
|
||||
free(Z_STRVAL($2));
|
||||
if (Z_TYPE($2) == IS_STRING) {
|
||||
free(Z_STRVAL($2));
|
||||
} else {
|
||||
zval_dtor(&$2);
|
||||
}
|
||||
zval_internal_dtor(&$5);
|
||||
}
|
||||
| TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); free(Z_STRVAL($1)); }
|
||||
|
||||
Vendored
+2
-2
@@ -1545,7 +1545,7 @@ freebsd* | dragonfly*)
|
||||
objformat=`/usr/bin/objformat`
|
||||
else
|
||||
case $host_os in
|
||||
freebsd[[123]]*) objformat=aout ;;
|
||||
freebsd[[123]].*) objformat=aout ;;
|
||||
*) objformat=elf ;;
|
||||
esac
|
||||
fi
|
||||
@@ -3162,7 +3162,7 @@ case $host_os in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
freebsd[[12]]*)
|
||||
freebsd[[12]].*)
|
||||
# C++ shared libraries reported to be fairly broken before switch to ELF
|
||||
_LT_AC_TAGVAR(ld_shlibs, $1)=no
|
||||
;;
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=12
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_RELEASE_VERSION=14
|
||||
PHP_EXTRA_VERSION="RC1"
|
||||
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`
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#define TIMELIB_SUPPORTS_V2DATA
|
||||
#include "timezonedb.h"
|
||||
|
||||
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
|
||||
|
||||
+28963
-27472
File diff suppressed because it is too large.
Load diff
+10
-5
@@ -383,7 +383,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_date_period_construct, 0, 0, 3)
|
||||
ZEND_ARG_INFO(0, end)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 0)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, interval_spec)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
@@ -3682,12 +3682,17 @@ PHP_FUNCTION(date_diff)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz TSRMLS_DC)
|
||||
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz, size_t tz_len TSRMLS_DC)
|
||||
{
|
||||
timelib_time *dummy_t = ecalloc(1, sizeof(timelib_time));
|
||||
int dst, not_found;
|
||||
char *orig_tz = tz;
|
||||
|
||||
if (strlen(tz) != tz_len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timezone must not contain null bytes");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
dummy_t->z = timelib_parse_zone(&tz, &dst, dummy_t, ¬_found, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
if (not_found) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad timezone (%s)", orig_tz);
|
||||
@@ -3714,7 +3719,7 @@ PHP_FUNCTION(timezone_open)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC);
|
||||
if (SUCCESS != timezone_initialize(tzobj, tz TSRMLS_CC)) {
|
||||
if (SUCCESS != timezone_initialize(tzobj, tz, tz_len TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -3733,7 +3738,7 @@ PHP_METHOD(DateTimeZone, __construct)
|
||||
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);
|
||||
if (FAILURE == timezone_initialize(tzobj, tz TSRMLS_CC)) {
|
||||
if (FAILURE == timezone_initialize(tzobj, tz, tz_len TSRMLS_CC)) {
|
||||
ZVAL_NULL(getThis());
|
||||
}
|
||||
}
|
||||
@@ -3748,7 +3753,7 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
|
||||
|
||||
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS && Z_TYPE_PP(z_timezone_type) == IS_LONG) {
|
||||
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS && Z_TYPE_PP(z_timezone) == IS_STRING) {
|
||||
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_PP(z_timezone) TSRMLS_CC)) {
|
||||
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_PP(z_timezone), Z_STRLEN_PP(z_timezone) TSRMLS_CC)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ $data = unserialize('a:2:{i:0;O:12:"DateTimeZone":2:{s:13:"timezone_type";a:2:{i
|
||||
var_dump($data);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: DateTimeZone::__wakeup(): Timezone initialization failed in %s/bug68942.php on line %d
|
||||
Fatal error: DateTimeZone::__wakeup(): Timezone initialization failed in %s%ebug68942.php on line %d
|
||||
@@ -6,4 +6,4 @@ $data = unserialize('a:2:{i:0;O:8:"DateTime":3:{s:4:"date";s:26:"2000-01-01 00:0
|
||||
var_dump($data);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Invalid serialization data for DateTime object in %s/bug68942_2.php on line %d
|
||||
Fatal error: Invalid serialization data for DateTime object in %s%ebug68942_2.php on line %d
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Bug #70266 (DateInterval::__construct.interval_spec is not supposed to be optional)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump((new ReflectionParameter(['DateInterval', '__construct'], 0))->isOptional());
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #70277 (new DateTimeZone($foo) is ignoring text after null byte)
|
||||
--FILE--
|
||||
<?php
|
||||
$timezone = "Europe/Zurich\0Foo";
|
||||
var_dump(timezone_open($timezone));
|
||||
var_dump(new DateTimeZone($timezone));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: timezone_open(): Timezone must not contain null bytes in %sbug70277.php on line %d
|
||||
bool(false)
|
||||
|
||||
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Timezone must not contain null bytes' in %sbug70277.php:%d
|
||||
Stack trace:
|
||||
#0 %sbug70277.php(%d): DateTimeZone->__construct('Europe/Zurich\x00F...')
|
||||
#1 {main}
|
||||
thrown in %sbug70277.php on line %d
|
||||
+3
-4
@@ -930,7 +930,6 @@ int dom_node_text_content_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
{
|
||||
xmlNode *nodep = dom_object_get_node(obj);
|
||||
zval value_copy;
|
||||
xmlChar *enc_str;
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
@@ -938,9 +937,9 @@ int dom_node_text_content_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
}
|
||||
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
enc_str = xmlEncodeEntitiesReentrant(nodep->doc, Z_STRVAL_P(newval));
|
||||
xmlNodeSetContent(nodep, enc_str);
|
||||
xmlFree(enc_str);
|
||||
/* we have to use xmlNodeAddContent() to get the same behavior as with xmlNewText() */
|
||||
xmlNodeSetContent(nodep, (xmlChar *) "");
|
||||
xmlNodeAddContent(nodep, Z_STRVAL_P(newval));
|
||||
if (newval == &value_copy) {
|
||||
zval_dtor(newval);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #70001 (Assigning to DOMNode::textContent does additional entity encoding)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$element = new DOMText('<p>foo & bar</p>');
|
||||
var_dump($element->textContent);
|
||||
$element = (new DOMDocument())->createTextNode('<p>foo & bar</p>');
|
||||
var_dump($element->textContent);
|
||||
$element->textContent = ('<p>foo & bar</p>');
|
||||
var_dump($element->textContent);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(16) "<p>foo & bar</p>"
|
||||
string(16) "<p>foo & bar</p>"
|
||||
string(16) "<p>foo & bar</p>"
|
||||
@@ -1,7 +1,10 @@
|
||||
--TEST--
|
||||
Testing reading and writing to DOMNode::textContent
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
if (LIBXML_VERSION < 20707) die ('skip requires libxml2-2.7.7 or higher');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
+106
-106
@@ -64,7 +64,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>
|
||||
@@ -151,7 +151,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)
|
||||
|
||||
@@ -160,7 +160,7 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
|
||||
#else
|
||||
#define EXIF_G(v) (exif_globals.v)
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ PHP_INI
|
||||
*/
|
||||
|
||||
@@ -203,7 +203,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)
|
||||
@@ -223,9 +223,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;
|
||||
}
|
||||
@@ -255,7 +255,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),
|
||||
@@ -268,7 +268,7 @@ zend_module_entry exif_module_entry = {
|
||||
NULL,
|
||||
NULL,
|
||||
STANDARD_MODULE_PROPERTIES_EX
|
||||
#else
|
||||
#else
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
#endif
|
||||
};
|
||||
@@ -657,73 +657,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 */
|
||||
@@ -929,7 +929,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"},
|
||||
@@ -948,7 +948,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"},
|
||||
@@ -1214,7 +1214,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;
|
||||
@@ -1564,7 +1564,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
|
||||
{
|
||||
@@ -2617,7 +2617,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)) {
|
||||
@@ -2635,8 +2635,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),
|
||||
@@ -2656,8 +2656,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),
|
||||
@@ -2691,12 +2691,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),
|
||||
@@ -2721,7 +2721,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;
|
||||
@@ -2842,9 +2842,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)) {
|
||||
@@ -2915,18 +2915,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;
|
||||
@@ -2936,7 +2936,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;
|
||||
@@ -2954,16 +2954,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);
|
||||
@@ -3051,10 +3051,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:
|
||||
@@ -3404,7 +3404,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;
|
||||
@@ -3449,21 +3449,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);
|
||||
@@ -3777,7 +3777,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;
|
||||
@@ -3957,7 +3957,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
|
||||
|
||||
|
||||
+5
-5
@@ -630,7 +630,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
|
||||
{
|
||||
mpz_ptr gmpnum;
|
||||
const unsigned char *p, *max;
|
||||
zval zv, *zv_ptr = &zv;
|
||||
zval *zv_ptr;
|
||||
int retval = FAILURE;
|
||||
php_unserialize_data_t unserialize_data = (php_unserialize_data_t) data;
|
||||
|
||||
@@ -640,7 +640,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
|
||||
p = buf;
|
||||
max = buf + buf_len;
|
||||
|
||||
INIT_ZVAL(zv);
|
||||
ALLOC_INIT_ZVAL(zv_ptr);
|
||||
if (!php_var_unserialize(&zv_ptr, &p, max, &unserialize_data TSRMLS_CC)
|
||||
|| Z_TYPE_P(zv_ptr) != IS_STRING
|
||||
|| convert_to_gmp(gmpnum, zv_ptr, 10 TSRMLS_CC) == FAILURE
|
||||
@@ -648,9 +648,9 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
|
||||
zend_throw_exception(NULL, "Could not unserialize number", 0 TSRMLS_CC);
|
||||
goto exit;
|
||||
}
|
||||
zval_dtor(&zv);
|
||||
var_push_dtor_no_addref(&unserialize_data, &zv_ptr);
|
||||
|
||||
INIT_ZVAL(zv);
|
||||
ALLOC_INIT_ZVAL(zv_ptr);
|
||||
if (!php_var_unserialize(&zv_ptr, &p, max, &unserialize_data TSRMLS_CC)
|
||||
|| Z_TYPE_P(zv_ptr) != IS_ARRAY
|
||||
) {
|
||||
@@ -667,7 +667,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
|
||||
|
||||
retval = SUCCESS;
|
||||
exit:
|
||||
zval_dtor(&zv);
|
||||
var_push_dtor_no_addref(&unserialize_data, &zv_ptr);
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(unserialize_data);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
Bug #70284 (Use after free vulnerability in unserialize() with GMP)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$inner = 'r:2;a:1:{i:0;a:1:{i:0;r:4;}}';
|
||||
$exploit = 'a:2:{i:0;s:1:"1";i:1;C:3:"GMP":'.strlen($inner).':{'.$inner.'}}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
$fakezval = ptr2str(1122334455);
|
||||
$fakezval .= ptr2str(0);
|
||||
$fakezval .= "\x00\x00\x00\x00";
|
||||
$fakezval .= "\x01";
|
||||
$fakezval .= "\x00";
|
||||
$fakezval .= "\x00\x00";
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = $fakezval.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
|
||||
function ptr2str($ptr)
|
||||
{
|
||||
$out = '';
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$out .= chr($ptr & 0xff);
|
||||
$ptr >>= 8;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
object(GMP)#%d (2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
NULL
|
||||
}
|
||||
["num"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -5,7 +5,7 @@ Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
|
||||
<?php if(substr(PHP_OS, 0, 3) == 'WIN' ) {die('skip not for windows');} ?>
|
||||
<?php if(setlocale(LC_ALL, "en_US.utf8",) === false) { die('skip en_US.utf8 locales not available'); } ?>
|
||||
<?php if(setlocale(LC_ALL, "en_US.utf8") === false) { die('skip en_US.utf8 locales not available'); } ?>
|
||||
--FILE--
|
||||
<?php
|
||||
setlocale(LC_ALL, "en_US.utf8");
|
||||
|
||||
+73
-18
@@ -70,17 +70,24 @@
|
||||
#define PHP_LDAP_ESCAPE_FILTER 0x01
|
||||
#define PHP_LDAP_ESCAPE_DN 0x02
|
||||
|
||||
#ifndef HAVE_LDAP_CONTROL_FIND
|
||||
#if defined(LDAP_CONTROL_PAGEDRESULTS) && !defined(HAVE_LDAP_CONTROL_FIND)
|
||||
LDAPControl *ldap_control_find( const char *oid, LDAPControl **ctrls, LDAPControl ***nextctrlp)
|
||||
{
|
||||
assert(nextctrlp == NULL);
|
||||
return ldap_find_control(oid, ctrls);
|
||||
assert(nextctrlp == NULL);
|
||||
return ldap_find_control(oid, ctrls);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(LDAP_API_FEATURE_X_OPENLDAP)
|
||||
void ldap_memvfree(void **v)
|
||||
{
|
||||
ldap_value_free((char **)v);
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
LDAP *link;
|
||||
#if defined(HAVE_3ARG_SETREBINDPROC)
|
||||
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
|
||||
zval *rebindproc;
|
||||
#endif
|
||||
} ldap_linkdata;
|
||||
@@ -104,10 +111,8 @@ static void _close_ldap_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
ldap_linkdata *ld = (ldap_linkdata *)rsrc->ptr;
|
||||
|
||||
/* ldap_unbind_s() is deprecated;
|
||||
* the distinction between ldap_unbind() and ldap_unbind_s() is moot */
|
||||
ldap_unbind_ext(ld->link, NULL, NULL);
|
||||
#ifdef HAVE_3ARG_SETREBINDPROC
|
||||
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
|
||||
|
||||
if (ld->rebindproc != NULL) {
|
||||
zval_dtor(ld->rebindproc);
|
||||
@@ -185,6 +190,9 @@ PHP_MINIT_FUNCTION(ldap)
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS);
|
||||
#elif defined (LDAP_X_OPT_CONNECT_TIMEOUT)
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS);
|
||||
#endif
|
||||
#ifdef LDAP_OPT_TIMEOUT
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_TIMEOUT", LDAP_OPT_TIMEOUT, CONST_PERSISTENT | CONST_CS);
|
||||
#endif
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS);
|
||||
@@ -349,11 +357,8 @@ PHP_FUNCTION(ldap_connect)
|
||||
|
||||
ld = ecalloc(1, sizeof(ldap_linkdata));
|
||||
|
||||
/* OpenLDAP provides a specific call to detect valid LDAP URIs;
|
||||
* ldap_init()/ldap_open() is deprecated, use ldap_initialize() instead.
|
||||
*/
|
||||
{
|
||||
int rc;
|
||||
int rc = LDAP_SUCCESS;
|
||||
char *url = host;
|
||||
if (!ldap_is_ldap_url(url)) {
|
||||
int urllen = hostlen + sizeof( "ldap://:65535" );
|
||||
@@ -367,7 +372,21 @@ PHP_FUNCTION(ldap_connect)
|
||||
snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port );
|
||||
}
|
||||
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP
|
||||
/* ldap_init() is deprecated, use ldap_initialize() instead.
|
||||
*/
|
||||
rc = ldap_initialize(&ldap, url);
|
||||
#else /* ! LDAP_API_FEATURE_X_OPENLDAP */
|
||||
/* ldap_init does not support URLs.
|
||||
* We must try the original host and port information.
|
||||
*/
|
||||
ldap = ldap_init(host, port);
|
||||
if (ldap == NULL) {
|
||||
efree(ld);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create session handle");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
|
||||
if (url != host) {
|
||||
efree(url);
|
||||
}
|
||||
@@ -465,14 +484,19 @@ PHP_FUNCTION(ldap_bind)
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP
|
||||
/* ldap_simple_bind_s() is deprecated, use ldap_sasl_bind_s() instead.
|
||||
*/
|
||||
struct berval cred;
|
||||
|
||||
/* ldap_bind_s() is deprecated; use ldap_sasl_bind_s() instead */
|
||||
cred.bv_val = ldap_bind_pw;
|
||||
cred.bv_len = ldap_bind_pw ? ldap_bind_pwlen : 0;
|
||||
rc = ldap_sasl_bind_s(ld->link, ldap_bind_dn, LDAP_SASL_SIMPLE, &cred,
|
||||
NULL, NULL, /* no controls right now */
|
||||
NULL); /* we don't care about the server's credentials */
|
||||
#else /* ! LDAP_API_FEATURE_X_OPENLDAP */
|
||||
rc = ldap_simple_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw);
|
||||
#endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
|
||||
}
|
||||
if ( rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc));
|
||||
@@ -644,7 +668,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
|
||||
/* timelimit */
|
||||
if (timelimit > -1) {
|
||||
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_timelimit);
|
||||
ldap_get_option(ldap, LDAP_OPT_TIMELIMIT, old_timelimit);
|
||||
ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
|
||||
#else
|
||||
*old_timelimit = ldap->ld_timelimit;
|
||||
@@ -655,7 +679,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
|
||||
/* deref */
|
||||
if (deref > -1) {
|
||||
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_deref);
|
||||
ldap_get_option(ldap, LDAP_OPT_DEREF, old_deref);
|
||||
ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
|
||||
#else
|
||||
*old_deref = ldap->ld_deref;
|
||||
@@ -1304,7 +1328,6 @@ PHP_FUNCTION(ldap_explode_dn)
|
||||
add_index_string(return_value, i, ldap_value[i], 1);
|
||||
}
|
||||
|
||||
/* ldap_value_free() is deprecated */
|
||||
ldap_memvfree((void **)ldap_value);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2046,6 +2069,25 @@ PHP_FUNCTION(ldap_get_option)
|
||||
zval_dtor(retval);
|
||||
ZVAL_LONG(retval, (timeout / 1000));
|
||||
} break;
|
||||
#endif
|
||||
#ifdef LDAP_OPT_TIMEOUT
|
||||
case LDAP_OPT_TIMEOUT:
|
||||
{
|
||||
struct timeval *timeout = NULL;
|
||||
|
||||
if (ldap_get_option(ld->link, LDAP_OPT_TIMEOUT, (void *) &timeout)) {
|
||||
if (timeout) {
|
||||
ldap_memfree(timeout);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (!timeout) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zval_dtor(retval);
|
||||
ZVAL_LONG(retval, timeout->tv_sec);
|
||||
ldap_memfree(timeout);
|
||||
} break;
|
||||
#endif
|
||||
/* options with string value */
|
||||
case LDAP_OPT_ERROR_STRING:
|
||||
@@ -2149,6 +2191,19 @@ PHP_FUNCTION(ldap_set_option)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
#ifdef LDAP_OPT_TIMEOUT
|
||||
case LDAP_OPT_TIMEOUT:
|
||||
{
|
||||
struct timeval timeout;
|
||||
|
||||
convert_to_long_ex(newval);
|
||||
timeout.tv_sec = Z_LVAL_PP(newval);
|
||||
timeout.tv_usec = 0;
|
||||
if (ldap_set_option(ldap, LDAP_OPT_TIMEOUT, (void *) &timeout)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
/* options with string value */
|
||||
case LDAP_OPT_ERROR_STRING:
|
||||
@@ -2485,7 +2540,7 @@ PHP_FUNCTION(ldap_start_tls)
|
||||
#endif
|
||||
#endif /* (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP */
|
||||
|
||||
#if defined(HAVE_3ARG_SETREBINDPROC)
|
||||
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
|
||||
/* {{{ _ldap_rebind_proc()
|
||||
*/
|
||||
int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgid, void *params)
|
||||
@@ -3138,7 +3193,7 @@ ZEND_END_ARG_INFO()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_3ARG_SETREBINDPROC)
|
||||
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_rebind_proc, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, link)
|
||||
ZEND_ARG_INFO(0, callback)
|
||||
@@ -3226,7 +3281,7 @@ const zend_function_entry ldap_functions[] = {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_3ARG_SETREBINDPROC)
|
||||
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
|
||||
PHP_FE(ldap_set_rebind_proc, arginfo_ldap_set_rebind_proc)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
|
||||
ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
|
||||
ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
|
||||
ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
|
||||
ldap_set_option($link, LDAP_OPT_TIMEOUT, 55);
|
||||
ldap_set_option($link, LDAP_OPT_REFERRALS, false);
|
||||
ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls);
|
||||
ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls);
|
||||
@@ -35,6 +36,8 @@ var_dump(
|
||||
$option,
|
||||
ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
|
||||
$option,
|
||||
ldap_get_option($link, LDAP_OPT_TIMEOUT, $option),
|
||||
$option,
|
||||
ldap_get_option($link, LDAP_OPT_REFERRALS, $option),
|
||||
$option,
|
||||
ldap_get_option($link, LDAP_OPT_RESTART, $option),
|
||||
@@ -56,6 +59,8 @@ int(33)
|
||||
bool(true)
|
||||
int(44)
|
||||
bool(true)
|
||||
int(55)
|
||||
bool(true)
|
||||
int(0)
|
||||
bool(true)
|
||||
int(0)
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
--TEST--
|
||||
ldap_search() test - test that overrides aren't permanent
|
||||
--CREDITS--
|
||||
Tyson Andre <tandre@ifwe.co>
|
||||
# Based on ldap_search_basic.phpt
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifbindfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_SEARCHING);
|
||||
ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
|
||||
ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
|
||||
ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
|
||||
|
||||
insert_dummy_data($link, $base);
|
||||
var_dump(
|
||||
$result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER),
|
||||
ldap_get_entries($link, $result)
|
||||
);
|
||||
var_dump(
|
||||
ldap_get_option($link, LDAP_OPT_DEREF, $option),
|
||||
$option,
|
||||
ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
|
||||
$option,
|
||||
ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
|
||||
$option,
|
||||
ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
|
||||
$option
|
||||
);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
remove_dummy_data($link, $base);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (ldap result)
|
||||
array(4) {
|
||||
["count"]=>
|
||||
int(3)
|
||||
[0]=>
|
||||
array(14) {
|
||||
["objectclass"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(6) "person"
|
||||
}
|
||||
[0]=>
|
||||
string(11) "objectclass"
|
||||
["cn"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(5) "userA"
|
||||
}
|
||||
[1]=>
|
||||
string(2) "cn"
|
||||
["sn"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(7) "testSN1"
|
||||
}
|
||||
[2]=>
|
||||
string(2) "sn"
|
||||
["userpassword"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(4) "oops"
|
||||
}
|
||||
[3]=>
|
||||
string(12) "userpassword"
|
||||
["telephonenumber"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(14) "xx-xx-xx-xx-xx"
|
||||
}
|
||||
[4]=>
|
||||
string(15) "telephonenumber"
|
||||
["description"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(6) "user A"
|
||||
}
|
||||
[5]=>
|
||||
string(11) "description"
|
||||
["count"]=>
|
||||
int(6)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userA,%s"
|
||||
}
|
||||
[1]=>
|
||||
array(12) {
|
||||
["objectclass"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(6) "person"
|
||||
}
|
||||
[0]=>
|
||||
string(11) "objectclass"
|
||||
["cn"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(5) "userB"
|
||||
}
|
||||
[1]=>
|
||||
string(2) "cn"
|
||||
["sn"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(7) "testSN2"
|
||||
}
|
||||
[2]=>
|
||||
string(2) "sn"
|
||||
["userpassword"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(15) "oopsIDitItAgain"
|
||||
}
|
||||
[3]=>
|
||||
string(12) "userpassword"
|
||||
["description"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(6) "user B"
|
||||
}
|
||||
[4]=>
|
||||
string(11) "description"
|
||||
["count"]=>
|
||||
int(5)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userB,%s"
|
||||
}
|
||||
[2]=>
|
||||
array(10) {
|
||||
["objectclass"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(6) "person"
|
||||
}
|
||||
[0]=>
|
||||
string(11) "objectclass"
|
||||
["cn"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(5) "userC"
|
||||
}
|
||||
[1]=>
|
||||
string(2) "cn"
|
||||
["sn"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(7) "testSN3"
|
||||
}
|
||||
[2]=>
|
||||
string(2) "sn"
|
||||
["userpassword"]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
string(17) "0r1g1na1 passw0rd"
|
||||
}
|
||||
[3]=>
|
||||
string(12) "userpassword"
|
||||
["count"]=>
|
||||
int(4)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userC,cn=userB,%s"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(1)
|
||||
bool(true)
|
||||
int(123)
|
||||
bool(true)
|
||||
int(33)
|
||||
bool(true)
|
||||
int(44)
|
||||
===DONE===
|
||||
+23
-13
@@ -288,6 +288,8 @@ const zend_function_entry mcrypt_functions[] = { /* {{{ */
|
||||
static PHP_MINFO_FUNCTION(mcrypt);
|
||||
static PHP_MINIT_FUNCTION(mcrypt);
|
||||
static PHP_MSHUTDOWN_FUNCTION(mcrypt);
|
||||
static PHP_GINIT_FUNCTION(mcrypt);
|
||||
static PHP_GSHUTDOWN_FUNCTION(mcrypt);
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(mcrypt)
|
||||
|
||||
@@ -300,8 +302,8 @@ zend_module_entry mcrypt_module_entry = {
|
||||
PHP_MINFO(mcrypt),
|
||||
NO_VERSION_YET,
|
||||
PHP_MODULE_GLOBALS(mcrypt),
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_GINIT(mcrypt),
|
||||
PHP_GSHUTDOWN(mcrypt),
|
||||
NULL,
|
||||
STANDARD_MODULE_PROPERTIES_EX
|
||||
};
|
||||
@@ -381,6 +383,25 @@ static void php_mcrypt_module_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static PHP_GINIT_FUNCTION(mcrypt)
|
||||
{
|
||||
mcrypt_globals->fd[RANDOM] = -1;
|
||||
mcrypt_globals->fd[URANDOM] = -1;
|
||||
}
|
||||
|
||||
static PHP_GSHUTDOWN_FUNCTION(mcrypt)
|
||||
{
|
||||
if (mcrypt_globals->fd[RANDOM] > 0) {
|
||||
close(mcrypt_globals->fd[RANDOM]);
|
||||
mcrypt_globals->fd[RANDOM] = -1;
|
||||
}
|
||||
|
||||
if (mcrypt_globals->fd[URANDOM] > 0) {
|
||||
close(mcrypt_globals->fd[URANDOM]);
|
||||
mcrypt_globals->fd[URANDOM] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */
|
||||
{
|
||||
le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number);
|
||||
@@ -438,9 +459,6 @@ static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */
|
||||
php_stream_filter_register_factory("mcrypt.*", &php_mcrypt_filter_factory TSRMLS_CC);
|
||||
php_stream_filter_register_factory("mdecrypt.*", &php_mcrypt_filter_factory TSRMLS_CC);
|
||||
|
||||
MCG(fd[RANDOM]) = -1;
|
||||
MCG(fd[URANDOM]) = -1;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -450,14 +468,6 @@ static PHP_MSHUTDOWN_FUNCTION(mcrypt) /* {{{ */
|
||||
php_stream_filter_unregister_factory("mcrypt.*" TSRMLS_CC);
|
||||
php_stream_filter_unregister_factory("mdecrypt.*" TSRMLS_CC);
|
||||
|
||||
if (MCG(fd[RANDOM]) > 0) {
|
||||
close(MCG(fd[RANDOM]));
|
||||
}
|
||||
|
||||
if (MCG(fd[URANDOM]) > 0) {
|
||||
close(MCG(fd[URANDOM]));
|
||||
}
|
||||
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,27 @@ mysqlnd_set_sock_no_delay(php_stream * stream TSRMLS_DC)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_set_sock_keepalive */
|
||||
static int
|
||||
mysqlnd_set_sock_keepalive(php_stream * stream TSRMLS_DC)
|
||||
{
|
||||
|
||||
int socketd = ((php_netstream_data_t*)stream->abstract)->socket;
|
||||
int ret = SUCCESS;
|
||||
int flag = 1;
|
||||
int result = setsockopt(socketd, SOL_SOCKET, SO_KEEPALIVE, (char *) &flag, sizeof(int));
|
||||
|
||||
DBG_ENTER("mysqlnd_set_sock_keepalive");
|
||||
|
||||
if (result == -1) {
|
||||
ret = FAILURE;
|
||||
}
|
||||
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_net::network_read_ex */
|
||||
static enum_func_status
|
||||
MYSQLND_METHOD(mysqlnd_net, network_read_ex)(MYSQLND_NET * const net, zend_uchar * const buffer, const size_t count,
|
||||
@@ -252,6 +273,8 @@ MYSQLND_METHOD(mysqlnd_net, post_connect_set_opt)(MYSQLND_NET * const net,
|
||||
if (!memcmp(scheme, "tcp://", sizeof("tcp://") - 1)) {
|
||||
/* TCP -> Set TCP_NODELAY */
|
||||
mysqlnd_set_sock_no_delay(net_stream TSRMLS_CC);
|
||||
/* TCP -> Set SO_KEEPALIVE */
|
||||
mysqlnd_set_sock_keepalive(net_stream TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -367,6 +367,10 @@ static inline void del_source(zend_code_block *from, zend_code_block *to)
|
||||
return;
|
||||
}
|
||||
|
||||
if (from == to) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (*cs) {
|
||||
if ((*cs)->from == from) {
|
||||
DEL_SOURCE(cs);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #70237 (Empty while and do-while segmentation fault with opcode on CLI enabled)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
function neverUsed() {
|
||||
$bool = false;
|
||||
while ($bool) { };
|
||||
//do { } while ($bool);
|
||||
}
|
||||
?>
|
||||
okey
|
||||
--EXPECT--
|
||||
okey
|
||||
+10
-8
@@ -348,11 +348,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_verify, 0, 0, 3)
|
||||
ZEND_ARG_INFO(0, method)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_openssl_seal, 0)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_seal, 0, 0, 4)
|
||||
ZEND_ARG_INFO(0, data)
|
||||
ZEND_ARG_INFO(1, sealdata)
|
||||
ZEND_ARG_INFO(1, ekeys) /* arary */
|
||||
ZEND_ARG_INFO(0, pubkeys) /* array */
|
||||
ZEND_ARG_INFO(0, method)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_openssl_open, 0)
|
||||
@@ -3597,13 +3598,10 @@ PHP_FUNCTION(openssl_pkey_new)
|
||||
OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, g);
|
||||
OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, priv_key);
|
||||
OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, pub_key);
|
||||
if (dh->p && dh->g) {
|
||||
if (!dh->pub_key) {
|
||||
DH_generate_key(dh);
|
||||
}
|
||||
if (EVP_PKEY_assign_DH(pkey, dh)) {
|
||||
RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC));
|
||||
}
|
||||
if (dh->p && dh->g &&
|
||||
(dh->pub_key || DH_generate_key(dh)) &&
|
||||
EVP_PKEY_assign_DH(pkey, dh)) {
|
||||
RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC));
|
||||
}
|
||||
DH_free(dh);
|
||||
}
|
||||
@@ -4873,6 +4871,10 @@ PHP_FUNCTION(openssl_seal)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature algorithm.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (EVP_CIPHER_iv_length(cipher) > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ciphers with modes requiring IV are not supported");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
cipher = EVP_rc4();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #55259 (openssl extension does not get the DH parameters from DH key resource)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("openssl")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
|
||||
'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
|
||||
'7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
|
||||
'6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
|
||||
$dh_details = array( 'p' => $phex, 'g' => '2' );
|
||||
$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => $phex, 'g' => '2' )));
|
||||
var_dump($dh);
|
||||
$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => hex2bin($phex), 'g' => '2' )));
|
||||
$details = openssl_pkey_get_details($dh);
|
||||
var_dump(bin2hex($details['dh']['p']));
|
||||
var_dump($details['dh']['g']);
|
||||
var_dump(strlen($details['dh']['pub_key']));
|
||||
var_dump(strlen($details['dh']['priv_key']));
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
string(256) "dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab"
|
||||
string(1) "2"
|
||||
int(128)
|
||||
int(128)
|
||||
Done
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #60632: openssl_seal fails with AES
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$pkey = openssl_pkey_new(array(
|
||||
'digest_alg' => 'sha256',
|
||||
'private_key_bits' => 1024,
|
||||
'private_key_type' => OPENSSL_KEYTYPE_RSA,
|
||||
'encrypt_key' => false
|
||||
));
|
||||
$details = openssl_pkey_get_details($pkey);
|
||||
$test_pubkey = $details['key'];
|
||||
$pubkey = openssl_pkey_get_public($test_pubkey);
|
||||
$encrypted = null;
|
||||
$ekeys = array();
|
||||
$result = openssl_seal('test phrase', $encrypted, $ekeys, array($pubkey), 'AES-256-CBC');
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: openssl_seal(): Ciphers with modes requiring IV are not supported in %s on line %d
|
||||
Done
|
||||
@@ -13,7 +13,7 @@ var_dump($info["validFrom"], $info["validFrom_time_t"], $info["validTo"], $info[
|
||||
Done
|
||||
--EXPECTF--
|
||||
string(15) "20090303125318Z"
|
||||
int(1236084798)
|
||||
int(12360%d)
|
||||
string(15) "20240303125318Z"
|
||||
int(1709470398)
|
||||
int(17094%d)
|
||||
Done
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #70395 (Missing ARG_INFO for openssl_seal())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$func = new ReflectionFunction('openssl_seal');
|
||||
$param = $func->getParameters()[4];
|
||||
var_dump($param);
|
||||
var_dump($param->isOptional());
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(ReflectionParameter)#%d (1) {
|
||||
["name"]=>
|
||||
string(6) "method"
|
||||
}
|
||||
bool(true)
|
||||
+84
-79
@@ -43,6 +43,11 @@
|
||||
|
||||
#define PCRE_CACHE_SIZE 4096
|
||||
|
||||
/* not fully functional workaround for libpcre < 8.0, see bug #70232 */
|
||||
#ifndef PCRE_NOTEMPTY_ATSTART
|
||||
# define PCRE_NOTEMPTY_ATSTART PCRE_NOTEMPTY
|
||||
#endif
|
||||
|
||||
enum {
|
||||
PHP_PCRE_NO_ERROR = 0,
|
||||
PHP_PCRE_INTERNAL_ERROR,
|
||||
@@ -136,7 +141,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);
|
||||
@@ -296,18 +301,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++;
|
||||
@@ -360,7 +365,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);
|
||||
|
||||
@@ -368,7 +373,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 */
|
||||
@@ -376,7 +381,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;
|
||||
@@ -389,12 +394,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;
|
||||
@@ -474,7 +479,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);
|
||||
@@ -503,7 +508,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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -513,7 +518,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;
|
||||
}
|
||||
@@ -523,7 +528,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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -540,7 +545,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);
|
||||
@@ -565,14 +570,14 @@ 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;
|
||||
}
|
||||
|
||||
pce->refcount++;
|
||||
php_pcre_match_impl(pce, subject, subject_len, return_value, subpats,
|
||||
php_pcre_match_impl(pce, subject, subject_len, return_value, subpats,
|
||||
global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC);
|
||||
pce->refcount--;
|
||||
}
|
||||
@@ -682,7 +687,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,
|
||||
@@ -704,7 +709,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);
|
||||
@@ -747,7 +752,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) {
|
||||
@@ -794,7 +799,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
pcre_free((void *) stringlist);
|
||||
}
|
||||
} else if (count == PCRE_ERROR_NOMATCH) {
|
||||
/* If we previously set PCRE_NOTEMPTY after a null match,
|
||||
/* If we previously set PCRE_NOTEMPTY_ATSTART after a null match,
|
||||
this is not necessarily the end. We need to advance
|
||||
the start offset, and continue. Fudge the offset values
|
||||
to achieve this, unless we're already at the end of the string. */
|
||||
@@ -809,12 +814,12 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
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
|
||||
This turns out to be rather cunning. First we set PCRE_NOTEMPTY_ATSTART 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;
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY_ATSTART | PCRE_ANCHORED : 0;
|
||||
|
||||
/* Advance to the position right after the last full match */
|
||||
start_offset = offsets[1];
|
||||
@@ -836,7 +841,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
add_assoc_zval(subpats, "MARK", marks);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
efree(offsets);
|
||||
efree(subpat_names);
|
||||
|
||||
@@ -886,7 +891,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++;
|
||||
@@ -898,9 +903,9 @@ static int preg_get_backref(char **str, int *backref)
|
||||
else
|
||||
walk++;
|
||||
}
|
||||
|
||||
|
||||
*str = walk;
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -910,7 +915,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;
|
||||
|
||||
@@ -964,11 +969,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) {
|
||||
@@ -1021,15 +1026,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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1058,7 +1063,7 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
/* }}} */
|
||||
|
||||
/* {{{ 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 */
|
||||
@@ -1139,7 +1144,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);
|
||||
|
||||
@@ -1148,7 +1153,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,
|
||||
@@ -1165,7 +1170,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;
|
||||
}
|
||||
@@ -1173,7 +1178,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,
|
||||
@@ -1218,7 +1223,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) {
|
||||
@@ -1256,7 +1261,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
limit--;
|
||||
|
||||
} else if (count == PCRE_ERROR_NOMATCH || limit == 0) {
|
||||
/* If we previously set PCRE_NOTEMPTY after a null match,
|
||||
/* If we previously set PCRE_NOTEMPTY_ATSTART after a null match,
|
||||
this is not necessarily the end. We need to advance
|
||||
the start offset, and continue. Fudge the offset values
|
||||
to achieve this, unless we're already at the end of the string. */
|
||||
@@ -1288,12 +1293,12 @@ 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
|
||||
This turns out to be rather cunning. First we set PCRE_NOTEMPTY_ATSTART 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;
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY_ATSTART | PCRE_ANCHORED : 0;
|
||||
|
||||
/* Advance to the next piece. */
|
||||
start_offset = offsets[1];
|
||||
@@ -1318,18 +1323,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;
|
||||
@@ -1338,9 +1343,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 */
|
||||
@@ -1355,7 +1360,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),
|
||||
@@ -1412,12 +1417,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;
|
||||
@@ -1443,10 +1448,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);
|
||||
@@ -1474,7 +1479,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 */
|
||||
@@ -1491,7 +1496,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
zval_dtor(*zcount);
|
||||
ZVAL_LONG(*zcount, replace_count);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1519,7 +1524,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)
|
||||
{
|
||||
@@ -1531,12 +1536,12 @@ 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;
|
||||
@@ -1573,7 +1578,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;
|
||||
}
|
||||
@@ -1599,13 +1604,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,
|
||||
@@ -1620,9 +1625,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) {
|
||||
@@ -1638,7 +1643,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];
|
||||
|
||||
@@ -1659,7 +1664,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
}
|
||||
} else if (count == PCRE_ERROR_NOMATCH) {
|
||||
/* If we previously set PCRE_NOTEMPTY after a null match,
|
||||
/* If we previously set PCRE_NOTEMPTY_ATSTART after a null match,
|
||||
this is not necessarily the end. We need to advance
|
||||
the start offset, and continue. Fudge the offset values
|
||||
to achieve this, unless we're already at the end of the string. */
|
||||
@@ -1691,10 +1696,10 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
|
||||
/* 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
|
||||
This turns out to be rather cunning. First we set PCRE_NOTEMPTY_ATSTART 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;
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY_ATSTART | PCRE_ANCHORED : 0;
|
||||
|
||||
/* Advance to the position right after the last full match */
|
||||
start_offset = offsets[1];
|
||||
@@ -1714,7 +1719,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Clean up */
|
||||
efree(offsets);
|
||||
}
|
||||
@@ -1735,13 +1740,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 */
|
||||
@@ -1753,11 +1758,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;
|
||||
@@ -1801,7 +1806,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);
|
||||
}
|
||||
@@ -1822,7 +1827,7 @@ 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;
|
||||
@@ -1848,9 +1853,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;
|
||||
@@ -1869,7 +1874,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);
|
||||
|
||||
@@ -1982,7 +1987,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)
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
--TEST--
|
||||
Bug #69864 (Segfault in preg_replace_callback)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
--TEST--
|
||||
Bug #70232 (Incorrect bump-along behavior with \K and empty string match)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (version_compare(explode(' ', PCRE_VERSION)[0], '8.0', 'lt')) {
|
||||
die("skip this test requires libpcre >= 8.0");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$pattern = '~(?: |\G)\d\B\K~';
|
||||
$subject = "123 a123 1234567 b123 123";
|
||||
preg_match_all($pattern, $subject, $matches);
|
||||
var_dump($matches);
|
||||
var_dump(preg_replace($pattern, "*", $subject));
|
||||
var_dump(preg_split($pattern, $subject));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(10) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
[1]=>
|
||||
string(0) ""
|
||||
[2]=>
|
||||
string(0) ""
|
||||
[3]=>
|
||||
string(0) ""
|
||||
[4]=>
|
||||
string(0) ""
|
||||
[5]=>
|
||||
string(0) ""
|
||||
[6]=>
|
||||
string(0) ""
|
||||
[7]=>
|
||||
string(0) ""
|
||||
[8]=>
|
||||
string(0) ""
|
||||
[9]=>
|
||||
string(0) ""
|
||||
}
|
||||
}
|
||||
string(35) "1*2*3 a123 1*2*3*4*5*6*7 b123 1*2*3"
|
||||
array(11) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "2"
|
||||
[2]=>
|
||||
string(8) "3 a123 1"
|
||||
[3]=>
|
||||
string(1) "2"
|
||||
[4]=>
|
||||
string(1) "3"
|
||||
[5]=>
|
||||
string(1) "4"
|
||||
[6]=>
|
||||
string(1) "5"
|
||||
[7]=>
|
||||
string(1) "6"
|
||||
[8]=>
|
||||
string(8) "7 b123 1"
|
||||
[9]=>
|
||||
string(1) "2"
|
||||
[10]=>
|
||||
string(1) "3"
|
||||
}
|
||||
@@ -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) {
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
--TEST--
|
||||
Compiled regex cache limit
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
define('PREG_CACHE_SIZE', 4096+1);
|
||||
|
||||
+8
-2
@@ -289,8 +289,14 @@ static PHP_METHOD(PDO, dbh_constructor)
|
||||
Z_STRVAL_PP(v));
|
||||
is_persistent = 1;
|
||||
} else {
|
||||
convert_to_long_ex(v);
|
||||
is_persistent = Z_LVAL_PP(v) ? 1 : 0;
|
||||
if (Z_TYPE_PP(v) != IS_LONG) {
|
||||
zval tmp = **v;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_long(&tmp);
|
||||
is_persistent = Z_LVAL(tmp)? 1 : 0;
|
||||
} else {
|
||||
is_persistent = Z_LVAL_PP(v)? 1 : 0;
|
||||
}
|
||||
plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s", data_source,
|
||||
username ? username : "",
|
||||
password ? password : "");
|
||||
|
||||
@@ -197,7 +197,12 @@ static inline long pdo_attr_lval(zval *options, enum pdo_attribute_type option_n
|
||||
zval **v;
|
||||
|
||||
if (options && SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), option_name, (void**)&v)) {
|
||||
convert_to_long_ex(v);
|
||||
if (Z_TYPE_PP(v) != IS_LONG) {
|
||||
zval tmp = **v;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_long(&tmp);
|
||||
return Z_LVAL(tmp);
|
||||
}
|
||||
return Z_LVAL_PP(v);
|
||||
}
|
||||
return defval;
|
||||
@@ -207,7 +212,12 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio
|
||||
zval **v;
|
||||
|
||||
if (options && SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), option_name, (void**)&v)) {
|
||||
convert_to_string_ex(v);
|
||||
if (Z_TYPE_PP(v) != IS_STRING) {
|
||||
zval tmp = **v;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
return Z_STRVAL(tmp);
|
||||
}
|
||||
return estrndup(Z_STRVAL_PP(v), Z_STRLEN_PP(v));
|
||||
}
|
||||
return defval ? estrdup(defval) : NULL;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Bug #70389 (PDO constructor changes unrelated variables)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require(dirname(__FILE__). DIRECTORY_SEPARATOR . 'config.inc');
|
||||
$flags = [
|
||||
PDO::MYSQL_ATTR_FOUND_ROWS => true,
|
||||
PDO::MYSQL_ATTR_LOCAL_INFILE => true,
|
||||
PDO::ATTR_PERSISTENT => true,
|
||||
];
|
||||
|
||||
$std = new StdClass();
|
||||
$std->flags = $flags;
|
||||
|
||||
new PDO(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, $flags);
|
||||
var_dump($flags);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
[1005]=>
|
||||
bool(true)
|
||||
[1001]=>
|
||||
bool(true)
|
||||
[12]=>
|
||||
bool(true)
|
||||
}
|
||||
@@ -70,14 +70,16 @@ var_dump($db->pgsqlGetNotify());
|
||||
// Test second parameter, should wait 2 seconds because no notify is queued
|
||||
$t = microtime(1);
|
||||
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 1000);
|
||||
var_dump((microtime(1) - $t) >= 1);
|
||||
$diff = microtime(1) - $t;
|
||||
var_dump($diff >= 1 || 1 - abs($diff) < .01);
|
||||
var_dump($notify);
|
||||
|
||||
// Test second parameter, should return immediately because a notify is queued
|
||||
$db->exec("NOTIFY notifies_phpt");
|
||||
$t = microtime(1);
|
||||
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000);
|
||||
var_dump((microtime(1) - $t) < 1);
|
||||
$diff = microtime(1) - $t;
|
||||
var_dump($diff < 1 || abs(1 - abs($diff)) < .01);
|
||||
var_dump(count($notify));
|
||||
|
||||
?>
|
||||
|
||||
@@ -14,8 +14,8 @@ $r = new Phar($fname, 0);
|
||||
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
exception 'UnexpectedValueException' with message 'phar error: "%s/bug69453.tar.phar" is a corrupted tar file (checksum mismatch of file "")' in %s:%d
|
||||
exception 'UnexpectedValueException' with message 'phar error: "%s%ebug69453.tar.phar" is a corrupted tar file (checksum mismatch of file "")' in %s:%d
|
||||
Stack trace:
|
||||
#0 %s/bug69453.php(%d): Phar->__construct('%s', 0)
|
||||
#0 %s%ebug69453.php(%d): Phar->__construct('%s', 0)
|
||||
#1 {main}
|
||||
==DONE==
|
||||
==DONE==
|
||||
@@ -1,5 +1,7 @@
|
||||
--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";
|
||||
|
||||
@@ -75,11 +75,11 @@ string(5) "query"
|
||||
6:
|
||||
7:
|
||||
8:
|
||||
9:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
10:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
11:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
12:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
13:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
9:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
10:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
11:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
12:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
13:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
|
||||
Exception: Entry a does not exist and cannot be created: phar error: invalid path "a" contains illegal character
|
||||
===DONE===
|
||||
|
||||
+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);
|
||||
@@ -862,7 +864,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));
|
||||
@@ -871,7 +876,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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -947,8 +952,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);
|
||||
@@ -1039,8 +1047,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:
|
||||
@@ -1884,7 +1897,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);
|
||||
}
|
||||
@@ -2063,9 +2076,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);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2698,12 +2709,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) {
|
||||
|
||||
@@ -2753,7 +2764,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);
|
||||
@@ -2765,7 +2776,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;
|
||||
|
||||
@@ -2778,7 +2789,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)
|
||||
|
||||
@@ -19,4 +19,4 @@ 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
|
||||
Fatal error: Call to a member function xpath() on boolean in %s on line %d
|
||||
+52
-44
@@ -997,7 +997,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;
|
||||
@@ -1041,7 +1041,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};
|
||||
@@ -1071,7 +1071,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;
|
||||
@@ -1128,7 +1128,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;
|
||||
@@ -1163,7 +1163,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));
|
||||
@@ -1223,7 +1223,7 @@ PHP_METHOD(SoapServer, SoapServer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (typemap_ht) {
|
||||
service->typemap = soap_create_typemap(service->sdl, typemap_ht TSRMLS_CC);
|
||||
}
|
||||
@@ -1353,7 +1353,7 @@ PHP_METHOD(SoapServer, getFunctions)
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FETCH_THIS_SERVICE(service);
|
||||
|
||||
array_init(return_value);
|
||||
@@ -1513,7 +1513,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;
|
||||
}
|
||||
@@ -1935,7 +1935,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);
|
||||
@@ -2151,10 +2151,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;
|
||||
@@ -2223,10 +2223,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);
|
||||
@@ -2456,13 +2456,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 &&
|
||||
@@ -2497,7 +2497,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);
|
||||
@@ -2507,7 +2507,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);
|
||||
@@ -2615,7 +2615,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;
|
||||
}
|
||||
|
||||
@@ -2921,8 +2921,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 {
|
||||
@@ -2930,7 +2932,7 @@ PHP_METHOD(SoapClient, __call)
|
||||
free_soap_headers = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
arg_count = zend_hash_num_elements(Z_ARRVAL_P(args));
|
||||
|
||||
if (arg_count > 0) {
|
||||
@@ -2996,7 +2998,7 @@ PHP_METHOD(SoapClient, __getTypes)
|
||||
HashPosition pos;
|
||||
|
||||
FETCH_THIS_SDL(sdl);
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3025,7 +3027,7 @@ PHP_METHOD(SoapClient, __getTypes)
|
||||
PHP_METHOD(SoapClient, __getLastRequest)
|
||||
{
|
||||
zval **tmp;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3048,7 +3050,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);
|
||||
@@ -3063,11 +3065,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);
|
||||
@@ -3082,7 +3084,7 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
|
||||
PHP_METHOD(SoapClient, __getLastResponseHeaders)
|
||||
{
|
||||
zval **tmp;
|
||||
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3227,10 +3229,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)
|
||||
{
|
||||
@@ -3279,10 +3281,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);
|
||||
|
||||
@@ -3707,7 +3709,7 @@ ignore_header:
|
||||
func = func->children;
|
||||
}
|
||||
deserialize_parameters(func, function, num_params, parameters TSRMLS_CC);
|
||||
|
||||
|
||||
encode_finish();
|
||||
|
||||
return function;
|
||||
@@ -3989,8 +3991,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;
|
||||
|
||||
@@ -4014,7 +4016,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);
|
||||
}
|
||||
str_efree(str);
|
||||
@@ -4040,7 +4042,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);
|
||||
}
|
||||
str_efree(str);
|
||||
@@ -4212,7 +4214,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;
|
||||
@@ -4346,11 +4348,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 &&
|
||||
@@ -4389,7 +4398,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4500,7 +4508,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"
|
||||
+1
-1
@@ -358,7 +358,7 @@ PHP_FUNCTION(spl_autoload)
|
||||
* The "scope" is determined by an opcode, if it is ZEND_FETCH_CLASS we know function was called indirectly by
|
||||
* the Zend engine.
|
||||
*/
|
||||
if (active_opline->opcode != ZEND_FETCH_CLASS) {
|
||||
if (EG(opline_ptr) && active_opline->opcode != ZEND_FETCH_CLASS) {
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s could not be loaded", class_name);
|
||||
|
||||
+2
-2
@@ -1842,8 +1842,8 @@ outexcept:
|
||||
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ arginfo and function tbale */
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_array___construct, 0)
|
||||
/* {{{ arginfo and function table */
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_array___construct, 0, 0, 0)
|
||||
ZEND_ARG_INFO(0, array)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
|
||||
@@ -1219,6 +1219,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);
|
||||
}
|
||||
|
||||
@@ -859,6 +859,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;
|
||||
@@ -870,6 +871,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);
|
||||
|
||||
@@ -14,6 +14,6 @@ foreach($it as $k=>$v) { }
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'LogicException' with message 'The object is in an invalid state as the parent constructor was not called' in %s:%d
|
||||
Stack trace:
|
||||
#0 %s/bug54281.php(8): RecursiveIteratorIterator->rewind()
|
||||
#0 %s%ebug54281.php(8): RecursiveIteratorIterator->rewind()
|
||||
#1 {main}
|
||||
thrown in %s/bug54281.php on line 8
|
||||
thrown in %s%ebug54281.php on line 8
|
||||
@@ -13,4 +13,4 @@ $h->insert(6);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Fatal error: Call to undefined method SplMinHeap::notexist() in %s/bug69737.php on line %d
|
||||
Fatal error: Call to undefined method SplMinHeap::notexist() in %s%ebug69737.php on line %d
|
||||
@@ -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,9 @@
|
||||
--TEST--
|
||||
Bug #70290 (Null pointer deref (segfault) in spl_autoload via ob_start)
|
||||
--INI--
|
||||
display_errors=2
|
||||
--FILE--
|
||||
<?php ob_start("spl_autoload"); ?> 1
|
||||
--EXPECT--
|
||||
Fatal error: Unknown: Class 1
|
||||
could not be loaded in Unknown on line 0
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #70303 (Incorrect constructor reflection for ArrayObject)
|
||||
--FILE--
|
||||
<?php
|
||||
$f = new ReflectionClass('ArrayObject');
|
||||
$c = $f->getConstructor();
|
||||
$params = $c->getParameters();
|
||||
$param = $params[0];
|
||||
var_dump($param->isOptional());
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -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"
|
||||
}
|
||||
@@ -3515,7 +3515,7 @@ PHPAPI double php_get_inf(void) /* {{{ */
|
||||
|
||||
#define BASIC_ADD_SUBMODULE(module) \
|
||||
zend_hash_add_empty_element(&basic_submodules, #module, strlen(#module));
|
||||
|
||||
|
||||
#define BASIC_RINIT_SUBMODULE(module) \
|
||||
if (zend_hash_exists(&basic_submodules, #module, strlen(#module))) { \
|
||||
PHP_RINIT(module)(INIT_FUNC_ARGS_PASSTHRU); \
|
||||
@@ -5903,10 +5903,11 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal
|
||||
ALLOC_ZVAL(element);
|
||||
MAKE_COPY_ZVAL(&arg2, element);
|
||||
|
||||
if (arg3 && Z_STRLEN_P(arg3) > 0) {
|
||||
add_assoc_zval_ex(hash, Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, element);
|
||||
} else {
|
||||
if (!arg3 || (Z_TYPE_P(arg3) == IS_STRING && Z_STRLEN_P(arg3) == 0)) {
|
||||
add_next_index_zval(hash, element);
|
||||
} else {
|
||||
array_set_zval_key(Z_ARRVAL_P(hash), arg3, element);
|
||||
zval_ptr_dtor(&element);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
|
||||
|
||||
cookie = emalloc(len + 100);
|
||||
|
||||
if (value && value_len == 0) {
|
||||
if (value == NULL || value_len == 0) {
|
||||
/*
|
||||
* MSIE doesn't delete a cookie when you set it to a null value
|
||||
* so in order to force cookies to be deleted, even on MSIE, we
|
||||
|
||||
@@ -576,13 +576,13 @@ finish:
|
||||
}
|
||||
}
|
||||
|
||||
/* Send a Connection: close header when using HTTP 1.1 or later to avoid
|
||||
* hanging when the server interprets the RFC literally and establishes a
|
||||
* keep-alive connection, unless the user specifically requests something
|
||||
* else by specifying a Connection header in the context options. */
|
||||
if (protocol_version &&
|
||||
((have_header & HTTP_HEADER_CONNECTION) == 0) &&
|
||||
(strncmp(protocol_version, "1.0", MIN(protocol_version_len, 3)) > 0)) {
|
||||
/* Send a Connection: close header to avoid hanging when the server
|
||||
* interprets the RFC literally and establishes a keep-alive connection,
|
||||
* unless the user specifically requests something else by specifying a
|
||||
* Connection header in the context options. Send that header even for
|
||||
* HTTP/1.0 to avoid issues when the server respond with a HTTP/1.1
|
||||
* keep-alive response, which is the preferred response type. */
|
||||
if ((have_header & HTTP_HEADER_CONNECTION) == 0) {
|
||||
php_stream_write_string(stream, "Connection: close\r\n");
|
||||
}
|
||||
|
||||
|
||||
+18
-7
@@ -969,6 +969,10 @@ static int php_get_wbmp(php_stream *stream, struct gfxinfo **result, int check T
|
||||
return 0;
|
||||
}
|
||||
width = (width << 7) | (i & 0x7f);
|
||||
/* maximum valid width for wbmp (although 127 may be a more accurate one) */
|
||||
if (width > 2048) {
|
||||
return 0;
|
||||
}
|
||||
} while (i & 0x80);
|
||||
|
||||
/* get height */
|
||||
@@ -978,10 +982,13 @@ static int php_get_wbmp(php_stream *stream, struct gfxinfo **result, int check T
|
||||
return 0;
|
||||
}
|
||||
height = (height << 7) | (i & 0x7f);
|
||||
/* maximum valid heigth for wbmp (although 127 may be a more accurate one) */
|
||||
if (height > 2048) {
|
||||
return 0;
|
||||
}
|
||||
} while (i & 0x80);
|
||||
|
||||
/* maximum valid sizes for wbmp (although 127x127 may be a more accurate one) */
|
||||
if (!height || !width || height > 2048 || width > 2048) {
|
||||
if (!height || !width) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1223,6 +1230,7 @@ PHP_FUNCTION(image_type_to_extension)
|
||||
PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
|
||||
{
|
||||
char tmp[12];
|
||||
int twelve_bytes_read;
|
||||
|
||||
if ( !filetype) filetype = tmp;
|
||||
if((php_stream_read(stream, filetype, 3)) != 3) {
|
||||
@@ -1273,12 +1281,11 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
|
||||
return IMAGE_FILETYPE_ICO;
|
||||
}
|
||||
|
||||
if (php_stream_read(stream, filetype+4, 8) != 8) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!");
|
||||
return IMAGE_FILETYPE_UNKNOWN;
|
||||
}
|
||||
/* WBMP may be smaller than 12 bytes, so delay error */
|
||||
twelve_bytes_read = (php_stream_read(stream, filetype+4, 8) == 8);
|
||||
|
||||
/* BYTES READ: 12 */
|
||||
if (!memcmp(filetype, php_sig_jp2, 12)) {
|
||||
if (twelve_bytes_read && !memcmp(filetype, php_sig_jp2, 12)) {
|
||||
return IMAGE_FILETYPE_JP2;
|
||||
}
|
||||
|
||||
@@ -1286,6 +1293,10 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
|
||||
if (php_get_wbmp(stream, NULL, 1 TSRMLS_CC)) {
|
||||
return IMAGE_FILETYPE_WBMP;
|
||||
}
|
||||
if (!twelve_bytes_read) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!");
|
||||
return IMAGE_FILETYPE_UNKNOWN;
|
||||
}
|
||||
if (php_get_xbm(stream, NULL TSRMLS_CC)) {
|
||||
return IMAGE_FILETYPE_XBM;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,10 @@ OK
|
||||
Failed, not created in the correct directory %s vs %s
|
||||
0
|
||||
-- Iteration 6 --
|
||||
OK
|
||||
|
||||
Warning: tempnam() expects parameter 2 to be a valid path, string given in %stempnam_variation3-win32.php on line %d
|
||||
Failed, not created in the correct directory %s vs %stempnamVar3
|
||||
0
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: tempnam() expects parameter 2 to be a valid path, array given in %s\ext\standard\tests\file\tempnam_variation3-win32.php on line %d
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
parse_ini_string() crashes on values starting with number or unquoted strings
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$contents = <<<EOS
|
||||
[agatha.christie]
|
||||
title = 10 little indians
|
||||
foo[123] = E_ALL & ~E_DEPRECATED
|
||||
foo[456] = 123
|
||||
EOS;
|
||||
|
||||
var_dump(parse_ini_string($contents, false, INI_SCANNER_TYPED));
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
array(%d) {
|
||||
["title"]=>
|
||||
string(%d) "10 little indians"
|
||||
["foo"]=>
|
||||
array(%d) {
|
||||
[123]=>
|
||||
string(%d) "24575"
|
||||
[456]=>
|
||||
int(123)
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -86,44 +86,52 @@ array(7) {
|
||||
string(15) "HTTP/1.0 200 OK"
|
||||
}
|
||||
string(5) "done."
|
||||
string(195) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
GET /foo/bar2 HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
GET /foo/bar3 HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
GET /foo/bar4 HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: fail after 2 redirections --
|
||||
|
||||
Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
|
||||
bool(false)
|
||||
string(97) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
GET /foo/bar2 HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: fail at first redirection --
|
||||
|
||||
Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
|
||||
bool(false)
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: fail at first redirection (2) --
|
||||
|
||||
Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
|
||||
bool(false)
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: return at first redirection --
|
||||
@@ -135,8 +143,9 @@ array(2) {
|
||||
string(41) "Location: http://127.0.0.1:12342/foo/bar2"
|
||||
}
|
||||
string(1) "1"
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: return at first redirection (2) --
|
||||
@@ -148,8 +157,9 @@ array(2) {
|
||||
string(41) "Location: http://127.0.0.1:12342/foo/bar2"
|
||||
}
|
||||
string(1) "1"
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: return at second redirection --
|
||||
@@ -165,10 +175,12 @@ array(4) {
|
||||
string(41) "Location: http://127.0.0.1:12342/foo/bar3"
|
||||
}
|
||||
string(0) ""
|
||||
string(97) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
GET /foo/bar2 HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
@@ -39,18 +39,20 @@ echo "-- Test: requests with 'header' as string --\n";
|
||||
do_test(array('header' => "X-Foo: bar\r\nContent-Type: text/plain", 'method' => 'POST', 'content' => 'ohai'));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
-- Test: requests with 'header' as array --
|
||||
string(103) "POST / HTTP/1.0
|
||||
string(%d) "POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
Content-Length: 4
|
||||
X-Foo: bar
|
||||
Content-Type: text/plain
|
||||
|
||||
ohai"
|
||||
-- Test: requests with 'header' as string --
|
||||
string(103) "POST / HTTP/1.0
|
||||
string(%d) "POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
Content-Length: 4
|
||||
X-Foo: bar
|
||||
Content-Type: text/plain
|
||||
|
||||
@@ -41,17 +41,18 @@ ini_set('from', 'junk@junk.com');
|
||||
do_test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
-- Test: leave default --
|
||||
string(63) "GET / HTTP/1.0
|
||||
string(%d) "GET / HTTP/1.0
|
||||
From: teste@teste.pt
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: after ini_set --
|
||||
string(62) "GET / HTTP/1.0
|
||||
string(%d) "GET / HTTP/1.0
|
||||
From: junk@junk.com
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
|
||||
@@ -44,30 +44,35 @@ Done
|
||||
--EXPECT--
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
Content-type: text/plain
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
Content-type: text/plain
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
Content-type: text/plain
|
||||
@@ -75,34 +80,40 @@ Third:
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
Third:
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Content-type:text/plain
|
||||
Second:2
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Content-type:text/plain
|
||||
Second:2
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Content-type:text/plain
|
||||
Second:2
|
||||
@@ -110,9 +121,9 @@ Third:
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
First:1
|
||||
Second:2
|
||||
Third:
|
||||
|
||||
Done
|
||||
|
||||
@@ -53,6 +53,7 @@ do_test('1.1', 'keep-alive');
|
||||
HTTP/1.0, default behaviour:
|
||||
GET / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
HTTP/1.0, connection: close:
|
||||
GET / HTTP/1.0
|
||||
@@ -78,4 +79,3 @@ HTTP/1.1, connection: keep-alive:
|
||||
GET / HTTP/1.1
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: keep-alive
|
||||
|
||||
@@ -39,11 +39,14 @@ Done
|
||||
--EXPECT--
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
GET /foo HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
POST / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
Done
|
||||
@@ -27,7 +27,7 @@ function do_test($context_options) {
|
||||
if ($fd) {
|
||||
$meta_data = stream_get_meta_data($fd);
|
||||
var_dump($meta_data['wrapper_data']);
|
||||
|
||||
|
||||
var_dump(stream_get_contents($fd));
|
||||
}
|
||||
|
||||
@@ -62,16 +62,18 @@ array(2) {
|
||||
string(10) "X-Foo: bar"
|
||||
}
|
||||
string(1) "1"
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
|
||||
Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: HTTP request failed! HTTP/1.0 404 Not found
|
||||
in %s on line %d
|
||||
bool(false)
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: requests with ignore_errors --
|
||||
@@ -83,8 +85,9 @@ array(2) {
|
||||
string(10) "X-Foo: bar"
|
||||
}
|
||||
string(1) "1"
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
resource(%d) of type (stream)
|
||||
@@ -95,8 +98,9 @@ array(2) {
|
||||
string(10) "X-bar: baz"
|
||||
}
|
||||
string(1) "2"
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
-- Test: requests with ignore_errors (2) --
|
||||
@@ -108,8 +112,9 @@ array(2) {
|
||||
string(10) "X-Foo: bar"
|
||||
}
|
||||
string(1) "1"
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
resource(%d) of type (stream)
|
||||
@@ -120,7 +125,8 @@ array(2) {
|
||||
string(10) "X-bar: baz"
|
||||
}
|
||||
string(1) "2"
|
||||
string(48) "GET /foo/bar HTTP/1.0
|
||||
string(%d) "GET /foo/bar HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
|
||||
"
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #70052 (getimagesize() fails for very large and very small WBMP)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(getimagesize(__DIR__ . '/bug70052_1.wbmp'));
|
||||
var_dump(getimagesize(__DIR__ . '/bug70052_2.wbmp'));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(3)
|
||||
[1]=>
|
||||
int(3)
|
||||
[2]=>
|
||||
int(15)
|
||||
[3]=>
|
||||
string(20) "width="3" height="3""
|
||||
["mime"]=>
|
||||
string(18) "image/vnd.wap.wbmp"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@ Bug #70096 (Repeated iptcembed() adds superfluous FF bytes)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!function_exists('imagejpeg')) die('skip imagejpeg not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Bug #55472 (ip2long(integer) returns integer)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(ip2long(26));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -6,6 +6,7 @@ date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
setcookie('name');
|
||||
setcookie('name', '');
|
||||
setcookie('name', 'value');
|
||||
setcookie('name', 'space value');
|
||||
setcookie('name', 'value', 0);
|
||||
@@ -19,7 +20,8 @@ setcookie('name', 'value', 0, '', '', FALSE, TRUE);
|
||||
|
||||
|
||||
$expected = array(
|
||||
'Set-Cookie: name=',
|
||||
'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0',
|
||||
'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0',
|
||||
'Set-Cookie: name=value',
|
||||
'Set-Cookie: name=space+value',
|
||||
'Set-Cookie: name=value',
|
||||
@@ -64,6 +66,7 @@ while (next($headers) !== FALSE);
|
||||
echo ($i === 0)
|
||||
? 'OK'
|
||||
: 'A total of '.$i.' errors found.';
|
||||
?>
|
||||
--EXPECTHEADERS--
|
||||
|
||||
--EXPECT--
|
||||
|
||||
@@ -7,11 +7,11 @@ $e = unserialize('O:9:"Exception":7:{s:17:"'."\0".'Exception'."\0".'string";s:1:
|
||||
var_dump($e."");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined property: Exception::$message in %s/bug69793.php on line %d
|
||||
Notice: Undefined property: Exception::$message in %s%ebug69793.php on line %d
|
||||
|
||||
Notice: Undefined property: Exception::$file in %s/bug69793.php on line %d
|
||||
Notice: Undefined property: Exception::$file in %s%ebug69793.php on line %d
|
||||
|
||||
Notice: Undefined property: Exception::$previous in %s/bug69793.php on line %d
|
||||
Notice: Undefined property: Exception::$previous in %s%ebug69793.php on line %d
|
||||
string(53) "exception 'Exception' in :1337
|
||||
Stack trace:
|
||||
#0 {main}"
|
||||
@@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
Bug #70172 - Use After Free Vulnerability in unserialize()
|
||||
--XFAIL--
|
||||
Memory leak on debug build, needs fix.
|
||||
--FILE--
|
||||
<?php
|
||||
class obj implements Serializable {
|
||||
var $data;
|
||||
function serialize() {
|
||||
return serialize($this->data);
|
||||
}
|
||||
function unserialize($data) {
|
||||
$this->data = unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
$fakezval = ptr2str(1122334455);
|
||||
$fakezval .= ptr2str(0);
|
||||
$fakezval .= "\x00\x00\x00\x00";
|
||||
$fakezval .= "\x01";
|
||||
$fakezval .= "\x00";
|
||||
$fakezval .= "\x00\x00";
|
||||
|
||||
$inner = 'r:2;';
|
||||
$exploit = 'a:2:{i:0;i:1;i:1;C:3:"obj":'.strlen($inner).':{'.$inner.'}}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = $fakezval.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
|
||||
function ptr2str($ptr)
|
||||
{
|
||||
$out = '';
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$out .= chr($ptr & 0xff);
|
||||
$ptr >>= 8;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
object(obj)#%d (1) {
|
||||
["data"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
--TEST--
|
||||
Bug #70172 - Use After Free Vulnerability in unserialize()
|
||||
--FILE--
|
||||
<?php
|
||||
class obj implements Serializable {
|
||||
var $data;
|
||||
function serialize() {
|
||||
return serialize($this->data);
|
||||
}
|
||||
function unserialize($data) {
|
||||
$this->data = unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
class obj2 {
|
||||
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 = 'r:2;';
|
||||
$exploit = 'a:2:{i:0;O:4:"obj2":1:{s:4:"ryat";C:3:"obj":'.strlen($inner).':{'.$inner.'}}i:1;a:1:{i:0;a:1:{i:0;R:4;}}}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = $fakezval.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
|
||||
function ptr2str($ptr)
|
||||
{
|
||||
$out = '';
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$out .= chr($ptr & 0xff);
|
||||
$ptr >>= 8;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(obj2)#%d (1) {
|
||||
["ryat"]=>
|
||||
int(1)
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
object(obj2)#%d (1) {
|
||||
["ryat"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #70219 Use after free vulnerability in session deserializer
|
||||
--FILE--
|
||||
<?php
|
||||
class obj implements Serializable {
|
||||
var $data;
|
||||
function serialize() {
|
||||
return serialize($this->data);
|
||||
}
|
||||
function unserialize($data) {
|
||||
session_start();
|
||||
session_decode($data);
|
||||
}
|
||||
}
|
||||
|
||||
$inner = 'ryat|a:1:{i:0;a:1:{i:1;';
|
||||
$exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;R:4;}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = 'hi'.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(obj)#%d (1) {
|
||||
["data"]=>
|
||||
NULL
|
||||
}
|
||||
[1]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
--TEST--
|
||||
Bug #70219 Use after free vulnerability in session deserializer
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set('session.serialize_handler', 'php_serialize');
|
||||
session_start();
|
||||
|
||||
class obj implements Serializable {
|
||||
var $data;
|
||||
function serialize() {
|
||||
return serialize($this->data);
|
||||
}
|
||||
function unserialize($data) {
|
||||
session_decode($data);
|
||||
}
|
||||
}
|
||||
|
||||
$inner = 'r:2;';
|
||||
$exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;C:3:"obj":'.strlen($inner).':{'.$inner.'}}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = 'hi'.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
var_dump($_SESSION);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
&object(obj)#%d (1) {
|
||||
["data"]=>
|
||||
NULL
|
||||
}
|
||||
[1]=>
|
||||
object(obj)#%d (1) {
|
||||
["data"]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
object(obj)#1 (1) {
|
||||
["data"]=>
|
||||
NULL
|
||||
}
|
||||
@@ -73,7 +73,7 @@ string(19) "Serbian_Serbia.1250"
|
||||
string(1) ","
|
||||
string(1) "."
|
||||
string(3) "RSD"
|
||||
string(4) "din."
|
||||
string(3) "RSD"
|
||||
string(1) ","
|
||||
string(1) "."
|
||||
++++++++++++++++++++++
|
||||
|
||||
@@ -488,7 +488,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void stream_bucket_prepend(resource brigade, resource bucket)
|
||||
/* {{{ proto void stream_bucket_prepend(resource brigade, object bucket)
|
||||
Prepend bucket to brigade */
|
||||
PHP_FUNCTION(stream_bucket_prepend)
|
||||
{
|
||||
@@ -496,7 +496,7 @@ PHP_FUNCTION(stream_bucket_prepend)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void stream_bucket_append(resource brigade, resource bucket)
|
||||
/* {{{ proto void stream_bucket_append(resource brigade, object bucket)
|
||||
Append bucket to brigade */
|
||||
PHP_FUNCTION(stream_bucket_append)
|
||||
{
|
||||
|
||||
+20
-4
@@ -373,7 +373,7 @@ static int php_array_element_export(zval **zv TSRMLS_DC, int num_args, va_list a
|
||||
|
||||
smart_str_appendc(buf, ',');
|
||||
smart_str_appendc(buf, '\n');
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -392,7 +392,7 @@ static int php_object_element_export(zval **zv TSRMLS_DC, int num_args, va_list
|
||||
const char *pname;
|
||||
char *pname_esc;
|
||||
int pname_esc_len;
|
||||
|
||||
|
||||
zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1,
|
||||
&class_name, &pname);
|
||||
pname_esc = php_addcslashes(pname, strlen(pname), &pname_esc_len, 0,
|
||||
@@ -469,7 +469,7 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC)
|
||||
buffer_append_spaces(buf, level - 1);
|
||||
}
|
||||
smart_str_appendc(buf, ')');
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case IS_OBJECT:
|
||||
@@ -799,7 +799,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var
|
||||
BG(serialize_lock)++;
|
||||
res = call_user_function_ex(CG(function_table), &struc, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
|
||||
BG(serialize_lock)--;
|
||||
|
||||
|
||||
if (EG(exception)) {
|
||||
if (retval_ptr) {
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
@@ -948,6 +948,8 @@ PHP_FUNCTION(unserialize)
|
||||
int buf_len;
|
||||
const unsigned char *p;
|
||||
php_unserialize_data_t var_hash;
|
||||
int oldlevel;
|
||||
zval *old_rval = return_value;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -967,6 +969,20 @@ PHP_FUNCTION(unserialize)
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (return_value != old_rval) {
|
||||
/*
|
||||
* Terrible hack due to the fact that executor passes us zval *,
|
||||
* but unserialize with r/R wants to replace it with another zval *
|
||||
*/
|
||||
zval_dtor(old_rval);
|
||||
*old_rval = *return_value;
|
||||
zval_copy_ctor(old_rval);
|
||||
var_push_dtor_no_addref(&var_hash, &return_value);
|
||||
/* FIXME: old_rval is not freed in some scenarios, see bug #70172
|
||||
var_push_dtor_no_addref(&var_hash, &old_rval); */
|
||||
} else {
|
||||
var_push_dtor(&var_hash, &return_value);
|
||||
}
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -68,7 +68,7 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
|
||||
|
||||
var_hash = (*var_hashx)->last_dtor;
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
|
||||
fprintf(stderr, "var_push_dtor(%p, %ld): %d\n", *rval, var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
|
||||
#endif
|
||||
|
||||
if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) {
|
||||
@@ -91,9 +91,15 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
|
||||
|
||||
PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval)
|
||||
{
|
||||
var_entries *var_hash = (*var_hashx)->last_dtor;
|
||||
var_entries *var_hash;
|
||||
|
||||
if (!var_hashx || !*var_hashx) {
|
||||
return;
|
||||
}
|
||||
|
||||
var_hash = (*var_hashx)->last_dtor;
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_push_dtor_no_addref(%ld): %d (%d)\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_PP(rval));
|
||||
fprintf(stderr, "var_push_dtor_no_addref(%p, %ld): %d (%d)\n", *rval, var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_PP(rval));
|
||||
#endif
|
||||
|
||||
if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) {
|
||||
@@ -120,7 +126,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **n
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
|
||||
#endif
|
||||
|
||||
|
||||
while (var_hash) {
|
||||
for (i = 0; i < var_hash->used_slots; i++) {
|
||||
if (var_hash->data[i] == ozval) {
|
||||
@@ -138,7 +144,7 @@ static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store)
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_access(%ld): %ld\n", var_hash?var_hash->used_slots:-1L, id);
|
||||
#endif
|
||||
|
||||
|
||||
while (id >= VAR_ENTRIES_MAX && var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
|
||||
var_hash = var_hash->next;
|
||||
id -= VAR_ENTRIES_MAX;
|
||||
@@ -161,7 +167,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_destroy(%ld)\n", var_hash?var_hash->used_slots:-1L);
|
||||
#endif
|
||||
|
||||
|
||||
while (var_hash) {
|
||||
next = var_hash->next;
|
||||
efree(var_hash);
|
||||
@@ -169,9 +175,12 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
|
||||
}
|
||||
|
||||
var_hash = (*var_hashx)->first_dtor;
|
||||
|
||||
|
||||
while (var_hash) {
|
||||
for (i = 0; i < var_hash->used_slots; i++) {
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_destroy dtor(%p, %ld)\n", var_hash->data[i], Z_REFCOUNT_P(var_hash->data[i]));
|
||||
#endif
|
||||
zval_ptr_dtor(&var_hash->data[i]);
|
||||
}
|
||||
next = var_hash->next;
|
||||
@@ -232,7 +241,7 @@ static char *unserialize_str(const unsigned char **p, size_t *len, size_t maxlen
|
||||
#define YYMARKER marker
|
||||
|
||||
|
||||
#line 240 "ext/standard/var_unserializer.re"
|
||||
#line 249 "ext/standard/var_unserializer.re"
|
||||
|
||||
|
||||
|
||||
@@ -250,7 +259,7 @@ static inline long parse_iv2(const unsigned char *p, const unsigned char **q)
|
||||
case '+':
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
cursor = (char)*p;
|
||||
if (cursor >= '0' && cursor <= '9') {
|
||||
@@ -279,7 +288,7 @@ static inline size_t parse_uiv(const unsigned char *p)
|
||||
if (*p == '+') {
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
cursor = *p;
|
||||
if (cursor >= '0' && cursor <= '9') {
|
||||
@@ -303,23 +312,20 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
|
||||
ALLOC_INIT_ZVAL(key);
|
||||
|
||||
if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {
|
||||
zval_dtor(key);
|
||||
FREE_ZVAL(key);
|
||||
var_push_dtor_no_addref(var_hash, &key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) {
|
||||
zval_dtor(key);
|
||||
FREE_ZVAL(key);
|
||||
var_push_dtor_no_addref(var_hash, &key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ALLOC_INIT_ZVAL(data);
|
||||
|
||||
if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {
|
||||
zval_dtor(key);
|
||||
FREE_ZVAL(key);
|
||||
zval_ptr_dtor(&data);
|
||||
var_push_dtor_no_addref(var_hash, &key);
|
||||
var_push_dtor_no_addref(var_hash, &data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -348,9 +354,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
|
||||
sizeof data, NULL);
|
||||
}
|
||||
var_push_dtor(var_hash, &data);
|
||||
|
||||
zval_dtor(key);
|
||||
FREE_ZVAL(key);
|
||||
var_push_dtor_no_addref(var_hash, &key);
|
||||
|
||||
if (elements && *(*p-1) != ';' && *(*p-1) != '}') {
|
||||
(*p)--;
|
||||
@@ -400,7 +404,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
|
||||
static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
|
||||
{
|
||||
long elements;
|
||||
|
||||
|
||||
elements = parse_iv2((*p) + 2, p);
|
||||
|
||||
(*p) += 2;
|
||||
@@ -464,21 +468,21 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
|
||||
|
||||
limit = max;
|
||||
cursor = *p;
|
||||
|
||||
|
||||
if (YYCURSOR >= YYLIMIT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (var_hash && cursor[0] != 'R') {
|
||||
var_push(var_hash, rval);
|
||||
}
|
||||
|
||||
start = cursor;
|
||||
|
||||
|
||||
|
||||
|
||||
#line 482 "ext/standard/var_unserializer.c"
|
||||
|
||||
|
||||
#line 486 "ext/standard/var_unserializer.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
@@ -538,9 +542,9 @@ yy2:
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych == ':') goto yy95;
|
||||
yy3:
|
||||
#line 833 "ext/standard/var_unserializer.re"
|
||||
#line 840 "ext/standard/var_unserializer.re"
|
||||
{ return 0; }
|
||||
#line 544 "ext/standard/var_unserializer.c"
|
||||
#line 548 "ext/standard/var_unserializer.c"
|
||||
yy4:
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych == ':') goto yy89;
|
||||
@@ -583,13 +587,13 @@ yy13:
|
||||
goto yy3;
|
||||
yy14:
|
||||
++YYCURSOR;
|
||||
#line 827 "ext/standard/var_unserializer.re"
|
||||
#line 834 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
/* this is the case where we have less data than planned */
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data");
|
||||
return 0; /* not sure if it should be 0 or 1 here? */
|
||||
}
|
||||
#line 593 "ext/standard/var_unserializer.c"
|
||||
#line 597 "ext/standard/var_unserializer.c"
|
||||
yy16:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy3;
|
||||
@@ -620,7 +624,7 @@ yy20:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '"') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 681 "ext/standard/var_unserializer.re"
|
||||
#line 687 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
size_t len, len2, len3, maxlen;
|
||||
long elements;
|
||||
@@ -636,10 +640,11 @@ yy20:
|
||||
zval **args[1];
|
||||
zval *arg_func_name;
|
||||
|
||||
if (!var_hash) return 0;
|
||||
if (*start == 'C') {
|
||||
custom_object = 1;
|
||||
}
|
||||
|
||||
|
||||
INIT_PZVAL(*rval);
|
||||
len2 = len = parse_uiv(start + 2);
|
||||
maxlen = max - YYCURSOR;
|
||||
@@ -688,14 +693,14 @@ yy20:
|
||||
efree(class_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Check for unserialize callback */
|
||||
if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) {
|
||||
incomplete_class = 1;
|
||||
ce = PHP_IC_ENTRY;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Call unserialize callback */
|
||||
MAKE_STD_ZVAL(user_func);
|
||||
ZVAL_STRING(user_func, PG(unserialize_callback_func), 1);
|
||||
@@ -728,7 +733,7 @@ yy20:
|
||||
zval_ptr_dtor(&arg_func_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* The callback function may have defined the class */
|
||||
if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
@@ -756,7 +761,7 @@ yy20:
|
||||
efree(class_name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
elements = object_common1(UNSERIALIZE_PASSTHRU, ce);
|
||||
|
||||
if (incomplete_class) {
|
||||
@@ -766,7 +771,7 @@ yy20:
|
||||
|
||||
return object_common2(UNSERIALIZE_PASSTHRU, elements);
|
||||
}
|
||||
#line 770 "ext/standard/var_unserializer.c"
|
||||
#line 775 "ext/standard/var_unserializer.c"
|
||||
yy25:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= ',') {
|
||||
@@ -791,15 +796,16 @@ yy27:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '"') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 673 "ext/standard/var_unserializer.re"
|
||||
#line 678 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
if (!var_hash) return 0;
|
||||
|
||||
INIT_PZVAL(*rval);
|
||||
|
||||
|
||||
return object_common2(UNSERIALIZE_PASSTHRU,
|
||||
object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
|
||||
}
|
||||
#line 803 "ext/standard/var_unserializer.c"
|
||||
#line 809 "ext/standard/var_unserializer.c"
|
||||
yy32:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == '+') goto yy33;
|
||||
@@ -820,11 +826,12 @@ yy34:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '{') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 653 "ext/standard/var_unserializer.re"
|
||||
#line 657 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
long elements = parse_iv(start + 2);
|
||||
/* use iv() not uiv() in order to check data range */
|
||||
*p = YYCURSOR;
|
||||
if (!var_hash) return 0;
|
||||
|
||||
if (elements < 0) {
|
||||
return 0;
|
||||
@@ -840,7 +847,7 @@ yy34:
|
||||
|
||||
return finish_nested_data(UNSERIALIZE_PASSTHRU);
|
||||
}
|
||||
#line 844 "ext/standard/var_unserializer.c"
|
||||
#line 851 "ext/standard/var_unserializer.c"
|
||||
yy39:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == '+') goto yy40;
|
||||
@@ -861,7 +868,7 @@ yy41:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '"') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 624 "ext/standard/var_unserializer.re"
|
||||
#line 628 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
size_t len, maxlen;
|
||||
char *str;
|
||||
@@ -890,7 +897,7 @@ yy41:
|
||||
ZVAL_STRINGL(*rval, str, len, 0);
|
||||
return 1;
|
||||
}
|
||||
#line 894 "ext/standard/var_unserializer.c"
|
||||
#line 901 "ext/standard/var_unserializer.c"
|
||||
yy46:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == '+') goto yy47;
|
||||
@@ -911,7 +918,7 @@ yy48:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '"') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 596 "ext/standard/var_unserializer.re"
|
||||
#line 600 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
size_t len, maxlen;
|
||||
char *str;
|
||||
@@ -939,7 +946,7 @@ yy48:
|
||||
ZVAL_STRINGL(*rval, str, len, 1);
|
||||
return 1;
|
||||
}
|
||||
#line 943 "ext/standard/var_unserializer.c"
|
||||
#line 950 "ext/standard/var_unserializer.c"
|
||||
yy53:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') {
|
||||
@@ -1027,7 +1034,7 @@ yy61:
|
||||
}
|
||||
yy63:
|
||||
++YYCURSOR;
|
||||
#line 586 "ext/standard/var_unserializer.re"
|
||||
#line 590 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
#if SIZEOF_LONG == 4
|
||||
use_double:
|
||||
@@ -1037,7 +1044,7 @@ use_double:
|
||||
ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL));
|
||||
return 1;
|
||||
}
|
||||
#line 1041 "ext/standard/var_unserializer.c"
|
||||
#line 1048 "ext/standard/var_unserializer.c"
|
||||
yy65:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= ',') {
|
||||
@@ -1096,7 +1103,7 @@ yy73:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ';') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 571 "ext/standard/var_unserializer.re"
|
||||
#line 575 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
*p = YYCURSOR;
|
||||
INIT_PZVAL(*rval);
|
||||
@@ -1111,7 +1118,7 @@ yy73:
|
||||
|
||||
return 1;
|
||||
}
|
||||
#line 1115 "ext/standard/var_unserializer.c"
|
||||
#line 1122 "ext/standard/var_unserializer.c"
|
||||
yy76:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'N') goto yy73;
|
||||
@@ -1138,7 +1145,7 @@ yy79:
|
||||
if (yych <= '9') goto yy79;
|
||||
if (yych != ';') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 544 "ext/standard/var_unserializer.re"
|
||||
#line 548 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
#if SIZEOF_LONG == 4
|
||||
int digits = YYCURSOR - start - 3;
|
||||
@@ -1165,7 +1172,7 @@ yy79:
|
||||
ZVAL_LONG(*rval, parse_iv(start + 2));
|
||||
return 1;
|
||||
}
|
||||
#line 1169 "ext/standard/var_unserializer.c"
|
||||
#line 1176 "ext/standard/var_unserializer.c"
|
||||
yy83:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy18;
|
||||
@@ -1173,24 +1180,24 @@ yy83:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ';') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 537 "ext/standard/var_unserializer.re"
|
||||
#line 541 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
*p = YYCURSOR;
|
||||
INIT_PZVAL(*rval);
|
||||
ZVAL_BOOL(*rval, parse_iv(start + 2));
|
||||
return 1;
|
||||
}
|
||||
#line 1184 "ext/standard/var_unserializer.c"
|
||||
#line 1191 "ext/standard/var_unserializer.c"
|
||||
yy87:
|
||||
++YYCURSOR;
|
||||
#line 530 "ext/standard/var_unserializer.re"
|
||||
#line 534 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
*p = YYCURSOR;
|
||||
INIT_PZVAL(*rval);
|
||||
ZVAL_NULL(*rval);
|
||||
return 1;
|
||||
}
|
||||
#line 1194 "ext/standard/var_unserializer.c"
|
||||
#line 1201 "ext/standard/var_unserializer.c"
|
||||
yy89:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= ',') {
|
||||
@@ -1213,7 +1220,7 @@ yy91:
|
||||
if (yych <= '9') goto yy91;
|
||||
if (yych != ';') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 507 "ext/standard/var_unserializer.re"
|
||||
#line 511 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
long id;
|
||||
|
||||
@@ -1233,10 +1240,10 @@ yy91:
|
||||
*rval = *rval_ref;
|
||||
Z_ADDREF_PP(rval);
|
||||
Z_UNSET_ISREF_PP(rval);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
#line 1240 "ext/standard/var_unserializer.c"
|
||||
#line 1247 "ext/standard/var_unserializer.c"
|
||||
yy95:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= ',') {
|
||||
@@ -1259,7 +1266,7 @@ yy97:
|
||||
if (yych <= '9') goto yy97;
|
||||
if (yych != ';') goto yy18;
|
||||
++YYCURSOR;
|
||||
#line 486 "ext/standard/var_unserializer.re"
|
||||
#line 490 "ext/standard/var_unserializer.re"
|
||||
{
|
||||
long id;
|
||||
|
||||
@@ -1272,17 +1279,17 @@ yy97:
|
||||
}
|
||||
|
||||
if (*rval != NULL) {
|
||||
zval_ptr_dtor(rval);
|
||||
var_push_dtor_no_addref(var_hash, rval);
|
||||
}
|
||||
*rval = *rval_ref;
|
||||
Z_ADDREF_PP(rval);
|
||||
Z_SET_ISREF_PP(rval);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
#line 1284 "ext/standard/var_unserializer.c"
|
||||
#line 1291 "ext/standard/var_unserializer.c"
|
||||
}
|
||||
#line 835 "ext/standard/var_unserializer.re"
|
||||
#line 842 "ext/standard/var_unserializer.re"
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -66,7 +66,7 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
|
||||
|
||||
var_hash = (*var_hashx)->last_dtor;
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
|
||||
fprintf(stderr, "var_push_dtor(%p, %ld): %d\n", *rval, var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
|
||||
#endif
|
||||
|
||||
if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) {
|
||||
@@ -89,9 +89,15 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
|
||||
|
||||
PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval)
|
||||
{
|
||||
var_entries *var_hash = (*var_hashx)->last_dtor;
|
||||
var_entries *var_hash;
|
||||
|
||||
if (!var_hashx || !*var_hashx) {
|
||||
return;
|
||||
}
|
||||
|
||||
var_hash = (*var_hashx)->last_dtor;
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_push_dtor_no_addref(%ld): %d (%d)\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_PP(rval));
|
||||
fprintf(stderr, "var_push_dtor_no_addref(%p, %ld): %d (%d)\n", *rval, var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_PP(rval));
|
||||
#endif
|
||||
|
||||
if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) {
|
||||
@@ -118,7 +124,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **n
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
|
||||
#endif
|
||||
|
||||
|
||||
while (var_hash) {
|
||||
for (i = 0; i < var_hash->used_slots; i++) {
|
||||
if (var_hash->data[i] == ozval) {
|
||||
@@ -136,7 +142,7 @@ static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store)
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_access(%ld): %ld\n", var_hash?var_hash->used_slots:-1L, id);
|
||||
#endif
|
||||
|
||||
|
||||
while (id >= VAR_ENTRIES_MAX && var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
|
||||
var_hash = var_hash->next;
|
||||
id -= VAR_ENTRIES_MAX;
|
||||
@@ -159,7 +165,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_destroy(%ld)\n", var_hash?var_hash->used_slots:-1L);
|
||||
#endif
|
||||
|
||||
|
||||
while (var_hash) {
|
||||
next = var_hash->next;
|
||||
efree(var_hash);
|
||||
@@ -167,9 +173,12 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
|
||||
}
|
||||
|
||||
var_hash = (*var_hashx)->first_dtor;
|
||||
|
||||
|
||||
while (var_hash) {
|
||||
for (i = 0; i < var_hash->used_slots; i++) {
|
||||
#if VAR_ENTRIES_DBG
|
||||
fprintf(stderr, "var_destroy dtor(%p, %ld)\n", var_hash->data[i], Z_REFCOUNT_P(var_hash->data[i]));
|
||||
#endif
|
||||
zval_ptr_dtor(&var_hash->data[i]);
|
||||
}
|
||||
next = var_hash->next;
|
||||
@@ -254,7 +263,7 @@ static inline long parse_iv2(const unsigned char *p, const unsigned char **q)
|
||||
case '+':
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
cursor = (char)*p;
|
||||
if (cursor >= '0' && cursor <= '9') {
|
||||
@@ -283,7 +292,7 @@ static inline size_t parse_uiv(const unsigned char *p)
|
||||
if (*p == '+') {
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
cursor = *p;
|
||||
if (cursor >= '0' && cursor <= '9') {
|
||||
@@ -307,23 +316,20 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
|
||||
ALLOC_INIT_ZVAL(key);
|
||||
|
||||
if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {
|
||||
zval_dtor(key);
|
||||
FREE_ZVAL(key);
|
||||
var_push_dtor_no_addref(var_hash, &key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) {
|
||||
zval_dtor(key);
|
||||
FREE_ZVAL(key);
|
||||
var_push_dtor_no_addref(var_hash, &key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ALLOC_INIT_ZVAL(data);
|
||||
|
||||
if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {
|
||||
zval_dtor(key);
|
||||
FREE_ZVAL(key);
|
||||
zval_ptr_dtor(&data);
|
||||
var_push_dtor_no_addref(var_hash, &key);
|
||||
var_push_dtor_no_addref(var_hash, &data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -352,9 +358,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
|
||||
sizeof data, NULL);
|
||||
}
|
||||
var_push_dtor(var_hash, &data);
|
||||
|
||||
zval_dtor(key);
|
||||
FREE_ZVAL(key);
|
||||
var_push_dtor_no_addref(var_hash, &key);
|
||||
|
||||
if (elements && *(*p-1) != ';' && *(*p-1) != '}') {
|
||||
(*p)--;
|
||||
@@ -404,7 +408,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
|
||||
static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
|
||||
{
|
||||
long elements;
|
||||
|
||||
|
||||
elements = parse_iv2((*p) + 2, p);
|
||||
|
||||
(*p) += 2;
|
||||
@@ -468,19 +472,19 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
|
||||
|
||||
limit = max;
|
||||
cursor = *p;
|
||||
|
||||
|
||||
if (YYCURSOR >= YYLIMIT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (var_hash && cursor[0] != 'R') {
|
||||
var_push(var_hash, rval);
|
||||
}
|
||||
|
||||
start = cursor;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*!re2c
|
||||
|
||||
"R:" iv ";" {
|
||||
@@ -495,12 +499,12 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
|
||||
}
|
||||
|
||||
if (*rval != NULL) {
|
||||
zval_ptr_dtor(rval);
|
||||
var_push_dtor_no_addref(var_hash, rval);
|
||||
}
|
||||
*rval = *rval_ref;
|
||||
Z_ADDREF_PP(rval);
|
||||
Z_SET_ISREF_PP(rval);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -523,7 +527,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
|
||||
*rval = *rval_ref;
|
||||
Z_ADDREF_PP(rval);
|
||||
Z_UNSET_ISREF_PP(rval);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -654,6 +658,7 @@ use_double:
|
||||
long elements = parse_iv(start + 2);
|
||||
/* use iv() not uiv() in order to check data range */
|
||||
*p = YYCURSOR;
|
||||
if (!var_hash) return 0;
|
||||
|
||||
if (elements < 0) {
|
||||
return 0;
|
||||
@@ -671,9 +676,10 @@ use_double:
|
||||
}
|
||||
|
||||
"o:" iv ":" ["] {
|
||||
if (!var_hash) return 0;
|
||||
|
||||
INIT_PZVAL(*rval);
|
||||
|
||||
|
||||
return object_common2(UNSERIALIZE_PASSTHRU,
|
||||
object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
|
||||
}
|
||||
@@ -693,10 +699,11 @@ object ":" uiv ":" ["] {
|
||||
zval **args[1];
|
||||
zval *arg_func_name;
|
||||
|
||||
if (!var_hash) return 0;
|
||||
if (*start == 'C') {
|
||||
custom_object = 1;
|
||||
}
|
||||
|
||||
|
||||
INIT_PZVAL(*rval);
|
||||
len2 = len = parse_uiv(start + 2);
|
||||
maxlen = max - YYCURSOR;
|
||||
@@ -745,14 +752,14 @@ object ":" uiv ":" ["] {
|
||||
efree(class_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Check for unserialize callback */
|
||||
if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) {
|
||||
incomplete_class = 1;
|
||||
ce = PHP_IC_ENTRY;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Call unserialize callback */
|
||||
MAKE_STD_ZVAL(user_func);
|
||||
ZVAL_STRING(user_func, PG(unserialize_callback_func), 1);
|
||||
@@ -785,7 +792,7 @@ object ":" uiv ":" ["] {
|
||||
zval_ptr_dtor(&arg_func_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* The callback function may have defined the class */
|
||||
if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
@@ -813,7 +820,7 @@ object ":" uiv ":" ["] {
|
||||
efree(class_name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
elements = object_common1(UNSERIALIZE_PASSTHRU, ce);
|
||||
|
||||
if (incomplete_class) {
|
||||
|
||||
@@ -4,6 +4,8 @@ Bug #32001 (xml_parse*() goes into infinite loop when autodetection in effect),
|
||||
<?php
|
||||
require_once("skipif.inc");
|
||||
if (!extension_loaded('iconv')) die ("skip iconv extension not available");
|
||||
if (ICONV_IMPL == 'glibc' && version_compare(ICONV_VERSION, '2.12', '<='))
|
||||
die("skip iconv of glibc <= 2.12 is buggy");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
+73
-69
@@ -81,10 +81,10 @@ ZEND_END_ARG_INFO();
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* class xsl_xsltprocessor
|
||||
* class xsl_xsltprocessor
|
||||
*
|
||||
* URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
|
||||
* Since:
|
||||
* Since:
|
||||
*/
|
||||
|
||||
const zend_function_entry php_xsl_xsltprocessor_class_functions[] = {
|
||||
@@ -111,9 +111,9 @@ static char *php_xsl_xslt_string_to_xpathexpr(const char *str TSRMLS_DC)
|
||||
|
||||
xmlChar *value;
|
||||
int str_len;
|
||||
|
||||
|
||||
str_len = xmlStrlen(string) + 3;
|
||||
|
||||
|
||||
if (xmlStrchr(string, '"')) {
|
||||
if (xmlStrchr(string, '\'')) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create XPath expression (string contains both quote and double-quotes)");
|
||||
@@ -133,7 +133,7 @@ static char *php_xsl_xslt_string_to_xpathexpr(const char *str TSRMLS_DC)
|
||||
Translates a PHP array to a libxslt parameters array */
|
||||
static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS_DC)
|
||||
{
|
||||
|
||||
|
||||
int parsize;
|
||||
zval **value;
|
||||
char *xpath_expr, *string_key = NULL;
|
||||
@@ -158,7 +158,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS
|
||||
SEPARATE_ZVAL(value);
|
||||
convert_to_string(*value);
|
||||
}
|
||||
|
||||
|
||||
if (!xpath_params) {
|
||||
xpath_expr = php_xsl_xslt_string_to_xpathexpr(Z_STRVAL_PP(value) TSRMLS_CC);
|
||||
} else {
|
||||
@@ -192,7 +192,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
|
||||
char *str;
|
||||
char *callable = NULL;
|
||||
xsl_object *intern;
|
||||
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (! zend_is_executing(TSRMLS_C)) {
|
||||
@@ -219,15 +219,17 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (error == 1) {
|
||||
for (i = nargs - 1; i >= 0; i--) {
|
||||
obj = valuePop(ctxt);
|
||||
xmlXPathFreeObject(obj);
|
||||
if (obj) {
|
||||
xmlXPathFreeObject(obj);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
fci.param_count = nargs - 1;
|
||||
if (fci.param_count > 0) {
|
||||
fci.params = safe_emalloc(fci.param_count, sizeof(zval**), 0);
|
||||
@@ -265,7 +267,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
|
||||
if (node->type == XML_NAMESPACE_DECL) {
|
||||
xmlNsPtr curns;
|
||||
xmlNodePtr nsparent;
|
||||
|
||||
|
||||
nsparent = node->_private;
|
||||
curns = xmlNewNs(NULL, node->name, NULL);
|
||||
if (node->children) {
|
||||
@@ -297,14 +299,16 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
|
||||
xmlXPathFreeObject(obj);
|
||||
fci.params[i] = &args[i];
|
||||
}
|
||||
|
||||
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = EG(function_table);
|
||||
|
||||
|
||||
obj = valuePop(ctxt);
|
||||
if (obj->stringval == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Handler name must be a string");
|
||||
xmlXPathFreeObject(obj);
|
||||
if (obj == NULL || obj->stringval == NULL) {
|
||||
if (obj) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Handler name must be a string");
|
||||
xmlXPathFreeObject(obj);
|
||||
}
|
||||
valuePush(ctxt, xmlXPathNewString(""));
|
||||
if (fci.param_count > 0) {
|
||||
for (i = 0; i < nargs - 1; i++) {
|
||||
@@ -313,12 +317,12 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
|
||||
efree(args);
|
||||
efree(fci.params);
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
INIT_PZVAL(&handler);
|
||||
ZVAL_STRING(&handler, obj->stringval, 1);
|
||||
xmlXPathFreeObject(obj);
|
||||
|
||||
|
||||
fci.function_name = &handler;
|
||||
fci.symbol_table = NULL;
|
||||
fci.object_ptr = NULL;
|
||||
@@ -328,7 +332,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
|
||||
if (!zend_make_callable(&handler, &callable TSRMLS_CC)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", callable);
|
||||
valuePush(ctxt, xmlXPathNewString(""));
|
||||
} else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable, strlen(callable) + 1) == 0) {
|
||||
} else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable, strlen(callable) + 1) == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%s()'", callable);
|
||||
/* Push an empty string, so that we at least have an xslt result... */
|
||||
valuePush(ctxt, xmlXPathNewString(""));
|
||||
@@ -392,7 +396,7 @@ void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{
|
||||
|
||||
/* {{{ proto void xsl_xsltprocessor_import_stylesheet(domdocument doc);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
||||
{
|
||||
@@ -404,13 +408,13 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
||||
xmlNode *nodep = NULL;
|
||||
zend_object_handlers *std_hnd;
|
||||
zval *cloneDocu, *member;
|
||||
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo", &id, xsl_xsltprocessor_class_entry, &docp) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
nodep = php_libxml_import_node(docp TSRMLS_CC);
|
||||
|
||||
|
||||
if (nodep) {
|
||||
doc = nodep->doc;
|
||||
}
|
||||
@@ -419,7 +423,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* libxslt uses _private, so we must copy the imported
|
||||
/* libxslt uses _private, so we must copy the imported
|
||||
stylesheet document otherwise the node proxies will be a mess */
|
||||
newdoc = xmlCopyDoc(doc, 1);
|
||||
xmlNodeSetBase((xmlNodePtr) newdoc, (xmlChar *)doc->URL);
|
||||
@@ -436,7 +440,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
|
||||
std_hnd = zend_get_std_object_handlers();
|
||||
MAKE_STD_ZVAL(member);
|
||||
@@ -463,10 +467,10 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
|
||||
intern->hasKeys = clone_docu;
|
||||
}
|
||||
|
||||
if ((oldsheetp = (xsltStylesheetPtr)intern->ptr)) {
|
||||
if ((oldsheetp = (xsltStylesheetPtr)intern->ptr)) {
|
||||
/* free wrapper */
|
||||
if (((xsltStylesheetPtr) intern->ptr)->_private != NULL) {
|
||||
((xsltStylesheetPtr) intern->ptr)->_private = NULL;
|
||||
((xsltStylesheetPtr) intern->ptr)->_private = NULL;
|
||||
}
|
||||
xsltFreeStylesheet((xsltStylesheetPtr) intern->ptr);
|
||||
intern->ptr = NULL;
|
||||
@@ -494,7 +498,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
|
||||
xsltSecurityPrefsPtr secPrefs = NULL;
|
||||
|
||||
node = php_libxml_import_node(docp TSRMLS_CC);
|
||||
|
||||
|
||||
if (node) {
|
||||
doc = node->doc;
|
||||
}
|
||||
@@ -507,7 +511,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stylesheet associated to this object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if (intern->profiling) {
|
||||
if (php_check_open_basedir(intern->profiling TSRMLS_CC)) {
|
||||
f = NULL;
|
||||
@@ -517,7 +521,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
|
||||
} else {
|
||||
f = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (intern->parameter) {
|
||||
params = php_xsl_xslt_make_params(intern->parameter, 0 TSRMLS_CC);
|
||||
}
|
||||
@@ -549,7 +553,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
|
||||
efree(member);
|
||||
|
||||
secPrefsValue = intern->securityPrefs;
|
||||
|
||||
|
||||
/* This whole if block can be removed, when we remove the xsl.security_prefs php.ini option in PHP 6+ */
|
||||
secPrefsIni= INI_INT("xsl.security_prefs");
|
||||
/* if secPrefsIni has the same value as secPrefsValue, all is fine */
|
||||
@@ -569,38 +573,38 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
|
||||
|
||||
/* if securityPrefs is set to NONE, we don't have to do any checks, but otherwise... */
|
||||
if (secPrefsValue != XSL_SECPREF_NONE) {
|
||||
secPrefs = xsltNewSecurityPrefs();
|
||||
if (secPrefsValue & XSL_SECPREF_READ_FILE ) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid)) {
|
||||
secPrefs = xsltNewSecurityPrefs();
|
||||
if (secPrefsValue & XSL_SECPREF_READ_FILE ) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid)) {
|
||||
secPrefsError = 1;
|
||||
}
|
||||
}
|
||||
if (secPrefsValue & XSL_SECPREF_WRITE_FILE ) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid)) {
|
||||
if (secPrefsValue & XSL_SECPREF_WRITE_FILE ) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid)) {
|
||||
secPrefsError = 1;
|
||||
}
|
||||
}
|
||||
if (secPrefsValue & XSL_SECPREF_CREATE_DIRECTORY ) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid)) {
|
||||
if (secPrefsValue & XSL_SECPREF_CREATE_DIRECTORY ) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid)) {
|
||||
secPrefsError = 1;
|
||||
}
|
||||
}
|
||||
if (secPrefsValue & XSL_SECPREF_READ_NETWORK) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid)) {
|
||||
if (secPrefsValue & XSL_SECPREF_READ_NETWORK) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid)) {
|
||||
secPrefsError = 1;
|
||||
}
|
||||
}
|
||||
if (secPrefsValue & XSL_SECPREF_WRITE_NETWORK) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid)) {
|
||||
if (secPrefsValue & XSL_SECPREF_WRITE_NETWORK) {
|
||||
if (0 != xsltSetSecurityPrefs(secPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid)) {
|
||||
secPrefsError = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != xsltSetCtxtSecurityPrefs(secPrefs, ctxt)) {
|
||||
|
||||
if (0 != xsltSetCtxtSecurityPrefs(secPrefs, ctxt)) {
|
||||
secPrefsError = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (secPrefsError == 1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't set libxslt security properties, not doing transformation for security reasons");
|
||||
} else {
|
||||
@@ -609,7 +613,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
|
||||
if (f) {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
xsltFreeTransformContext(ctxt);
|
||||
if (secPrefs) {
|
||||
xsltFreeSecurityPrefs(secPrefs);
|
||||
@@ -617,7 +621,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
|
||||
|
||||
if (intern->node_list != NULL) {
|
||||
zend_hash_destroy(intern->node_list);
|
||||
FREE_HASHTABLE(intern->node_list);
|
||||
FREE_HASHTABLE(intern->node_list);
|
||||
intern->node_list = NULL;
|
||||
}
|
||||
|
||||
@@ -640,7 +644,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
|
||||
|
||||
/* {{{ proto domdocument xsl_xsltprocessor_transform_to_doc(domnode doc);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
|
||||
{
|
||||
@@ -677,13 +681,13 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
|
||||
found = zend_lookup_class(ret_class, ret_class_len, &ce TSRMLS_CC);
|
||||
if ((found != SUCCESS) || !instanceof_function(*ce, curce TSRMLS_CC)) {
|
||||
xmlFreeDoc(newdocp);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Expecting class compatible with %s, '%s' given", curclass_name, ret_class);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
object_init_ex(return_value, *ce);
|
||||
|
||||
|
||||
interndoc = (php_libxml_node_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
php_libxml_increment_doc_ref(interndoc, newdocp TSRMLS_CC);
|
||||
php_libxml_increment_node_ptr(interndoc, (xmlNodePtr)newdocp, (void *)interndoc TSRMLS_CC);
|
||||
@@ -693,7 +697,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} end xsl_xsltprocessor_transform_to_doc */
|
||||
|
||||
@@ -707,7 +711,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
|
||||
int ret, uri_len;
|
||||
char *uri;
|
||||
xsl_object *intern;
|
||||
|
||||
|
||||
id = getThis();
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
sheetp = (xsltStylesheetPtr) intern->ptr;
|
||||
@@ -739,7 +743,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml)
|
||||
xmlChar *doc_txt_ptr;
|
||||
int doc_txt_len;
|
||||
xsl_object *intern;
|
||||
|
||||
|
||||
id = getThis();
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
sheetp = (xsltStylesheetPtr) intern->ptr;
|
||||
@@ -770,7 +774,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml)
|
||||
*/
|
||||
PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
|
||||
{
|
||||
|
||||
|
||||
zval *id;
|
||||
zval *array_value, **entry, *new_string;
|
||||
xsl_object *intern;
|
||||
@@ -786,34 +790,34 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
|
||||
while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) {
|
||||
SEPARATE_ZVAL(entry);
|
||||
convert_to_string_ex(entry);
|
||||
|
||||
|
||||
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(array_value), &string_key, &string_key_len, &idx, 0, NULL) != HASH_KEY_IS_STRING) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter array");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
ALLOC_ZVAL(new_string);
|
||||
Z_ADDREF_PP(entry);
|
||||
COPY_PZVAL_TO_ZVAL(*new_string, *entry);
|
||||
|
||||
|
||||
zend_hash_update(intern->parameter, string_key, string_key_len, &new_string, sizeof(zval*), NULL);
|
||||
zend_hash_move_forward(Z_ARRVAL_P(array_value));
|
||||
}
|
||||
RETURN_TRUE;
|
||||
|
||||
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sss", &namespace, &namespace_len, &name, &name_len, &value, &value_len) == SUCCESS) {
|
||||
|
||||
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
|
||||
|
||||
MAKE_STD_ZVAL(new_string);
|
||||
ZVAL_STRING(new_string, value, 1);
|
||||
|
||||
|
||||
zend_hash_update(intern->parameter, name, name_len + 1, &new_string, sizeof(zval*), NULL);
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} end xsl_xsltprocessor_set_parameter */
|
||||
|
||||
@@ -828,7 +832,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter)
|
||||
xsl_object *intern;
|
||||
|
||||
DOM_GET_THIS(id);
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &namespace, &namespace_len, &name, &name_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -852,7 +856,7 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter)
|
||||
xsl_object *intern;
|
||||
|
||||
DOM_GET_THIS(id);
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &namespace, &namespace_len, &name, &name_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -876,7 +880,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
|
||||
char *name;
|
||||
|
||||
DOM_GET_THIS(id);
|
||||
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "a", &array_value) == SUCCESS) {
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value));
|
||||
@@ -884,10 +888,10 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
|
||||
while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) {
|
||||
SEPARATE_ZVAL(entry);
|
||||
convert_to_string_ex(entry);
|
||||
|
||||
|
||||
MAKE_STD_ZVAL(new_string);
|
||||
ZVAL_LONG(new_string,1);
|
||||
|
||||
|
||||
zend_hash_update(intern->registered_phpfunctions, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &new_string, sizeof(zval*), NULL);
|
||||
zend_hash_move_forward(Z_ARRVAL_P(array_value));
|
||||
}
|
||||
@@ -895,17 +899,17 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
|
||||
|
||||
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == SUCCESS) {
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
|
||||
|
||||
MAKE_STD_ZVAL(new_string);
|
||||
ZVAL_LONG(new_string,1);
|
||||
zend_hash_update(intern->registered_phpfunctions, name, name_len + 1, &new_string, sizeof(zval*), NULL);
|
||||
intern->registerPhpFunctions = 2;
|
||||
|
||||
|
||||
} else {
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
intern->registerPhpFunctions = 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} end xsl_xsltprocessor_register_php_functions(); */
|
||||
|
||||
@@ -947,7 +951,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs)
|
||||
return;
|
||||
}
|
||||
intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
oldSecurityPrefs = intern->securityPrefs;
|
||||
oldSecurityPrefs = intern->securityPrefs;
|
||||
intern->securityPrefs = securityPrefs;
|
||||
/* set this to 1 so that we know, it was set through this method. Can be removed, when we remove the ini setting */
|
||||
intern->securityPrefsSet = 1;
|
||||
|
||||
+9
-3
@@ -200,7 +200,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
|
||||
|
||||
/* it is a directory only, see #40228 */
|
||||
if (path_cleaned_len > 1 && IS_SLASH(path_cleaned[path_cleaned_len - 1])) {
|
||||
len = spprintf(&file_dirname_fullpath, 0, "%s/%s", dest, file);
|
||||
len = spprintf(&file_dirname_fullpath, 0, "%s/%s", dest, path_cleaned);
|
||||
is_dir_only = 1;
|
||||
} else {
|
||||
memcpy(file_dirname, path_cleaned, path_cleaned_len);
|
||||
@@ -1616,6 +1616,7 @@ static ZIPARCHIVE_METHOD(close)
|
||||
struct zip *intern;
|
||||
zval *this = getThis();
|
||||
ze_zip_object *ze_obj;
|
||||
int err;
|
||||
|
||||
if (!this) {
|
||||
RETURN_FALSE;
|
||||
@@ -1625,7 +1626,8 @@ static ZIPARCHIVE_METHOD(close)
|
||||
|
||||
ze_obj = (ze_zip_object*) zend_object_store_get_object(this TSRMLS_CC);
|
||||
|
||||
if (zip_close(intern)) {
|
||||
if ((err = zip_close(intern))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", zip_strerror(intern));
|
||||
zip_discard(intern);
|
||||
}
|
||||
|
||||
@@ -1634,7 +1636,11 @@ static ZIPARCHIVE_METHOD(close)
|
||||
ze_obj->filename_len = 0;
|
||||
ze_obj->za = NULL;
|
||||
|
||||
RETURN_TRUE;
|
||||
if (!err) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #70322 (ZipArchive::close() doesn't indicate errors)
|
||||
--DESCRIPTION--
|
||||
We want to test whether ZipArchive::close() returns FALSE and raises a warning
|
||||
on failure, so we force the failure by adding a file to the archive, which we
|
||||
delete before closing.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('zip')) die('skip requires zip extension');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$zipfile = __DIR__ . '/bug70322.zip';
|
||||
$textfile = __DIR__ . '/bug70322.txt';
|
||||
touch($textfile);
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($zipfile, ZipArchive::CREATE);
|
||||
$zip->addFile($textfile);
|
||||
unlink($textfile);
|
||||
var_dump($zip->close());
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
// we don't expect the archive to be created, but clean up just in case...
|
||||
@unlink(__DIR__ . '/bug70322.zip');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ZipArchive::close(): Read error: No such file or directory in %s%ebug70322.php on line %d
|
||||
bool(false)
|
||||
Loaded 100 of 117 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user