In php.ini, my error display settings are as follows:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
display_errors = Off
which works for any normally called file, however, if a file is called using jQuery/AJAX, I receive errors such as:
Strict Standards: Non-static method XML_Util::replaceEntities() should not be called statically, assuming $this from incompatible context in /usr/lib/php/XML/Util.php on line 664
Strict Standards: Non-static method XML_Util::createTagFromArray() should not be called statically, assuming $this from incompatible context in /home/site/public_html/site/paypal/lib/Serializer/Serializer.php on line 1231
Strict Standards: Non-static method XML_Util::attributesToString() should not be called statically, assuming $this from incompatible context in /usr/lib/php/XML/Util.php on line 652
As can be assumed, this is breaking parts of my website, how can I fix this?
I am running PHP 5.4.10
The files are being called using Jquery functions: $.get or $.post
The code/library you are using is triggering a Strict Standards error/notice/warning.
The related error-reporting constant for it is called E_STRICTDocs which was introduced in PHP 5.0Docs.
Since PHP 5.4 E_STRICT is part of E_ALL, so it has to be removed from it as well if you configure the way you do:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
^^^^^^^^^^^
So if you exclude E_STRICT from your production error settings, these Strict Standards errors should not be logged any longer - which would be probably like you would have had it with your earlier PHP 5.3 version.
Additionally you should contact the vendor of the library and request to make the code E_STRICT compatible. This is good practice and also shows you that some code has a certain quality.
For your development you should equally make your code E_STRICT compatible, fixing any place that is causing a Strict Standards error.
Same applies to E_NOTICE and E_DEPRECATED, you should enable these messages in your development environment and fix all the reported problems. This saves you from getting more and more bugs too easily.
From the php.ini:
;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.
...
; error_reporting
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
The reason why you see the error messages outputted instead of logged is not clear from the information you provide in your question. This can have multiple reasons,
most straight forward because you have not properly disabled display of errors - or enabled it again in the runtime (that setting can be changed from within PHP code, too).
error display is disabled but there is some error handlerDocs that is displaying them anyway.
So apart from the error level setting, this part of your question requires more trouble-shooting on your end to find out why the error messages are being displayed.
See Also:
How to disable E_STRICT (17 May 2010; by rtacconi)
Error Reporting - PHP The Right Way
Related
After implementing the answer to this question on how to set up a script for time visualization in this project (which uses a small extension to the published Log::Timeline that allows me to set the logging file from the program itself), I still get the same error
12:18 Timeline connection error: Could not get timeline data: java.net.ConnectException: Conexión rehusada
(which means refused connection). I've also checked the created files, and they are empty, they don't receive anything. I'm using this to log:
class Events does Log::Timeline::Event['ConcurrentEA', 'App', 'Log'] { }
(as per the README.md file). It's probably the case that there's no such thing as a default implementation, as shown in the tests, but, in that case, what would be the correct way of making it print to the file and also connect to the timeline visualizer?
If you want to use the timeline visualization, leave the defaults for logging, commenting out any modification of the standard logging output. In my case:
#BEGIN {
# PROCESS::<$LOG-TIMELINE-OUTPUT>
# = Log::Timeline::Output::JSONLines.new(
# path => log-file
# )
#}
Not really sure if this would have happened if an output file is defined using an environment variable, but in any case, better to be on the safe side. You can use the output file when you eventually drop the script into production.
I'm trying to understand the mechanism Yocto provides to enable/disable a particular bbappend for a specific MACHINE. I read this link (Modifying Variables to Support a Different Machine):
https://www.yoctoproject.org/docs/1.5/dev-manual/dev-manual.html#best-practices-to-follow-when-creating-layers
And also found some information related here on stack overflow:
Machine specific layers in yocto
I have tried putting all this information into practice without any success. This is my particular problem:
A BSP layer for an "x" platform provides a qtbase_%.bbappend that modifies qtbase recipe from meta-qt5. I need this qtbase_%.bbappend only applying when building for MACHINE="x", but not for other different machines.
This is the content of the original qtbase_%.bbappend defined on the x-bsp-layer:
PACKAGECONFIG_GL = "gles2"
PACKAGECONFIG_FONTS = "fontconfig"
PACKAGECONFIG_APPEND = " \
${#bb.utils.contains("DISTRO_FEATURES", "wayland", "xkbcommon-evdev", \
bb.utils.contains("DISTRO_FEATURES", "x11", " ", "libinput eglfs gbm", d), d)} \
"
PACKAGECONFIG_append = " ${PACKAGECONFIG_APPEND} kms accessibility sm"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
PACKAGECONFIG_remove = "evdev"
Whenever I try to build an image for a MACHINE different from "x", the compilation is broken:
| ERROR: Feature 'opengles2' was enabled, but the pre-condition 'config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)' failed.
| ERROR: Feature 'eglfs' was enabled, but the pre-condition '!config.android && !config.darwin && !config.win32 && features.egl' failed.
| ERROR: Feature 'gbm' was enabled, but the pre-condition 'libs.gbm' failed.
Removing the x-BSP-layer from bblayers.conf solves the problem, but that's not the kind of solution I am looking for.
I tried fixing this using information provided in previous links. I modified qtbase_%.bbappend recipe in this way:
PACKAGECONFIG_GL_x = "gles2"
PACKAGECONFIG_FONTS_x = "fontconfig"
PACKAGECONFIG_APPEND_x = " \
${#bb.utils.contains("DISTRO_FEATURES", "wayland", "xkbcommon-evdev", \
bb.utils.contains("DISTRO_FEATURES", "x11", " ", "libinput eglfs gbm", d), d)} \
"
PACKAGECONFIG_append_x = " ${PACKAGECONFIG_APPEND} kms accessibility sm"
FILESEXTRAPATHS_prepend_x := "${THISDIR}/${PN}:"
PACKAGECONFIG_remove_x = "evdev"
As you can see, I appended the "_x" suffix to all recipe variables. It's supposed (at least that it's what I understand) those "_x" make the variable being assigned just in case the PLATFORM="x" is defined. Right? But it doesn't work as expected, it generates the same problem. So, in practice, this means I don't understand even the basics of this mechanism.
Can some of you provide a good explanation for this? I think it should be helpful for others with the same issue out there. Thanks a lot for your time! :-)
Just add COMPATIBLE_MACHINE = "x" in .bbappend file.
As you can see, I appended "_x" suffix to all recipe variables
Remove all "_x" suffix in .bbappend file.
Note adding COMPATIBLE_MACHINE as suggested would change the signatures of the original recipe, which is bad practice, and would result in your layer failing the compatibility test carried out by the yocto-check-layer script. Consult this for details.
The correct way of making a .bbappend file machine-specific is through overrides, as you're already doing in your proposal. Why it still fails is a different question. I suggest you to inspect the variables of the recipe through bitbake, and switch machines to verify they change accordingly.
I get this error in my log files every time a cache file doesn't exist it seems. On the first page load, I always get this error
[message] => filemtime(): stat failed for [...]/runtime/cache/my/myapp03eab921185f7b68bbca50d8debc0dda.bin
[file] => [...]/vendor/yiisoft/yii2/caching/FileCache.php
[line] => 113
It doesn't happen anymore on next page loads but that one time is really annoying since the slack bot watcher is spamming our channel with this useless warning. Is there a way to avoid that, or is it a permission problem?
The "runtime", "cache" and "my" folders all have 775.
Update
Turns out the issue is that I'm using error_get_last() that is also getting warning-level errors. So it's a different issue entirely, not Yii-related
Make sure that you don't have enabled scream in your php.ini. Warnings from this filemtime() call should be suppressed by # operator, but scream setting can override this operator and generate warning anyway.
if (#filemtime($cacheFile) > time()) {
// ...
}
You must be getting this in PHP 7.1. try to run this with PHP 5.5 and see if you are getting the same error.
To reproduce you need to delete all files from runtime/cache directory
Then start app again(reload page) and look into runtime/cache. It is empty
Yii2 doesn't make cache again
Got same issue in Yii. The error was on the same string (FileCache.php:113)
if (#filemtime($cacheFile) > time()) {...
In my case reason was that my custom php error handler (heir
of the class yii\base\ErrorHandler) didn't check if
error type need to be handled according error_reporting().
Custom handlers allways gets every error, even muted by Error Control operator (#)
https://www.php.net/manual/en/function.set-error-handler.php
error_reporting() settings will have no effect and your error handler will be called regardless
I get the following error:
Keen.delete(:iron_worker_analytics, filters: [{:property_name => 'start_time', :operator => 'eq', :property_value => '0001-01-01T00:00:00Z'}])
Keen::ConfigurationError: Keen IO Exception: Project ID must be set
However, when I set the value, I get the following:
warning: already initialized constant KEEN_PROJECT_ID
iron.io/env.rb:36: warning: previous definition of KEEN_PROJECT_ID was here
Keen works fine when I run the app and load the values from a env.rb file but from the console I cannot get past this.
I am using the ruby gem.
I figured it out. The documentation is confusing. Per the documentation:
https://github.com/keenlabs/keen-gem
The recommended way to set keys is via the environment. The keys you
can set are KEEN_PROJECT_ID, KEEN_WRITE_KEY, KEEN_READ_KEY and
KEEN_MASTER_KEY. You only need to specify the keys that correspond to
the API calls you'll be performing. If you're using foreman, add this
to your .env file:
KEEN_PROJECT_ID=aaaaaaaaaaaaaaa
KEEN_MASTER_KEY=xxxxxxxxxxxxxxx
KEEN_WRITE_KEY=yyyyyyyyyyyyyyy KEEN_READ_KEY=zzzzzzzzzzzzzzz If not,
make a script to export the variables into your shell or put it before
the command you use to start your server.
But I had to set it explicitly as Keen.project_id after doing a Keen.methods.
It's sort of confusing since from the docs, I assumed I just need to set the variables. Maybe I am misunderstanding the docs but it was confusing at least to me.
My struts 2 (2.3.1) application at debug mode for url http://localhost/app/check.action?13239 raises such kind of exceptions
2011-12-15 14:45:06,455 DEBUG [CommonsLogger.java:68] : Setting static parameters {}
2011-12-15 14:45:06,456 DEBUG [CommonsLogger.java:68] : Setting params NONE
2011-12-15 14:45:06,456 DEBUG [CommonsLogger.java:68] : Setting params 13239 => [ ]
2011-12-15 14:45:06,461 WARN [CommonsLogger.java:60] : Error setting expression '13239' with value '[Ljava.lang.String;#33b4450e'
ognl.InappropriateExpressionException: Inappropriate OGNL expression: 13239
at ognl.SimpleNode.setValueBody(SimpleNode.java:312)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301)
I was expecting silently ignoring them according to documentation. What is the correct way to fix this problem?
By the way it seems that struts looking for a setter field for the value 13239 however I guess that it is not suitable for a property which is started by a number.
That is more or less a issue of your personal taste.Sometime we wants to know any time a parameter is submitted that doesn't have a matching getter/setter on the action and its a common use case in development our application and we forget a getter/setter on an action, we want to know about any possible error case.
One possible way to is setting the logging level differently from dev to production.There was a long discussion about this on Struts2 mailing list here is the link for same
OgnlValueStack Error setting expression warnings after upgrade from struts 2 to struts 2.1.7