xref: /PHP-8.0/ext/phar/tests/bug65028.phpt (revision f8d79582)
1--TEST--
2Phar - test specific manifest length
3--INI--
4phar.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");
130foreach($files as $file)
131{
132    $phar->addFromString($file, "");
133}
134
135// Copy phar
136copy(__DIR__ . "/bug65028.phar", __DIR__ . "/bug65028-copy.phar");
137
138// Open phar
139try
140{
141    $phar = new Phar(__DIR__ . "/bug65028-copy.phar");
142    echo "No exception thrown.\n";
143}
144catch(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--
155No exception thrown.
156