I am getting a warning after PHP update
Warning: Creating default object from empty value in /modules/mod_feed/helper.php on line 42
I had faced this issue before and at that time I have used $v=new stdclass();. But the issue was not in a Joomla site. Now the same issue with a joomla site. My code link is here
What I should change in this file? Any thoughts?
You also need
$feed->image = new stdclass;
before line 42. This is an E_STRICT level warning. These are designed to alert you to code smells (like auto-creating arrays / objects).
Related
When i code phalcon with phpstorm i have one particular error i cannot figure out how to resolve. I like to see the green check at the top of each page to indicate there are no issues but this error is preventing the green checkmark shown.
So this is what causes the error:
$this->persistent->parameters = null;
How can i alter that code to prevent the PHP Storm error:
Field accessed via magic method
I know its a bit picky but would love to solve this
Use #property PhpDoc construction. Example:
It's also gives autocomplete to magic properties. Always use all available inspections.
Uncheck "Notify about access to a field via magic method".
You can find this setting under Project Settings -> Inspections -> PHP -> Undefined -> Undefined field.
You can try to download the framework code from the devtoolos on Github and Include it in PHP Storm. You can either add it as library dependency or simple paste it in the file explorer of your project.
https://github.com/phalcon/phalcon-devtools/tree/master/ide/2.0.7/Phalcon
It should have all the required PHP Doc
I am using a code where code is in code.php and the user defined functions are stored in function.php.
The functions are called multiple times.
While executing the code in code.php - I got the following error message.
Warning: in_array() expects parameter 2 to be array, null given in C:\xampp\htdocs\SanskritVerb\function.php on line 1177
the line 1177 of function.php falls inside a user defined function 'ends'.
How can I know which line of code.php called this function 'ends' ?
I think some languages show error like - Error in line X of function.php called in line Y of code.php
If something of this sort exists for PHP - it would save my debug time.
For such a task you need to assign an error handler and call
Exception::getTrace()
to get trace of Exception. see the documentation set_error_handler.
Using xdebug extension for PHP can give you higher tracing capabilities even without error. If you choose xdebug you should enable tracing by adding lines to php.ini
xdebug.auto_trace=On
xdebug.trace_output_dir=c:\path
Anyway this is up to you.
I'm new to PyroCMS and I'm currently working on a news website which requires the blog functionality. In order not to have my urls displaying "blog" I duplicated the blog module and renamed it "posts" which worked fine.
But now when I view a post I get the following error at the top of the page:
"A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/newerawe/public_html/addons/default/themes/era/theme.php:1)
Filename: drivers/Session_cookie.php
Line Number: 701"
Because you didn't mention the most crucial information of all, what php and pyro version you are using .. i have to assume you are using PHP 5.4 the PyroCMS 2.2.
There is something sent before a header, PyroCMS had some problems with this kind of stuff, because PHP has gotten a bit more strict and is throwing several warnings if for example you are trying to create a variable out of thin air:
This will issues an warning saying that $text hasn't been defined, and that happens before the headers, which causes the problem.
// Warning: "Creating default object from empty value" errors
$text->string = 'My text is fine';
You nead you need to either find and fix the problems, which is a long shot:
$text = new stdClass();
$text->string = 'My text is fine';
or try exclude E_WARNING from error_reporting, and you should be fine.
error_reporting(E_ERROR | E_PARSE | E_NOTICE);
Hope that it helps!
Just started with new project and want to try ModX to use it for the project but get stuck on this error (it won't disappear) :
**Catchable fatal error: Argument 2 passed to modParser::collectElementTags() must be of the type array, null given, called in D:\Personal\illumation\modx\core\model\modx\modstaticresource.class.php on line 57 and defined in D:\Personal\illumation\modx\core\model\modx\modparser.class.php on line 101**
It went wrong at the moment I want to try to write a plugin so i created a new plugin in the Manager in an external file called webit-core-plugin.php. Add one event to it and save it. After this, the error described above appear.
Tried to remove it, do it again etc, nothing helps. Does anybody know what is going on?
I use the latest XAMPP, latest SQL/PHP and lastest ModX running on localhost (windows 7) with adminstrator privileges.
Clear Cache folder manually by deleting it through file browser
Open your SQL client, check your elements (templates - *modx_site_templates*, chunks - *modx_site_htmlsnippets*, snippets - *modx_site_snippets*, and plugins - *modx_site_plugins*) that have "static" field = 1, but have "static_file" empty.
My first time posting, I'm hoping someone could help me with this error that has appeared on my website as of Wednesday, I'm not sure how to correct it since I've never touched the .php file.
If I could get some help, I would be really appreciative of it.
The website with error, located at the top of the page.
The error is:
Warning: Creating default object from empty value in whitelight/functions/admin-hooks.php on line 160
Here is the code from lines 150 -170
This probably means that your host has upgraded the server to php 5.4.x. Please reference this page on how to solve the issue: PHP 5.4: disable warning "Creating default object from empty value"
In summary, You either need have your own error handler or if this is the only place that it occurs then you just need to make it a stdClass before making it an array like so:
} // End IF Statement
if ( !is_object( $query_context ) ) {
$query_context = new stdClass();
}
$query_context->context = array();
It is also possible that upgrading wordpress and its plugins would solve the problem. I don't know much about that area though...
The following 2 lines should be added to admin-hooks.php just before the if statement on line 160:
$query_context = new stdClass();
$query_context->context = array();
Insert this at the beginning of whitelight/functions/admin-hooks.php to disable warnings:
error_reporting(E_ERROR);
This is not really a fix but it should stop the error. Add it to your active themes functions.php
/* Stop errors if any /error_reporting(E_ERROR | E_PARSE);/ End stop Errors */
We have PHP v5.4.24 and users are seeing the same error when not logged-in on Wordpress v4.3.1 with Wootique theme v1.6.11. So i added this temp patch until a fix is available.
Added code below to suppress the error. Insert before 'if' statement in admin-hooks.php:
/* suppress error with this */
ini_set('display_errors', 0);
$query_context = new stdClass();
$query_context->context = array();