Skip to content

Commit dd71f1f

Browse files
committed
Merge branch 'PHP-5.5' of ssh://git.php.net/php-src into PHP-5.5
2 parents 3dd5f4a + 2041376 commit dd71f1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1722
-475
lines changed

NEWS

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,25 @@ PHP NEWS
77
(Adam)
88
. Fixed bug #65108 (is_callable() triggers Fatal Error).
99
(David Soria Parra, Laruence)
10+
. Fixed bug #65035 (yield / exit segfault). (Nikita)
11+
. Fixed bug #65161 (Generator + autoload + syntax error = segfault). (Nikita)
12+
. hex2bin() raises E_WARNING for invalid hex string. (Yasuo)
1013

1114
- OPcache
1215
. Fixed bug #64827 (Segfault in zval_mark_grey (zend_gc.c)). (Laruence)
1316
. OPcache must be compatible with LiteSpeed SAPI (Dmitry)
1417

18+
- CGI:
19+
. Fixed Bug #65143 (Missing php-cgi man page). (Remi)
20+
1521
- CLI server:
1622
. Fixed bug #65066 (Cli server not responsive when responding with 422 http
1723
status code). (Adam)
1824

25+
- DateTime
26+
. Fixed fug #65184 (strftime() returns insufficient-length string under
27+
multibyte locales). (Anatol)
28+
1929
- GD
2030
. Fixed #65070 (bgcolor does not use the same format as the input image with
2131
imagerotate). (Pierre)
@@ -25,20 +35,40 @@ PHP NEWS
2535
that other formats. (Remi)
2636

2737
- Intl:
28-
. Fixed bug #62759: Buggy grapheme_substr() on edge case. (Stas)
38+
. Add IntlCalendar::setMinimalDaysInFirstWeek()/
39+
intlcal_set_minimal_days_in_first_week().
40+
. Fixed trailing space in the name of constant IntlCalendar::FIELD_FIELD_COUNT.
41+
. Fixed bug #62759 (Buggy grapheme_substr() on edge case). (Stas)
42+
. Fixed bug #61860 (Offsets may be wrong for grapheme_stri* functions).
43+
(Stas)
2944

3045
- PDO:
3146
. Allowed PDO_OCI to compile with Oracle Database 12c client libraries.
3247
(Chris Jones)
3348

49+
- Pgsql
50+
. pg_unescape_bytea() raises E_WARNING for invalid inputs. (Yasuo)
51+
52+
- Phar:
53+
. Fixed Bug #65142 (Missing phar man page). (Remi)
54+
55+
- Session:
56+
. Added optional create_sid() argument to session_set_save_handler(),
57+
SessionHandler and new SessionIdInterface. (Leigh, Arpad)
58+
3459
- Sockets:
3560
. Implemented FR #63472 (Setting SO_BINDTODEVICE with socket_set_option).
3661
(Damjan Cvetko)
3762

3863
- SPL:
64+
. Fixed bug #65136 (RecursiveDirectoryIterator segfault). (Laruence)
3965
. Fixed bug #61828 (Memleak when calling Directory(Recursive)Iterator
4066
/Spl(Temp)FileObject ctor twice). (Laruence)
4167

68+
- CGI/FastCGI SAPI:
69+
. Added PHP_FCGI_BACKLOG, overrides the default listen backlog. (Arnaud Le
70+
Blanc)
71+
4272
20 Jun 2013, PHP 5.5.0
4373

4474
- Core:

