PHP deprecated warnings on Drupal pages despite turning them off in php.ini - drupal-6

I have PHP deprecated errors flooding log files and Drupal status pages like this:
: Function ereg() is deprecated in mysite/includes/file.inc on line 893.
I should be able to turn off E_DEPRECATED errors in my php.ini, but it is having no effect despite being set to:
error_reporting = E_ALL & ~E_DEPRECATED
phpInfo() reports error_reporting master value and local value both 22527.
I did a
grep -R error_reporting
in my document root in the hopes of finding any hard coded error levels and no luck:
./includes/common.inc: // If the # error suppression operator was used, error_reporting will have
./includes/common.inc: if (error_reporting() == 0) {
./modules/system/system.module: 'page arguments' => array('system_error_reporting_settings'),
./modules/system/system.admin.inc:function system_error_reporting_settings() {
./modules/system/system.install: $err = error_reporting(0);
./modules/system/system.install: error_reporting($err);
Nothing that I can see that is supect except possibly the first line in system.install but if I'm right that should turn all errors OFF.
I'm not setting error_reporting in .htaccess, but doing that does not have any effect either.
I'm hoping that there is a solution that doesn't involve hard coding error levels in common.inc (which DOES work, I've tried - but obviously undesirable).
I know the deprecated errors are a result of upgrading to PHP 5.3, but downgrading PHP is not option (new sites are going live now on the same server that have been tested on 5.3, and the sites where these errors occur have 2 months to live). I also cannot upgrade to Drupal versions that play nicely with 5.3 as unfortunately the previous owner haxxed the core modules without documenting his changes.
Version stuff:
PHP 5.3.2-1, Ubuntu 10.04, Drupal 6.13 on one site, 6.5 (!!1!) on the other, Apache 2.2

Did you try editing index.php to be
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

I have used this on my php.ini file and could hide those deprecated errors. Hope it helps you! =)
error_reporting = E_ALL & ~E_DEPRECATED & -E_WARNING

I don't know about disabling error reporting but you can replace all ereg functions by preg_match..!

Related

Whoops! We seem to have hit a snag. Please try again later

Whoops! We seem to have hit a snag. Please try again later.
Codeigniter 4 shows an error when I run the CI4 application, How I resolve?
Changes:
public $baseURL = 'http://ci.local';
public $baseURL = 'http://localhost:8080';
public $indexPage = '';
This work for me try it
Go to app directory then to boot directory you will see production.php file.
That is:
app => Config => Boot => production.php
Change the ini_set('display_errors', '0') to ini_set('display_errors', '1').
Warning: When in production change back to initial ini_set('display_errors', '0')
Or
you can rename your file env in your project directory to .env after that open it and edit.
Search for # CI_ENVIRONMENT = production remove # and change production to development
Warning: When in production change back to initial CI_ENVIRONMENT = development to CI_ENVIRONMENT = production
For those experiencing intl error go to where your php installation directory edit the php.ini file remove semi-colon ";" from ;extension=intl to extension=intl. save the file and restart your server. I think this will solve that error. This particular editing of my php.ini was on php 7.2 - 8.1 so I haven't check other version of php lesser than these versions which Codeigniter 4 does not support
After installing CodeIgniter 4 when you run the app then you will get an error like this
To know the error go to the app/Config/Boot/production.php and set display_errors to 1 as below
ini_set('display_errors', '1');
Now, you will see the actual error below
Nothing to worry about it. The app needs permission. Assign the permission like as below
sudo chmod -R 777 project_name
Assume that your root folder of your CI4 project is rootproject.
Edit rootproject/.env file.
On line 17 change from:
# CI_ENVIRONMENT = production
to:
CI_ENVIRONMENT = development
Save it.
Refresh your browser that pointing to your CI4 project.
It should give you many error messages.
If there is something written as CacheException, than your cache folders are not writable.
Make it writable;
Ubuntu:
chown -Rv www-data rootproject/writable
CentOS:
chown -Rv apache rootproject/writable
Easy way:
chmod 777 -Rv rootproject/writable
In your CI4 project root, create a file named .env. It should be in the same directory as system, app e.t.c
Then, add this CI_ENVIRONMENT = development
The problem is most likely due to missing extensions. Check server requirements here.. Check your php.ini file and make sure intl and mbstring are enabled.
I had the same problem, I have a simple solution for Mac.
- in the project folder, go to 'writable'
- select all the folders contained and click on 'get information'
- go share and permissions
- in 'everyone' select 'read and write'
That's it! refresh the page
Try This
Open [xampp]/php/php.ini
Search for ;extension=intl and remove the ;
Save the php.ini file and restart Apache(server).
In Root folder change: env to .env
Change # CI_ENVIRONMENT = production to CI_ENVIRONMENT = development (ensure it is uncommented)
Your error may be related to the knit.php file.
Go to System/Third Party and change: knit.php to Knit.php (Capital)
Reload.
For those using XAMPP in MacOS:
You don't need to change the ownership of the writable directory. You only need to change permission to entire directory:
chmod -R 777 writable
When you change # CI_ENVIRONMENT = production to CI_ENVIRONMENT = development don't forget of rename the env file to .env else it will not work.
You're running in the production environment and need to change it to a Development or Testing environment to see the error messages within the browser.
There are a few ways to do this, but adding:
SetEnv CI_ENVIRONMENT development
To the Apache httpd.config file is what worked for me.
_t
I got the answer for this query; just follow these steps:
From the command line, at your project root just hit this
php spark serve
Then hit this on your browser http://localhost:8080/
Enjoy your Latest CI.
Not sure what the desired answer is, but:
If you are asking to see what is the actual error is - either change
your environment to testing/development (as suggested so far) or you
can check your logs - writable/logs/log-.php
If you wish to solve the error, we will need more information, like have
you setup virtual hosts, have you change .htaccess file in public
folder, etc. Otherwise we will be most likely betting (I bet it's virtual hosts).
In any case, a copy of the displayed error (after changing evnironment) or log file will be useful.
You can check logs file on writable/logs find error information,
If your logs information like :
CRITICAL - 2020-04-19 17:44:55 --> Invalid file: template/header.php
#0 F:\xampp\htdocs\ppdb\vendor\codeigniter4\framework\system\View\View.php(224): CodeIgniter\Exceptions\FrameworkException::forInvalidFile('template/header...')
And go fix your error, in my case i am wrong typed name on controller file
In Codeigniter 4 source code have a folder named writable, just update it's access permission. Sometimes it'll help to get rid of Whoops. Also can check the video for Ubuntu / Linux

invalid SSL_version specified at /usr/local/share/perl5/IO/Socket/SSL.pm line 598

When I try send an email using Net::SMTP::TLS from perl script I am getting below:
invalid SSL_version specified at /usr/local/share/perl5/IO/Socket/SSL.pm line 598
OS:Linux
You know what the problem is and what I have to do to fix it?
Thank you!
Net::SMTP::TLS is not maintained since 10 years and it is broken in that it causes exactly the error you describe. If you insist of using this broken module you need to fix it. Change the code in line 182 to remove the invalid setting of SSL_version:
if(not IO::Socket::SSL::socket_to_SSL($me->{sock},
- SSL_version => "SSLv3 TLSv1")){
+ )){
croak "Couldn't start TLS: ".IO::Socket::SSL::errstr."\n";
}
Instead of using the broken and unmaintained Net::SMTP::TLS or its successor but again unmaintained Net::SMTP::TLS::ButMaintained I suggest you use the latest version of Net::SMTP which has built in support for both kinds of SMTP+SSL and for IPv6 too. It comes already by default with newer Perl versions.
If using a new Net::SMTP is not possible you might use Net::SSLGlue::SMTP which monkey patches older Net::SMTP version to add SSL support. And there is also Net::SMTPS which provides a similar functionality.
Let me summarize as I had just fixed my problem (Thanks to the contributors above)
Open [Perl_dir]/site/lib/Net/SMTP/TLS.pm
Look for line 182, which looks like
if(not IO::Socket::SSL::socket_to_SSL($me->{sock}, SSL_version=>"SSLv3 TLSv1")){
Changed to line below by removing "SSL_version=>"SSLv3 TLSv1"
if(not IO::Socket::SSL::socket_to_SSL($me->{sock})){
Save [Perl_dir]/site/lib/Net/SMTP/TLS.pm
Other ref URL:
http://www.pclinuxos.com/forum/index.php/topic,143156.msg1223280.html#msg1223280

How to enable Felix framework security feature in Karaf?

all.
I am trying to enable Felix framework security features on Apache Karaf(version 3.0 +),
but I could not find any official (or even unofficial) instructions on doing this.
The system.properties file (in Karaf/etc folder), in fact, contains following contents.
#
# Security properties
#
# To enable OSGi security, uncomment the properties below,
# install the framework-security feature and restart.
#
java.security.policy=${karaf.etc}/all.policy
org.osgi.framework.security=osgi
org.osgi.framework.trust.repositories=${karaf.etc}/trustStore.ks
When I uncomment those two properties and execute Karaf,
it gives the following error message:
Exception in thread "CM Configuration Updater" java.security.AccessControlException: access denied ("org.osgi.framework.AdaptPermission" "org.osgi.framework.wiring.BundleRevision" "adapt")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
at java.security.AccessController.checkPermission(AccessController.java:559)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at org.apache.felix.framework.BundleImpl.checkAdapt(BundleImpl.java:1058)
at org.apache.felix.framework.BundleImpl.adapt(BundleImpl.java:1066)
In all.policy file, it looks like it is giving all the permissions required to all components:
grant {
permission java.security.AllPermission;
};
I've done some googling to find anyone else ran into this issue,
and I found this one: https://issues.apache.org/jira/browse/KARAF-3400
It says this issue actually arises due to a bug.
Is it really a bug or some minor configuration error?
Is there anyone succeeded in enabling felix security on Karaf version 3.0+?

Does Firefox disable plugins that failed to initialize?

I am trying to test a Mozilla plugin (developed using FireBreath) in the form of an .so shared object file. The plugin was developed on Ubuntu, where it works fine.
I am now trying it under OpenSUSE - so I first symlinked the .so file in ~/.mozilla/plugins:
> ln -s /path/to/npXXX.so ~/.mozilla/plugins/
... and then ran Firefox (7) from command line:
> /path/to/firefox -P myprofile
...
LoadPlugin: failed to initialize shared library libXext.so [libXext.so: cannot open shared object file: No such file or directory]
LoadPlugin: failed to initialize shared library /path/to/npXXX.so [/path/to/npXXX.so: undefined symbol: gtk_widget_get_mapped]
# and the LoadPlugin messages do NOT show a second time - probably because plugin is disabled (via about:addons).
And so I thought to try different stuff to look into this - but first, I restarted Firefox, and realized that on the second run I do not get the "LoadPlugin: failed to initialize" messages anymore! Then I tried removing the plugins symlink, and restarting FF; and adding it again, and restarting FF - still no error messages!
So, this tells me that probably Firefox somehow disabled/blacklisted the plugin (but which one: libXext, npXXX or both?) , but searching (grepping) for (np)XXX in '/path/to/myprofile/blocklist.xml' returns nothing (the plugin should use a email-like id, not those number GUIDs, so I'd expect that string to show in blocklist.xml if it's there).
Does anyone know: is the default behavior of Firefox to disable/blocklist plugins, that fail to load at first? If so, is there a way to force Firefox to load them again (and spit out error messages)? If you'd also have links to where this behavior is documented, it will be much appreciated :)
Many thanks in advance for any answers,
Cheers!
Note: after I stopped seeing the error messages, I did the following:
I am trying "about:plugins": "No enabled plugins found";
then trying "about:addons", and clicking under Plugins: "You don't have any add-ons of this type installed";
This plugin is not embedded in an extension, so nothing new should be added in "about:addons" under "Extensions" - and as expected, nothing new shows there. Under Ubuntu (where all works), just by symlinking the plugin to ~/.mozilla/plugins, the above two locations/screens start showing the plugin info.
This one of the things that puzzle me - if it just showed the plugin as "disabled", maybe I would have had a chance to re-enable it again (to get a new batch of error messages) - however, "about:plugins" and "about:addons" simply show nothing - so there's nothing I can use to enable from there. Which tells me Firefox has used a different method to disable the plugin(s) - but I cannot tell what it is...
Firefox has a cache for XPCOM modules ("fastload cache"), if a module fails to load Firefox won't try again. The cache is reset automatically if an extension is installed or if the application is updated. Starting with Firefox 4 you can also use -purgecaches command line flag to discard the cache.

PHPUnit + Kohana: Undefined index: HTTP_HOST

Trying to run PHPUnit on my Kohana 2.3.4 install:
phpunit --colors --bootstrap=index.php ../../modules/phpunit/libraries/Tests.php
Getting an error at one of my modules:
<p><tt>modules/core/helpers/MY_url.php <strong>[118]:</strong></tt></p>
<p><code class="block">Undefined index: HTTP_HOST</code></p>
I realize this is happening since I'm going via command line so HTTP_HOST won't be set. Is there any way around this without rewriting HTTP_HOST in that module? I know I could rewrite it to be exec(hostname), but am trying to avoid rewriting every instance of HTTP_HOST in my code.
Any workaround you can think of?
Quick and dirty way to fix it would be to set the value in the bootstrap if you're in cli mode.
The "better" way would be to set it in the test's setUp method
Is this $_SERVER['HTTP_HOST']?
If so, have a look at adding an xml config file and setting it in there:
https://phpunit.de/manual/current/en/appendixes.configuration.html
We actually decided to use a different bootstrap, load in variables there, then require the Kohana index file.
Works like a charm. Thanks, Matt, for getting me started down that path.

Resources