Commit Graph

19 Commits

Author SHA1 Message Date
jrfnl 57ef8c914f
Escape special characters the same way in all PHP versions
The `htmlspecialchars()` function is used to escape arbitrary text strings for display.

Original the default for the `$flags` parameter of that function in PHP was `ENT_COMPAT`, which translates to "convert double quotes to `"` and leave single quotes alone".

As of PHP 8.1, the default value for the `$flags` parameter has been made more robust and was changed to `ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401`, which translates to "convert both double and single quotes, replace invalid code unit sequences with a Unicode Replacement Character and treat code as HTML 4.01".

For code to provide the same/predictable output cross-version PHP, the `$flags` parameter should be explicitly set and what with the new default value being the more robust one, this commit adds that value for `$flags` in all instances of function calls to `htmlspecialchars()`.

Once the application minimum PHP version is PHP 8.1 or higher, the parameter can be removed again (as the value will then be the same as the default parameter value).

Ref: https://www.php.net/manual/en/function.htmlspecialchars.php
2025-11-24 10:50:37 +01:00
Marcus Bointon dfa731a087
Check broken links, update for HTTPS everywhere 2024-04-01 20:48:10 +02:00
Marcus Bointon 0f24617b0c
Consistent comment style 2021-02-19 13:42:01 +01:00
Marcus Bointon 3dffb3e4ee
Load classes earlier 2020-10-29 15:33:52 +01:00
Marcus Bointon f6321480c5
Retain uploaded extension in the attachment examples so that the MIME type is more easily obtained 2020-10-28 19:06:04 +01:00
Marcus Bointon 22e81749ae
Switch from PHP CS fixer to phpcs and apply PSR12 reformatting 2020-10-13 15:08:42 +02:00
Marcus Bointon db03bb6c1a
Escape output on file upload messages 2020-08-04 08:51:55 +02:00
Marcus Bointon 79b5d815d6
Better error checking & reporting on file uploads 2020-08-04 08:51:48 +02:00
Marcus Bointon 3649f0697e Use HTML5 doctype and set lang attr everywhere 2019-10-16 10:09:01 +02:00
Marcus Bointon c9e4d921d4
Standards cleanup 2019-10-08 13:35:03 +02:00
Marcus Bointon 1f9a66492a
Replace all uses of MD5 and SHA1 with SHA256
Use more secure method of generating IDs
2017-05-11 18:41:34 +02:00
Marcus Bointon 8914ec7a4b
Merge branch 'master' into 6.0
# Conflicts:
#	VERSION
#	examples/contentsutf8.html
#	src/PHPMailer.php
#	src/POP3.php
#	src/SMTP.php
#	test/bootstrap.php
2017-01-06 23:34:57 +01:00
Marcus Bointon a39c742bd7
Example cleanup 2017-01-05 13:06:20 +01:00
Marcus Bointon 2acd2eff9c Update examples, add contact form example 2016-06-29 18:26:55 +02:00
Marcus f0ed47850c Sort out namespaces and imports in examples 2016-04-22 19:13:15 +02:00
Marcus 27501ac7b9 Merge branch 'master' into 5.4
Bump version to 5.5
Clean up code generator
# Conflicts:
#	README.md
#	examples/send_file_upload.phps
#	src/SMTP.php
#	test/phpmailerTest.php
2016-04-07 10:51:05 +02:00
Marcus f0a6839a05 Improve send file examples 2016-03-29 10:05:36 +02:00
Synchro 9b3e13dc14 First draft of 5.4 2015-11-09 19:09:13 +01:00
Synchro cee5e9b442 Add example of sending a file upload 2014-12-24 10:40:13 +01:00