How can I fix the following error:
Fatal error: Cannot redeclare Cpages::edit_galleries_picture() in
C:\Program Files
(x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\application\admin\controllers\Cpages.php
on line 476
A PHP Error was encountered
Severity: Compile Error
Message: Cannot redeclare Cpages::edit_galleries_picture()
Filename: controllers/Cpages.php
Line Number: 476
Backtrace:
The url: http://localhost/masterlinkci2/admin/index.php/cpages/edit_galleries_picture/21
Line 476: public function edit_galleries_picture() {
From Comment
public function edit_galleries_picture() {
$gallery_id = $this->uri->segment(3);
$data['pictures'] = $this->Mpages->call_gallery_pictures($gallery_id);
$this->load->view('editgalleries', $data);
}
This error showing because you already have function edit_galleries_picture() in controller Cpages.
To fix this error, make sure you don't have duplicated function. You can rename the function edit_galleries_picture() to something different, or you can combine the code into one function.
Related
I am wanting to execute a simple test using Pest and using Orcestra Testbench Dusk. However when this happens, I encounter the following in the browser:
This page isn’t working
127.0.0.1 is currently unable to handle this request.
HTTP ERROR 500
My set up is as follows:
MyTest.php
$this->browse(function($browser) {
$browser->visit('/')
->tap(fn() => sleep(3))
->assertSee('Laravel');
});
Pest.php
...
uses(BrowserTestCase::class)->in('Browser');
...
BrowserTestCase.php
class BrowserTestCase extends \Orchestra\Testbench\Dusk\TestCase
{
protected function defineRoutes($router)
{
$router->get('/', function() {
return view('welcome');
});
}
protected function defineEnvironment($app)
{
//set this as wondered if I could get the output of any error rendered
$app['config']->set('app.debug', true);
}
}
Since the HTTP error is 500, it feels like there is an error in my code but I am unsure where/if this is logged anywhere. That said running ./vendor/bin/testbench serve yields no errors.
What am I missing to get this to run my test successfully?
Endpoint:
(<LuisService>botconfig.findServiceByNameOrId("aiBot")).getEndpoint()
In here when I debugging I am getting an error.
My handler() throws a SalesforceException. I want to watch that and log the particular error message from the it, using the failed() method on the Queue in Laravel 5.6. If I do the below, I am getting the error:
Error
[2018-04-17 00:18:12] local.ERROR: Type error: Argument 1 passed to App\Listeners\SyncNewsletterSignupToSalesforce::failed() must be an instance of Exception, instance of App\Events\NewsletterSignup given {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Type error: Argument 1 passed to App\\Listeners\\SyncNewsletterSignupToSalesforce::failed() must be an instance of Exception, instance of App\\Events\\NewsletterSignup ...
Code
public function failed(Exception $e)
{
try {
} catch(SalesforceException $e)
{
$response = $e->getResponse();
$responseBodyAsString = $response->getBody()->getContents();
logger($responseBodyAsString);
}
}
Set up a listener in your AppServiceProvider to listen for failed jobs from the queue:
public function boot() {
Queue::failing(function (JobFailed $event) {
// $event->connectionName
// $event->job
// $event->exception
// check for the specific exception type
if ($event->exception instanceof SalesforceException) {
// do something
}
});
}
More here on failed job events.
I have Cs Cart Multi vendor. I upgraded my PHP 5.5 to PHP 7.0.
And have error:
865 FastCGI sent in stderr: "PHP message: PHP Warning:
session_start(): Session callback expects true/false return value in
/var/www/cscart/app/Tygh/Session.php on line 341 PHP message: PHP
Fatal error: session_start(): Failed to initialize storage module:
user (path: /var/lib/php/sessions) in /var/www/cscart/app/Tygh/Session.php on line 341"
while reading response header from upstream, client: 49.189.136.11,
server:
Directory /var/lib/php/sessions has 0777. On other sites session works fine.
File Session.php:
/**
* Starts session
* #param array $request Request data
*/
public static function start($request = array())
{
// Force transfer session id to cookies if it passed via url
if (!empty($request[self::$_name])) {
self::setId($request[self::$_name], false);
} elseif (empty($_COOKIE[self::$_name])) {
self::setId(self::_generateId());
}
session_name(self::$_name);
session_start();
// Session checker (for external services, returns "OK" if session exists, empty - otherwise)
if (!empty($request['check_session'])) {
die(!empty($_SESSION) ? 'OK' : '');
}
// Validate session
if (!defined('SKIP_SESSION_VALIDATION')) {
$validator_data = self::getValidatorData();
if (!isset($_SESSION['_validator_data'])) {
$_SESSION['_validator_data'] = $validator_data;
} else {
if ($_SESSION['_validator_data'] != $validator_data) {
session_regenerate_id();
$_SESSION = array();
}
}
}
// _SESSION superglobal variable populates here, so remove it from global scope if needed
if (Bootstrap::getIniParam('register_globals')) {
Bootstrap::unregisterGlobals('_SESSION');
}
}
Server: NGINX, PHP7.0-FPM
session_start() uses any handlers you've previously set with session_set_save_handler(...), and that handler (or the individual functions) must return a true/false result to signal success or failure. You have a handler that does not return a true/false result.
To recap; the actual error is the implementation of your session handler, not the code that calls session_start().
if you user session_handler , for_example, SessionRedisHandler Class,the open function must return true。I solve this problem in php7.0。
This is my code and it is giving error
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error
in template "C:\wamp\www\pangu\application\views\front\employer\lesson\topic_popup.tpl" on line 89
"$.post("{site_url()}("employer/library/show_topic");",{"id":id,"sts":sts},function(responseText){" - Unexpected ":", expected one of: "}" , " " , ATTR'
in C:\wamp\www\pangu\application\third_party\Smarty-3.1.13\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 665
i am new in smarty
<script>
function show_topic(id,sts){
if($('#ch_'+id).is(":checked")) {
sts =1;
}
else{
sts = 0;
}
$.post("{site_url()}("employer/library/show_topic");"{"id":id,"sts":sts},function(responseText){});}
</script>
use {literal} after open function() eg:
function init_map(){
{literal}
scripts
{/literal}
}
It seems that's problem you have Javasript in your Smarty template.
You should do it in this way:
<script type="text/javascript"?
{literal}
// here you can put your javascript code safely
{/literal}
</script>
However in some cases it's not necessary to use them - look at http://www.smarty.net/docs/en/language.function.literal.tpl