Jump to content

Recommended Posts

How can this be?

$app->get('/1.0/configure', function (Request $request, Response $response, $args) {
    exit((isset($this->db)?'$this->db is set':'$this->db not is set').'<pre>'.print_r($this,1).'</pre>');
    $mapper=new \MyApp\Configure(['logger'=>$this->db]);
    echo('<pre>'.print_r($mapper->display(),1).'</pre>');
    return $this->view->render($response, 'configure.html',$mapper->display());
})->setName('configure');
$this->db is set

Slim\Container Object
(
    [defaultSettings:Slim\Container:private] => Array
        (
            [httpVersion] => 1.1
            [responseChunkSize] => 4096
            [outputBuffering] => append
            [determineRouteBeforeAppMiddleware] =>
            [displayErrorDetails] =>
            [addContentLengthHeader] => 1
            [routerCacheFile] =>
        )

    [values:Pimple\Container:private] => Array
        (
            [settings] => Slim\Collection Object
                (
                    [data:protected] => Array
                        (
                            [httpVersion] => 1.1
                            [responseChunkSize] => 4096
                            [outputBuffering] => append
                            [determineRouteBeforeAppMiddleware] => 1
                            [displayErrorDetails] => 1
                            [addContentLengthHeader] =>
                            [routerCacheFile] =>
                            [db] => Array
                                (
                                    [host] => localhost
                                    [charset] => utf8mb4
                                    [dbname] => MyDatabase
                                    [username] => MyUsername
                                    [password] => MyPassword
                                )

                            [testing] => Array
                                (
                                    [key] => main_key
                                    [ip] => http://testing.example.com
                                )

                        )

                )

            [environment] => Slim\Http\Environment Object
                (
                    [data:protected] => Array
                        (
                            REMOVED TO BE WITHIN PHPFREAKS SIZE LIMITS
                        )

                )

            [request] => Slim\Http\Request Object
                (
                    [method:protected] => GET
                    [originalMethod:protected] => GET
                    [uri:protected] => Slim\Http\Uri Object
                        (
                            [scheme:protected] => http
                            [user:protected] => Michael
                            [password:protected] => MyPassword
                            [host:protected] => dd.example.com
                            [port:protected] => 80
                            [basePath:protected] =>
                            [path:protected] => /1.0/configure
                            [query:protected] =>
                            [fragment:protected] =>
                        )

                    [requestTarget:protected] =>
                    [queryParams:protected] =>
                    [cookies:protected] => Array
                        (
                            [PHPSESSID] => 6m6gefl3233v5hvsok4c7bdl97
                        )

                    [serverParams:protected] => Array
                        (
                            REMOVED TO BE WITHIN PHPFREAKS SIZE LIMITS
                        )

                    [attributes:protected] => Slim\Collection Object
                        (
                            [data:protected] => Array
                                (
                                )

                        )

                    [bodyParsed:protected] =>
                    [bodyParsers:protected] => Array
                        (
                            [application/json] => Closure Object
                                (
                                    [this] => Slim\Http\Request Object
 *RECURSION*
                                    [parameter] => Array
                                        (
                                            [$input] =>
                                        )

                                )

                            [application/xml] => Closure Object
                                (
                                    [this] => Slim\Http\Request Object
 *RECURSION*
                                    [parameter] => Array
                                        (
                                            [$input] =>
                                        )

                                )

                            [text/xml] => Closure Object
                                (
                                    [this] => Slim\Http\Request Object
 *RECURSION*
                                    [parameter] => Array
                                        (
                                            [$input] =>
                                        )

                                )

                            [application/x-www-form-urlencoded] => Closure Object
                                (
                                    [this] => Slim\Http\Request Object
 *RECURSION*
                                    [parameter] => Array
                                        (
                                            [$input] =>
                                        )

                                )

                        )

                    [uploadedFiles:protected] => Array
                        (
                        )

                    [validMethods:protected] => Array
                        (
                            [CONNECT] => 1
                            [DELETE] => 1
                            [GET] => 1
                            [HEAD] => 1
                            [OPTIONS] => 1
                            [PATCH] => 1
                            [POST] => 1
                            [PUT] => 1
                            [TRACE] => 1
                        )

                    [protocolVersion:protected] => 1.1
                    [headers:protected] => Slim\Http\Headers Object
                        (
                            REMOVED TO BE WITHIN SIZE LIMITATIONS OF PHPFREAKS
                        )

                    [body:protected] => Slim\Http\RequestBody Object
                        (
                            [stream:protected] => Resource id #4
                            [meta:protected] =>
                            [readable:protected] =>
                            [writable:protected] =>
                            [seekable:protected] =>
                            [size:protected] =>
                            [isPipe:protected] =>
                        )

                )

            [response] => Slim\Http\Response Object
                (
                    [status:protected] => 200
                    [reasonPhrase:protected] =>
                    [protocolVersion:protected] => 1.1
                    [headers:protected] => Slim\Http\Headers Object
                        (
                            [data:protected] => Array
                                (
                                    [content-type] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [0] => text/html; charset=UTF-8
                                                )

                                            [originalKey] => Content-Type
                                        )

                                )

                        )

                    [body:protected] => Slim\Http\Body Object
                        (
                            [stream:protected] => Resource id #9
                            [meta:protected] =>
                            [readable:protected] =>
                            [writable:protected] =>
                            [seekable:protected] =>
                            [size:protected] =>
                            [isPipe:protected] =>
                        )

                )

            [router] => Slim\Router Object
                (
                    [routeParser:protected] => FastRoute\RouteParser\Std Object
                        (
                        )

                    [basePath:protected] =>
                    [cacheFile:protected] =>
                    [routes:protected] => Array
                        (
                            [route0] => Slim\Route Object
                                (
                                    [methods:protected] => Array
                                        (
                                            [0] => GET
                                        )

                                    [identifier:protected] => route0
                                    [name:protected] => configure
                                    [groups:protected] => Array
                                        (
                                        )

                                    [finalized:Slim\Route:private] => 1
                                    [outputBuffering:protected] => append
                                    [arguments:protected] => Array
                                        (
                                        )

                                    [callable:protected] => Closure Object
                                        (
                                            [this] => Slim\Container Object
 *RECURSION*
                                            [parameter] => Array
                                                (
                                                    [$request] =>
                                                    [$response] =>
                                                    [$args] =>
                                                )

                                        )

                                    [container:protected] => Slim\Container Object
 *RECURSION*
                                    [middleware:protected] => Array
                                        (
                                        )

                                    [pattern:protected] => /1.0/configure
                                    [stack:protected] => SplStack Object
                                        (
                                            [flags:SplDoublyLinkedList:private] => 2
                                            [dllist:SplDoublyLinkedList:private] => Array
                                                (
                                                    [0] => Slim\Route Object
 *RECURSION*
                                                )

                                        )

                                    [middlewareLock:protected] => 1
                                )

                        )

                    [routeCounter:protected] => 1
                    [routeGroups:protected] => Array
                        (
                        )

                    [dispatcher:protected] => FastRoute\Dispatcher\GroupCountBased Object
                        (
                            [staticRouteMap:protected] => Array
                                (
                                    [GET] => Array
                                        (
                                            [/1.0/configure] => route0
                                        )

                                )

                            [variableRouteData:protected] => Array
                                (
                                )

                        )

                )

            [foundHandler] => Slim\Handlers\Strategies\RequestResponse Object
                (
                )

            [phpErrorHandler] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                    [parameter] => Array
                        (
                            [$container] =>
                        )

                )

            [errorHandler] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                    [parameter] => Array
                        (
                            [$container] =>
                        )

                )

            [notFoundHandler] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                )

            [notAllowedHandler] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                )

            [callableResolver] => Slim\CallableResolver Object
                (
                    [container:Slim\CallableResolver:private] => Slim\Container Object
 *RECURSION*
                )

            [logger] => Closure Object
                (
                    [parameter] => Array
                        (
                            [$c] =>
                        )

                )

            [db] => Closure Object
                (
                    [parameter] => Array
                        (
                            [$c] =>
                        )

                )

            [view] => Closure Object
                (
                    [parameter] => Array
                        (
                            [$c] =>
                        )

                )

        )

    [factories:Pimple\Container:private] => SplObjectStorage Object
        (
            [storage:SplObjectStorage:private] => Array
                (
                )

        )

    [protected:Pimple\Container:private] => SplObjectStorage Object
        (
            [storage:SplObjectStorage:private] => Array
                (
                )

        )

    [frozen:Pimple\Container:private] => Array
        (
            [settings] => 1
            [router] => 1
            [environment] => 1
            [request] => 1
            [response] => 1
            [callableResolver] => 1
            [foundHandler] => 1
        )

    [raw:Pimple\Container:private] => Array
        (
            [settings] => Closure Object
                (
                    [static] => Array
                        (
                            [userSettings] => Array
                                (
                                    [db] => Array
                                        (
                                            [host] => localhost
                                            [charset] => utf8mb4
                                            [dbname] => drupal_testing
                                            [username] => MyUsername
                                            [password] => MyPassword
                                        )

                                    [testing] => Array
                                        (
                                            [key] => main_key
                                            [ip] => http://testing.example.com
                                        )

                                    [displayErrorDetails] => 1
                                    [addContentLengthHeader] =>
                                    [determineRouteBeforeAppMiddleware] => 1
                                )

                            [defaultSettings] => Array
                                (
                                    [httpVersion] => 1.1
                                    [responseChunkSize] => 4096
                                    [outputBuffering] => append
                                    [determineRouteBeforeAppMiddleware] =>
                                    [displayErrorDetails] =>
                                    [addContentLengthHeader] => 1
                                    [routerCacheFile] =>
                                )

                        )

                    [this] => Slim\Container Object
 *RECURSION*
                )

            [router] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                    [parameter] => Array
                        (
                            [$container] =>
                        )

                )

            [environment] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                )

            [request] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                    [parameter] => Array
                        (
                            [$container] =>
                        )

                )

            [response] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                    [parameter] => Array
                        (
                            [$container] =>
                        )

                )

            [callableResolver] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                    [parameter] => Array
                        (
                            [$container] =>
                        )

                )

            [foundHandler] => Closure Object
                (
                    [this] => Slim\DefaultServicesProvider Object
                        (
                        )

                )

        )

    [keys:Pimple\Container:private] => Array
        (
            [settings] => 1
            [environment] => 1
            [request] => 1
            [response] => 1
            [router] => 1
            [foundHandler] => 1
            [phpErrorHandler] => 1
            [errorHandler] => 1
            [notFoundHandler] => 1
            [notAllowedHandler] => 1
            [callableResolver] => 1
            [logger] => 1
            [db] => 1
            [view] => 1
        )

)
Edited by NotionCommotion
Link to comment
https://forums.phpfreaks.com/topic/302136-is-php-lying-to-me/
Share on other sites

The forum software is not being nice to me and the editor is not appearing correctly for the first post.  I think it might be because I included too much text.  What confuses me is when I look at $this, I don't see the immediate property 'db" being set, but it appears to be so.

Edited by NotionCommotion
Link to comment
https://forums.phpfreaks.com/topic/302136-is-php-lying-to-me/#findComment-1537301
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.