Skip to content

Commit 9791943

Browse files
committed
Merge branch 'PHP-5.4' of https://git.php.net/repository/php-src into PHP-5.4
# By Xinchen Hui (2) and others # Via Stanislav Malyshev (1) and Xinchen Hui (1) * 'PHP-5.4' of https://git.php.net/repository/php-src: Upper section name Fixed bug #65328 (Segfault when getting SplStack object Value) Fix compiler warning on redefined constant fixed bug #65311 testsuite failure due to incomplete fix to bug28985.phpt fix bug #65028 Phar::buildFromDirectory creates corrupt archives for some specific contents
2 parents a1bf38e + 5150929 commit 9791943

File tree

7 files changed

+540
-6
lines changed

7 files changed

+540
-6
lines changed

NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ PHP NEWS
1414
. Fixed bug #50308 (session id not appended properly for empty anchor tags).
1515
(Arpad)
1616

17+
- SPL:
18+
. Fixed bug #65328 (Segfault when getting SplStack object Value). (Laruence)
19+
20+
- Phar:
21+
. Fixed bug #65028 (Phar::buildFromDirectory creates corrupt archives for
22+
some specific contents). (Stas)
23+
1724
?? ??? 2013, PHP 5.4.18
1825

1926
- Core:

ext/pdo_mysql/mysql_driver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,9 @@ static struct pdo_dbh_methods mysql_methods = {
527527
/* }}} */
528528

529529
#ifdef PHP_WIN32
530-
# define MYSQL_UNIX_ADDR NULL
530+
# define PDO_DEFAULT_MYSQL_UNIX_ADDR NULL
531531
#else
532-
# define MYSQL_UNIX_ADDR PDO_MYSQL_G(default_socket)
532+
# define PDO_DEFAULT_MYSQL_UNIX_ADDR PDO_MYSQL_G(default_socket)
533533
#endif
534534

535535
/* {{{ pdo_mysql_handle_factory */
@@ -545,7 +545,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
545545
{ "dbname", "", 0 },
546546
{ "host", "localhost", 0 },
547547
{ "port", "3306", 0 },
548-
{ "unix_socket", MYSQL_UNIX_ADDR, 0 },
548+
{ "unix_socket", PDO_DEFAULT_MYSQL_UNIX_ADDR, 0 },
549549
};
550550
int connect_opts = 0
551551
#ifdef CLIENT_MULTI_RESULTS

ext/phar/phar.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,6 +2579,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
25792579
php_serialize_data_t metadata_hash;
25802580
smart_str main_metadata_str = {0};
25812581
int free_user_stub, free_fp = 1, free_ufp = 1;
2582+
int manifest_hack = 0;
25822583

25832584
if (phar->is_persistent) {
25842585
if (error) {
@@ -2930,6 +2931,12 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
29302931

29312932
manifest_len = offset + phar->alias_len + sizeof(manifest) + main_metadata_str.len;
29322933
phar_set_32(manifest, manifest_len);
2934+
/* Hack - see bug #65028, add padding byte to the end of the manifest */
2935+
if(manifest[0] == '\r' || manifest[0] == '\n') {
2936+
manifest_len++;
2937+
phar_set_32(manifest, manifest_len);
2938+
manifest_hack = 1;
2939+
}
29332940
phar_set_32(manifest+4, new_manifest_count);
29342941
if (has_dirs) {
29352942
*(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) >> 8) & 0xFF);
@@ -3054,6 +3061,22 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
30543061
return EOF;
30553062
}
30563063
}
3064+
/* Hack - see bug #65028, add padding byte to the end of the manifest */
3065+
if(manifest_hack) {
3066+
if(1 != php_stream_write(newfile, manifest, 1)) {
3067+
if (closeoldfile) {
3068+
php_stream_close(oldfile);
3069+
}
3070+
3071+
php_stream_close(newfile);
3072+
3073+
if (error) {
3074+
spprintf(error, 0, "unable to write manifest padding byte");
3075+
}
3076+
3077+
return EOF;
3078+
}
3079+
}
30573080

30583081
/* now copy the actual file data to the new phar */
30593082
offset = php_stream_tell(newfile);

