Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

bruce zhang
1,317 PointsValidator Error
Hi, I keep getting this error when I use laravel validator
ErrorException (E_UNKNOWN)
preg_replace(): Parameter mismatch, pattern is a string while replacement is an array Open: /home/vagrant/sites/zihai/vendor/laravel/framework/src/Illuminate/Support/helpers.php
<?php
/**
* @param string $subject
* @return string
*/
function str_replace_array($search, array $replace, $subject)
{
foreach ($replace as $value)
{
$subject = preg_replace('/'.$search.'/', $value, $subject, 1);
}
my code simply like that
<?php
$rules = array(
'title' => array('required')
);
$name = Input::all();
$validate = Validator::make($name,$rules);
1 Answer

Petros Sordinas
16,181 PointsBruce,
Something is passed incorrectly to the Validator::make method. Can you show us your form code?
bruce zhang
1,317 Pointsbruce zhang
1,317 PointsHi Petros,
Thanks for your reply, I finally found the issue. validator are perfect, the issue was happen when passing data to ORM.
sorted
Regards Bruce