comparison vendor/symfony/http-kernel/HttpCache/Esi.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
69 if (empty($type)) { 69 if (empty($type)) {
70 $type = 'text/html'; 70 $type = 'text/html';
71 } 71 }
72 72
73 $parts = explode(';', $type); 73 $parts = explode(';', $type);
74 if (!in_array($parts[0], $this->contentTypes)) { 74 if (!\in_array($parts[0], $this->contentTypes)) {
75 return $response; 75 return $response;
76 } 76 }
77 77
78 // we don't use a proper XML parser here as we can have ESI tags in a plain text response 78 // we don't use a proper XML parser here as we can have ESI tags in a plain text response
79 $content = $response->getContent(); 79 $content = $response->getContent();
83 $chunks = preg_split('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', $content, -1, PREG_SPLIT_DELIM_CAPTURE); 83 $chunks = preg_split('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
84 $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]); 84 $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]);
85 85
86 $i = 1; 86 $i = 1;
87 while (isset($chunks[$i])) { 87 while (isset($chunks[$i])) {
88 $options = array(); 88 $options = [];
89 preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); 89 preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER);
90 foreach ($matches as $set) { 90 foreach ($matches as $set) {
91 $options[$set[1]] = $set[2]; 91 $options[$set[1]] = $set[2];
92 } 92 }
93 93