Skip to content

Commit 4c2ee01

Browse files
authored
Update index.php
1 parent 1ed9f6b commit 4c2ee01

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

public/index.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,15 @@ function cleanArray($didYouMeans){
272272

273273
if(isset($_GET['bundle'])){
274274
// $code = file_get_contents($file);
275+
$rawFileContents = $code;
275276
$FileAll = (new \Nette\PhpGenerator\Extractor(file_get_contents($file)))->extractAll();
276277
$code = (new \Nette\PhpGenerator\PsrPrinter)->printFile($FileAll);
277-
278-
278+
if( empty(trim($code, ' <?php '))
279+
|| preg_match("/(echo|\=)([\s\t\n\r]*)\<\<\<[\s\t\n\r]*/", $rawFileContents)){
280+
$code = $rawFileContents;
281+
}
282+
283+
279284
$code = false === strpos($code, base64_decode('X19oYWx0X2NvbXBpbGVyKCk7'))
280285
? $loader->sign($code, [ file_get_contents($priv_key_file), $password], 'X19oYWx0X2NvbXBpbGVyKCk7')
281286
: $code;
@@ -363,8 +368,11 @@ function cleanArray($didYouMeans){
363368
$outPut = (new \Nette\PhpGenerator\PsrPrinter)->printFile($File);
364369
}
365370

366-
if(0===count($Nss) || empty(trim($outPut, ' <?php '))){
367-
$outPut = file_get_contents($file);
371+
$rawFileContents = file_get_contents($file);
372+
373+
if(0===count($Nss) || empty(trim($outPut, ' <?php '))
374+
|| preg_match("/(echo|\=)([\s\t\n\r]*)\<\<\<[\s\t\n\r]*/", $rawFileContents)){
375+
$outPut = $rawFileContents;
368376
}
369377

370378

0 commit comments

Comments
 (0)