Skip to main content

php strict warnings | Drupal Groups

php strict warnings | Drupal Groups:

Thanks, forcing 5.2 worked.

Disabling warnings from php strict in Drupal

DarrellDuane's picture
I'm well aware that hacking core is frowned upon, but sometimes ya gotta do what ya gotta do. Running drupal 6 with views 2.x using PHP 5.4 (Fedora 17 in this case) yields a number of strict warnings that are not easily turned off. PHP doesn't allow you to turn off these strict warnings in its php.ini file, they come through even if E_STRICT is disabled, see
http://stackoverflow.com/questions/4692999/e-strict-messages-thrown-thou... for more details.
In order to fix this, I have edited includes/bootstrap.inc and put the following at the beginning of function drupal_set_message starting after line 991:
// filter out strict warnings due to conflicts between views-2.x and PHP 5.4
if( !strncmp($message, 'strict warning:', 14) ) {
return isset($_SESSION['messages']) ? $_SESSION['messages'] : NULL;
}
There may be other messages that come through that you want to filter in this manner as well.
If there is a hook that can be used to filter drupal messages or a cleaner way to do this by adding a module instead of hacking core I'd love to hear about it.
Post a Comment

Popular posts from this blog

Viterbi Algorithm in C++ and using STL

To practice my C++ and STL skills, I implemented the Viterbi algorithm example from the Wikipedia page: http://en.wikipedia.org/wiki/Viterbi_algorithm. The original algorithm was implemented in Python. I reimplemented the example in C++ and I used STL (mainly vector and map classes).  This code is in public-domain. So, use it as you want. 
The complete solution for MS Visual C++ 2008 can be found at http://filip.jurcicek.googlepages.com/ViterbiSTL.rar

// ViterbiSTL.cpp : is an C++ and STL implementatiton of the Wikipedia example // Wikipedia: http://en.wikipedia.org/wiki/Viterbi_algorithm#A_concrete_example
// It as accurate implementation as it was possible

#include "stdafx.h"
#include "string" #include "vector" #include "map" #include "iostream"
using namespace std;
//states = ('Rainy', 'Sunny') //  //observations = ('walk', 'shop', 'clean') //  //start_probability = {'Rainy': 0.6, 'Sunny': 0.…

Temporal-Difference Learning Policy Evaluation in Python

In the code bellow, is an example of policy evaluation for very simple task. Example is taken from the book: "Reinforcement Learning: An Introduction, Surto and Barto".
#!/usr/local/bin/python

"""
This is an example of policy evaluation for a random walk policy.

Example 6.2: Random Walk from the book:
"Reinforcement Learning: An Introduction, Surto and Barto"

The policy is evaluated by dynamic programing and TD(0).

In this example, the policy can start in five states 1, 2, 3, 4, 5 and end in
two states 0 and 6. The allowed transitions between the states are as follwes:

0 <-> 1 <-> 2 <-> 3 <-> 4 <-> 5 <-> 6

The reward for ending in the state 6 is 1.
The reward for ending in the state 0 is 0.

In any state, except the final states, you can take two actions: 'left' and 'right'.
In the final states the policy and episodes end.

Because this example implements the random walk policy then both actions can be
taken with th…

how the make HCL and G graphs, and on the fly compositon of HCL and G for KALDI

Well, I had again to do something ;-) The task is to generate/create/update a decoding graph for KALDI on the fly. In my case, I aim at changing a G (grammar) in the context of a dialogue system.

One can generate a new HCLG but this would take a lot of time as this involves FST determinization, epsilon-removal, minimization, etc. Therefore, I tried to use on-the-fly composition of statically prepared HCL and G. At first, I struggled with it but later I made it work. See https://github.com/jpuigcerver/kaldi-decoders/issues/1

Here is a short summary:

At the end, I managed to get LabelLookAheadMatcher to work. It is mostly based on the code and examples in opendcd, e.g. https://github.com/opendcd/opendcd/blob/master/script/makegraphotf.sh.

First, Here is how I build and prepare the HCL and G. Please not that OpenFST must be compiled with --enable-lookahead-fsts, see http://www.openfst.org/twiki/bin/view/FST/ReadMe.

#--------------- fstdeterminize ${lang}/L_disambig.fst | fstarcsort >…