Skip to content

Commit f037ddc

Browse files
committed
Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
2 parents 2322be0 + ffa7270 commit f037ddc

19 files changed

+360
-58
lines changed

NEWS

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2012, PHP 5.4.8
44

5+
- CLI server:
6+
. Changed response to unknown HTTP method to 501 according to RFC.
7+
(Niklas Lindgren).
8+
. Support HTTP PATCH method. Patch by Niklas Lindgren, GitHub PR #190.
9+
(Lars)
10+
511
- Core:
612
. Added optional second argument for assert() to specify custom message. Patch
713
by Lonny Kapelushnik ([email protected]). (Lars)
14+
. Support building PHP with the native client toolchain. (Stuart Langley)
15+
. Fixed bug #63093 (Segfault while load extension failed in zts-build).
16+
(Laruence)
817
. Fixed bug #62976 (Notice: could not be converted to int when comparing
918
some builtin classes). (Laruence)
1019
. Fixed bug #62955 (Only one directive is loaded from "Per Directory Values"
@@ -15,6 +24,13 @@ PHP NEWS
1524
. Fixed bug #60909 (custom error handler throwing Exception + fatal error
1625
= no shutdown function). (Dmitry)
1726

27+
- DOM:
28+
. Fixed bug #63015 (Incorrect arginfo for DOMErrorHandler). (Rob)
29+
30+
- OpenSSL:
31+
. Implemented FR #61421 (OpenSSL signature verification missing RMD160,
32+
SHA224, SHA256, SHA384, SHA512). (Mark Jones)
33+
1834
- SOAP
1935
. Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice).
2036
(Dmitry)
@@ -58,10 +74,6 @@ PHP NEWS
5874
(Pierrick)
5975
. Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick)
6076

61-
- DateTime:
62-
. Fixed bug #62852 (Unserialize invalid DateTime causes crash).
63-
64-
6577
- Intl:
6678
. Fixed Spoofchecker not being registered on ICU 49.1. (Gustavo)
6779
. Fix bug #62933 (ext/intl compilation error on icu 3.4.1). (Gustavo)
@@ -238,7 +250,9 @@ PHP NEWS
238250

239251
- Sockets:
240252
. Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe)
241-
253+
. Fixed bug #63000 (MCAST_JOIN_GROUP on OSX is broken, merge of PR 185 by
254+
Igor Wiedler). (Lars)
255+
242256
- SPL:
243257
. Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to
244258
dot files). (Laruence)

Zend/zend_API.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,9 @@ void module_destructor(zend_module_entry *module) /* {{{ */
22652265
/* Deinitilaise module globals */
22662266
if (module->globals_size) {
22672267
#ifdef ZTS
2268-
ts_free_id(*module->globals_id_ptr);
2268+
if (*module->globals_id_ptr) {
2269+
ts_free_id(*module->globals_id_ptr);
2270+
}
22692271
#else
22702272
if (module->globals_dtor) {
22712273
module->globals_dtor(module->globals_ptr TSRMLS_CC);

Zend/zend_alloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
664664

665665
static inline unsigned int zend_mm_high_bit(size_t _size)
666666
{
667-
#if defined(__GNUC__) && defined(i386)
667+
#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
668668
unsigned int n;
669669

670670
__asm__("bsrl %1,%0\n\t" : "=r" (n) : "rm" (_size));
@@ -690,7 +690,7 @@ static inline unsigned int zend_mm_high_bit(size_t _size)
690690

691691
static inline unsigned int zend_mm_low_bit(size_t _size)
692692
{
693-
#if defined(__GNUC__) && defined(i386)
693+
#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
694694
unsigned int n;
695695

696696
__asm__("bsfl %1,%0\n\t" : "=r" (n) : "rm" (_size));
@@ -2454,7 +2454,7 @@ ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_
24542454
return _zend_mm_block_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
24552455
}
24562456

2457-
#if defined(__GNUC__) && defined(i386)
2457+
#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
24582458

24592459
static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
24602460
{

ext/curl/tests/bug62839.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Bug #62839 (curl_copy_handle segfault with CURLOPT_FILE)
77
<?php
88
$curl = curl_init();
99

10-
$fd = fopen('/tmp/test', 'wb');
10+
$fd = tmpfile();
1111
curl_setopt($curl, CURLOPT_FILE, $fd);
1212

1313
curl_copy_handle($curl);

ext/date/php_date.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,19 +2467,16 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
24672467
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
24682468
convert_to_long(*z_timezone_type);
24692469
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
2470-
zend_error_handling error_handling;
2471-
2472-
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
24732470
convert_to_string(*z_timezone);
24742471

24752472
switch (Z_LVAL_PP(z_timezone_type)) {
24762473
case TIMELIB_ZONETYPE_OFFSET:
24772474
case TIMELIB_ZONETYPE_ABBR: {
24782475
char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2);
24792476
snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone));
2480-
php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 TSRMLS_CC);
2477+
php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
24812478
efree(tmp);
2482-
break;
2479+
return 1;
24832480
}
24842481

24852482
case TIMELIB_ZONETYPE_ID:
@@ -2493,15 +2490,10 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
24932490
tzobj->tzi.tz = tzi;
24942491
tzobj->initialized = 1;
24952492

2496-
php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC);
2493+
php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
24972494
zval_ptr_dtor(&tmp_obj);
2498-
break;
2499-
default:
2500-
zend_restore_error_handling(&error_handling TSRMLS_CC);
2501-
return 0;
2495+
return 1;
25022496
}
2503-
zend_restore_error_handling(&error_handling TSRMLS_CC);
2504-
return 1;
25052497
}
25062498
}
25072499
}

