mirror of
https://github.com/php/php-src.git
synced 2025-08-17 22:48:57 +02:00

Disallows constructing an `IMAPConnection` class directly with `new IMAPConnection` construct, by throwing an `Error` exception if attempted. `imap_open` is still the only way to create `IMAPConnection` objects.
15 lines
369 B
PHP
15 lines
369 B
PHP
--TEST--
|
|
Attempt to instantiate an IMAPConnection directly
|
|
--SKIPIF--
|
|
<?php
|
|
extension_loaded('imap') or die('skip imap extension not available in this build');
|
|
--FILE--
|
|
<?php
|
|
|
|
try {
|
|
new IMAPConnection();
|
|
} catch (Error $ex) {
|
|
echo "Exception: ", $ex->getMessage(), "\n";
|
|
}
|
|
--EXPECT--
|
|
Exception: Cannot directly construct IMAPConnection, use imap_open() instead
|