htmlentities() expects parameter 1 to be string, object given - laravel

I am currently using Laravel 5 but any suggestions would be appreciated. I am currently using laravel's form builder and I keep getting this html entity error. I have tried even changing the textarea to a text field and much more to no avail. Below is my full stack trace.
STACK TRACE
ErrorException in helpers.php line 455:
htmlentities() expects parameter 1 to be string, object given (View: /home/fujita/resources/views/emails/contact.blade.php)
in helpers.php line 455
at CompilerEngine->handleViewException(object(ErrorException), '1') in PhpEngine.php line 43
at PhpEngine->evaluatePath('/home/fujita/storage/framework/views/e0d450cfe03e94c1d8bac332b837ce79', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'name' => 'jkj', 'email' => 'jkjkjk#m.com', 'phone' => 'jkjkjk', 'message' => object(Message))) in CompilerEngine.php line 57
at CompilerEngine->get('/home/fujita/resources/views/emails/contact.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'name' => 'jkj', 'email' => 'jkjkjk#m.com', 'phone' => 'jkjkjk', 'message' => object(Message))) in View.php line 136
at View->getContents() in View.php line 104
at View->renderContents() in View.php line 78
at View->render() in Mailer.php line 425
at Mailer->getView('emails.contact', array('name' => 'jkj', 'email' => 'jkjkjk#m.com', 'phone' => 'jkjkjk', 'message' => object(Message))) in Mailer.php line 288
at Mailer->addContent(object(Message), 'emails.contact', null, null, array('name' => 'jkj', 'email' => 'jkjkjk#m.com', 'phone' => 'jkjkjk', 'message' => object(Message))) in Mailer.php line 162
at Mailer->send('emails.contact', array('name' => 'jkj', 'email' => 'jkjkjk#m.com', 'phone' => 'jkjkjk', 'message' => 'jkjkj'), object(Closure)) in Facade.php line 216
at Facade::__callStatic('send', array('emails.contact', array('name' => 'jkj', 'email' => 'jkjkjk#m.com', 'phone' => 'jkjkjk', 'message' => 'jkjkj'), object(Closure))) in PagesController.php line 37
at Mail::send('emails.contact', array('name' => 'jkj', 'email' => 'jkjkjk#m.com', 'phone' => 'jkjkjk', 'message' => 'jkjkj'), object(Closure)) in PagesController.php line 37
at PagesController->store(object(ContactFormRequest))
at call_user_func_array(array(object(PagesController), 'store'), array(object(ContactFormRequest))) in Controller.php line 246
at Controller->callAction('store', array(object(ContactFormRequest))) in ControllerDispatcher.php line 162
at ControllerDispatcher->call(object(PagesController), object(Route), 'store') in ControllerDispatcher.php line 107
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 108
at ControllerDispatcher->callWithinStack(object(PagesController), object(Route), object(Request), 'store') in ControllerDispatcher.php line 67
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\PagesController', 'store') in Route.php line 198
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 131
at Route->run(object(Request)) in Router.php line 691
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Router.php line 693
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 660
at Router->dispatchToRoute(object(Request)) in Router.php line 618
at Router->dispatch(object(Request)) in Kernel.php line 210
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 43
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Kernel.php line 111
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 84
at Kernel->handle(object(Request)) in index.php line 53
contact.blade.php
<p>
Name: {{ $name }}
</p>
<p>
{{ $email }}
</p>
<p>
{{ $phone }}
</p>
<p>
{{ $message }}
</p>
ContactFormRequest.php
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class ContactFormRequest extends Request {
public function authorize()
{
return true;
}
public function rules()
{
return [
'name' => 'required',
'email' => 'required|email',
'phone' => 'required',
'message' => 'required',
];
}
}
Form on index.blade.php
{!! Form::open(array('route' => 'contact_store', 'class' => 'form')) !!}
<div class="form-group">
{!! Form::text('name', null,
array('required',
'class'=>'form-control',
'placeholder'=>'Name*')) !!}
</div>
<div class="form-group">
{!! Form::text('email', null,
array('required',
'class'=>'form-control',
'placeholder'=>'Email Address*')) !!}
</div>
<div class="form-group">
{!! Form::text('phone', null,
array('required',
'class'=>'form-control',
'placeholder'=>'Phone')) !!}
</div>
<div class="form-group">
{!! Form::textarea('message', null,
array('required',
'class'=>'form-control',
'placeholder'=>'Message')) !!}
</div>
<div class="form-group">
{!! Form::submit('Submit',
array('class'=>'btn btn-primary')) !!}
</div>
{!! Form::close() !!}
<ul>
#foreach($errors->all() as $error)
<li>{{ $error }}</li>
#endforeach
</ul>
PagesController
<?php namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\ContactFormRequest;
class PagesController extends Controller {
public function home()
{
// Mail::send('emails.contact', array('name' => 'Justin' ), function($message){
// $message->to('justin#sfp.net', 'Justin')->subject('Test');
// });
return view('pages.index');
}
public function store(ContactFormRequest $request)
{
\Mail::send('emails.contact',
array(
'name' => $request->get('name'),
'email' => $request->get('email'),
'phone' => $request->get('phone'),
'message' => $request->get('message')
), function($message)
{
$message->from('justin#sfp.net');
$message->to('justin#sfp.net', 'Admin')->subject('Chyall Pharma Contact');
});
return \Redirect::route('/')->with('message', 'Thanks for contacting us!');
}
}

The problem is in PagesController inside the Mail::send.
'message' => $request->get('message');
You are using the variable name 'message' and it should be avoided.
Note: A $message variable is always passed to e-mail views, and allows
the inline embedding of attachments. So, it is best to avoid passing a
message variable in your view payload.
source: http://laravel.com/docs/5.0/mail#basic-usage in the first note.
You might need to change the variable name to be something else.
'bodyMessage' => $request->get('message');
And don't forget the change the variable name in your contact.blade.php as well
<p>
Name: {{ $name }}
</p>
<p>
{{ $email }}
</p>
<p>
{{ $phone }}
</p>
<p>
{{ $bodyMessage }} // This line.
</p>

{!! Form::submit('Submit', array('class'=>'btn btn-primary')) !!}
This line needs a non-array second parameter, try changing it to:
{!! Form::submit('Submit', '', array('class'=>'btn btn-primary')) !!}

if you want print a array must be done like:
<?php dd($nameOfvarArray); ?>
reference: https://laravel.com/docs/5.2/helpers#method-dd

I also encountered this error when I had the wrong form method. To create a text input make sure to use text method, not input method.
{!! Form::text('name', null, ['class' => 'form-control']) !!}
instead of:
{!! Form::input('name', null, ['class' => 'form-control']) !!}
This is corrected the error.
This is for Laravel 5.3 with Laravel Collective (i.e. composer require "laravelcollective/html":"^5.3.0")

Did you add
to composer.json:
"require": {
"illuminate/html": "5.0.*#dev"
},
to app.php providers array
'Illuminate\Html\HtmlServiceProvider',
to app.php aliases array
'Html' => 'Illuminate\Html\HtmlFacade',
'Form' => 'Illuminate\Html\FormFacade',
and then
composer update

Related

Error performing load testing using jmeter

I am trying to perform load testing using JMeter in which I have recorded a script using HTTP script recorder. now I have to perform the same test with multiple users, hence using a .csv file containing the details of 5 users.now when the test script is run after configuring for 5 users and suppose there are 5 HTTP requests.then some of the requests fails showing the error below:-
PDOException in Connector.php line 55:
SQLSTATE[HY000] [1045] Access denied for user 'forge'#'localhost' (using password: NO)
in Connector.php line 55
at PDO->__construct('mysql:host=localhost;port=3306;dbname=forge', 'forge', '', array('0', '2', '0', false, false)) in Connector.php line 55
at Connector->createConnection('mysql:host=localhost;port=3306;dbname=forge', array('driver' => 'mysql', 'host' => 'localhost', 'port' => '3306', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'timezone' => '+00:00', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 22
at MySqlConnector->connect(array('driver' => 'mysql', 'host' => 'localhost', 'port' => '3306', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'timezone' => '+00:00', 'strict' => false, 'name' => 'mysql')) in ConnectionFactory.php line 60
at ConnectionFactory->createSingleConnection(array('driver' => 'mysql', 'host' => 'localhost', 'port' => '3306', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'timezone' => '+00:00', 'strict' => false, 'name' => 'mysql')) in ConnectionFactory.php line 49
at ConnectionFactory->make(array('driver' => 'mysql', 'host' => 'localhost', 'port' => '3306', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'timezone' => '+00:00', 'strict' => false, 'name' => 'mysql'), 'mysql') in DatabaseManager.php line 175
at DatabaseManager->makeConnection('mysql') in DatabaseManager.php line 67
at DatabaseManager->connection('mysql') in Model.php line 3224
at Model::resolveConnection(null) in Model.php line 3190
at Model->getConnection() in Model.php line 1870
at Model->newBaseQueryBuilder() in Model.php line 1813
at Model->newQueryWithoutScopes() in Model.php line 1432
at Model->save() in ActivityController.php line 19
at ActivityController::logUserActivity(object(Request), 'visited', array('url' => 'http://localhost/busnet/Source/Main/Services/public/index.php/post', 'method' => 'POST', 'requested_on' => '1508130477.865', 'responded_on' => '1508130477.8878', 'ip_address' => '127.0.0.1', 'status' => '200')) in ActivityMiddleware.php line 52
at ActivityMiddleware->addToActivityLog(object(Request), object(JsonResponse)) in ActivityMiddleware.php line 34
at ActivityMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ActivityMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AuthMiddleware.php line 74
at AuthMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AuthMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CorsMiddleware.php line 26
at CorsMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CorsMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Application.php line 1451
at Application->sendThroughPipeline(array('App\Http\Middleware\CorsMiddleware', 'App\Http\Middleware\AuthMiddleware', 'App\Http\Middleware\ActivityMiddleware'), object(Closure)) in Application.php line 1221
at Application->dispatch(object(Request)) in Application.php line 1161
at Application->run(object(Request)) in index.php line 30
this is my .csv in notepad
test1#gmail.com,test#123,DATE,DESC,null,1,2,test1#gmail.com
test2#gmail.com,test#124,DATE,DESC,null,3,3,test2#gmail.com
test3#gmail.com,test#125,DATE,DESC,null,4,4,test3#gmail.com
test4#gmail.com,test#126,DATE,DESC,null,5,5,test4#gmail.com
test5#gmail.com,test#127,DATE,DESC,null,6,6,test5#gmail.com
and the CSV dataset config is as follows
https://i.imgur.com/zZaIP9M.png
The error appears for different requests for each run ie sometimes the same request send by 4 out of 5 user passes but one fails.
Can anyone please help me out to resolve this?
Just a guess, but could this be due to mysql not being configured to accept concurrent logins? You could test this by putting everything in the Jmeter thread group under a Critical Section controller:
https://jmeter.apache.org/api/org/apache/jmeter/control/CriticalSectionController.html

Oci8Exception in Oci8.php (line 460)

I met a problem when i use laravel 5.4 to connect to oracle, it will throw the error like this, i googled for days, but can't solve the problem, i don't know where i did wrong, i need your help.
(1/1) Oci8Exception
in Oci8.php (line 460)
at Oci8->connect('(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.98)(PORT = 1521)) (CONNECT_DATA =(SID = fanhua)))', 'tianhengrd', 'tianheng123', array(2, 0, 2, 'charset' => 'AL32UTF8'), 'AL32UTF8')
in Oci8.php (line 78)
at Oci8->__construct('(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.98)(PORT = 1521)) (CONNECT_DATA =(SID = fanhua)))', 'tianhengrd', 'tianheng123', array(2, 0, 2, 'charset' => 'AL32UTF8'))
in OracleConnector.php (line 204)
at OracleConnector->createConnection('(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.98)(PORT = 1521)) (CONNECT_DATA =(SID = fanhua)))', array('driver' => 'oracle', 'tns' => '', 'host' => '192.168.2.98', 'port' => '1521', 'database' => 'fanhua', 'username' => 'tianhengrd', 'password' => 'tianheng123', 'charset' => 'AL32UTF8', 'prefix' => '', 'prefix_schema' => '', 'options' => array(2)), array(2, 0, 2, 'charset' => 'AL32UTF8'))
in OracleConnector.php (line 35)
at OracleConnector->connect(array('driver' => 'oracle', 'tns' => '', 'host' => '192.168.2.98', 'port' => '1521', 'database' => 'fanhua', 'username' => 'tianhengrd', 'password' => 'tianheng123', 'charset' => 'AL32UTF8', 'prefix' => '', 'prefix_schema' => '', 'options' => array(2)))
in Oci8ServiceProvider.php (line 48)
at Oci8ServiceProvider->Yajra\Oci8\{closure}(array('driver' => 'oracle', 'tns' => '', 'host' => '192.168.2.98', 'port' => '1521', 'database' => 'fanhua', 'username' => 'tianhengrd', 'password' => 'tianheng123', 'charset' => 'AL32UTF8', 'prefix' => '', 'prefix_schema' => '', 'options' => array(2)), 'fanhua')
at call_user_func(object(Closure), array('driver' => 'oracle', 'tns' => '', 'host' => '192.168.2.98', 'port' => '1521', 'database' => 'fanhua', 'username' => 'tianhengrd', 'password' => 'tianheng123', 'charset' => 'AL32UTF8', 'prefix' => '', 'prefix_schema' => '', 'options' => array(2)), 'fanhua')
in DatabaseManager.php (line 113)
at DatabaseManager->makeConnection('fanhua')
in DatabaseManager.php (line 71)
at DatabaseManager->connection('fanhua')
in Model.php (line 1041)
at Model::resolveConnection(null)
in Model.php (line 1007)
at Model->getConnection()
in Model.php (line 855)
at Model->newBaseQueryBuilder()
in Model.php (line 814)
at Model->newQueryWithoutScopes()
in Model.php (line 798)
at Model->newQuery()
in OracleUserProvider.php (line 25)
at OracleUserProvider->retrieveByCredentials(array('username' => 'admin', 'password' => '123456'))
in SessionGuard.php (line 352)
at SessionGuard->attempt(array('username' => 'admin', 'password' => '123456'), false)
in AuthenticatesUsers.php (line 76)
at LoginController->attemptLogin(object(Request))
in AuthenticatesUsers.php (line 41)
at LoginController->login(object(Request))
at call_user_func_array(array(object(LoginController), 'login'), array(object(Request)))
in Controller.php (line 55)
at Controller->callAction('login', array(object(Request)))
in ControllerDispatcher.php (line 44)
at ControllerDispatcher->dispatch(object(Route), object(LoginController), 'login')
in Route.php (line 203)
at Route->runController()
in Route.php (line 160)
at Route->run()
in Router.php (line 574)
at Router->Illuminate\Routing\{closure}(object(Request))
in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in RedirectIfAuthenticated.php (line 24)
at RedirectIfAuthenticated->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in SubstituteBindings.php (line 41)
at SubstituteBindings->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in ShareErrorsFromSession.php (line 49)
at ShareErrorsFromSession->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in StartSession.php (line 64)
at StartSession->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in AddQueuedCookiesToResponse.php (line 37)
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in EncryptCookies.php (line 59)
at EncryptCookies->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in Pipeline.php (line 102)
at Pipeline->then(object(Closure))
in Router.php (line 576)
at Router->runRouteWithinStack(object(Route), object(Request))
in Router.php (line 535)
at Router->dispatchToRoute(object(Request))
in Router.php (line 513)
at Router->dispatch(object(Request))
in Kernel.php (line 176)
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in ValidatePostSize.php (line 27)
at ValidatePostSize->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in CheckForMaintenanceMode.php (line 46)
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in Pipeline.php (line 102)
at Pipeline->then(object(Closure))
in Kernel.php (line 151)
at Kernel->sendRequestThroughRouter(object(Request))
in Kernel.php (line 116)
at Kernel->handle(object(Request))
in index.php (line 53)
my env file is like this, and my database.php is below,
ORACLE_DB_TNS=
ORACLE_DB_HOST=192.168.2.98
ORACLE_DB_PORT=1521
ORACLE_DB_DATABASE=fanhua
ORACLE_DB_USERNAME=tianhengrd
ORACLE_DB_PASSWORD=tianheng123
ORACLE_DB_PREFIX=
ORACLE_DB_SCHEMA_PREFIX=
'fanhua' => [
'driver' => 'oracle',
'tns' => env('ORACLE_DB_TNS', ''),
'host' => env('ORACLE_DB_HOST', ''),
'port' => env('ORACLE_DB_PORT', '1521'),
'database' => env('ORACLE_DB_DATABASE', ''),
'username' => env('ORACLE_DB_USERNAME', ''),
'password' => env('ORACLE_DB_PASSWORD', ''),
'charset' => env('ORACLE_DB_CHARSET', 'AL32UTF8'),
'prefix' => env('ORACLE_DB_PREFIX', ''),
'prefix_schema' => env('ORACLE_DB_SCHEMA_PREFIX', ''),
'options' => [
PDO::ATTR_CASE => PDO::CASE_LOWER,
]
],
Create a pure-PHP script calling oci_connect() with the DB credentials and connect string shown in your trace output. Something like:
<?php
$c = oci_connect('tianhengrd, 'tianheng123', '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.98)(PORT=1521))(CONNECT_DATA=(SID=fanhua)))', 'AL32UTF8')
if (!$c) {
$m = oci_error();
trigger_error($m['message'], E_USER_ERROR);
}
This will confirm they are valid and show what error is happening if they are not. Most modern databases connection strings use 'service names' not 'SIDs', so I'd expect to see '... (CONNECT_DATA =(SERVICE_NAME = fanhua)) ...'
I was having the same problem and it was apache permission
check you Apache variables $ORACLE_HOME AND LD_LIBRARY_PATH
check permission apache for diretorys oracle_home and ld_library
alway check apache error log

issue in update controller

i got the issue while updateing
NotFoundHttpException in RouteCollection.php line 161: in RouteCollection.php line 161 at
RouteCollection->match(object(Request)) in Router.php line 821 at
Router->findRoute(object(Request)) in Router.php line 691 at
Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246 at
Kernel->Illuminate\Foundation\Http{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php
line 52 at
Pipeline->Illuminate\Routing{closure}(object(Request)) in
CheckForMaintenanceMode.php line 44 at
CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode),
'handle'), array(object(Request), object(Closure))) in Pipeline.php
line 136 at
Pipeline->Illuminate\Pipeline{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php
line 32 at
Pipeline->Illuminate\Routing{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php
line 103 at Pipeline->then(object(Closure)) in Kernel.php line
132 at Kernel->sendRequestThroughRouter(object(Request)) in
Kernel.php line 99 at Kernel->handle(object(Request)) in
index.php line 54
For the given issue Here is my Controller
public function update(Request $request ,$id){
print_r($request);
return redirect()->back();
}
View
{!! Form::model($website, ['method' => 'PATCH ', 'route' => ['websites.update', $website->id]]) !!}`
<div class="form-group">
{{ Form::label('user', 'User Name:', ['class' => 'control-label']) }}
{{ Form::text('user', null, ['class' => 'form-control']) }}
</div>
{!! Form::submit('Update', ['class' => 'btn btn-primary']) !!}
{!! Form::close() !!}
Here My route
Route::post('websites/{id}/update',
['as' => 'websites.update', 'uses' => 'WebsiteController#update']
);
Thanks For every one to helping me out. But i Uses this and now it is work fine. Thanks again!!
{!! Form::model($website, ['method' => 'PATCH', 'route' => ['websites.update', $website->id]]) !!}`
.
.
.
Route::any('websites/{id}/update',
['as' => 'websites.update', 'uses' => 'WebsiteController#update']
);
Your method differs and should be the same as route
Let's change like this:
{!! Form::model($website, ['method' => 'PUT', 'route' => ['websites.update', $website->id]]) !!}`
.
.
.
Route::PUT('websites/{id}/update',
['as' => 'websites.update', 'uses' => 'WebsiteController#update']
);

Laravel 5.1 NotFoundHttpException in RouteCollection.php line 161:

I get this error when I try to access delayTime method. I can't see what I am doing wrong. I have the routes setup like this:
Route::post('quiz', [ 'as' => 'quiz', 'uses' => 'QuizController#create' ]);
Route::get('quiz/token/{quizByToken}', [ 'as' => 'quiz.token', 'uses' => 'QuizController#getQuizByToken' ]);
Route::get('quiz/code/{quizByCode}', [ 'as' => 'quiz.code', 'uses' => 'QuizController#getQuizByCode' ]);
Route::get('quiz/id/{quiz}/players', [ 'as' => 'quiz.players', 'uses' => 'QuizController#getQuizPlayers' ]);
Route::get('quiz/token/{quizByToken}/players/highscore', [ 'as' => 'quizzes.player.highscore', 'uses' => 'PlayerController#highscore' ]);
Route::put('quiz/nextQuestion/{quizByToken}', [ 'as' => 'quizzes.nextQuestion', 'uses' => 'QuizController#nextQuestion' ]);
Route::get('quiz/poll/{quiz}', [ 'as' => 'quizzes.poll', 'uses' => 'QuizController#currentQuestion' ]);
Route::put('quiz/poll/token/{quizByToken}/delay-current/{delayTime}', [ 'as' => 'quizzes.delayTime', 'uses' => 'QuizController#delayTime' ]);
Error message:
NotFoundHttpException in RouteCollection.php line 161 in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 750
at Router->findRoute(object(Request)) in Router.php line 659
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
You are using the following route:
Route::put(
'quiz/poll/token/{quizByToken}/delay-current/{delayTime}',
[ 'as' => 'quizzes.delayTime', 'uses' => 'QuizController#delayTime'
]);
Which means when you submit the form, you've to pass a hidden input field named _token with value put in it, for example:
<form method='POST'>
<input type="hidden" name="_method" value="PUT" />
<!-- Other Fields -->
</form>
I'm sure you missed it. You may check Form Method Spoofing for more information on this topic.

Laravel validation - ErrorException in helpers.php line 466: htmlentities() expects parameter 1 to be string, object given

So, I followed the laravel documentation to create a validator. But every time the validation fails, I get a nasty "ErrorException in helpers.php line 466".
If I dump the $validator before the redirect, everything seems to be perfect and all the errors are there. But, after the redirect, I get the problem.
routes.php
Route::group(['as' => 'todas'], function(){
Route::group(['middleware' => ['web'], 'as' => 'web', 'namespace' => 'Web'], function(){
Route::group(['middleware' => ['auth'], 'prefix' => 'dashboard', 'as' => 'privadas', 'namespace' => 'Privadas'], function(){
Route::get('criar', ['uses' => 'PrivateController#criar', 'as' => 'criar']);
Route::post('salvar', ['uses' => 'FestaController#salvar', 'as' => 'salvar']);
});
});
});
kernel.php
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
],
'api' => [
'throttle:60,1',
],
];
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
The controller
namespace App\Http\Controllers\Web\Privadas;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Validator;
class FestaController extends Controller
{
public function salvar(Request $request){
$validator = Validator::make($request->all(),[
'numConvidados' => 'required|numeric|min:1',
'inicioFesta' => 'required|date|before:' . $request->fimFesta,
'fimFesta' => 'required|date|after:' . $request->inicioFesta . '|mais_x_dias:' . $request->inicioFesta . ',1'
]);
if ($validator->fails()){
return redirect('dashboard/criar')
->withErrors($validator)
->withInput();
}
dd('success');
}
}
The part of the view which contains the $errors variable
#section('subHeader')
#if (count($errors) > 0) {{-- Div de erros --}}
<div class="alert alert-danger">
{{$errors}}
<strong>{{ trans('mensagens.opa-algo-deu-errado')}}</strong>
<br>
<ul>
#foreach ($errors->all() as $error)
<li>{{ $error }}</li>
#endforeach
</ul>
</div>
#endif
#endsection
The error is called:
ErrorException in helpers.php line 466:
htmlentities() expects parameter 1 to be string, object given (View: E:[....]\resources\views\privadas\criar-evento.blade.php)
in helpers.php line 466
at CompilerEngine->handleViewException(object(ErrorException), '1') in PhpEngine.php line 44
at PhpEngine->evaluatePath('E:\Profissional\photo2me\Repos\photo2me\storage\framework\views/07ef3b6137fe5cd5f04a28b6acfeb98af95e1888.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag))) in CompilerEngine.php line 59
at CompilerEngine->get('E:\Profissional\photo2me\Repos\photo2me\resources\views/privadas/criar-evento.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag))) in View.php line 142
at View->getContents() in View.php line 113
at View->renderContents() in View.php line 82
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 197
at Response->__construct(object(View)) in Router.php line 1030
at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack(object(PrivateController), object(Route), object(Request), 'criar') in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Web\Privadas\PrivateController', 'criar') in Route.php line 174
at Route->runController(object(Request)) in Route.php line 140
at Route->run(object(Request)) in Router.php line 703
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Authenticate.php line 28
at Authenticate->handle(object(Request), object(Closure))
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 705
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 678
at Router->dispatchToRoute(object(Request)) in Router.php line 654
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
remove {{$errors}}in blade file

Resources