Commit Graph

17 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
jrfnl b9d0e242fb
Examples/mailing_list: remove use of `E_STRICT`
While this is only example code, it is still code which should be functional for all supported PHP versions.

As `E_STRICT` has been deprecated since PHP 8.4 and wasn't really all that useful since PHP 7.0 anyway, it's probably better not to mention it in the example code.

Ref: https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant
2025-11-23 05:23:36 +01:00
Marcus Bointon 677ff5b2f9
CS 2023-11-23 12:12:10 +01:00
Marcus Bointon dd16b7d95b
Add use of replaceCustomHeader in mailing list example, see #2981 2023-11-23 11:59:21 +01:00
Marcus Bointon 0f24617b0c
Consistent comment style 2021-02-19 13:42:01 +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 589ec7d8f3
Access the `$smtp` instance the right way, fixes #1990 2020-02-24 15:01:57 +01:00
Marcus Bointon 12c4f0a85a
Add more error checking to mailing list example 2019-07-30 18:26:19 +02:00
Marcus Bointon 31493b6732
Big cleanup for Symfony coding style and php-cs-fixer, see #1148 2017-09-07 18:21:09 +02:00
Marcus f0ed47850c Sort out namespaces and imports in examples 2016-04-22 19:13:15 +02:00
Marcus 33f82ab517 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:52:37 +02:00
Synchro 9b3e13dc14 First draft of 5.4 2015-11-09 19:09:13 +01:00
Synchro e8c61ada87 Add SMTP example
Simplify other code examples
2014-09-25 14:18:57 +02:00
Synchro e3314c44ed Fix body setting in list example 2014-04-24 14:39:33 +02:00
michaelkonecny 213bdd6de4 host declaration was there twice 2014-04-09 18:29:41 +02:00
Synchro d992ae6dc4 Centralise check for debug output
PSR-2 reformat

Enable debug output for failing test

Fix broken test
Comment clearout

Proper thin spaces before French punctuation

Fix phpdocs for addrAppend and addrFormat, fixes #81
Minor code cleanup, remove some local vars

See changelog.

More phpdoc cleanup
2013-07-30 12:51:15 +02:00
Synchro ff8718f722 Major overhaul and cleanup of example code
Update test_script to use some recently changed features, rename to code_generator
Generated code actually works!
Update SyntaxHighlighter
New PHPMailer graphic
2013-04-26 18:22:45 +02:00