ext/phar/tests/bug65028.phpt

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
--TEST--
2+
Phar - test specific manifest length
3+
--INI--
4+
phar.readonly=0
5+
--SKIPIF--
6+
<?php if (!extension_loaded("phar")) die("skip"); ?>
7+
--FILE--
8+
<?php
9+
10+
$files = array(
11+
"lib/widgets/Widgets.php",
12+
"lib/events/FormBeginEventArgs.php",
13+
"lib/events/FormEndEventArgs.php",
14+
"lib/Core.php",
15+
"lib/database/MySqlDatabase.php",
16+
"lib/utils/DateUtil.php",
17+
"js/global.js",
18+
"files/_emptyDirectory",
19+
"files/search/schema.xml",
20+
"vendor/Fusonic/Linq/Internal/WhereIterator.php",
21+
"vendor/Fusonic/Linq/Internal/SelectManyIterator.php",
22+
"vendor/Fusonic/Linq/Internal/SelectIterator.php",
23+
"vendor/Fusonic/Linq/Internal/DiffIterator.php",
24+
"vendor/Fusonic/Linq/Internal/GroupIterator.php",
25+
"vendor/Fusonic/Linq/Internal/DistinctIterator.php",
26+
"vendor/Fusonic/Linq/Internal/LinqHelper.php",
27+
"vendor/Fusonic/Linq/Internal/OrderIterator.php",
28+
"vendor/Fusonic/Linq/Internal/IntersectIterator.php",
29+
"vendor/Fusonic/Linq/GroupedLinq.php",
30+
"vendor/Fusonic/Linq.php",
31+
"vendor/Fusonic/UI/Widgets/Forms/FormBegin.php",
32+
"vendor/Fusonic/UI/Widgets/Forms/FormSectionBuilder.php",
33+
"vendor/Fusonic/UI/Widgets/Forms/AutoSelect.php",
34+
"vendor/Fusonic/UI/Widgets/Forms/ControlGroup.php",
35+
"vendor/Fusonic/UI/Widgets/Forms/FormEnd.php",
36+
"vendor/Fusonic/UI/Widgets/WidgetBase.php",
37+
"modules/calendar/ajax/calendarGetInvitedUsersContentAjaxHandler.php",
38+
"modules/calendar/js/calendarAppointmentForm.js",
39+
"modules/calendar/misc/calendarAppointment.php",
40+
"modules/calendar/pages/forms/calendarAppointmentForm.php",
41+
"modules/calendar/setup/config.xml",
42+
"modules/cmt/js/cmtMicroCommentsWidget.js",
43+
"modules/cmt/setup/config.xml",
44+
"modules/meta/misc/metaContentHelper.php",
45+
"modules/meta/setup/config.xml",
46+
"modules/brd/misc/brdPostStreamFormatter.php",
47+
"modules/brd/misc/brdPost.php",
48+
"modules/brd/setup/config/streamContents.xml",
49+
"modules/brd/setup/resources/lang/en.xml",
50+
"modules/brd/setup/resources/lang/de.xml",
51+
"modules/brd/setup/config.xml",
52+
"modules/auth/misc/authLoginService.php",
53+
"modules/auth/setup/config.xml",
54+
"modules/bwd/cache/bwdWordCacheCreator.php",
55+
"modules/bwd/bwd.php",
56+
"modules/bwd/setup/config.xml",
57+
"modules/nws/templates/pages/forms/nwsNewsForm.tpl",
58+
"modules/nws/templates/pages/nwsShowNewsPage.tpl",
59+
"modules/nws/pages/forms/nwsNewsForm.php",
60+
"modules/nws/pages/nwsShowNewsPage.php",
61+
"modules/nws/setup/config.xml",
62+
"modules/gmp/cache/gmpMarkersCacheCreator.php",
63+
"modules/gmp/select/gmpMapContentSelect.php",
64+
"modules/gmp/templates/gmpShowAppointmentPage.tpl",
65+
"modules/gmp/templates/gmpShowLinkPage.tpl",
66+
"modules/gmp/setup/config.xml",
67+
"modules/mul/cache/mulVideoPortalCacheCreator.php",
68+
"modules/mul/misc/mulPermissionHelper.php",
69+
"modules/mul/templates/widgets/mulFileEmbedWidget_Video_Flv.tpl",
70+
"modules/mul/setup/config/mulUploadVideoPortalMatches.xml",
71+
"modules/mul/setup/config.xml",
72+
"modules/cat/select/catCategorySelect.php",
73+
"modules/cat/misc/catCategory.php",
74+
"modules/cat/templates/pages/forms/catCategoryForm.tpl",
75+
"modules/cat/pages/forms/catEditCategoryForm.php",
76+
"modules/cat/pages/forms/catAddCategoryForm.php",
77+
"modules/cat/setup/config.xml",
78+
"modules/sty/events/styPageShowEventHandler.php",
79+
"modules/sty/misc/styBox.php",
80+
"modules/sty/templates/pages/forms/styLayoutForm.tpl",
81+
"modules/sty/templates/pages/forms/styBoxForm.tpl",
82+
"modules/sty/templates/pages/forms/styVariantForm.tpl",
83+
"modules/sty/setup/resources/lang/en.xml",
84+
"modules/sty/setup/resources/lang/de.xml",
85+
"modules/sty/setup/config.xml",
86+
"modules/reg/misc/regRegistrationHelper.php",
87+
"modules/reg/setup/config.xml",
88+
"modules/not/misc/notEmailNotificationProvider.php",
89+
"modules/not/setup/config.xml",
90+
"modules/styfusonic/setup/config.xml",
91+
"modules/sys/ajax/sysUserAutoSuggestSelectAjaxHandler.php",
92+
"modules/sys/js/sysUserAutoSuggestSelect.js",
93+
"modules/sys/select/sysPermissionSelect.php",
94+
"modules/sys/misc/sysHtaccessConfigWriter.php",
95+
"modules/sys/misc/sysUserRepository.php",
96+
"modules/sys/setup/resources/lang/en.xml",
97+
"modules/sys/setup/resources/lang/de.xml",
98+
"modules/sys/setup/config.xml",
99+
"modules/igr/boxes/igrGreatestEntriesBoxTab.php",
100+
"modules/igr/boxes/igrTopRatedEntriesBoxTab.php",
101+
"modules/igr/setup/config.xml",
102+
"modules/rat/ajax/ratRateAjaxHandler.php",
103+
"modules/rat/ajax/ratUnlikeAjaxHandler.php",
104+
"modules/rat/setup/config.xml",
105+
"modules/search/select/searchModuleSelect.php",
106+
"modules/search/select/searchOrderSelect.php",
107+
"modules/search/misc/searchResultFormatter.php",
108+
"modules/search/misc/searchProviderSolr.php",
109+
"modules/search/misc/searchProviderLucene.php",
110+
"modules/search/misc/searchResultItem.php",
111+
"modules/search/misc/searchProviderBase.php",
112+
"modules/search/misc/searchIProvider.php",
113+
"modules/search/templates/misc/searchResultFormatter.tpl",
114+
"modules/search/templates/pages/searchIndexPage.tpl",
115+
"modules/search/templates/pages/forms/searchSearchForm.tpl",
116+
"modules/search/pages/forms/searchSearchForm.php",
117+
"modules/search/css/searchResultFormatter.css",
118+
"modules/search/setup/config/sysSettings.xml",
119+
"modules/search/setup/resources/lang/en.xml",
120+
"modules/search/setup/resources/lang/de.xml",
121+
"modules/search/setup/config.xml",
122+
"style/Fusonic/40components.css",
123+
"style/_emptyDirectory",
124+
"index.php",
125+
// "a", // This will make the test pass
126+
);
127+
128+
// Create Phar with the filenames above
129+
$phar = new Phar(__DIR__ . "/bug65028.phar");
130+
foreach($files as $file)
131+
{
132+
$phar->addFromString($file, "");
133+
}
134+
135+
// Copy phar
136+
copy(__DIR__ . "/bug65028.phar", __DIR__ . "/bug65028-copy.phar");
137+
138+
// Open phar
139+
try
140+
{
141+
$phar = new Phar(__DIR__ . "/bug65028-copy.phar");
142+
echo "No exception thrown.\n";
143+
}
144+
catch(UnexpectedValueException $ex)
145+
{
146+
echo "Exception thrown: " . $ex->getMessage() . "\n";
147+
}
148+
?>
149+
--CLEAN--
150+
<?php
151+
@unlink(__DIR__ . "/bug65028.phar");
152+
@unlink(__DIR__ . "/bug65028-copy.phar");
153+
?>
154+
--EXPECT--
155+
No exception thrown.
156+

ext/soap/tests/bugs/bug28985.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ array(42) {
4444
string iUserPassword;
4545
}"
4646
[8]=>
47-
string(86) "struct MGCodeLibelle {
47+
string(87) "struct MGCodeLibelle {
4848
string Code;
4949
string Libelle;
5050
boolean Default;
@@ -203,4 +203,4 @@ array(42) {
203203
string(76) "struct GetEnvironnementResponse {
204204
MGEnvironnement GetEnvironnementResult;
205205
}"
206-
}
206+
}

ext/spl/spl_array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ SPL_METHOD(Array, getChildren)
16581658
return;
16591659
}
16601660
if (instanceof_function(Z_OBJCE_PP(entry), Z_OBJCE_P(getThis()) TSRMLS_CC)) {
1661-
RETURN_ZVAL(*entry, 0, 0);
1661+
RETURN_ZVAL(*entry, 1, 0);
16621662
}
16631663
}
16641664

0 commit comments

Comments
 (0)