@@ -21,7 +21,15 @@ public function process(Configuration $config): iterable
2121
2222 $ targetPathname = $ this ->getBinaryTargetPathname ($ config );
2323
24- $ targetStream = \fopen ($ targetPathname , 'wb+ ' );
24+ $ targetStream = @\fopen ($ targetPathname , 'wb+ ' );
25+
26+ if ($ targetStream === false ) {
27+ throw new \RuntimeException (\sprintf (
28+ 'Unable to create target binary "%s" ' ,
29+ $ targetPathname ,
30+ ));
31+ }
32+
2533 \flock ($ targetStream , \LOCK_EX );
2634
2735 $ this ->appendSfxArchive ($ targetStream );
@@ -51,7 +59,15 @@ private function getBinaryTargetPathname(Configuration $config): string
5159 */
5260 private function appendSource (mixed $ stream , Configuration $ config ): void
5361 {
54- $ sourceStream = \fopen ($ config ->pharPathname , 'rb ' );
62+ $ sourceStream = @\fopen ($ config ->pharPathname , 'rb ' );
63+
64+ if ($ sourceStream === false ) {
65+ throw new \RuntimeException (\sprintf (
66+ 'Unable to open application phar file "%s" ' ,
67+ $ config ->pharPathname ,
68+ ));
69+ }
70+
5571 \flock ($ sourceStream , \LOCK_SH );
5672
5773 \stream_copy_to_stream ($ sourceStream , $ stream );
@@ -78,7 +94,15 @@ private function appendSfxArchive(mixed $stream): void
7894 {
7995 $ archive = $ this ->getSfxArchivePathname ($ this ->assembly );
8096
81- $ archiveStream = \fopen ($ archive , 'rb ' );
97+ $ archiveStream = @\fopen ($ archive , 'rb ' );
98+
99+ if ($ archiveStream === false ) {
100+ throw new \RuntimeException (\sprintf (
101+ 'Unable to open application SFX file "%s" ' ,
102+ $ archive ,
103+ ));
104+ }
105+
82106 \flock ($ archiveStream , \LOCK_SH );
83107
84108 \stream_copy_to_stream ($ archiveStream , $ stream );
0 commit comments