log.php 488 B

12345678910111213141516171819
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. if (!isset($_GET['name'])) {
  8. throw new \InvalidArgumentException(
  9. 'The name of log file is required for getting logs.'
  10. );
  11. }
  12. $name = urldecode($_GET['name']);
  13. if (preg_match('/\.\.(\\\|\/)/', $name)) {
  14. throw new \InvalidArgumentException('Invalid log file name');
  15. }
  16. echo serialize(file_get_contents('../../../../var/log' .'/' .$name));