Fatal crash when using "@" symbol in JSON field


#1

Hi,

we are experiencing an odd behavior when trying to build a custom service. When we use a proper email address as a string, the DSP web app responds with a fatal crash.

Service is configured like this…

When entering a common text string in the user_id object everything seems to work ok. However as soon as we enter an email "test@test.com" DSP blows up like this:

I will post the complete error message separately as I want to keep this ticket short.

Does anyone know what is going? I would assume that an “@” character is legal…

Thanks much Christoph


#2

Here is the complete error output - by the way I forgot to mention that this is version 1.8.0

  array
(
    [_viewFile_] => /opt/bitnami/apps/dreamfactory/htdocs/app/views/web/error.php
    [_data_] => Array
        (
            [current_user] => CWebUser Object
                (
                    [allowAutoLogin] => 1
                    [guestName] => Guest
                    [loginUrl] => Array
                        (
                            [0] => web/login
                        )

                    [identityCookie] => 
                    [authTimeout] => 
                    [autoRenewCookie] => 
                    [autoUpdateFlash] => 1
                    [loginRequiredAjaxResponse] => 
                    [_keyPrefix:CWebUser:private] => c79976af18ddd3663deb5d8d3290a4a2
                    [_access:CWebUser:private] => Array
                        (
                        )

                    [behaviors] => Array
                        (
                        )

                    [_initialized:CApplicationComponent:private] => 1
                    [_e:CComponent:private] => 
                    [_m:CComponent:private] => 
                )

            [code] => 500
            [type] => DreamFactory\Platform\Exceptions\NotFoundException
            [errorCode] => 404
            [message] => Not.found
            [file] => /opt/bitnami/apps/dreamfactory/htdocs/app/controllers/RestController.php
            [line] => 84
            [trace] => #0 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/yii/framework/yiilite.php(3394): RestController->missingAction('syncgateway')
#1 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/yii/framework/yiilite.php(1736): CController->run('syncgateway')
#2 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/yii/framework/yiilite.php(1656): CWebApplication->runController('rest/syncgatewa...')
#3 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/yii/framework/yiilite.php(1181): CWebApplication->processRequest()
#4 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/lib-php-common-yii/src/Utility/Pii.php(214): CApplication->run()
#5 /opt/bitnami/apps/dreamfactory/htdocs/web/index.php(69): DreamFactory\Yii\Utility\Pii::run('/opt/bitnami/ap...', Object(Composer\Autoload\ClassLoader), 'DreamFactory\\Pl...')
#6 {main}
            [traces] => Array
                (
                    [0] => Array
                        (
                            [file] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/yii/framework/yiilite.php
                            [line] => 3394
                            [function] => missingAction
                            [class] => RestController
                            [type] => ->
                            [args] => Array
                                (
                                    [0] => syncgateway
                                )

                        )

                    [1] => Array
                        (
                            [file] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/yii/framework/yiilite.php
                            [line] => 1736
                            [function] => run
                            [class] => CController
                            [type] => ->
                            [args] => Array
                                (
                                    [0] => syncgateway
                                )

                        )

                    [2] => Array
                        (
                            [file] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/yii/framework/yiilite.php
                            [line] => 1656
                            [function] => runController
                            [class] => CWebApplication
                            [type] => ->
                            [args] => Array
                                (
                                    [0] => rest/syncgateway/oneplan/_user/test@test.com
                                )

                        )

                    [3] => Array
                        (
                            [file] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/yii/framework/yiilite.php
                            [line] => 1181
                            [function] => processRequest
                            [class] => CWebApplication
                            [type] => ->
                            [args] => Array
                                (
                                )

                        )

                    [4] => Array
                        (
                            [file] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/lib-php-common-yii/src/Utility/Pii.php
                            [line] => 214
                            [function] => run
                            [class] => CApplication
                            [type] => ->
                            [args] => Array
                                (
                                )

                        )

                    [5] => Array
                        (
                            [file] => /opt/bitnami/apps/dreamfactory/htdocs/web/index.php
                            [line] => 69
                            [function] => run
                            [class] => DreamFactory\Yii\Utility\Pii
                            [type] => ::
                            [args] => Array
                                (
                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/web
                                    [1] => Composer\Autoload\ClassLoader Object
                                        (
                                            [prefixLengthsPsr4:Composer\Autoload\ClassLoader:private] => Array
                                                (
                                                    [W] => Array
                                                        (
                                                            [WindowsAzure\] => 13
                                                        )

                                                    [M] => Array
                                                        (
                                                            [Monolog\] => 8
                                                        )

                                                    [K] => Array
                                                        (
                                                            [Kisma\] => 6
                                                        )

                                                    [D] => Array
                                                        (
                                                            [DreamFactory\Yii\] => 17
                                                            [DreamFactory\Platform\] => 22
                                                            [DreamFactory\Oasys\] => 19
                                                            [DreamFactory\Common\] => 20
                                                        )

                                                )

                                            [prefixDirsPsr4:Composer\Autoload\ClassLoader:private] => Array
                                                (
                                                    [WindowsAzure\] => Array
                                                        (
                                                            [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/azure-sdk-for-php/src
                                                        )

                                                    [Monolog\] => Array
                                                        (
                                                            [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/monolog/monolog/src/Monolog
                                                        )

                                                    [Kisma\] => Array
                                                        (
                                                            [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/kisma/kisma/src/Kisma
                                                        )

                                                    [DreamFactory\Yii\] => Array
                                                        (
                                                            [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/lib-php-common-yii/src
                                                        )

                                                    [DreamFactory\Platform\] => Array
                                                        (
                                                            [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/lib-php-common-platform/src
                                                        )

                                                    [DreamFactory\Oasys\] => Array
                                                        (
                                                            [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/oasys/src
                                                        )

                                                    [DreamFactory\Common\] => Array
                                                        (
                                                            [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/lib-php-common/src
                                                        )

                                                )

                                            [fallbackDirsPsr4:Composer\Autoload\ClassLoader:private] => Array
                                                (
                                                )

                                            [prefixesPsr0:Composer\Autoload\ClassLoader:private] => Array
                                                (
                                                    [S] => Array
                                                        (
                                                            [Symfony\Component\HttpFoundation\] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/symfony/http-foundation
                                                                )

                                                            [Symfony\Component\EventDispatcher\] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/symfony/event-dispatcher
                                                                )

                                                        )

                                                    [P] => Array
                                                        (
                                                            [Psr\Log\] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/psr/log
                                                                )

                                                            [Phpforce\SoapClient] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/phpforce/soap-client/src
                                                                )

                                                            [Phpforce\Common] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/phpforce/common/src
                                                                )

                                                            [PHPParser] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/nikic/php-parser/lib
                                                                )

                                                        )

                                                    [J] => Array
                                                        (
                                                            [Jeremeamia\SuperClosure] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/jeremeamia/SuperClosure/src
                                                                )

                                                        )

                                                    [G] => Array
                                                        (
                                                            [Guzzle\Tests] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/guzzle/guzzle/tests
                                                                )

                                                            [Guzzle] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/guzzle/guzzle/src
                                                                )

                                                        )

                                                    [D] => Array
                                                        (
                                                            [Doctrine\Common\Cache\] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/doctrine/cache/lib
                                                                )

                                                        )

                                                    [A] => Array
                                                        (
                                                            [Aws] => Array
                                                                (
                                                                    [0] => /opt/bitnami/apps/dreamfactory/htdocs/vendor/aws/aws-sdk-php/src
                                                                )

                                                        )

                                                )

                                            [fallbackDirsPsr0:Composer\Autoload\ClassLoader:private] => Array
                                                (
                                                )

                                            [useIncludePath:Composer\Autoload\ClassLoader:private] => 
                                            [classMap:Composer\Autoload\ClassLoader:private] => Array
                                                (

#3

Our goal is to conform to this spec on handling of reserved characters.

http://tools.ietf.org/html/rfc3986#page-12

We are looking into it, as it appears there could be an issue with how we are doing this. As a workaround in your swagger definition you can change user_id from a path variable to a query variable and then you will be able to handle strings like test@test.com.


#4

This has been fixed and will be available in 1.8.3.

GET /rest/db/foo/user@domain.com will return a 404 instead of crashing PHP.


#5

Hi, just a quick question from a new user: How can I change my swagger definition to set a variable as a path variable?

Thanks


#6

Hi @spackmat, not sure that your question is on-topic to this thread. Sorry it got buried.

To accomplish this, you will need to edit the "path": on your manually created Service Definition to include the variable of your choice, and (if applicable) remove that parameter from the "parameters:" block.

If this does not sufficiently answer your question, I recommend you post a new thread with a copy of your Service Definition so the community can better assist you.