File tree 3 files changed +20
-4
lines changed
Component/HttpKernel/HttpCache 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Bridge \Doctrine \Tests \DependencyInjection ;
13
13
14
- use Symfony \ Bundle \ FrameworkBundle \ Tests \TestCase ;
14
+ use PHPUnit \ Framework \TestCase ;
15
15
use Symfony \Component \DependencyInjection \Definition ;
16
16
use Symfony \Component \DependencyInjection \ContainerBuilder ;
17
17
use Symfony \Component \DependencyInjection \ParameterBag \ParameterBag ;
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ protected function setUp()
72
72
$ ids = range (1 , 300 );
73
73
74
74
foreach ($ ids as $ id ) {
75
- $ name = 65 + chr ($ id % 57 );
75
+ $ name = 65 + ( int ) chr ($ id % 57 );
76
76
$ this ->em ->persist (new SingleIntIdEntity ($ id , $ name ));
77
77
}
78
78
Original file line number Diff line number Diff line change @@ -317,14 +317,30 @@ private function getMetadata($key)
317
317
/**
318
318
* Purges data for the given URL.
319
319
*
320
+ * This method purges both the HTTP and the HTTPS version of the cache entry.
321
+ *
320
322
* @param string $url A URL
321
323
*
322
- * @return bool true if the URL exists and has been purged, false otherwise
324
+ * @return bool true if the URL exists with either HTTP or HTTPS scheme and has been purged, false otherwise
323
325
*/
324
326
public function purge ($ url )
325
327
{
326
- $ key = $ this ->getCacheKey (Request::create ($ url ));
328
+ $ http = preg_replace ('#^https# ' , 'http ' , $ url );
329
+ $ https = preg_replace ('#^http# ' , 'https ' , $ url );
327
330
331
+ return $ this ->doPurge ($ http ) || $ this ->doPurge ($ https );
332
+ }
333
+
334
+ /**
335
+ * Purges data for the given URL.
336
+ *
337
+ * @param string $url A URL
338
+ *
339
+ * @return bool true if the URL exists and has been purged, false otherwise
340
+ */
341
+ private function doPurge ($ url )
342
+ {
343
+ $ key = $ this ->getCacheKey (Request::create ($ url ));
328
344
if (isset ($ this ->locks [$ key ])) {
329
345
flock ($ this ->locks [$ key ], LOCK_UN );
330
346
fclose ($ this ->locks [$ key ]);
You can’t perform that action at this time.
0 commit comments