I migrated a cake website from one server to another, but in statics pages is showing a blank page, this is happening in two case scenarios right now
Scenario1:
$this->redirect(Router::url(array('controller' => 'staticpages',
'action' => 'message', 'messageSlug' => 'welcome')));
Scenario2:
$link = Router::url(array('controller' => 'staticpages',
'action' => 'message', 'messageSlug' => 'thanks-for-registering'));
The Facebook PHP SDK is interfering. It's probably throwing an error before Cake can properly redirect (the headers are already sent by groofi__extra_facebook.php.
Have a look what's happening in groofi__extra_facebook.php where the error seems to be stemming from. Probably your new server configuration is missing a vital component, is cURL present, for example?
Related
I need to debug some errors and formatting within a professional wordpress site. I need to do the debugging from the raw code. It is mostly php and JS. I have ended up with more than 2million lines of code after the most recent update. There are some empty box space on the home page and a list of bugs from the WP_DEBUG log.
This is my first time working with Wordpress at all. I am overwhelmed by the amount of code, and can't figure out where any of the bugs and issues are. I have worked with Angular Typescript in the past.
I would assume, to an extent, that some of these issues would be able to be fixed within the 'drag and drop' API of wordpress, but I have no idea how to use that either, when there is an already several million lined website code, and like I said, I was given the raw php code of over 2 mil lines to debug with.
I have been using VS code for the editor and MAMP as a live server.
I have no idea where to start, and I have not been able to find any useful tutorials online. Any help is greatly appreciated. I could really just use some guidance on how this process might work. Or if it even is something that people do, ever. It looks like according to the internet, this may not be the way to go about debugging. Feel free to ask questions I'll try to answer anything I can without giving away any confidential info.
Here are the bugs that show up on the site from WP_Debug:
Warning: preg_match(): No ending delimiter '*' found in C:\repos\website\wp-content\mu-plugins\no-cache.php on line 8
Warning: preg_match(): Empty regular expression in C:\repos\website\wp-content\mu-plugins\no-cache.php on line 8
Notice: Trying to get property 'Location' of non-object in C:\repos\website\wp-content\themes\Child-Theme\functions.php on line 45
Notice: Trying to get property 'Subrole' of non-object in C:\repos\website\wp-content\themes\Child-Theme\functions.php on line 46
Update: I am still having issues with these same errors. I am looking for assistance on how the process of debugging raw WP php code works, and if I am trying the right things. I can provide the code that a few errors are pointing to, but I do have to adjust the variables to maintain confidentiality.
\Child-Theme\functions.php (35-50):
if(class_exists(\RoleList\RoleList::class)) {
wp_localize_script('site-name', 'SiteName', [
'RoleList' => [
'categories' => $role_categories,
'locations' => \RoleList\Categories::getLocations(),
'category_counts' => \RoleList\Listings::getCategoryCounts(),
],
'CurrentRole' => [
'is_role_page' => ($listing ? true : false),
'current_category' => ($current_category ? $current_category : null),
'current_location' => ($listing->Location ? $listing->Location : null),
'current_subrole' => ($listing->Subrole ? $listing->Subrole : null),
'home_url' => home_url(),
]
]);
}
I'm encountering a strange error in CakePHP and I have no idea how to figure out what is going on.
I am using a Ajax request to load dynamic data for a dataTable and it works perfectly on my localhost. For some reason I can't get it to work on my live server when I have more than a few entries.
After debugging I found that it's the find function that is not working. When I have more than a few entries in my response array than one of the arrays('SollProject') is just simply completely empty and the whole script stops working.
Here is my Code:
$project = $this->Project->find("first", array('conditions'=>array('id'=>$project_id) ,
'contain' => array(
'SollProject' => array(
'conditions'=> array(
'SollProject.date >=' => $year.'-01-01',
'SollProject.date <=' => $year.'-12-31'
)
),
'HabenProject'=> array(
'conditions'=> array(
'HabenProject.date >=' => $year.'-01-01',
'HabenProject.date <=' => $year.'-12-31'
)
))));
Any idea what I am doing wrong here or why it is not working on the live server? There is no afterFind method in case you were wondering.
Maybe I should mention that I tried error debugging already and I don't get any error messages. I also tried the same sql code on my sql server and it works perfectly. There is also no memory issues since the memory I'm using is way beyound what I'm usually using and it's only a json response.
The function itself also works for small entries (not more than maybe 5 entries) but as soon as I have a little bit more entries in the database it just crashes.
The interesting thing is that I can debug($project['HabenProject']) and it shows me all HabenProject but if I try debug($project['SollProject']) or just debug($project) the variable is just empty. It's not even declared as array. There is just no output. The rest of the page is still showing.
Basic debugging steps:
Set debug to 2
Check your CakePHP apps logs
Check the php logs
Check the webserver logs
However, I guess it's a memory limit and debug is off, that's probably why you get a white page. Check the memory usage and increase the php memory limit.
Ok, after lots of debugging it looks like I found the problem:
For some reason every entry with an Umlaut (äüö) in the database produced an error that caused the result array of the find function to not work anymore.
Turns out the problem was the live server database utf-8 encryption was commented off...
I want to create a test which will directly post data to a Laravel page to test it handling bad data.
I can run an acceptance test starting at the page with the form on, call $I->click('Search'); and the page processes the data as expected.
Reading the introduction to Functional Tests on the Codeception website, it states
In simple terms we set $_REQUEST, $_GET and $_POST variables, then we execute your script inside a test, we receive output, and then we test it.
This sounds ideal, set an array of POST data and fire it directly at the processing page. But I can't find any documentation for it. I've played with sendAjaxPostRequest but it's not passing anything to $_POST.
Is there a way I can test the pages in isolation like this?
Turns out the solution lies with the Codeception REST module.
Adding this to the functional.suite.yml file allows you to write:
$I = new TestGuy($scenario);
$I->wantTo('check a page is resistant to POST injection');
$I->sendPOST(
'search',
array(
'startDate' => '2013-07-03',
'endDate' => '2013-07-10',
'exec' => 'some dodgy commands',
));
$I->see('Search results');
$I->dontSee('Dodgy command executed');
A little clunky, but it allows testing of a single page.
From the manual # http://codeception.com/docs/04-AcceptanceTests
$I->submitForm('#update_form', array('user' => array(
'name' => 'Miles',
'email' => 'Davis',
'gender' => 'm'
)));
I am developing activecollab custom module; facing an issue related to Routers.
I by mistake type wrong action name in Router's action where we need to define in router, but after getting error I updated that action name but activecollabs still reading a previous action i removed files from cache and complie folders but reading previous action.
please share if you ever face this problem in development of activecollab module..
By mistake I did this: (action=>'views')
Router::map('mymodule_view', 'mymodule/view/:request_id', array('controller' => 'mymodule', 'action' => 'views' ), array('req_id' => Router::MATCH_ID) );
but after getting error i update above code by this: (action=>'views')
Router::map('mymodule_view', 'mymodule/view/:request_id', array('controller' => 'mymodule', 'action' => 'view' ), array('req_id' => Router::MATCH_ID) );
First, make sure that your system is in development mode. Open config/config.php and confirm that APPLICATION_MODE is set to in_development:
define('APPLICATION_MODE', 'in_development');
Now that you have that covered, go to activeCollab and you'll have Developer toolbar available in the lower right corner of the application interface, next to activeCollab powered button (it has a red bug icon). Use this tool to clear cache, rebuild images etc.
PS: You can also clear all files from /cache folder, just in case.
I'm trying to create a cookie with codeigniter for like 2 days -.- (I was to ashame to ask the question before...)
Anyone care to explain me what is wrong with this code:
$websiteUrl = preg_replace("/^[\w]{2,6}:\/\/([\w\d\.\-]+).*$/","$1", base_url());
$this->load->helper('cookie');
$cookie = array(
'name' => 'rememberMe',
'value' => $this->encrypt->encode(serialize($serialize)),
'expire' => (time() + $this->config->item('remember_me')),
'domain' => '.'.$websiteUrl,
'path' => '/',
'prefix' => 'chv_',
'secure' => false,
);
set_cookie($cookie);
$this->input->set_cookie($cookie)
($this is CI instance)
Docs: http://codeigniter.com/user_guide/helpers/cookie_helper.html
Make sure $this->config->item('remember_me') > 0
I was working with CI many times and i was always using native setcookie() function, because i really don't need any framework to set cookie (it's simple operation)... But according to documentation using CI instance and input CI->input->set_cookie() should do the job. Remember NO FRAMEWORK is 100% perfect working... It's only framework... You can debug step-by-step CI code to see what happens.
(from comment)
Make sure that there is no extra whitespace being loaded before you are running set_cookie that is preventing the cookie header from being sent to the browser. I have spent many an hour tracking down that issue and found i had an extra space at the end of a closing tag somewhere. If you turn E_WARNING on, this should reveal the issue.