Tag Archives: php

Testing Warnings in PHPUnit 9+

Testing warnings thrown via trigger_error throws a deprecation warning in PHPUnit 9+:

Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10

Testing E_USER_WARNING and E_WARNINGM will no longer be possible, in favor of thrown exceptions. None of the usual convertWarningsToExceptions configuration tricks work.

Here’s a snippet that will help:

$errored = null;
set_error_handler(function($errno, $errstr, ...$args) use (&$errored) {
    $errored = [$errno, $errstr, $args];
    restore_error_handler();
});
call_error_triggering_function();
$this->assertNotNull($errored, 'did not trigger any warning');                                                                             
[$errno, $errstr, $args] = $errored;
$this->assertEquals(E_USER_WARNING, $errno, 'did not trigger an E_USER_WARNING');

The fact that we’re not even going to be seeing warnings, deprecations in PHPUnit 10 is appalling!

https://phpunit.de/announcements/phpunit-10.html



WordPress Newsletter Plugin Multisite Vulnerability

WordPress Newsletter Plugin Vulnerability

I have had the opportunity to work with the WordPress Newsletter Plugin from Tribulant, a plugin that rivals the free MailPress plugin, but with its own twist (and its own pricetag of $54.99 single license, $274.95 unlimited).

The WordPress Newsletter Plugin copy starts out by shouting:

A WordPress newsletter plugin which will, without a doubt, blow your mind away with its feature set…

And it does, after you take a look at one of its core features that they’re proud of:

Both PHP, HTML, CSS and WordPress shortcodes can be put into themes.

Newsletters: Themes Documentation

See anything wrong with that?

Continue reading