@@ -67,7 +67,7 @@ function getContentHash(array $composerJson)
67
67
68
68
$ referencedCommits = [];
69
69
70
- foreach ($ composerJsons as list ( $ dir , $ lockedPackages) ) {
70
+ foreach ($ composerJsons as [ $ dir , $ lockedPackages] ) {
71
71
foreach ($ lockedPackages as $ lockedJson ) {
72
72
if (0 !== strpos ($ version = $ lockedJson ['version ' ], 'dev- ' ) && '-dev ' !== substr ($ version , -4 )) {
73
73
continue ;
@@ -119,30 +119,36 @@ function getContentHash(array $composerJson)
119
119
$ chs = [];
120
120
121
121
foreach ($ referencedCommits as $ name => $ dirsByCommit ) {
122
- $ chs [] = $ ch = [curl_init (), fopen ($ _SERVER ['HOME ' ].'/.cache/composer/repo/https---repo.packagist.org/provider- ' .strtr ($ name , '/ ' , '$ ' ).'.json ' , 'wb ' )];
123
- curl_setopt ($ ch [0 ], CURLOPT_URL , 'https://repo.packagist.org/p/ ' .$ name .'.json ' );
124
- curl_setopt ($ ch [0 ], CURLOPT_FILE , $ ch [1 ]);
125
- curl_setopt ($ ch [0 ], CURLOPT_SHARE , $ sh );
126
- curl_multi_add_handle ($ mh , $ ch [0 ]);
122
+ foreach (['' , '~dev ' ] as $ suffix ) {
123
+ $ chs [] = $ ch = [curl_init (), fopen ($ _SERVER ['HOME ' ].'/.cache/composer/repo/https---repo.packagist.org/provider- ' .strtr ($ name , '/ ' , '~ ' ).$ suffix .'.json ' , 'w ' )];
124
+ curl_setopt ($ ch [0 ], CURLOPT_URL , 'https://repo.packagist.org/p2/ ' .$ name .$ suffix .'.json ' );
125
+ curl_setopt ($ ch [0 ], CURLOPT_FILE , $ ch [1 ]);
126
+ curl_setopt ($ ch [0 ], CURLOPT_SHARE , $ sh );
127
+ curl_multi_add_handle ($ mh , $ ch [0 ]);
128
+ }
127
129
}
128
130
129
131
do {
130
132
curl_multi_exec ($ mh , $ active );
131
133
curl_multi_select ($ mh );
132
134
} while ($ active );
133
135
134
- foreach ($ chs as list ( $ ch , $ fd) ) {
136
+ foreach ($ chs as [ $ ch , $ fd] ) {
135
137
curl_multi_remove_handle ($ mh , $ ch );
136
138
curl_close ($ ch );
137
139
fclose ($ fd );
138
140
}
139
141
140
142
foreach ($ referencedCommits as $ name => $ dirsByCommit ) {
141
- $ repo = file_get_contents ($ _SERVER ['HOME ' ].'/.cache/composer/repo/https---repo.packagist.org/provider- ' .strtr ($ name , '/ ' , '$ ' ).'.json ' );
142
- $ repo = json_decode ($ repo , true );
143
+ foreach (['' , '~dev ' ] as $ suffix ) {
144
+ $ repo = file_get_contents ($ _SERVER ['HOME ' ].'/.cache/composer/repo/https---repo.packagist.org/provider- ' .strtr ($ name , '/ ' , '~ ' ).$ suffix .'.json ' );
145
+ $ repo = json_decode ($ repo , true );
143
146
144
- foreach ($ repo ['packages ' ][$ name ] as $ version ) {
145
- unset($ referencedCommits [$ name ][$ version ['source ' ]['reference ' ]]);
147
+ foreach ($ repo ['packages ' ][$ name ] as $ version ) {
148
+ if (isset ($ version ['source ' ]['reference ' ])) {
149
+ unset($ referencedCommits [$ name ][$ version ['source ' ]['reference ' ]]);
150
+ }
151
+ }
146
152
}
147
153
}
148
154
0 commit comments