简体   繁体   中英

Kohana preg_replace error in database.php

ErrorException [8192]:preg_replace():不建议使用/ e修饰符,而应在http://mastersoftwaretechnologies.com/kohana/index.php/user/login上使用preg_replace_callback

This works in my kohana-3.2

Replace

$column = preg_replace('/"(.+?)"/e', '$this->quote_column("$1")', $column);

to

$column = preg_replace_callback('/"(.+?)"/', function($m) { return $this->quote_column($m[1]); }, $column);

In the file MODPATH/database/classes/kohana/database.php line 525

Looks like you are using php 5.5. If you want to use preg replace eval with it you have to modify it firts because it is deprecated due to security reasons: http://php.net/manual/en/migration55.deprecated.php

With php 5.5 you should use preg_replace_callback()

Good example you will find here: Replace deprecated preg_replace /e with preg_replace_callback

And info how it works here: Replace preg_replace() e modifier with preg_replace_callback

Just modify second paremeter accordingly to that what you want to do with matches.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM