RiFi2k / format-html-in-php

Basically this vscode extension uses all your standard configurations for html formatting, and your standard configurations for format on save, etc. It more or less works exactly how vscode should already work as it pertains to HTML in PHP files.
The Unlicense
33 stars 6 forks source link

Wrong format and ruin file PHPMailer.php #62

Open HungTran93 opened 2 years ago

HungTran93 commented 2 years ago

I'm learning and praticing the send email functiong provided by PHPMailer from https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php. It worked very well. But after I opened the PHPMailler.php and Format HTML in PHP extension format it file. The file was broken and was not format well. The code in line 1825 of https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php will become like this: for ($i = 0; $i < $length; ++$i) { $c=$string[$i]; //All other characters have a special meaning in at least one common shell, including=and +. //Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here. //Note that this does permit non-Latin alphanumeric characters based on the current locale. if (!ctype_alnum($c) && strpos('@_-.', $c)===false) { return false; } } return true; } /** * Check whether a file path is of a permitted type. * Used to reject URLs and phar files from functions that access local file paths, * such as addAttachment. * * @param string $path A relative or absolute path to a file * * @return bool */ protected static function isPermittedPath($path) { //Matches scheme definition from https://tools.ietf.org/html/rfc3986#section-3.1 return !preg_match('#^[a-z][a-z\d+.-]*://#i', $path); } /** * Check whether a file path is safe, accessible, and readable. * * @param string $path A relative or absolute path to a file * * @return bool */ protected static function fileIsAccessible($path) { if (!static::isPermittedPath($path)) { return false; } $readable=file_exists($path); //If not a UNC path (expected to start with \\), check read permission, see #2069 if (strpos($path, '\\\\' ) !==0) { $readable=$readable && is_readable($path); } return $readable; } /** * Send mail using the PHP mail() function. * * @see http://www.php.net/manual/en/book.mail.php * * @param string $header The message headers * @param string $body The message body * * @throws Exception * * @return bool */ protected function mailSend($header, $body) { $header=static::stripTrailingWSP($header) . static::$LE . static::$LE; $toArr=[]; foreach ($this->to as $toaddr) { $toArr[] = $this->addrFormat($toaddr); } Please check it out and fix that. Thank you!