Why $this->Html not defined but $this->html in cakephp? - php

I am using CakePHP 2.X latest. Facing unique error.
This is error i am getting:
Warning (2): call_user_func_array() expects parameter 1 to be a valid
callback, first array member is not a valid class name or object
[CORE/Cake/Utility/ObjectCollection.php, line 132]
Warning (2): call_user_func_array() expects parameter 1 to be a valid
callback, first array member is not a valid class name or object
[CORE/Cake/Utility/ObjectCollection.php, line 132]
Fatal error: Call to a member function link() on a non-object in
/data/html/savaganza/app/View/Elements/header.ctp on line 21
I am simply using Html in my header element
Line 21: <?php echo $this->Html->link('Categories', array('controller'=>'categories') ); ?>
This Header element is calling from all views this is giving me error for some view, i don't know why but its working fine for some views.
Efforts:
When i change $this->Html to $this->html it works why???
When i tried var_dump($this->Html) it gives string(58)
"�H��.
Its working in my loacal server but not in live server.
Suggest me please.

May be this question link to Weird PHP error: 'Can't use function return value in write context'
Perfect Answer: Because empty is not a function but a language construct (not sure), and it only takes variable
but when i change this line:
$des = (!empty(html_entity_decode($c['Coupon']['description'])))?html_entity_decode($c['Coupon']['description']):'Not Avaliable';
to
$des = html_entity_decode($c['Coupon']['description']);
$des = (!empty($des)) ? $des : 'Not Avaliable';
It works i don't know exact reason. Hope somebody help me to understand this.

Related

Symfony2 initialize error

I have problem with my Symfony2 project. On the localhost it works fine, but on the server I got that error:
"Catchable Fatal Error: Argument 1 passed to
Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag::initialize()
must be of the type array, string given, called in
/home/visset/ftp/cms/dashboard/app/cache/dev/classes.php on line 252
and defined"
I checked it and to initialize() function passed empty string.
What is the reason of that problem?

function 'parent_theme_locations' not found or invalid function name

I am creating the child theme of twentythirteen. It works fine in localhost without any error but when I put live on the server I got the following error
Warning: call_user_func_array() expects parameter 1 to be a valid
callback, function 'parent_theme_locations' not found or invalid
function name in
/home/nonaitpub/public_html/subedi/wordpress/wp-includes/plugin.php on
line 496
I think you had called function 'parent_theme_locations' somewhere in your functions.php file.Like add_action('after_setup_theme','parent_theme_locations',20);

Fatal Error: Call to member function xpath to non-object AFTER uploading to provider

I'm trying to extract data from a tumblr XML-Feed and it works perfectly on my local MAMP-Server. However, having uploaded it to my provider's server I get the following error:
Fatal error: Call to a member function xpath() on a non-object in
/home/httpd/vhosts/anthronaut.net/subdomains/nico/httpdocs/scripts/tumblr.php
on line 19
Here's the part of the code in question:
$request_url = "http://nicolasblandin.tumblr.com/api/read";
$xml = simplexml_load_file($request_url);
$posts = $xml->xpath("/tumblr/posts/post");
My hunch is that the serverside settings need to be changed. I found one setting allow_url_fopenand set it to true, however with no success.
Any ideas would be greatly appreciated! Thanks
The problem seems to be that simplexml_load_file returns an array of type SimpleXMLElement. So, changing the third line of your code to
$posts = $xml[0]->xpath("/tumblr/posts/post");
seems to solve the issue. The real question is now: why does it actually work in the other case?

Fatal error: Call to a member function in product.php

I am new to opencart, so please help me.
I am using opencart version 1.5.6, now whenever I edit and delete the product it shows me
Fatal error: Call to a member function productUpdateListen() on a non-object in /home/crazepur/public_html/admin/controller/catalog/product.php on line 78
and
Fatal error: Call to a member function deleteProduct() on a non-object in /home/crazepur/public_html/admin/controller/catalog/product.php on line 133 respectively.
Although it edit and delete the product.
Please help me how to fix it.
Code in Line 78 $this->openbay->productUpdateListen($this->request->get['product_id'], $this->request->post);
And code in line 133 $this->openbay->deleteProduct($product_id);
This means $this->openbay is not an object which contains function productUpdateListen() & deleteProduct(), probably it's NULL or false in some cases (nothing found) due to it's not accessible. Out of scope.
Try
var_dump($this->openbay);
Check the O/P
it's simple and the error-message says it all: your $this->openbay doesn't have those methods (productUpdateListen() and deleteProduct()) - most likely it isn't an object at all.
please debug your code since it's impossible to say what's going wrong wich so little information. to start, do a var_dump($this->openbay); right before the function-calls and check the output.

Fatal error: Call to a member function assistance required

I have taken over a website to complete.
The website works fine.
for some reason I get the following error:
Fatal error: Call to a member function navigate() on a non-object in C:\xampp\htdocs\studio.php on line 224
This is the code for the page at line 224:
if(!empty($_GET['nav']))
{
$params = null;
$params['listOrder'] = 'id desc';
$$_GET['nav']->navigate($params); <<<This is line 224
}
Any assistance will be greatly appreciated.
$$_GET['nav'] refers to an object dynamically, this object is not instanciated at the point of calling navigate(), or the variable passed to $_GET['nav'] does not correspond to a defined variable.
My problem has been resolved. after a strenuous search I found a phantom piece of code that was where it should not have been. Thank you all for your assistance. The code was:
$user = $_SESSION['usr'];

Categories