Plugin Directory

Changeset 1986677


Ignore:
Timestamp:
12/06/2018 10:35:27 AM (7 years ago)
Author:
neosit
Message:

42b830ec1b48750c9a085a249d32d43b634d5706 Updated readme for new release

Location:
next-active-directory-integration/trunk
Files:
8 added
82 edited

Legend:

Unmodified
Added
Removed
  • next-active-directory-integration/trunk/classes/Adi/Authentication/LoginService.php

    r1948580 r1986677  
    4747    private $roleManager;
    4848
    49     private $currentUserAuthenticated;
     49    private $currentUserHasAccessGranted;
    5050
    5151    /**
     
    8080        $this->logger = NextADInt_Core_Logger::getLogger();
    8181
    82         $this->currentUserAuthenticated = false;
     82        $this->currentUserHasAccessGranted = false;
    8383    }
    8484
     
    8989    {
    9090        add_filter('authenticate', array($this, 'authenticate'), 10, 3);
     91        add_filter(NEXT_AD_INT_PREFIX . 'auth_before_create_or_update_user', array($this, 'beforeCreateOrUpdateUser'), 10 , 2);
     92        add_filter(NEXT_AD_INT_PREFIX . 'auth_after_create_or_update_user', array($this, 'afterCreateOrUpdateUser'), 10, 3);
    9193
    9294        // disable 'lost password' feature
     
    547549        // ADI-256: user does only have a valid id if he is already inside the directory or has been created with "Auto Create User" == on
    548550        if (is_object($wpUser) && !is_wp_error($wpUser) && ($wpUser->ID > 0)) {
    549 
     551            // state: user is authenticated, we won't explicitly set any flag
    550552            $userGuid = get_user_meta($wpUser->ID, 'next_ad_int_objectguid', true);
    551553
     
    554556                return false;
    555557            }
     558            // state: user is authorized
    556559
    557560            if ($this->userManager->isDisabled($wpUser->ID)) {
     
    560563                return false;
    561564            }
     565
     566            // state: user is authenticated, authorized and enabled -> grant access to WordPress
     567            $this->currentUserHasAccessGranted = true;
    562568        }
    563569
     
    590596        $credentials->setSAMAccountName($ldapAttributes->getFilteredValue('samaccountname'));
    591597
     598        /**
     599         * This filter can be used in order to implement custom checks validating the ldapAttributes and credentials of
     600         * the user currently trying to authenticate against your Active Directory.
     601         *
     602         * By default this filter returns true | boolean
     603         *
     604         */
     605        $preCreateStatus = apply_filters(NEXT_AD_INT_PREFIX . 'auth_before_create_or_update_user', $credentials, $ldapAttributes);
     606
     607        if (!$preCreateStatus) {
     608            $this->logger->debug('PreCreateStatus is false. The user will not be created nor updated. If this behavior is not intended, please if your custom logic for the "auth_before_create_or_update_user" filter works properly.');
     609            return false;
     610        }
     611
    592612        $adiUser = $this->userManager->createAdiUser($credentials, $ldapAttributes);
    593613
     
    608628        }
    609629
    610         if (is_object($wpUser)) {
    611             $this->currentUserAuthenticated = true;
    612         }
    613 
    614         return $wpUser;
     630        /**
     631         * This filter can be used in order to implement custom checks validating the credentials, ldapAttributes and $wpUser of
     632         * the user currently trying to authenticate against your Active Directory. You can intercept the authentication process
     633         * by returning false.
     634         *
     635         * By default the $wpUser | WP_USER is returned.
     636         */
     637        return apply_filters(NEXT_AD_INT_PREFIX . 'auth_after_create_or_update_user', $credentials, $ldapAttributes, $wpUser);
    615638    }
    616639
     
    720743     * @return bool
    721744     */
    722     public function isCurrentUserAuthenticated()
    723     {
    724         return $this->currentUserAuthenticated;
     745    public function hasCurrentUserAccessGranted()
     746    {
     747        return $this->currentUserHasAccessGranted;
    725748    }
    726749
     
    796819        return $this->roleManager;
    797820    }
     821
     822    /**
     823     * @param NextADInt_Adi_Authentication_Credentials $credentials
     824     * @param array $ldapAttributes
     825     * @return boolean
     826     */
     827    public function beforeCreateOrUpdateUser($credentials, $ldapAttributes) {
     828        return true;
     829    }
     830
     831    /**
     832     * @param NextADInt_Adi_Authentication_Credentials $credentials
     833     * @param NextADInt_Adi_User $adiUser
     834     * @param WP_User $wpUser
     835     * @return boolean|WP_User
     836     */
     837    public function afterCreateOrUpdateUser($credentials, $adiUser, $wpUser) {
     838        return $wpUser;
     839    }
    798840}
  • next-active-directory-integration/trunk/classes/Adi/Authentication/PasswordValidationService.php

    r1756617 r1986677  
    7272
    7373        // return true for users authenticated by ADI (should never happen, but who knows?)
    74         if ($this->loginService->isCurrentUserAuthenticated()) {
    75             $this->logger->debug('User successfully authenticated by the "Active Directory Integration" plugin: override local (WordPress) password check.');
     74        if ($this->loginService->hasCurrentUserAccessGranted()) {
     75            $this->logger->debug('User is enabled and has been successfully authenticated and authorized by the "Active Directory Integration" plugin: override local (WordPress) password check.');
    7676
    7777            return true;
  • next-active-directory-integration/trunk/classes/Adi/Configuration/ImportService.php

    r1595001 r1986677  
    293293        $configurationString = '';
    294294
    295         while (list($attribute, $setting) = each($data)) {
     295        foreach ($data as $attribute => $setting) {
    296296            $subsettings = array($attribute,
    297297                $setting['type'],
  • next-active-directory-integration/trunk/classes/Adi/Configuration/Ui/Layout.php

    r1944146 r1986677  
    7272                        ),
    7373                    ),
    74                     __('Menu', 'next-active-directory-integration') => array(
    75                         self::DESCRIPTION => __(
    76                             'It is also possible to only disable certain NADI features.',
    77                             'next-active-directory-integration'
    78                         ),
    79                         self::OPTIONS => array(
    80                             NextADInt_Adi_Configuration_Options::SHOW_MENU_TEST_AUTHENTICATION,
    81                             NextADInt_Adi_Configuration_Options::SHOW_MENU_SYNC_TO_AD,
    82                             NextADInt_Adi_Configuration_Options::SHOW_MENU_SYNC_TO_WORDPRESS
    83                         )
    84                     ),
    85                 ),
     74                ),
     75                __('Menu', 'next-active-directory-integration') => array(
     76                    self::DESCRIPTION => __(
     77                        'It is also possible to only disable certain NADI features.',
     78                        'next-active-directory-integration'
     79                    ),
     80                    self::OPTIONS => array(
     81                        NextADInt_Adi_Configuration_Options::SHOW_MENU_TEST_AUTHENTICATION,
     82                        NextADInt_Adi_Configuration_Options::SHOW_MENU_SYNC_TO_AD,
     83                        NextADInt_Adi_Configuration_Options::SHOW_MENU_SYNC_TO_WORDPRESS
     84                    )
     85                ),
    8686            ),
    8787            // Tab name
  • next-active-directory-integration/trunk/classes/Ldap/Connection.php

    r1944146 r1986677  
    417417     *
    418418     * @issue ADI-420
     419     * @issue ADI-628 refactored methode since each() is flagged deprecated with PHP 7.2.5
    419420     * @param array $userInfo in adLDAP format
    420421     * @return string
    421422     */
    422423    public function __debug($userInfo = array()) {
    423         $r = '';
     424        $result = "";
    424425        $maxOutputChars = 32;
    425426
    426         while (list($idxOrAttribute, $value) = each($userInfo)) {
    427             if (!is_numeric($idxOrAttribute)) {
     427        foreach ($userInfo as $key => $attribute) {
     428            if (!is_numeric($key)) {
    428429                continue;
    429430            }
    430431
    431             // only match the "[0] => cn" parts
    432             $r .= "$value={";
    433             $data = $userInfo[$value];
    434 
    435             // $data = [count => 1, 0 => 'my cn']
    436             while (list($idxOfAttribute, $valueOfAttribute) = each($data)) {
    437                 if (!is_numeric($idxOfAttribute)) {
     432            $result .= "$attribute={";
     433            $data = $userInfo[$attribute];
     434
     435            foreach ($data as $index => $element) {
     436                if (!is_numeric($index)) {
    438437                    continue;
    439438                }
    440439
    441440                // remove any linebreaks or carriagereturns from the attributes
    442                 $valueOfAttribute = preg_replace("/\r\n|\r|\n/",'',$valueOfAttribute);
    443                 $r .=  NextADInt_Core_Util_StringUtil::firstChars($valueOfAttribute, 500);
    444             }
    445 
    446             $r .= "}, ";
    447         }
    448 
    449         if (strlen($r) > 0) {
     441                $element = preg_replace("/\r\n|\r|\n/",'',$element);
     442
     443                if ($attribute === "objectguid") {
     444                    try {
     445                        $element = NextADInt_Core_Util_StringUtil::binaryToGuid($element);
     446                    } catch (Exception $exception) {
     447                        $this->logger->error("An exception occurred trying to convert binary to GUID. Exception: " . $exception->getMessage());
     448                    }
     449
     450                }
     451
     452                $result .=  NextADInt_Core_Util_StringUtil::firstChars($element, 500);
     453
     454            }
     455
     456            $result .= "}, ";
     457
     458        }
     459
     460        if (strlen($result) > 0) {
    450461            // remove last ", " part if given
    451             $r = substr($r, 0, -2);
    452         }
    453 
    454         return $r;
     462            $result = substr($result, 0, -2);
     463        }
     464
     465        return $result;
    455466    }
    456467
  • next-active-directory-integration/trunk/index.php

    r1948580 r1986677  
    44Plugin URI: https://www.active-directory-wp.com
    55Description: This is the successor of the Active Directory Integration plug-in which allows you to authenticate, authorize, create and update users through Active Directory.
    6 Version: 2.1.4
     6Version: 2.1.5
    77Author: NeosIT GmbH
    88Author URI: http://www.neos-it.de/
  • next-active-directory-integration/trunk/readme.txt

    r1948580 r1986677  
    44Requires at least: 4.0
    55Tested up to: 4.9.8
    6 Stable tag: 2.1.4
     6Stable tag: 2.1.5
    77License: GPLv3
    88
     
    127127For detailed information you can visit the official [GitHub repository of Active Directory Integration 2](https://github.com/NeosIT/active-directory-integration2)
    128128
     129= 2.1.5 =
     130* FIXED: replaced all references to the deprecated each-function with foreach (ADI-628)
     131* FIXED: authorization groups will now properly prevent users from logging in (ADI-664, https://wordpress.org/support/topic/authorization-groups-not-working/ Thanks to shmew22, GitHub #92 Thanks to pokertour)
     132* FIXED: the menu-visibility options were missing inside the profile-tab (ADI-663, https://wordpress.org/support/topic/menu-items-missing-3/ Thanks to 5tu)
     133* ADDED: 2 new filters to allow for custom validation during the authentication process (ADI-657, GitHub #89 Thanks to Destabilizator)
     134
    129135= 2.1.4 =
    130136* FIXED: isUserAuthorized() prevented login for users successfully authenticated via SSO at Active Directory due username was passed instead of guid
  • next-active-directory-integration/trunk/vendor/composer/installed.json

    r1944146 r1986677  
    129129    },
    130130    {
     131        "name": "paragonie/random_compat",
     132        "version": "v2.0.17",
     133        "version_normalized": "2.0.17.0",
     134        "source": {
     135            "type": "git",
     136            "url": "https://github.com/paragonie/random_compat.git",
     137            "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d"
     138        },
     139        "dist": {
     140            "type": "zip",
     141            "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d",
     142            "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d",
     143            "shasum": ""
     144        },
     145        "require": {
     146            "php": ">=5.2.0"
     147        },
     148        "require-dev": {
     149            "phpunit/phpunit": "4.*|5.*"
     150        },
     151        "suggest": {
     152            "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
     153        },
     154        "time": "2018-07-04T16:31:37+00:00",
     155        "type": "library",
     156        "installation-source": "dist",
     157        "autoload": {
     158            "files": [
     159                "lib/random.php"
     160            ]
     161        },
     162        "notification-url": "https://packagist.org/downloads/",
     163        "license": [
     164            "MIT"
     165        ],
     166        "authors": [
     167            {
     168                "name": "Paragon Initiative Enterprises",
     169                "email": "security@paragonie.com",
     170                "homepage": "https://paragonie.com"
     171            }
     172        ],
     173        "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
     174        "keywords": [
     175            "csprng",
     176            "polyfill",
     177            "pseudorandom",
     178            "random"
     179        ]
     180    },
     181    {
    131182        "name": "psr/log",
    132         "version": "1.0.2",
    133         "version_normalized": "1.0.2.0",
     183        "version": "1.1.0",
     184        "version_normalized": "1.1.0.0",
    134185        "source": {
    135186            "type": "git",
    136187            "url": "https://github.com/php-fig/log.git",
    137             "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
    138         },
    139         "dist": {
    140             "type": "zip",
    141             "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
    142             "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
     188            "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
     189        },
     190        "dist": {
     191            "type": "zip",
     192            "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
     193            "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
    143194            "shasum": ""
    144195        },
     
    146197            "php": ">=5.3.0"
    147198        },
    148         "time": "2016-10-10T12:19:37+00:00",
     199        "time": "2018-11-20T15:27:04+00:00",
    149200        "type": "library",
    150201        "extra": {
     
    179230    {
    180231        "name": "monolog/monolog",
    181         "version": "1.23.0",
    182         "version_normalized": "1.23.0.0",
     232        "version": "1.24.0",
     233        "version_normalized": "1.24.0.0",
    183234        "source": {
    184235            "type": "git",
    185236            "url": "https://github.com/Seldaek/monolog.git",
    186             "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
    187         },
    188         "dist": {
    189             "type": "zip",
    190             "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
    191             "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
     237            "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266"
     238        },
     239        "dist": {
     240            "type": "zip",
     241            "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
     242            "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
    192243            "shasum": ""
    193244        },
     
    225276            "sentry/sentry": "Allow sending log messages to a Sentry server"
    226277        },
    227         "time": "2017-06-19T01:22:40+00:00",
     278        "time": "2018-11-05T09:00:11+00:00",
    228279        "type": "library",
    229280        "extra": {
     
    256307            "psr-3"
    257308        ]
    258     },
    259     {
    260         "name": "paragonie/random_compat",
    261         "version": "v2.0.17",
    262         "version_normalized": "2.0.17.0",
    263         "source": {
    264             "type": "git",
    265             "url": "https://github.com/paragonie/random_compat.git",
    266             "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d"
    267         },
    268         "dist": {
    269             "type": "zip",
    270             "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d",
    271             "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d",
    272             "shasum": ""
    273         },
    274         "require": {
    275             "php": ">=5.2.0"
    276         },
    277         "require-dev": {
    278             "phpunit/phpunit": "4.*|5.*"
    279         },
    280         "suggest": {
    281             "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
    282         },
    283         "time": "2018-07-04T16:31:37+00:00",
    284         "type": "library",
    285         "installation-source": "dist",
    286         "autoload": {
    287             "files": [
    288                 "lib/random.php"
    289             ]
    290         },
    291         "notification-url": "https://packagist.org/downloads/",
    292         "license": [
    293             "MIT"
    294         ],
    295         "authors": [
    296             {
    297                 "name": "Paragon Initiative Enterprises",
    298                 "email": "security@paragonie.com",
    299                 "homepage": "https://paragonie.com"
    300             }
    301         ],
    302         "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
    303         "keywords": [
    304             "csprng",
    305             "polyfill",
    306             "pseudorandom",
    307             "random"
    308         ]
    309309    }
    310310]
  • next-active-directory-integration/trunk/vendor/monolog/monolog/CHANGELOG.md

    r1756617 r1986677  
     1### 1.24.0 (2018-11-05)
     2
     3  * Added a `ResettableInterface` in order to reset/reset/clear/flush handlers and processors
     4  * Added a `ProcessorInterface` as an optional way to label a class as being a processor (mostly useful for autowiring dependency containers)
     5  * Added a way to log signals being received using Monolog\SignalHandler
     6  * Added ability to customize error handling at the Logger level using Logger::setExceptionHandler
     7  * Added InsightOpsHandler to migrate users of the LogEntriesHandler
     8  * Added protection to NormalizerHandler against circular and very deep structures, it now stops normalizing at a depth of 9
     9  * Added capture of stack traces to ErrorHandler when logging PHP errors
     10  * Added RavenHandler support for a `contexts` context or extra key to forward that to Sentry's contexts
     11  * Added forwarding of context info to FluentdFormatter
     12  * Added SocketHandler::setChunkSize to override the default chunk size in case you must send large log lines to rsyslog for example
     13  * Added ability to extend/override BrowserConsoleHandler
     14  * Added SlackWebhookHandler::getWebhookUrl and SlackHandler::getToken to enable class extensibility
     15  * Added SwiftMailerHandler::getSubjectFormatter to enable class extensibility
     16  * Dropped official support for HHVM in test builds
     17  * Fixed normalization of exception traces when call_user_func is used to avoid serializing objects and the data they contain
     18  * Fixed naming of fields in Slack handler, all field names are now capitalized in all cases
     19  * Fixed HipChatHandler bug where slack dropped messages randomly
     20  * Fixed normalization of objects in Slack handlers
     21  * Fixed support for PHP7's Throwable in NewRelicHandler
     22  * Fixed race bug when StreamHandler sometimes incorrectly reported it failed to create a directory
     23  * Fixed table row styling issues in HtmlFormatter
     24  * Fixed RavenHandler dropping the message when logging exception
     25  * Fixed WhatFailureGroupHandler skipping processors when using handleBatch
     26    and implement it where possible
     27  * Fixed display of anonymous class names
     28
    129### 1.23.0 (2017-06-19)
    230
  • next-active-directory-integration/trunk/vendor/monolog/monolog/README.md

    r1756617 r1986677  
    33[![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog)
    44[![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog)
    5 [![Reference Status](https://www.versioneye.com/php/monolog:monolog/reference_badge.svg)](https://www.versioneye.com/php/monolog:monolog/references)
    65
    76
  • next-active-directory-integration/trunk/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md

    r1756617 r1986677  
    5656- _SyslogUdpHandler_: Logs records to a remote [Syslogd](http://www.rsyslog.com/) server.
    5757- _LogEntriesHandler_: Logs records to a [LogEntries](http://logentries.com/) account.
     58- _InsightOpsHandler_: Logs records to a [InsightOps](https://www.rapid7.com/products/insightops/) account.
    5859
    5960### Logging in development
  • next-active-directory-integration/trunk/vendor/monolog/monolog/doc/03-utilities.md

    r1756617 r1986677  
    66- _ErrorHandler_: The `Monolog\ErrorHandler` class allows you to easily register
    77  a Logger instance as an exception handler, error handler or fatal error handler.
     8- _SignalHandler_: The `Monolog\SignalHandler` class allows you to easily register
     9  a Logger instance as a POSIX signal handler.
    810- _ErrorLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain log
    911  level is reached.
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/ErrorHandler.php

    r1756617 r1986677  
    1515use Psr\Log\LogLevel;
    1616use Monolog\Handler\AbstractHandler;
     17use Monolog\Registry;
    1718
    1819/**
     
    3940    private $fatalLevel;
    4041    private $reservedMemory;
     42    private $lastFatalTrace;
    4143    private static $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR);
    4244
     
    133135        $this->logger->log(
    134136            $this->uncaughtExceptionLevel === null ? LogLevel::ERROR : $this->uncaughtExceptionLevel,
    135             sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()),
     137            sprintf('Uncaught Exception %s: "%s" at %s line %s', Utils::getClass($e), $e->getMessage(), $e->getFile(), $e->getLine()),
    136138            array('exception' => $e)
    137139        );
     
    157159            $level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL;
    158160            $this->logger->log($level, self::codeToString($code).': '.$message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line));
     161        } else {
     162            // http://php.net/manual/en/function.debug-backtrace.php
     163            // As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added.
     164            // Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'.
     165            $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS);
     166            array_shift($trace); // Exclude handleError from trace
     167            $this->lastFatalTrace = $trace;
    159168        }
    160169
     
    178187                $this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel,
    179188                'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'],
    180                 array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'])
     189                array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'], 'trace' => $this->lastFatalTrace)
    181190            );
    182191
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php

    r1756617 r1986677  
    6363        $message = array(
    6464            'message' => $record['message'],
     65            'context' => $record['context'],
    6566            'extra' => $record['extra'],
    6667        );
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php

    r1756617 r1986677  
    5959        }
    6060
    61         return "<tr style=\"padding: 4px;spacing: 0;text-align: left;\">\n<th style=\"background: #cccccc\" width=\"100px\">$th:</th>\n<td style=\"padding: 4px;spacing: 0;text-align: left;background: #eeeeee\">".$td."</td>\n</tr>";
     61        return "<tr style=\"padding: 4px;text-align: left;\">\n<th style=\"vertical-align: top;background: #ccc;color: #000\" width=\"100\">$th:</th>\n<td style=\"padding: 4px;text-align: left;vertical-align: top;background: #eee;color: #000\">".$td."</td>\n</tr>";
    6262    }
    6363
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php

    r1756617 r1986677  
    1313
    1414use Exception;
     15use Monolog\Utils;
    1516use Throwable;
    1617
     
    139140     * @return mixed
    140141     */
    141     protected function normalize($data)
    142     {
     142    protected function normalize($data, $depth = 0)
     143    {
     144        if ($depth > 9) {
     145            return 'Over 9 levels deep, aborting normalization';
     146        }
     147
    143148        if (is_array($data) || $data instanceof \Traversable) {
    144149            $normalized = array();
     
    146151            $count = 1;
    147152            foreach ($data as $key => $value) {
    148                 if ($count++ >= 1000) {
    149                     $normalized['...'] = 'Over 1000 items, aborting normalization';
     153                if ($count++ > 1000) {
     154                    $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization';
    150155                    break;
    151156                }
    152                 $normalized[$key] = $this->normalize($value);
     157
     158                $normalized[$key] = $this->normalize($value, $depth+1);
    153159            }
    154160
     
    175181        // TODO 2.0 only check for Throwable
    176182        if (!$e instanceof Exception && !$e instanceof Throwable) {
    177             throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
     183            throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e));
    178184        }
    179185
    180186        $data = array(
    181             'class' => get_class($e),
     187            'class' => Utils::getClass($e),
    182188            'message' => $e->getMessage(),
    183189            'code' => $e->getCode(),
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php

    r1756617 r1986677  
    1111
    1212namespace Monolog\Formatter;
     13
     14use Monolog\Utils;
    1315
    1416/**
     
    130132        // TODO 2.0 only check for Throwable
    131133        if (!$e instanceof \Exception && !$e instanceof \Throwable) {
    132             throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
     134            throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e));
    133135        }
    134136
     
    136138        if ($previous = $e->getPrevious()) {
    137139            do {
    138                 $previousText .= ', '.get_class($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine();
     140                $previousText .= ', '.Utils::getClass($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine();
    139141            } while ($previous = $previous->getPrevious());
    140142        }
    141143
    142         $str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')';
     144        $str = '[object] ('.Utils::getClass($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')';
    143145        if ($this->includeStacktraces) {
    144146            $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n";
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php

    r1756617 r1986677  
    1111
    1212namespace Monolog\Formatter;
     13
     14use Monolog\Utils;
    1315
    1416/**
     
    7678    {
    7779        $objectVars = get_object_vars($value);
    78         $objectVars['class'] = get_class($value);
     80        $objectVars['class'] = Utils::getClass($value);
    7981
    8082        return $this->formatArray($objectVars, $nestingLevel);
     
    8486    {
    8587        $formattedException = array(
    86             'class' => get_class($exception),
     88            'class' => Utils::getClass($exception),
    8789            'message' => $exception->getMessage(),
    8890            'code' => $exception->getCode(),
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php

    r1756617 r1986677  
    1313
    1414use Exception;
     15use Monolog\Utils;
    1516
    1617/**
     
    5657    }
    5758
    58     protected function normalize($data)
    59     {
     59    protected function normalize($data, $depth = 0)
     60    {
     61        if ($depth > 9) {
     62            return 'Over 9 levels deep, aborting normalization';
     63        }
     64
    6065        if (null === $data || is_scalar($data)) {
    6166            if (is_float($data)) {
     
    7681            $count = 1;
    7782            foreach ($data as $key => $value) {
    78                 if ($count++ >= 1000) {
     83                if ($count++ > 1000) {
    7984                    $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization';
    8085                    break;
    8186                }
    82                 $normalized[$key] = $this->normalize($value);
     87
     88                $normalized[$key] = $this->normalize($value, $depth+1);
    8389            }
    8490
     
    104110            }
    105111
    106             return sprintf("[object] (%s: %s)", get_class($data), $value);
     112            return sprintf("[object] (%s: %s)", Utils::getClass($data), $value);
    107113        }
    108114
     
    118124        // TODO 2.0 only check for Throwable
    119125        if (!$e instanceof Exception && !$e instanceof \Throwable) {
    120             throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
     126            throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e));
    121127        }
    122128
    123129        $data = array(
    124             'class' => get_class($e),
     130            'class' => Utils::getClass($e),
    125131            'message' => $e->getMessage(),
    126132            'code' => $e->getCode(),
     
    147153                $data['trace'][] = $frame['file'].':'.$frame['line'];
    148154            } elseif (isset($frame['function']) && $frame['function'] === '{closure}') {
    149                 // We should again normalize the frames, because it might contain invalid items
     155                // Simplify closures handling
    150156                $data['trace'][] = $frame['function'];
    151157            } else {
     158                if (isset($frame['args'])) {
     159                    // Make sure that objects present as arguments are not serialized nicely but rather only
     160                    // as a class name to avoid any unexpected leak of sensitive information
     161                    $frame['args'] = array_map(function ($arg) {
     162                        if (is_object($arg) && !($arg instanceof \DateTime || $arg instanceof \DateTimeInterface)) {
     163                            return sprintf("[object] (%s)", Utils::getClass($arg));
     164                        }
     165
     166                        return $arg;
     167                    }, $frame['args']);
     168                }
    152169                // We should again normalize the frames, because it might contain invalid items
    153170                $data['trace'][] = $this->toJson($this->normalize($frame), true);
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php

    r1756617 r1986677  
    103103    }
    104104
    105     protected function normalize($data)
     105    protected function normalize($data, $depth = 0)
    106106    {
    107107        if (is_object($data) && !$data instanceof \DateTime) {
     
    109109        }
    110110
    111         return parent::normalize($data);
     111        return parent::normalize($data, $depth);
    112112    }
    113113}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php

    r1756617 r1986677  
    1212namespace Monolog\Handler;
    1313
    14 use Monolog\Logger;
    1514use Monolog\Formatter\FormatterInterface;
    1615use Monolog\Formatter\LineFormatter;
     16use Monolog\Logger;
     17use Monolog\ResettableInterface;
    1718
    1819/**
     
    2122 * @author Jordi Boggiano <j.boggiano@seld.be>
    2223 */
    23 abstract class AbstractHandler implements HandlerInterface
     24abstract class AbstractHandler implements HandlerInterface, ResettableInterface
    2425{
    2526    protected $level = Logger::DEBUG;
     
    3334
    3435    /**
    35      * @param int     $level  The minimum logging level at which this handler will be triggered
    36      * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
     36     * @param int  $level  The minimum logging level at which this handler will be triggered
     37     * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
    3738     */
    3839    public function __construct($level = Logger::DEBUG, $bubble = true)
     
    142143     * Sets the bubbling behavior.
    143144     *
    144      * @param  Boolean $bubble true means that this handler allows bubbling.
    145      *                         false means that bubbling is not permitted.
     145     * @param  bool $bubble true means that this handler allows bubbling.
     146     *                      false means that bubbling is not permitted.
    146147     * @return self
    147148     */
     
    156157     * Gets the bubbling behavior.
    157158     *
    158      * @return Boolean true means that this handler allows bubbling.
    159      *                 false means that bubbling is not permitted.
     159     * @return bool true means that this handler allows bubbling.
     160     *              false means that bubbling is not permitted.
    160161     */
    161162    public function getBubble()
     
    175176    }
    176177
     178    public function reset()
     179    {
     180        foreach ($this->processors as $processor) {
     181            if ($processor instanceof ResettableInterface) {
     182                $processor->reset();
     183            }
     184        }
     185    }
     186
    177187    /**
    178188     * Gets the default formatter.
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php

    r1756617 r1986677  
    1111
    1212namespace Monolog\Handler;
     13
     14use Monolog\ResettableInterface;
    1315
    1416/**
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php

    r1756617 r1986677  
    5454
    5555    /**
    56      * @param mixed   $facility
    57      * @param int     $level    The minimum logging level at which this handler will be triggered
    58      * @param Boolean $bubble  Whether the messages that are handled can bubble up the stack or not
     56     * @param mixed $facility
     57     * @param int   $level The minimum logging level at which this handler will be triggered
     58     * @param bool  $bubble Whether the messages that are handled can bubble up the stack or not
    5959     */
    6060    public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php

    r1756617 r1986677  
    4444    {
    4545        // Accumulate records
    46         self::$records[] = $record;
     46        static::$records[] = $record;
    4747
    4848        // Register shutdown handler if not already done
    49         if (!self::$initialized) {
    50             self::$initialized = true;
     49        if (!static::$initialized) {
     50            static::$initialized = true;
    5151            $this->registerShutdownFunction();
    5252        }
     
    5959    public static function send()
    6060    {
    61         $format = self::getResponseFormat();
     61        $format = static::getResponseFormat();
    6262        if ($format === 'unknown') {
    6363            return;
    6464        }
    6565
    66         if (count(self::$records)) {
     66        if (count(static::$records)) {
    6767            if ($format === 'html') {
    68                 self::writeOutput('<script>' . self::generateScript() . '</script>');
     68                static::writeOutput('<script>' . static::generateScript() . '</script>');
    6969            } elseif ($format === 'js') {
    70                 self::writeOutput(self::generateScript());
    71             }
    72             self::reset();
    73         }
     70                static::writeOutput(static::generateScript());
     71            }
     72            static::resetStatic();
     73        }
     74    }
     75
     76    public function close()
     77    {
     78        self::resetStatic();
     79    }
     80
     81    public function reset()
     82    {
     83        self::resetStatic();
    7484    }
    7585
     
    7787     * Forget all logged records
    7888     */
    79     public static function reset()
    80     {
    81         self::$records = array();
     89    public static function resetStatic()
     90    {
     91        static::$records = array();
    8292    }
    8393
     
    134144    {
    135145        $script = array();
    136         foreach (self::$records as $record) {
    137             $context = self::dump('Context', $record['context']);
    138             $extra = self::dump('Extra', $record['extra']);
     146        foreach (static::$records as $record) {
     147            $context = static::dump('Context', $record['context']);
     148            $extra = static::dump('Extra', $record['extra']);
    139149
    140150            if (empty($context) && empty($extra)) {
    141                 $script[] = self::call_array('log', self::handleStyles($record['formatted']));
     151                $script[] = static::call_array('log', static::handleStyles($record['formatted']));
    142152            } else {
    143153                $script = array_merge($script,
    144                     array(self::call_array('groupCollapsed', self::handleStyles($record['formatted']))),
     154                    array(static::call_array('groupCollapsed', static::handleStyles($record['formatted']))),
    145155                    $context,
    146156                    $extra,
    147                     array(self::call('groupEnd'))
     157                    array(static::call('groupEnd'))
    148158                );
    149159            }
     
    155165    private static function handleStyles($formatted)
    156166    {
    157         $args = array(self::quote('font-weight: normal'));
     167        $args = array(static::quote('font-weight: normal'));
    158168        $format = '%c' . $formatted;
    159169        preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
    160170
    161171        foreach (array_reverse($matches) as $match) {
    162             $args[] = self::quote(self::handleCustomStyles($match[2][0], $match[1][0]));
     172            $args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0]));
    163173            $args[] = '"font-weight: normal"';
    164174
     
    167177        }
    168178
    169         array_unshift($args, self::quote($format));
     179        array_unshift($args, static::quote($format));
    170180
    171181        return $args;
     
    199209            return $script;
    200210        }
    201         $script[] = self::call('log', self::quote('%c%s'), self::quote('font-weight: bold'), self::quote($title));
     211        $script[] = static::call('log', static::quote('%c%s'), static::quote('font-weight: bold'), static::quote($title));
    202212        foreach ($dict as $key => $value) {
    203213            $value = json_encode($value);
    204214            if (empty($value)) {
    205                 $value = self::quote('');
    206             }
    207             $script[] = self::call('log', self::quote('%s: %o'), self::quote($key), $value);
     215                $value = static::quote('');
     216            }
     217            $script[] = static::call('log', static::quote('%s: %o'), static::quote($key), $value);
    208218        }
    209219
     
    221231        $method = array_shift($args);
    222232
    223         return self::call_array($method, $args);
     233        return static::call_array($method, $args);
    224234    }
    225235
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php

    r1756617 r1986677  
    1313
    1414use Monolog\Logger;
     15use Monolog\ResettableInterface;
    1516
    1617/**
     
    3536     * @param int              $bufferLimit     How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
    3637     * @param int              $level           The minimum logging level at which this handler will be triggered
    37      * @param Boolean          $bubble          Whether the messages that are handled can bubble up the stack or not
    38      * @param Boolean          $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
     38     * @param bool             $bubble          Whether the messages that are handled can bubble up the stack or not
     39     * @param bool             $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
    3940     */
    4041    public function __construct(HandlerInterface $handler, $bufferLimit = 0, $level = Logger::DEBUG, $bubble = true, $flushOnOverflow = false)
     
    115116        $this->buffer = array();
    116117    }
     118
     119    public function reset()
     120    {
     121        $this->flush();
     122
     123        parent::reset();
     124
     125        if ($this->handler instanceof ResettableInterface) {
     126            $this->handler->reset();
     127        }
     128    }
    117129}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php

    r1756617 r1986677  
    3333     */
    3434    const HEADER_NAME = 'X-ChromeLogger-Data';
    35    
     35
    3636    /**
    3737     * Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+)
     
    4646     * Chrome limits the headers to 256KB, so when we sent 240KB we stop sending
    4747     *
    48      * @var Boolean
     48     * @var bool
    4949     */
    5050    protected static $overflowed = false;
     
    5959
    6060    /**
    61      * @param int     $level  The minimum logging level at which this handler will be triggered
    62      * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
     61     * @param int  $level  The minimum logging level at which this handler will be triggered
     62     * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
    6363     */
    6464    public function __construct($level = Logger::DEBUG, $bubble = true)
     
    175175     * Verifies if the headers are accepted by the current user agent
    176176     *
    177      * @return Boolean
     177     * @return bool
    178178     */
    179179    protected function headersAccepted()
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php

    r1756617 r1986677  
    6161     * @param int              $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
    6262     * @param int              $time               The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
    63      * @param Boolean          $bubble             Whether the messages that are handled can bubble up the stack or not
     63     * @param bool             $bubble             Whether the messages that are handled can bubble up the stack or not
    6464     */
    6565    public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, $bubble = true)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php

    r1756617 r1986677  
    4747
    4848    /**
    49      * @param Client  $client  Elastica Client object
    50      * @param array   $options Handler configuration
    51      * @param int     $level   The minimum logging level at which this handler will be triggered
    52      * @param Boolean $bubble  Whether the messages that are handled can bubble up the stack or not
     49     * @param Client $client  Elastica Client object
     50     * @param array  $options Handler configuration
     51     * @param int    $level   The minimum logging level at which this handler will be triggered
     52     * @param bool  $bubble  Whether the messages that are handled can bubble up the stack or not
    5353     */
    5454    public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php

    r1756617 r1986677  
    2929
    3030    /**
    31      * @param int     $messageType    Says where the error should go.
    32      * @param int     $level          The minimum logging level at which this handler will be triggered
    33      * @param Boolean $bubble         Whether the messages that are handled can bubble up the stack or not
    34      * @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
     31     * @param int  $messageType    Says where the error should go.
     32     * @param int  $level          The minimum logging level at which this handler will be triggered
     33     * @param bool $bubble         Whether the messages that are handled can bubble up the stack or not
     34     * @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
    3535     */
    3636    public function __construct($messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, $bubble = true, $expandNewlines = false)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php

    r1756617 r1986677  
    4141     * Whether the messages that are handled can bubble up the stack or not
    4242     *
    43      * @var Boolean
     43     * @var bool
    4444     */
    4545    protected $bubble;
     
    4949     * @param int|array                 $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
    5050     * @param int                       $maxLevel       Maximum level to accept, only used if $minLevelOrList is not an array
    51      * @param Boolean                   $bubble         Whether the messages that are handled can bubble up the stack or not
     51     * @param bool                      $bubble         Whether the messages that are handled can bubble up the stack or not
    5252     */
    5353    public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, $bubble = true)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php

    r1756617 r1986677  
    2323     *
    2424     * @param  array   $record
    25      * @return Boolean
     25     * @return bool
    2626     */
    2727    public function isHandlerActivated(array $record);
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php

    r1756617 r1986677  
    1515use Monolog\Handler\FingersCrossed\ActivationStrategyInterface;
    1616use Monolog\Logger;
     17use Monolog\ResettableInterface;
    1718
    1819/**
     
    4243     * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action
    4344     * @param int                             $bufferSize         How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
    44      * @param Boolean                         $bubble             Whether the messages that are handled can bubble up the stack or not
    45      * @param Boolean                         $stopBuffering      Whether the handler should stop buffering after being triggered (default true)
     45     * @param bool                            $bubble             Whether the messages that are handled can bubble up the stack or not
     46     * @param bool                            $stopBuffering      Whether the handler should stop buffering after being triggered (default true)
    4647     * @param int                             $passthruLevel      Minimum level to always flush to handler on close, even if strategy not triggered
    4748     */
     
    131132    public function close()
    132133    {
    133         if (null !== $this->passthruLevel) {
    134             $level = $this->passthruLevel;
    135             $this->buffer = array_filter($this->buffer, function ($record) use ($level) {
    136                 return $record['level'] >= $level;
    137             });
    138             if (count($this->buffer) > 0) {
    139                 $this->handler->handleBatch($this->buffer);
    140                 $this->buffer = array();
    141             }
    142         }
     134        $this->flushBuffer();
    143135    }
    144136
    145     /**
    146      * Resets the state of the handler. Stops forwarding records to the wrapped handler.
    147      */
    148137    public function reset()
    149138    {
    150         $this->buffering = true;
     139        $this->flushBuffer();
     140
     141        parent::reset();
     142
     143        if ($this->handler instanceof ResettableInterface) {
     144            $this->handler->reset();
     145        }
    151146    }
    152147
     
    161156        $this->reset();
    162157    }
     158
     159    /**
     160     * Resets the state of the handler. Stops forwarding records to the wrapped handler.
     161     */
     162    private function flushBuffer()
     163    {
     164        if (null !== $this->passthruLevel) {
     165            $level = $this->passthruLevel;
     166            $this->buffer = array_filter($this->buffer, function ($record) use ($level) {
     167                return $record['level'] >= $level;
     168            });
     169            if (count($this->buffer) > 0) {
     170                $this->handler->handleBatch($this->buffer);
     171            }
     172        }
     173
     174        $this->buffer = array();
     175        $this->buffering = true;
     176    }
    163177}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php

    r1756617 r1986677  
    159159     * Verifies if the headers are accepted by the current user agent
    160160     *
    161      * @return Boolean
     161     * @return bool
    162162     */
    163163    protected function headersAccepted()
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php

    r1756617 r1986677  
    5151     * {@inheritdoc}
    5252     */
    53     public function close()
    54     {
    55         $this->publisher = null;
    56     }
    57 
    58     /**
    59      * {@inheritdoc}
    60      */
    6153    protected function write(array $record)
    6254    {
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php

    r1756617 r1986677  
    1313
    1414use Monolog\Formatter\FormatterInterface;
     15use Monolog\ResettableInterface;
    1516
    1617/**
     
    2425
    2526    /**
    26      * @param array   $handlers Array of Handlers.
    27      * @param Boolean $bubble   Whether the messages that are handled can bubble up the stack or not
     27     * @param array $handlers Array of Handlers.
     28     * @param bool $bubble   Whether the messages that are handled can bubble up the stack or not
    2829     */
    2930    public function __construct(array $handlers, $bubble = true)
     
    9192    }
    9293
     94    public function reset()
     95    {
     96        parent::reset();
     97
     98        foreach ($this->handlers as $handler) {
     99            if ($handler instanceof ResettableInterface) {
     100                $handler->reset();
     101            }
     102        }
     103    }
     104
    93105    /**
    94106     * {@inheritdoc}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php

    r1756617 r1986677  
    3232     * @param array $record Partial log record containing only a level key
    3333     *
    34      * @return Boolean
     34     * @return bool
    3535     */
    3636    public function isHandling(array $record);
     
    4747     *
    4848     * @param  array   $record The record to handle
    49      * @return Boolean true means that this handler handled the record, and that bubbling is not permitted.
     49     * @return bool true means that this handler handled the record, and that bubbling is not permitted.
    5050     *                        false means the record was either not processed or that this handler allows bubbling.
    5151     */
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php

    r1756617 r1986677  
    1212namespace Monolog\Handler;
    1313
     14use Monolog\ResettableInterface;
    1415use Monolog\Formatter\FormatterInterface;
    1516
     
    3132 * @author Alexey Karapetov <alexey@karapetov.com>
    3233 */
    33 class HandlerWrapper implements HandlerInterface
     34class HandlerWrapper implements HandlerInterface, ResettableInterface
    3435{
    3536    /**
     
    106107        return $this->handler->getFormatter();
    107108    }
     109
     110    public function reset()
     111    {
     112        if ($this->handler instanceof ResettableInterface) {
     113            return $this->handler->reset();
     114        }
     115    }
    108116}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php

    r1756617 r1986677  
    220220    {
    221221        parent::write($record);
     222        $this->finalizeWrite();
     223    }
     224
     225    /**
     226     * Finalizes the request by reading some bytes and then closing the socket
     227     *
     228     * If we do not read some but close the socket too early, hipchat sometimes
     229     * drops the request entirely.
     230     */
     231    protected function finalizeWrite()
     232    {
     233        $res = $this->getResource();
     234        if (is_resource($res)) {
     235            @fread($res, 2048);
     236        }
    222237        $this->closeSocket();
    223238    }
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php

    r1756617 r1986677  
    3131
    3232    /**
    33      * @param string  $eventName The name of the IFTTT Maker event that should be triggered
    34      * @param string  $secretKey A valid IFTTT secret key
    35      * @param int     $level     The minimum logging level at which this handler will be triggered
    36      * @param Boolean $bubble    Whether the messages that are handled can bubble up the stack or not
     33     * @param string $eventName The name of the IFTTT Maker event that should be triggered
     34     * @param string $secretKey A valid IFTTT secret key
     35     * @param int    $level     The minimum logging level at which this handler will be triggered
     36     * @param bool  $bubble    Whether the messages that are handled can bubble up the stack or not
    3737     */
    3838    public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php

    r1756617 r1986677  
    3232     * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
    3333     */
    34     public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true)
     34    public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true, $host = 'data.logentries.com')
    3535    {
    3636        if ($useSSL && !extension_loaded('openssl')) {
     
    3838        }
    3939
    40         $endpoint = $useSSL ? 'ssl://data.logentries.com:443' : 'data.logentries.com:80';
     40        $endpoint = $useSSL ? 'ssl://' . $host . ':443' : $host . ':80';
    4141        parent::__construct($endpoint, $level, $bubble);
    4242        $this->logToken = $token;
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php

    r1756617 r1986677  
    2828     * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
    2929     * @param int                     $level   The minimum logging level at which this handler will be triggered
    30      * @param Boolean                 $bubble  Whether the messages that are handled can bubble up the stack or not
     30     * @param bool                    $bubble  Whether the messages that are handled can bubble up the stack or not
    3131     */
    3232    public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php

    r1756617 r1986677  
    1818 * Class to record a log on a NewRelic application.
    1919 * Enabling New Relic High Security mode may prevent capture of useful information.
     20 *
     21 * This handler requires a NormalizerFormatter to function and expects an array in $record['formatted']
    2022 *
    2123 * @see https://docs.newrelic.com/docs/agents/php-agent
     
    8587        }
    8688
    87         if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) {
     89        if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) {
    8890            newrelic_notice_error($record['message'], $record['context']['exception']);
    8991            unset($record['formatted']['context']['exception']);
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php

    r1756617 r1986677  
    3232     * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied
    3333     * @param int             $level  The minimum logging level at which this handler will be triggered
    34      * @param Boolean         $bubble Whether the messages that are handled can bubble up the stack or not
     34     * @param bool            $bubble Whether the messages that are handled can bubble up the stack or not
    3535     */
    3636    public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php

    r1756617 r1986677  
    7070     * @param string       $title             Title sent to the Pushover API
    7171     * @param int          $level             The minimum logging level at which this handler will be triggered
    72      * @param Boolean      $bubble            Whether the messages that are handled can bubble up the stack or not
    73      * @param Boolean      $useSSL            Whether to connect via SSL. Required when pushing messages to users that are not
     72     * @param bool         $bubble            Whether the messages that are handled can bubble up the stack or not
     73     * @param bool         $useSSL            Whether to connect via SSL. Required when pushing messages to users that are not
    7474     *                                        the pushover.net app owner. OpenSSL is required for this option.
    7575     * @param int          $highPriorityLevel The minimum logging level at which this handler will start
     
    181181    public function useFormattedMessage($value)
    182182    {
    183         $this->useFormattedMessage = (boolean) $value;
     183        $this->useFormattedMessage = (bool) $value;
    184184    }
    185185}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php

    r1756617 r1986677  
    1919/**
    2020 * Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server
    21  * using raven-php (https://github.com/getsentry/raven-php)
     21 * using sentry-php (https://github.com/getsentry/sentry-php)
    2222 *
    2323 * @author Marc Abramowitz <marc@marc-abramowitz.com>
     
    2828     * Translates Monolog log levels to Raven log levels.
    2929     */
    30     private $logLevels = array(
     30    protected $logLevels = array(
    3131        Logger::DEBUG     => Raven_Client::DEBUG,
    3232        Logger::INFO      => Raven_Client::INFO,
     
    4343     *             software. Can be any string (git commit, version number)
    4444     */
    45     private $release;
     45    protected $release;
    4646
    4747    /**
     
    5858     * @param Raven_Client $ravenClient
    5959     * @param int          $level       The minimum logging level at which this handler will be triggered
    60      * @param Boolean      $bubble      Whether the messages that are handled can bubble up the stack or not
     60     * @param bool         $bubble      Whether the messages that are handled can bubble up the stack or not
    6161     */
    6262    public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true)
     
    181181
    182182        if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) {
    183             $options['extra']['message'] = $record['formatted'];
     183            $options['message'] = $record['formatted'];
    184184            $this->ravenClient->captureException($record['context']['exception'], $options);
    185185        } else {
     
    217217    protected function getExtraParameters()
    218218    {
    219         return array('checksum', 'release', 'event_id');
     219        return array('contexts', 'checksum', 'release', 'event_id');
    220220    }
    221221
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php

    r1756617 r1986677  
    130130        $this->flush();
    131131    }
     132
     133    /**
     134     * {@inheritdoc}
     135     */
     136    public function reset()
     137    {
     138        $this->flush();
     139
     140        parent::reset();
     141    }
     142
     143
    132144}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php

    r1756617 r1986677  
    4040     * @param int      $maxFiles       The maximal amount of files to keep (0 means unlimited)
    4141     * @param int      $level          The minimum logging level at which this handler will be triggered
    42      * @param Boolean  $bubble         Whether the messages that are handled can bubble up the stack or not
     42     * @param bool     $bubble         Whether the messages that are handled can bubble up the stack or not
    4343     * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
    44      * @param Boolean  $useLocking     Try to lock log file before doing any writes
     44     * @param bool     $useLocking     Try to lock log file before doing any writes
    4545     */
    4646    public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false)
     
    6161    {
    6262        parent::close();
     63
     64        if (true === $this->mustRotate) {
     65            $this->rotate();
     66        }
     67    }
     68
     69    /**
     70     * {@inheritdoc}
     71     */
     72    public function reset()
     73    {
     74        parent::reset();
    6375
    6476        if (true === $this->mustRotate) {
     
    167179        $glob = str_replace(
    168180            array('{filename}', '{date}'),
    169             array($fileInfo['filename'], '*'),
     181            array($fileInfo['filename'], '[0-9][0-9][0-9][0-9]*'),
    170182            $fileInfo['dirname'] . '/' . $this->filenameFormat
    171183        );
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php

    r1756617 r1986677  
    147147                    if ($this->useShortAttachment) {
    148148                        $attachment['fields'][] = $this->generateAttachmentField(
    149                             ucfirst($key),
     149                            $key,
    150150                            $record[$key]
    151151                        );
     
    230230     * Generates attachment field
    231231     *
    232      * @param string $title
    233      * @param string|array $value\
     232     * @param string       $title
     233     * @param string|array $value
    234234     *
    235235     * @return array
     
    242242
    243243        return array(
    244             'title' => $title,
     244            'title' => ucfirst($title),
    245245            'value' => $value,
    246246            'short' => false
     
    258258    {
    259259        $fields = array();
    260         foreach ($data as $key => $value) {
     260        foreach ($this->normalizerFormatter->format($data) as $key => $value) {
    261261            $fields[] = $this->generateAttachmentField($key, $value);
    262262        }
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php

    r1756617 r1986677  
    7676    }
    7777
     78    public function getToken()
     79    {
     80        return $this->token;
     81    }
     82
    7883    /**
    7984     * {@inheritdoc}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php

    r1756617 r1986677  
    7171    }
    7272
     73    public function getWebhookUrl()
     74    {
     75        return $this->webhookUrl;
     76    }
     77
    7378    /**
    7479     * {@inheritdoc}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php

    r1756617 r1986677  
    2828    private $writingTimeout = 10;
    2929    private $lastSentBytes = null;
     30    private $chunkSize = null;
    3031    private $persistent = false;
    3132    private $errno;
     
    3435
    3536    /**
    36      * @param string  $connectionString Socket connection string
    37      * @param int     $level            The minimum logging level at which this handler will be triggered
    38      * @param Boolean $bubble           Whether the messages that are handled can bubble up the stack or not
     37     * @param string $connectionString Socket connection string
     38     * @param int    $level            The minimum logging level at which this handler will be triggered
     39     * @param bool  $bubble           Whether the messages that are handled can bubble up the stack or not
    3940     */
    4041    public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true)
     
    8889    public function setPersistent($persistent)
    8990    {
    90         $this->persistent = (boolean) $persistent;
     91        $this->persistent = (bool) $persistent;
    9192    }
    9293
     
    129130
    130131    /**
     132     * Set chunk size. Only has effect during connection in the writing cycle.
     133     *
     134     * @param float $bytes
     135     */
     136    public function setChunkSize($bytes)
     137    {
     138        $this->chunkSize = $bytes;
     139    }
     140
     141    /**
    131142     * Get current connection string
    132143     *
     
    176187    {
    177188        return $this->writingTimeout;
     189    }
     190
     191    /**
     192     * Get current chunk size
     193     *
     194     * @return float
     195     */
     196    public function getChunkSize()
     197    {
     198        return $this->chunkSize;
    178199    }
    179200
     
    218239
    219240        return stream_set_timeout($this->resource, $seconds, $microseconds);
     241    }
     242
     243    /**
     244     * Wrapper to allow mocking
     245     *
     246     * @see http://php.net/manual/en/function.stream-set-chunk-size.php
     247     */
     248    protected function streamSetChunkSize()
     249    {
     250        return stream_set_chunk_size($this->resource, $this->chunkSize);
    220251    }
    221252
     
    269300        $this->createSocketResource();
    270301        $this->setSocketTimeout();
     302        $this->setStreamChunkSize();
    271303    }
    272304
     
    288320        if (!$this->streamSetTimeout()) {
    289321            throw new \UnexpectedValueException("Failed setting timeout with stream_set_timeout()");
     322        }
     323    }
     324
     325    private function setStreamChunkSize()
     326    {
     327        if ($this->chunkSize && !$this->streamSetChunkSize()) {
     328            throw new \UnexpectedValueException("Failed setting chunk size with stream_set_chunk_size()");
    290329        }
    291330    }
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php

    r1756617 r1986677  
    3333     * @param resource|string $stream
    3434     * @param int             $level          The minimum logging level at which this handler will be triggered
    35      * @param Boolean         $bubble         Whether the messages that are handled can bubble up the stack or not
     35     * @param bool            $bubble         Whether the messages that are handled can bubble up the stack or not
    3636     * @param int|null        $filePermission Optional file permissions (default (0644) are only for owner read/write)
    37      * @param Boolean         $useLocking     Try to lock log file before doing any writes
     37     * @param bool            $useLocking     Try to lock log file before doing any writes
    3838     *
    3939     * @throws \Exception                If a missing directory is not buildable
     
    168168            $status = mkdir($dir, 0777, true);
    169169            restore_error_handler();
    170             if (false === $status) {
     170            if (false === $status && !is_dir($dir)) {
    171171                throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and its not buildable: '.$this->errorMessage, $dir));
    172172            }
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php

    r1756617 r1986677  
    1313
    1414use Monolog\Logger;
     15use Monolog\Formatter\FormatterInterface;
    1516use Monolog\Formatter\LineFormatter;
    1617use Swift;
     
    3031     * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
    3132     * @param int                     $level   The minimum logging level at which this handler will be triggered
    32      * @param Boolean                 $bubble  Whether the messages that are handled can bubble up the stack or not
     33     * @param bool                    $bubble  Whether the messages that are handled can bubble up the stack or not
    3334     */
    3435    public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true)
     
    4647    {
    4748        $this->mailer->send($this->buildMessage($content, $records));
     49    }
     50
     51    /**
     52     * Gets the formatter for the Swift_Message subject.
     53     *
     54     * @param  string             $format The format of the subject
     55     * @return FormatterInterface
     56     */
     57    protected function getSubjectFormatter($format)
     58    {
     59        return new LineFormatter($format);
    4860    }
    4961
     
    7082
    7183        if ($records) {
    72             $subjectFormatter = new LineFormatter($message->getSubject());
     84            $subjectFormatter = $this->getSubjectFormatter($message->getSubject());
    7385            $message->setSubject($subjectFormatter->format($this->getHighestRecord($records)));
    7486        }
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php

    r1756617 r1986677  
    3333
    3434    /**
    35      * @param string  $ident
    36      * @param mixed   $facility
    37      * @param int     $level    The minimum logging level at which this handler will be triggered
    38      * @param Boolean $bubble   Whether the messages that are handled can bubble up the stack or not
    39      * @param int     $logopts  Option flags for the openlog() call, defaults to LOG_PID
     35     * @param string $ident
     36     * @param mixed  $facility
     37     * @param int    $level    The minimum logging level at which this handler will be triggered
     38     * @param bool  $bubble   Whether the messages that are handled can bubble up the stack or not
     39     * @param int    $logopts  Option flags for the openlog() call, defaults to LOG_PID
    4040     */
    4141    public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $logopts = LOG_PID)
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php

    r1756617 r1986677  
    2626
    2727    /**
    28      * @param string  $host
    29      * @param int     $port
    30      * @param mixed   $facility
    31      * @param int     $level    The minimum logging level at which this handler will be triggered
    32      * @param Boolean $bubble   Whether the messages that are handled can bubble up the stack or not
    33      * @param string  $ident    Program name or tag for each log message.
     28     * @param string $host
     29     * @param int    $port
     30     * @param mixed  $facility
     31     * @param int    $level    The minimum logging level at which this handler will be triggered
     32     * @param bool  $bubble   Whether the messages that are handled can bubble up the stack or not
     33     * @param string $ident    Program name or tag for each log message.
    3434     */
    3535    public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php')
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php

    r1756617 r1986677  
    8585    }
    8686
     87    /**
     88     * @param string|array $record Either a message string or an array containing message and optionally context keys that will be checked against all records
     89     * @param int          $level  Logger::LEVEL constant value
     90     */
    8791    public function hasRecord($record, $level)
    8892    {
    89         if (is_array($record)) {
    90             $record = $record['message'];
     93        if (is_string($record)) {
     94            $record = array('message' => $record);
    9195        }
    9296
    9397        return $this->hasRecordThatPasses(function ($rec) use ($record) {
    94             return $rec['message'] === $record;
     98            if ($rec['message'] !== $record['message']) {
     99                return false;
     100            }
     101            if (isset($record['context']) && $rec['context'] !== $record['context']) {
     102                return false;
     103            }
     104            return true;
    95105        }, $level);
    96106    }
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php

    r1756617 r1986677  
    4949    public function handleBatch(array $records)
    5050    {
     51        if ($this->processors) {
     52            $processed = array();
     53            foreach ($records as $record) {
     54                foreach ($this->processors as $processor) {
     55                    $processed[] = call_user_func($processor, $record);
     56                }
     57            }
     58            $records = $processed;
     59        }
     60
    5161        foreach ($this->handlers as $handler) {
    5262            try {
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Logger.php

    r1756617 r1986677  
    1616use Psr\Log\LoggerInterface;
    1717use Psr\Log\InvalidArgumentException;
     18use Exception;
    1819
    1920/**
     
    2526 * @author Jordi Boggiano <j.boggiano@seld.be>
    2627 */
    27 class Logger implements LoggerInterface
     28class Logger implements LoggerInterface, ResettableInterface
    2829{
    2930    /**
     
    135136
    136137    /**
     138     * @var callable
     139     */
     140    protected $exceptionHandler;
     141
     142    /**
    137143     * @param string             $name       The logging channel
    138144     * @param HandlerInterface[] $handlers   Optional stack of handlers, the first one in the array is called first, etc.
     
    142148    {
    143149        $this->name = $name;
    144         $this->handlers = $handlers;
     150        $this->setHandlers($handlers);
    145151        $this->processors = $processors;
    146152    }
     
    282288     * @param  string  $message The log message
    283289     * @param  array   $context The log context
    284      * @return Boolean Whether the record has been processed
     290     * @return bool Whether the record has been processed
    285291     */
    286292    public function addRecord($level, $message, array $context = array())
     
    330336        );
    331337
     338        try {
     339            foreach ($this->processors as $processor) {
     340                $record = call_user_func($processor, $record);
     341            }
     342
     343            while ($handler = current($this->handlers)) {
     344                if (true === $handler->handle($record)) {
     345                    break;
     346                }
     347
     348                next($this->handlers);
     349            }
     350        } catch (Exception $e) {
     351            $this->handleException($e, $record);
     352        }
     353
     354        return true;
     355    }
     356
     357    /**
     358     * Ends a log cycle and frees all resources used by handlers.
     359     *
     360     * Closing a Handler means flushing all buffers and freeing any open resources/handles.
     361     * Handlers that have been closed should be able to accept log records again and re-open
     362     * themselves on demand, but this may not always be possible depending on implementation.
     363     *
     364     * This is useful at the end of a request and will be called automatically on every handler
     365     * when they get destructed.
     366     */
     367    public function close()
     368    {
     369        foreach ($this->handlers as $handler) {
     370            if (method_exists($handler, 'close')) {
     371                $handler->close();
     372            }
     373        }
     374    }
     375
     376    /**
     377     * Ends a log cycle and resets all handlers and processors to their initial state.
     378     *
     379     * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal
     380     * state, and getting it back to a state in which it can receive log records again.
     381     *
     382     * This is useful in case you want to avoid logs leaking between two requests or jobs when you
     383     * have a long running process like a worker or an application server serving multiple requests
     384     * in one process.
     385     */
     386    public function reset()
     387    {
     388        foreach ($this->handlers as $handler) {
     389            if ($handler instanceof ResettableInterface) {
     390                $handler->reset();
     391            }
     392        }
     393
    332394        foreach ($this->processors as $processor) {
    333             $record = call_user_func($processor, $record);
    334         }
    335 
    336         while ($handler = current($this->handlers)) {
    337             if (true === $handler->handle($record)) {
    338                 break;
     395            if ($processor instanceof ResettableInterface) {
     396                $processor->reset();
    339397            }
    340 
    341             next($this->handlers);
    342         }
    343 
    344         return true;
     398        }
    345399    }
    346400
     
    348402     * Adds a log record at the DEBUG level.
    349403     *
    350      * @param  string  $message The log message
    351      * @param  array   $context The log context
    352      * @return Boolean Whether the record has been processed
     404     * @param  string $message The log message
     405     * @param  array  $context The log context
     406     * @return bool  Whether the record has been processed
    353407     */
    354408    public function addDebug($message, array $context = array())
     
    360414     * Adds a log record at the INFO level.
    361415     *
    362      * @param  string  $message The log message
    363      * @param  array   $context The log context
    364      * @return Boolean Whether the record has been processed
     416     * @param  string $message The log message
     417     * @param  array  $context The log context
     418     * @return bool  Whether the record has been processed
    365419     */
    366420    public function addInfo($message, array $context = array())
     
    372426     * Adds a log record at the NOTICE level.
    373427     *
    374      * @param  string  $message The log message
    375      * @param  array   $context The log context
    376      * @return Boolean Whether the record has been processed
     428     * @param  string $message The log message
     429     * @param  array  $context The log context
     430     * @return bool  Whether the record has been processed
    377431     */
    378432    public function addNotice($message, array $context = array())
     
    384438     * Adds a log record at the WARNING level.
    385439     *
    386      * @param  string  $message The log message
    387      * @param  array   $context The log context
    388      * @return Boolean Whether the record has been processed
     440     * @param  string $message The log message
     441     * @param  array  $context The log context
     442     * @return bool  Whether the record has been processed
    389443     */
    390444    public function addWarning($message, array $context = array())
     
    396450     * Adds a log record at the ERROR level.
    397451     *
    398      * @param  string  $message The log message
    399      * @param  array   $context The log context
    400      * @return Boolean Whether the record has been processed
     452     * @param  string $message The log message
     453     * @param  array  $context The log context
     454     * @return bool  Whether the record has been processed
    401455     */
    402456    public function addError($message, array $context = array())
     
    408462     * Adds a log record at the CRITICAL level.
    409463     *
    410      * @param  string  $message The log message
    411      * @param  array   $context The log context
    412      * @return Boolean Whether the record has been processed
     464     * @param  string $message The log message
     465     * @param  array  $context The log context
     466     * @return bool  Whether the record has been processed
    413467     */
    414468    public function addCritical($message, array $context = array())
     
    420474     * Adds a log record at the ALERT level.
    421475     *
    422      * @param  string  $message The log message
    423      * @param  array   $context The log context
    424      * @return Boolean Whether the record has been processed
     476     * @param  string $message The log message
     477     * @param  array  $context The log context
     478     * @return bool  Whether the record has been processed
    425479     */
    426480    public function addAlert($message, array $context = array())
     
    432486     * Adds a log record at the EMERGENCY level.
    433487     *
    434      * @param  string  $message The log message
    435      * @param  array   $context The log context
    436      * @return Boolean Whether the record has been processed
     488     * @param  string $message The log message
     489     * @param  array  $context The log context
     490     * @return bool  Whether the record has been processed
    437491     */
    438492    public function addEmergency($message, array $context = array())
     
    485539     *
    486540     * @param  int     $level
    487      * @return Boolean
     541     * @return bool
    488542     */
    489543    public function isHandling($level)
     
    503557
    504558    /**
     559     * Set a custom exception handler
     560     *
     561     * @param  callable $callback
     562     * @return $this
     563     */
     564    public function setExceptionHandler($callback)
     565    {
     566        if (!is_callable($callback)) {
     567            throw new \InvalidArgumentException('Exception handler must be valid callable (callback or object with an __invoke method), '.var_export($callback, true).' given');
     568        }
     569        $this->exceptionHandler = $callback;
     570
     571        return $this;
     572    }
     573
     574    /**
     575     * @return callable
     576     */
     577    public function getExceptionHandler()
     578    {
     579        return $this->exceptionHandler;
     580    }
     581
     582    /**
     583     * Delegates exception management to the custom exception handler,
     584     * or throws the exception if no custom handler is set.
     585     */
     586    protected function handleException(Exception $e, array $record)
     587    {
     588        if (!$this->exceptionHandler) {
     589            throw $e;
     590        }
     591
     592        call_user_func($this->exceptionHandler, $e, $record);
     593    }
     594
     595    /**
    505596     * Adds a log record at an arbitrary level.
    506597     *
     
    508599     *
    509600     * @param  mixed   $level   The log level
    510      * @param  string  $message The log message
    511      * @param  array   $context The log context
    512      * @return Boolean Whether the record has been processed
     601     * @param  string $message The log message
     602     * @param  array  $context The log context
     603     * @return bool  Whether the record has been processed
    513604     */
    514605    public function log($level, $message, array $context = array())
     
    524615     * This method allows for compatibility with common interfaces.
    525616     *
    526      * @param  string  $message The log message
    527      * @param  array   $context The log context
    528      * @return Boolean Whether the record has been processed
     617     * @param  string $message The log message
     618     * @param  array  $context The log context
     619     * @return bool  Whether the record has been processed
    529620     */
    530621    public function debug($message, array $context = array())
     
    538629     * This method allows for compatibility with common interfaces.
    539630     *
    540      * @param  string  $message The log message
    541      * @param  array   $context The log context
    542      * @return Boolean Whether the record has been processed
     631     * @param  string $message The log message
     632     * @param  array  $context The log context
     633     * @return bool  Whether the record has been processed
    543634     */
    544635    public function info($message, array $context = array())
     
    552643     * This method allows for compatibility with common interfaces.
    553644     *
    554      * @param  string  $message The log message
    555      * @param  array   $context The log context
    556      * @return Boolean Whether the record has been processed
     645     * @param  string $message The log message
     646     * @param  array  $context The log context
     647     * @return bool  Whether the record has been processed
    557648     */
    558649    public function notice($message, array $context = array())
     
    566657     * This method allows for compatibility with common interfaces.
    567658     *
    568      * @param  string  $message The log message
    569      * @param  array   $context The log context
    570      * @return Boolean Whether the record has been processed
     659     * @param  string $message The log message
     660     * @param  array  $context The log context
     661     * @return bool  Whether the record has been processed
    571662     */
    572663    public function warn($message, array $context = array())
     
    580671     * This method allows for compatibility with common interfaces.
    581672     *
    582      * @param  string  $message The log message
    583      * @param  array   $context The log context
    584      * @return Boolean Whether the record has been processed
     673     * @param  string $message The log message
     674     * @param  array  $context The log context
     675     * @return bool  Whether the record has been processed
    585676     */
    586677    public function warning($message, array $context = array())
     
    594685     * This method allows for compatibility with common interfaces.
    595686     *
    596      * @param  string  $message The log message
    597      * @param  array   $context The log context
    598      * @return Boolean Whether the record has been processed
     687     * @param  string $message The log message
     688     * @param  array  $context The log context
     689     * @return bool  Whether the record has been processed
    599690     */
    600691    public function err($message, array $context = array())
     
    608699     * This method allows for compatibility with common interfaces.
    609700     *
    610      * @param  string  $message The log message
    611      * @param  array   $context The log context
    612      * @return Boolean Whether the record has been processed
     701     * @param  string $message The log message
     702     * @param  array  $context The log context
     703     * @return bool  Whether the record has been processed
    613704     */
    614705    public function error($message, array $context = array())
     
    622713     * This method allows for compatibility with common interfaces.
    623714     *
    624      * @param  string  $message The log message
    625      * @param  array   $context The log context
    626      * @return Boolean Whether the record has been processed
     715     * @param  string $message The log message
     716     * @param  array  $context The log context
     717     * @return bool  Whether the record has been processed
    627718     */
    628719    public function crit($message, array $context = array())
     
    636727     * This method allows for compatibility with common interfaces.
    637728     *
    638      * @param  string  $message The log message
    639      * @param  array   $context The log context
    640      * @return Boolean Whether the record has been processed
     729     * @param  string $message The log message
     730     * @param  array  $context The log context
     731     * @return bool  Whether the record has been processed
    641732     */
    642733    public function critical($message, array $context = array())
     
    650741     * This method allows for compatibility with common interfaces.
    651742     *
    652      * @param  string  $message The log message
    653      * @param  array   $context The log context
    654      * @return Boolean Whether the record has been processed
     743     * @param  string $message The log message
     744     * @param  array  $context The log context
     745     * @return bool  Whether the record has been processed
    655746     */
    656747    public function alert($message, array $context = array())
     
    664755     * This method allows for compatibility with common interfaces.
    665756     *
    666      * @param  string  $message The log message
    667      * @param  array   $context The log context
    668      * @return Boolean Whether the record has been processed
     757     * @param  string $message The log message
     758     * @param  array  $context The log context
     759     * @return bool  Whether the record has been processed
    669760     */
    670761    public function emerg($message, array $context = array())
     
    678769     * This method allows for compatibility with common interfaces.
    679770     *
    680      * @param  string  $message The log message
    681      * @param  array   $context The log context
    682      * @return Boolean Whether the record has been processed
     771     * @param  string $message The log message
     772     * @param  array  $context The log context
     773     * @return bool  Whether the record has been processed
    683774     */
    684775    public function emergency($message, array $context = array())
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php

    r1756617 r1986677  
    2020 * @author Jordi Boggiano <j.boggiano@seld.be>
    2121 */
    22 class GitProcessor
     22class GitProcessor implements ProcessorInterface
    2323{
    2424    private $level;
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php

    r1756617 r1986677  
    2525 * @author Jordi Boggiano <j.boggiano@seld.be>
    2626 */
    27 class IntrospectionProcessor
     27class IntrospectionProcessor implements ProcessorInterface
    2828{
    2929    private $level;
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php

    r1756617 r1986677  
    1717 * @author Rob Jensen
    1818 */
    19 abstract class MemoryProcessor
     19abstract class MemoryProcessor implements ProcessorInterface
    2020{
    2121    /**
     
    3535    public function __construct($realUsage = true, $useFormatting = true)
    3636    {
    37         $this->realUsage = (boolean) $realUsage;
    38         $this->useFormatting = (boolean) $useFormatting;
     37        $this->realUsage = (bool) $realUsage;
     38        $this->useFormatting = (bool) $useFormatting;
    3939    }
    4040
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php

    r1756617 r1986677  
    1919 * @author Jonathan A. Schweder <jonathanschweder@gmail.com>
    2020 */
    21 class MercurialProcessor
     21class MercurialProcessor implements ProcessorInterface
    2222{
    2323    private $level;
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php

    r1756617 r1986677  
    1717 * @author Andreas Hörnicke
    1818 */
    19 class ProcessIdProcessor
     19class ProcessIdProcessor implements ProcessorInterface
    2020{
    2121    /**
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php

    r1756617 r1986677  
    1212namespace Monolog\Processor;
    1313
     14use Monolog\Utils;
     15
    1416/**
    1517 * Processes a record's message according to PSR-3 rules
     
    1921 * @author Jordi Boggiano <j.boggiano@seld.be>
    2022 */
    21 class PsrLogMessageProcessor
     23class PsrLogMessageProcessor implements ProcessorInterface
    2224{
    2325    /**
     
    3638                $replacements['{'.$key.'}'] = $val;
    3739            } elseif (is_object($val)) {
    38                 $replacements['{'.$key.'}'] = '[object '.get_class($val).']';
     40                $replacements['{'.$key.'}'] = '[object '.Utils::getClass($val).']';
    3941            } else {
    4042                $replacements['{'.$key.'}'] = '['.gettype($val).']';
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php

    r1756617 r1986677  
    1717 * @author Martijn Riemers
    1818 */
    19 class TagProcessor
     19class TagProcessor implements ProcessorInterface
    2020{
    2121    private $tags;
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php

    r1756617 r1986677  
    1212namespace Monolog\Processor;
    1313
     14use Monolog\ResettableInterface;
     15
    1416/**
    1517 * Adds a unique identifier into records
     
    1719 * @author Simon Mönch <sm@webfactory.de>
    1820 */
    19 class UidProcessor
     21class UidProcessor implements ProcessorInterface, ResettableInterface
    2022{
    2123    private $uid;
     
    2729        }
    2830
    29         $this->uid = substr(hash('md5', uniqid('', true)), 0, $length);
     31
     32        $this->uid = $this->generateUid($length);
    3033    }
    3134
     
    4447        return $this->uid;
    4548    }
     49
     50    public function reset()
     51    {
     52        $this->uid = $this->generateUid(strlen($this->uid));
     53    }
     54
     55    private function generateUid($length)
     56    {
     57        return substr(hash('md5', uniqid('', true)), 0, $length);
     58    }
    4659}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php

    r1756617 r1986677  
    1717 * @author Jordi Boggiano <j.boggiano@seld.be>
    1818 */
    19 class WebProcessor
     19class WebProcessor implements ProcessorInterface
    2020{
    2121    /**
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php

    r1756617 r1986677  
    4141        $formatter = new FluentdFormatter();
    4242        $this->assertEquals(
    43             '["test",0,{"message":"test","extra":[],"level":300,"level_name":"WARNING"}]',
     43            '["test",0,{"message":"test","context":[],"extra":[],"level":300,"level_name":"WARNING"}]',
    4444            $formatter->format($record)
    4545        );
     
    5656        $formatter = new FluentdFormatter(true);
    5757        $this->assertEquals(
    58             '["test.error",0,{"message":"test","extra":[]}]',
     58            '["test.error",0,{"message":"test","context":[],"extra":[]}]',
    5959            $formatter->format($record)
    6060        );
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php

    r1756617 r1986677  
    181181        return $formattedException;
    182182    }
     183
     184    public function testNormalizeHandleLargeArraysWithExactly1000Items()
     185    {
     186        $formatter = new NormalizerFormatter();
     187        $largeArray = range(1, 1000);
     188
     189        $res = $formatter->format(array(
     190            'level_name' => 'CRITICAL',
     191            'channel' => 'test',
     192            'message' => 'bar',
     193            'context' => array($largeArray),
     194            'datetime' => new \DateTime,
     195            'extra' => array(),
     196        ));
     197
     198        $this->assertCount(1000, $res['context'][0]);
     199        $this->assertArrayNotHasKey('...', $res['context'][0]);
     200    }
     201
     202    public function testNormalizeHandleLargeArrays()
     203    {
     204        $formatter = new NormalizerFormatter();
     205        $largeArray = range(1, 2000);
     206
     207        $res = $formatter->format(array(
     208            'level_name' => 'CRITICAL',
     209            'channel' => 'test',
     210            'message' => 'bar',
     211            'context' => array($largeArray),
     212            'datetime' => new \DateTime,
     213            'extra' => array(),
     214        ));
     215
     216        $this->assertCount(1001, $res['context'][0]);
     217        $this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
     218    }
    183219}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php

    r1756617 r1986677  
    194194    }
    195195
     196    public function testCanNormalizeReferences()
     197    {
     198        $formatter = new NormalizerFormatter();
     199        $x = array('foo' => 'bar');
     200        $y = array('x' => &$x);
     201        $x['y'] = &$y;
     202        $formatter->format($y);
     203    }
     204
    196205    public function testIgnoresInvalidTypes()
    197206    {
     
    218227    }
    219228
    220     public function testNormalizeHandleLargeArrays()
    221     {
    222         $formatter = new NormalizerFormatter();
    223         $largeArray = range(1, 2000);
     229    public function testNormalizeHandleLargeArraysWithExactly1000Items()
     230    {
     231        $formatter = new NormalizerFormatter();
     232        $largeArray = range(1, 1000);
    224233
    225234        $res = $formatter->format(array(
     
    233242
    234243        $this->assertCount(1000, $res['context'][0]);
     244        $this->assertArrayNotHasKey('...', $res['context'][0]);
     245    }
     246
     247    public function testNormalizeHandleLargeArrays()
     248    {
     249        $formatter = new NormalizerFormatter();
     250        $largeArray = range(1, 2000);
     251
     252        $res = $formatter->format(array(
     253            'level_name' => 'CRITICAL',
     254            'channel' => 'test',
     255            'message' => 'bar',
     256            'context' => array($largeArray),
     257            'datetime' => new \DateTime,
     258            'extra' => array(),
     259        ));
     260
     261        $this->assertCount(1001, $res['context'][0]);
    235262        $this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
    236263    }
     
    381408        );
    382409    }
     410
     411    public function testExceptionTraceDoesNotLeakCallUserFuncArgs()
     412    {
     413        try {
     414            $arg = new TestInfoLeak;
     415            call_user_func(array($this, 'throwHelper'), $arg, $dt = new \DateTime());
     416        } catch (\Exception $e) {
     417        }
     418
     419        $formatter = new NormalizerFormatter();
     420        $record = array('context' => array('exception' => $e));
     421        $result = $formatter->format($record);
     422
     423        $this->assertSame(
     424            '{"function":"throwHelper","class":"Monolog\\\\Formatter\\\\NormalizerFormatterTest","type":"->","args":["[object] (Monolog\\\\Formatter\\\\TestInfoLeak)","'.$dt->format('Y-m-d H:i:s').'"]}',
     425            $result['context']['exception']['trace'][0]
     426        );
     427    }
     428
     429    private function throwHelper($arg)
     430    {
     431        throw new \RuntimeException('Thrown');
     432    }
    383433}
    384434
     
    422472    }
    423473}
     474
     475class TestInfoLeak
     476{
     477    public function __toString()
     478    {
     479        return 'Sensitive information';
     480    }
     481}
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php

    r1756617 r1986677  
    2222    protected function setUp()
    2323    {
    24         BrowserConsoleHandler::reset();
     24        BrowserConsoleHandler::resetStatic();
    2525    }
    2626
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php

    r1756617 r1986677  
    2222    protected function setUp()
    2323    {
    24         TestChromePHPHandler::reset();
     24        TestChromePHPHandler::resetStatic();
    2525        $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; Chrome/1.0';
    2626    }
     
    137137    protected $headers = array();
    138138
    139     public static function reset()
     139    public static function resetStatic()
    140140    {
    141141        self::$initialized = false;
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php

    r1756617 r1986677  
    5959     * @covers Monolog\Handler\FingersCrossedHandler::reset
    6060     */
    61     public function testHandleRestartBufferingAfterReset()
     61    public function testHandleResetBufferingAfterReset()
    6262    {
    6363        $test = new TestHandler();
     
    7777     * @covers Monolog\Handler\FingersCrossedHandler::activate
    7878     */
    79     public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()
     79    public function testHandleResetBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()
    8080    {
    8181        $test = new TestHandler();
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php

    r1756617 r1986677  
    2222    public function setUp()
    2323    {
    24         TestFirePHPHandler::reset();
     24        TestFirePHPHandler::resetStatic();
    2525        $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; FirePHP/1.0';
    2626    }
     
    7878    protected $headers = array();
    7979
    80     public static function reset()
     80    public static function resetStatic()
    8181    {
    8282        self::$initialized = false;
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php

    r1756617 r1986677  
    192192    }
    193193
     194    /**
     195     * @dataProvider rotationWhenSimilarFilesExistTests
     196     */
     197    public function testRotationWhenSimilarFileNamesExist($dateFormat)
     198    {
     199        touch($old1 = __DIR__.'/Fixtures/foo-foo-'.date($dateFormat).'.rot');
     200        touch($old2 = __DIR__.'/Fixtures/foo-bar-'.date($dateFormat).'.rot');
     201
     202        $log = __DIR__.'/Fixtures/foo-'.date($dateFormat).'.rot';
     203
     204        $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
     205        $handler->setFormatter($this->getIdentityFormatter());
     206        $handler->setFilenameFormat('{filename}-{date}', $dateFormat);
     207        $handler->handle($this->getRecord());
     208        $handler->close();
     209
     210        $this->assertTrue(file_exists($log));
     211    }
     212
     213    public function rotationWhenSimilarFilesExistTests()
     214    {
     215
     216        return array(
     217            'Rotation is triggered when the file of the current day is not present but similar exists'
     218                => array(RotatingFileHandler::FILE_PER_DAY),
     219
     220            'Rotation is triggered when the file of the current month is not present but similar exists'
     221                => array(RotatingFileHandler::FILE_PER_MONTH),
     222
     223            'Rotation is triggered when the file of the current year is not present but similar exists'
     224                => array(RotatingFileHandler::FILE_PER_YEAR),
     225        );
     226    }
     227
    194228    public function testReuseCurrentFile()
    195229    {
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php

    r1756617 r1986677  
    321321            ),
    322322            array(
    323                 'title' => 'tags',
     323                'title' => 'Tags',
    324324                'value' => sprintf('```%s```', json_encode($extra['tags'])),
    325325                'short' => false
    326326            ),
    327327            array(
    328                 'title' => 'test',
     328                'title' => 'Test',
    329329                'value' => $context['test'],
    330330                'short' => false
     
    354354    }
    355355
     356    public function testContextHasException()
     357    {
     358        $record = $this->getRecord(Logger::CRITICAL, 'This is a critical message.', array('exception' => new \Exception()));
     359        $slackRecord = new SlackRecord(null, null, true, null, false, true);
     360        $data = $slackRecord->getSlackData($record);
     361        $this->assertInternalType('string', $data['attachments'][0]['fields'][1]['value']);
     362    }
     363
    356364    public function testExcludeExtraAndContextFields()
    357365    {
     
    369377        $expected = array(
    370378            array(
    371                 'title' => 'info',
     379                'title' => 'Info',
    372380                'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)),
    373381                'short' => false
    374382            ),
    375383            array(
    376                 'title' => 'tags',
     384                'title' => 'Tags',
    377385                'value' => sprintf('```%s```', json_encode(array('web'))),
    378386                'short' => false
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php

    r1756617 r1986677  
    7878    }
    7979
     80    public function testSetChunkSize()
     81    {
     82        $this->createHandler('localhost:1234');
     83        $this->handler->setChunkSize(1025);
     84        $this->assertEquals(1025, $this->handler->getChunkSize());
     85    }
     86
    8087    public function testSetConnectionString()
    8188    {
     
    117124        $this->handler->expects($this->once())
    118125            ->method('streamSetTimeout')
     126            ->will($this->returnValue(false));
     127        $this->writeRecord('Hello world');
     128    }
     129
     130    /**
     131     * @expectedException UnexpectedValueException
     132     */
     133    public function testExceptionIsThrownIfCannotSetChunkSize()
     134    {
     135        $this->setMockHandler(array('streamSetChunkSize'));
     136        $this->handler->setChunkSize(8192);
     137        $this->handler->expects($this->once())
     138            ->method('streamSetChunkSize')
    119139            ->will($this->returnValue(false));
    120140        $this->writeRecord('Hello world');
     
    305325        }
    306326
     327        if (!in_array('streamSetChunkSize', $methods)) {
     328            $this->handler->expects($this->any())
     329                ->method('streamSetChunkSize')
     330                ->will($this->returnValue(8192));
     331        }
     332
    307333        $this->handler->setFormatter($this->getIdentityFormatter());
    308334    }
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php

    r1756617 r1986677  
    5555    }
    5656
     57    public function testHandlerAssertEmptyContext() {
     58        $handler = new TestHandler;
     59        $record  = $this->getRecord(Logger::WARNING, 'test', array());
     60        $this->assertFalse($handler->hasWarning(array(
     61            'message' => 'test',
     62            'context' => array(),
     63        )));
     64
     65        $handler->handle($record);
     66
     67        $this->assertTrue($handler->hasWarning(array(
     68            'message' => 'test',
     69            'context' => array(),
     70        )));
     71        $this->assertFalse($handler->hasWarning(array(
     72            'message' => 'test',
     73            'context' => array(
     74                'foo' => 'bar'
     75            ),
     76        )));
     77    }
     78
     79    public function testHandlerAssertNonEmptyContext() {
     80        $handler = new TestHandler;
     81        $record  = $this->getRecord(Logger::WARNING, 'test', array('foo' => 'bar'));
     82        $this->assertFalse($handler->hasWarning(array(
     83            'message' => 'test',
     84            'context' => array(
     85                'foo' => 'bar'
     86            ),
     87        )));
     88
     89        $handler->handle($record);
     90
     91        $this->assertTrue($handler->hasWarning(array(
     92            'message' => 'test',
     93            'context' => array(
     94                'foo' => 'bar'
     95            ),
     96        )));
     97        $this->assertFalse($handler->hasWarning(array(
     98            'message' => 'test',
     99            'context' => array(),
     100        )));
     101    }
     102
    57103    public function methodProvider()
    58104    {
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php

    r1756617 r1986677  
    8989
    9090    /**
     91     * @covers Monolog\Handler\WhatFailureGroupHandler::handleBatch
     92     */
     93    public function testHandleBatchUsesProcessors()
     94    {
     95        $testHandlers = array(new TestHandler(), new TestHandler());
     96        $handler = new WhatFailureGroupHandler($testHandlers);
     97        $handler->pushProcessor(function ($record) {
     98            $record['extra']['foo'] = true;
     99
     100            return $record;
     101        });
     102        $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
     103        foreach ($testHandlers as $test) {
     104            $this->assertTrue($test->hasDebugRecords());
     105            $this->assertTrue($test->hasInfoRecords());
     106            $this->assertTrue(count($test->getRecords()) === 2);
     107            $records = $test->getRecords();
     108            $this->assertTrue($records[0]['extra']['foo']);
     109            $this->assertTrue($records[1]['extra']['foo']);
     110        }
     111    }
     112
     113    /**
    91114     * @covers Monolog\Handler\WhatFailureGroupHandler::handle
    92115     */
  • next-active-directory-integration/trunk/vendor/monolog/monolog/tests/Monolog/LoggerTest.php

    r1756617 r1986677  
    546546        );
    547547    }
     548
     549    /**
     550     * @covers Monolog\Logger::setExceptionHandler
     551     */
     552    public function testSetExceptionHandler()
     553    {
     554        $logger = new Logger(__METHOD__);
     555        $this->assertNull($logger->getExceptionHandler());
     556        $callback = function ($ex) {
     557        };
     558        $logger->setExceptionHandler($callback);
     559        $this->assertEquals($callback, $logger->getExceptionHandler());
     560    }
     561
     562    /**
     563     * @covers Monolog\Logger::setExceptionHandler
     564     * @expectedException InvalidArgumentException
     565     */
     566    public function testBadExceptionHandlerType()
     567    {
     568        $logger = new Logger(__METHOD__);
     569        $logger->setExceptionHandler(false);
     570    }
     571
     572    /**
     573     * @covers Monolog\Logger::handleException
     574     * @expectedException Exception
     575     */
     576    public function testDefaultHandleException()
     577    {
     578        $logger = new Logger(__METHOD__);
     579        $handler = $this->getMock('Monolog\Handler\HandlerInterface');
     580        $handler->expects($this->any())
     581            ->method('isHandling')
     582            ->will($this->returnValue(true))
     583        ;
     584        $handler->expects($this->any())
     585            ->method('handle')
     586            ->will($this->throwException(new \Exception('Some handler exception')))
     587        ;
     588        $logger->pushHandler($handler);
     589        $logger->info('test');
     590    }
     591
     592    /**
     593     * @covers Monolog\Logger::handleException
     594     * @covers Monolog\Logger::addRecord
     595     */
     596    public function testCustomHandleException()
     597    {
     598        $logger = new Logger(__METHOD__);
     599        $that = $this;
     600        $logger->setExceptionHandler(function ($e, $record) use ($that) {
     601            $that->assertEquals($e->getMessage(), 'Some handler exception');
     602            $that->assertTrue(is_array($record));
     603            $that->assertEquals($record['message'], 'test');
     604        });
     605        $handler = $this->getMock('Monolog\Handler\HandlerInterface');
     606        $handler->expects($this->any())
     607            ->method('isHandling')
     608            ->will($this->returnValue(true))
     609        ;
     610        $handler->expects($this->any())
     611            ->method('handle')
     612            ->will($this->throwException(new \Exception('Some handler exception')))
     613        ;
     614        $logger->pushHandler($handler);
     615        $logger->info('test');
     616    }
     617
     618    public function testReset()
     619    {
     620        $logger = new Logger('app');
     621
     622        $testHandler = new Handler\TestHandler();
     623        $bufferHandler = new Handler\BufferHandler($testHandler);
     624        $groupHandler = new Handler\GroupHandler(array($bufferHandler));
     625        $fingersCrossedHandler = new Handler\FingersCrossedHandler($groupHandler);
     626
     627        $logger->pushHandler($fingersCrossedHandler);
     628
     629        $processorUid1 = new Processor\UidProcessor(10);
     630        $uid1 = $processorUid1->getUid();
     631        $groupHandler->pushProcessor($processorUid1);
     632
     633        $processorUid2 = new Processor\UidProcessor(5);
     634        $uid2 = $processorUid2->getUid();
     635        $logger->pushProcessor($processorUid2);
     636
     637        $getProperty = function ($object, $property) {
     638            $reflectionProperty = new \ReflectionProperty(get_class($object), $property);
     639            $reflectionProperty->setAccessible(true);
     640
     641            return $reflectionProperty->getValue($object);
     642        };
     643        $that = $this;
     644        $assertBufferOfBufferHandlerEmpty = function () use ($getProperty, $bufferHandler, $that) {
     645            $that->assertEmpty($getProperty($bufferHandler, 'buffer'));
     646        };
     647        $assertBuffersEmpty = function() use ($assertBufferOfBufferHandlerEmpty, $getProperty, $fingersCrossedHandler, $that) {
     648            $assertBufferOfBufferHandlerEmpty();
     649            $that->assertEmpty($getProperty($fingersCrossedHandler, 'buffer'));
     650        };
     651
     652        $logger->debug('debug');
     653        $logger->reset();
     654        $assertBuffersEmpty();
     655        $this->assertFalse($testHandler->hasDebugRecords());
     656        $this->assertFalse($testHandler->hasErrorRecords());
     657        $this->assertNotSame($uid1, $uid1 = $processorUid1->getUid());
     658        $this->assertNotSame($uid2, $uid2 = $processorUid2->getUid());
     659
     660        $logger->debug('debug');
     661        $logger->error('error');
     662        $logger->reset();
     663        $assertBuffersEmpty();
     664        $this->assertTrue($testHandler->hasDebugRecords());
     665        $this->assertTrue($testHandler->hasErrorRecords());
     666        $this->assertNotSame($uid1, $uid1 = $processorUid1->getUid());
     667        $this->assertNotSame($uid2, $uid2 = $processorUid2->getUid());
     668
     669        $logger->info('info');
     670        $this->assertNotEmpty($getProperty($fingersCrossedHandler, 'buffer'));
     671        $assertBufferOfBufferHandlerEmpty();
     672        $this->assertFalse($testHandler->hasInfoRecords());
     673
     674        $logger->reset();
     675        $assertBuffersEmpty();
     676        $this->assertFalse($testHandler->hasInfoRecords());
     677        $this->assertNotSame($uid1, $uid1 = $processorUid1->getUid());
     678        $this->assertNotSame($uid2, $uid2 = $processorUid2->getUid());
     679
     680        $logger->notice('notice');
     681        $logger->emergency('emergency');
     682        $logger->reset();
     683        $assertBuffersEmpty();
     684        $this->assertFalse($testHandler->hasInfoRecords());
     685        $this->assertTrue($testHandler->hasNoticeRecords());
     686        $this->assertTrue($testHandler->hasEmergencyRecords());
     687        $this->assertNotSame($uid1, $processorUid1->getUid());
     688        $this->assertNotSame($uid2, $processorUid2->getUid());
     689    }
    548690}
  • next-active-directory-integration/trunk/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php

    r1756617 r1986677  
    102102    public function testContextCanContainAnything()
    103103    {
     104        $closed = fopen('php://memory', 'r');
     105        fclose($closed);
     106
    104107        $context = array(
    105108            'bool' => true,
     
    111114            'object' => new \DateTime,
    112115            'resource' => fopen('php://memory', 'r'),
     116            'closed' => $closed,
    113117        );
    114118
  • next-active-directory-integration/trunk/vendor/psr/log/README.md

    r1756617 r1986677  
    77Note that this is not a logger of its own. It is merely an interface that
    88describes a logger. See the specification for more details.
     9
     10Installation
     11------------
     12
     13```bash
     14composer require psr/log
     15```
    916
    1017Usage
Note: See TracChangeset for help on using the changeset viewer.