ext/date/tests/bug62852.phpt

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,35 @@
22
Bug #62852 (Unserialize invalid DateTime causes crash)
33
--INI--
44
date.timezone=GMT
5+
--XFAIL--
6+
bug is not fixed yet
57
--FILE--
68
<?php
7-
try {
8-
$datetime = unserialize('O:8:"DateTime":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}');
9-
var_dump($datetime);
10-
} catch (Exception $e) {
11-
var_dump($e->getMessage());
9+
$s1 = 'O:8:"DateTime":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}';
10+
$s2 = 'O:3:"Foo":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}';
11+
12+
global $foo;
13+
14+
class Foo extends DateTime {
15+
function __wakeup() {
16+
global $foo;
17+
$foo = $this;
18+
parent::__wakeup();
19+
}
1220
}
21+
22+
// Old test case
23+
try {
24+
unserialize( $s1 );
25+
} catch ( Exception $e ) {}
26+
27+
// My test case
28+
try {
29+
unserialize( $s2 );
30+
} catch ( Exception $e ) {}
31+
var_dump( $foo );
32+
33+
echo "okey";
1334
?>
1435
--EXPECTF--
15-
string(%d) "DateTime::__wakeup(): Failed to parse time string (%s) at position 12 (0): Double time specification"
36+
okey

ext/dom/domerrorhandler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* {{{ arginfo */
3131
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_domerrorhandler_handle_error, 0, 0, 1)
32-
ZEND_ARG_OBJ_INFO(0, error, DOMError, 0)
32+
ZEND_ARG_OBJ_INFO(0, error, DOMDomError, 0)
3333
ZEND_END_ARG_INFO();
3434
/* }}} */
3535

ext/openssl/openssl.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@
6969
#define OPENSSL_ALGO_MD2 4
7070
#endif
7171
#define OPENSSL_ALGO_DSS1 5
72-
72+
#if OPENSSL_VERSION_NUMBER >= 0x0090708fL
73+
#define OPENSSL_ALGO_SHA224 6
74+
#define OPENSSL_ALGO_SHA256 7
75+
#define OPENSSL_ALGO_SHA384 8
76+
#define OPENSSL_ALGO_SHA512 9
77+
#define OPENSSL_ALGO_RMD160 10
78+
#endif
7379
#define DEBUG_SMIME 0
7480

7581
/* FIXME: Use the openssl constants instead of
@@ -954,6 +960,23 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(long algo) { /* {{{ */
954960
case OPENSSL_ALGO_DSS1:
955961
mdtype = (EVP_MD *) EVP_dss1();
956962
break;
963+
#if OPENSSL_VERSION_NUMBER >= 0x0090708fL
964+
case OPENSSL_ALGO_SHA224:
965+
mdtype = (EVP_MD *) EVP_sha224();
966+
break;
967+
case OPENSSL_ALGO_SHA256:
968+
mdtype = (EVP_MD *) EVP_sha256();
969+
break;
970+
case OPENSSL_ALGO_SHA384:
971+
mdtype = (EVP_MD *) EVP_sha384();
972+
break;
973+
case OPENSSL_ALGO_SHA512:
974+
mdtype = (EVP_MD *) EVP_sha512();
975+
break;
976+
case OPENSSL_ALGO_RMD160:
977+
mdtype = (EVP_MD *) EVP_ripemd160();
978+
break;
979+
#endif
957980
default:
958981
return NULL;
959982
break;
@@ -1048,6 +1071,13 @@ PHP_MINIT_FUNCTION(openssl)
10481071
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT);
10491072
#endif
10501073
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT);
1074+
#if OPENSSL_VERSION_NUMBER >= 0x0090708fL
1075+
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT);
1076+
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT);
1077+
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT);
1078+
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT);
1079+
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT);
1080+
#endif
10511081

10521082
/* flags for S/MIME */
10531083
REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT);

ext/sockets/multicast.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
/* $Id$ */
2020

2121
#if defined(MCAST_JOIN_GROUP) && \
22-
(!defined(PHP_WIN32) || (_WIN32_WINNT >= 0x600 && SOCKETS_ENABLE_VISTA_API))
22+
(!defined(PHP_WIN32) || (_WIN32_WINNT >= 0x600 && SOCKETS_ENABLE_VISTA_API)) && \
23+
!defined(__APPLE__)
2324
#define RFC3678_API 1
2425
/* has block/unblock and source membership, in this case for both IPv4 and IPv6 */
2526
#define HAS_MCAST_EXT 1
26-
#elif defined(IP_ADD_SOURCE_MEMBERSHIP)
27+
#elif defined(IP_ADD_SOURCE_MEMBERSHIP) && !defined(__APPLE__)
2728
/* has block/unblock and source membership, but only for IPv4 */
2829
#define HAS_MCAST_EXT 1
2930
#endif

ext/sockets/tests/bug63000.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #63000: Multicast on OSX
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('sockets')) {
6+
die('skip sockets extension not available.');
7+
}
8+
if (PHP_OS !== 'Darwin') {
9+
die('is not OSX.');
10+
}
11+
--FILE--
12+
<?php
13+
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
14+
socket_bind($socket, '0.0.0.0', 31057);
15+
16+
$so = socket_set_option($socket, IPPROTO_IP, MCAST_JOIN_GROUP, array(
17+
"group" => '224.0.0.251',
18+
"interface" => 0,
19+
));
20+
var_dump($so);
21+
--EXPECTF--
22+
bool(true)

0 commit comments

Comments
 (0)