UPGRADING

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,45 @@ PHP 5.5 UPGRADE NOTES
4040
(http://php.net/foreach#control-structures.foreach.list,
4141
http://wiki.php.net/rfc/foreachlist)
4242

43-
- Support finally keyword. (Laruence)
43+
- Support "finally" keyword. (Laruence)
4444
(http://php.net/exceptions, http://wiki.php.net/rfc/finally)
4545

4646
- Support constant array/string dereferencing. (Laruence)
47-
(https://wiki.php.net/rfc/constdereference)
47+
(http://php.net/manual/en/language.types.array.php,
48+
https://wiki.php.net/rfc/constdereference)
4849

4950
- Add support for using empty() on the result of function calls and
5051
other expressions. Thus it is now possible to write empty(getArray()),
51-
for example. (https://wiki.php.net/rfc/empty_isset_exprs)
52+
for example. (http://php.net/manual/en/function.empty.php,
53+
https://wiki.php.net/rfc/empty_isset_exprs)
5254

5355
- Added generators.
5456
(http://php.net/generators, https://wiki.php.net/rfc/generators)
5557

5658
- ClassName::class syntax returning full class name for a class as a
57-
string constant.
58-
(http://php.net/oop5.basic#language.oop5.basic.class.class,
59+
string constant. (http://php.net/oop5.basic,
5960
https://wiki.php.net/rfc/class_name_scalars)
6061

6162
- Added support for non-scalar Iterator keys in foreach.
62-
(https://wiki.php.net/rfc/foreach-non-scalar-keys).
63+
(http://php.net/manual/en/control-structures.foreach.php,
64+
https://wiki.php.net/rfc/foreach-non-scalar-keys).
6365

6466
- Bundled Zend OPcache extension to improve performance
6567
(http://php.net/manual/en/book.opcache.php,
6668
https://wiki.php.net/rfc/optimizerplus)
6769

6870
- Added a simplified password hashing API
69-
(http://php.net/password)
71+
(http://php.net/password, https://wiki.php.net/rfc/password_hash)
7072

7173
========================================
7274
2. Changes in SAPI modules
7375
========================================
7476

7577
- Support for changing the process's title in CLI/CLI-Server
76-
SAPIs. (Keyur) (https://wiki.php.net/rfc/cli_process_title)
78+
SAPIs. (Keyur)
79+
(http://php.net/manual/en/function.cli-set-process-title.php,
80+
http://php.net/manual/en/function.cli-get-process-title.php,
81+
https://wiki.php.net/rfc/cli_process_title)
7782

7883
- Support for systemd in php-fpm: Add --with-fpm-systemd option to
7984
report health to systemd, and add systemd_interval option to

Zend/tests/generators/bug65035.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #65035: yield / exit segfault
3+
--FILE--
4+
<?php
5+
6+
function gen() {
7+
fn();
8+
yield;
9+
}
10+
11+
function fn() {
12+
exit('Done');
13+
}
14+
15+
$gen = gen();
16+
$gen->current();
17+
18+
?>
19+
--EXPECT--
20+
Done

Zend/tests/generators/bug65161.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #65161: Generator + autoload + syntax error = segfault
3+
--FILE--
4+
<?php
5+
6+
function autoload() {
7+
foo();
8+
}
9+
spl_autoload_register('autoload');
10+
11+
function testGenerator() {
12+
new SyntaxError('param');
13+
yield;
14+
}
15+
16+
foreach (testGenerator() as $i);
17+
18+
?>
19+
--EXPECTF--
20+
Fatal error: Call to undefined function foo() in %s on line %d

Zend/zend_alloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,7 +2465,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
24652465
size_t res = nmemb;
24662466
unsigned long overflow = 0;
24672467

2468-
__asm__ ("mull %3\n\taddl %4,%0\n\tadcl %1,%1"
2468+
__asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1"
24692469
: "=&a"(res), "=&d" (overflow)
24702470
: "%0"(res),
24712471
"rm"(size),
@@ -2493,7 +2493,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
24932493

24942494
__asm__ ("mul" LP_SUFF " %3\n\t"
24952495
"add %4,%0\n\t"
2496-
"adc %1,%1"
2496+
"adc $0,%1"
24972497
: "=&a"(res), "=&d" (overflow)
24982498
: "%0"(res),
24992499
"rm"(size),
@@ -2535,7 +2535,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
25352535
size_t res;
25362536
unsigned long overflow;
25372537

2538-
__asm__ ("mul %0,%2,%3\n\tumulh %1,%2,%3\n\tadds %0,%0,%4\n\tadc %1,%1,%1"
2538+
__asm__ ("mul %0,%2,%3\n\tumulh %1,%2,%3\n\tadds %0,%0,%4\n\tadc %1,%1,xzr"
25392539
: "=&r"(res), "=&r"(overflow)
25402540
: "r"(nmemb),
25412541
"r"(size),

Zend/zend_generators.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
5555
zval_ptr_dtor(&execute_data->current_this);
5656
}
5757

58+
/* A fatal error / die occured during the generator execution. Trying to clean
59+
* up the stack may not be safe in this case. */
60+
if (CG(unclean_shutdown)) {
61+
return;
62+
}
63+
5864
/* If the generator is closed before it can finish execution (reach
5965
* a return statement) we have to free loop variables manually, as
6066
* we don't know whether the SWITCH_FREE / FREE opcodes have run */

ext/date/php_date.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,13 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
16781678
break;
16791679
}
16801680
}
1681+
#if defined(PHP_WIN32) && _MSC_VER >= 1700
1682+
/* VS2012 strftime() returns number of characters, not bytes.
1683+
See VC++11 bug id 766205. */
1684+
if (real_len > 0) {
1685+
real_len = strlen(buf);
1686+
}
1687+
#endif
16811688

16821689
timelib_time_dtor(ts);
16831690
if (!gmt) {

ext/date/tests/bug65184.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Test bug #65184 strftime() returns insufficient-length string under multibyte locales
3+
--SKIPIF--
4+
<?php
5+
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
6+
die("skip Test is valid for Windows");
7+
}
8+
?>
9+
--FILE--
10+
<?php
11+
setlocale(LC_ALL, 'Japanese_Japan.932');
12+
/* timestamp has to be some wednesday */
13+
$s = strftime('%A', 1372884126);
14+
15+
for ($i = 0; $i < strlen($s); $i++) {
16+
printf("%x ", ord($s[$i]));
17+
}
18+
echo "\n";
19+
20+
echo strlen(strftime('%A')), "\n";
21+
?>
22+
===DONE===
23+
--EXPECT--
24+
90 85 97 6a 93 fa
25+
6
26+
===DONE===

ext/dba/tests/bug38698.phpt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ Bug #38698 (Bug #38698 for some keys cdbmake creates corrupted db and cdb can't
88
--FILE--
99
<?php
1010

11+
function isLittleEndian() {
12+
return 0x00FF === current(unpack('v', pack('S',0x00FF)));
13+
}
14+
1115
$db_file = dirname(__FILE__) .'/129php.cdb';
1216

1317
if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) {
14-
dba_insert(pack('i',129), "Booo!", $db_make);
18+
if (isLittleEndian() === FALSE) {
19+
dba_insert(pack('V',129), "Booo!", $db_make);
20+
} else{
21+
dba_insert(pack('i',129), "Booo!", $db_make);
22+
}
1523
dba_close($db_make);
1624
// write md5 checksum of generated database file
1725
var_dump(md5_file($db_file));

ext/imap/php_imap.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,6 @@ PHP_FUNCTION(imap_reopen)
12701270
int mailbox_len;
12711271
long options = 0, retries = 0;
12721272
pils *imap_le_struct;
1273-
MAILSTREAM *imap_stream;
12741273
long flags=NIL;
12751274
long cl_flags=NIL;
12761275

@@ -1298,12 +1297,12 @@ PHP_FUNCTION(imap_reopen)
12981297
RETURN_FALSE;
12991298
}
13001299

1301-
imap_stream = mail_open(imap_le_struct->imap_stream, mailbox, flags);
1302-
if (imap_stream == NIL) {
1300+
imap_le_struct->imap_stream = mail_open(imap_le_struct->imap_stream, mailbox, flags);
1301+
if (imap_le_struct->imap_stream == NIL) {
1302+
zend_list_delete(Z_RESVAL_P(streamind));
13031303
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't re-open stream");
13041304
RETURN_FALSE;
13051305
}
1306-
imap_le_struct->imap_stream = imap_stream;
13071306
RETURN_TRUE;
13081307
}
13091308
/* }}} */

ext/intl/calendar/calendar_class.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_setLenient, 0, 0, 1)
361361
ZEND_ARG_INFO(0, isLenient)
362362
ZEND_END_ARG_INFO()
363363

364+
ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_set_minimal_days_in_first_week, 0, 0, 1)
365+
ZEND_ARG_INFO(0, numberOfDays)
366+
ZEND_END_ARG_INFO()
367+
364368
ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1)
365369
ZEND_ARG_INFO(0, dateTime)
366370
ZEND_END_ARG_INFO()
@@ -433,6 +437,7 @@ static const zend_function_entry Calendar_class_functions[] = {
433437
#endif
434438
PHP_ME_MAPPING(setFirstDayOfWeek, intlcal_set_first_day_of_week, ainfo_cal_dow, ZEND_ACC_PUBLIC)
435439
PHP_ME_MAPPING(setLenient, intlcal_set_lenient, ainfo_cal_setLenient, ZEND_ACC_PUBLIC)
440+
PHP_ME_MAPPING(setMinimalDaysInFirstWeek,intlcal_set_minimal_days_in_first_week,ainfo_cal_set_minimal_days_in_first_week,ZEND_ACC_PUBLIC)
436441
PHP_ME_MAPPING(equals, intlcal_equals, ainfo_cal_other_cal, ZEND_ACC_PUBLIC)
437442
#if U_ICU_VERSION_MAJOR_NUM >= 49
438443
PHP_ME_MAPPING(getRepeatedWallTimeOption,intlcal_get_repeated_wall_time_option,ainfo_cal_void, ZEND_ACC_PUBLIC)
@@ -523,7 +528,7 @@ void calendar_register_IntlCalendar_class(TSRMLS_D)
523528
CALENDAR_DECL_LONG_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY);
524529
CALENDAR_DECL_LONG_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY);
525530
CALENDAR_DECL_LONG_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH);
526-
CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT ", UCAL_FIELD_COUNT);
531+
CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT);
527532
CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH);
528533

529534
CALENDAR_DECL_LONG_CONST("DOW_SUNDAY", UCAL_SUNDAY);

ext/intl/calendar/calendar_methods.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,32 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient)
997997
RETURN_TRUE;
998998
}
999999

1000+
U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week)
1001+
{
1002+
long num_days;
1003+
CALENDAR_METHOD_INIT_VARS;
1004+
1005+
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
1006+
"Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) {
1007+
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
1008+
"intlcal_set_minimal_days_in_first_week: bad arguments", 0 TSRMLS_CC);
1009+
RETURN_FALSE;
1010+
}
1011+
1012+
if (num_days < 1 || num_days > 7) {
1013+
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
1014+
"intlcal_set_minimal_days_in_first_week: invalid number of days; "
1015+
"must be between 1 and 7", 0 TSRMLS_CC);
1016+
RETURN_FALSE;
1017+
}
1018+
1019+
CALENDAR_METHOD_FETCH_OBJECT;
1020+
1021+
co->ucal->setMinimalDaysInFirstWeek((uint8_t)num_days);
1022+
1023+
RETURN_TRUE;
1024+
}
1025+
10001026
U_CFUNC PHP_FUNCTION(intlcal_equals)
10011027
{
10021028
zval *other_object;

ext/intl/calendar/calendar_methods.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ PHP_FUNCTION(intlcal_set_first_day_of_week);
9191

9292
PHP_FUNCTION(intlcal_set_lenient);
9393

94+
PHP_FUNCTION(intlcal_set_minimal_days_in_first_week);
95+
9496
PHP_FUNCTION(intlcal_equals);
9597

9698
PHP_FUNCTION(intlcal_get_repeated_wall_time_option);

0 commit comments

Comments
 (0)