Posts Tagged ‘php’

Zend_Form apply Zend_Filter to all form elements

By Mark Davidson on May 28th, 2010

So recently at work I have been doing a lot of work with the Zend Framework, but I was having some issues with magic_quotes_gpc
being turned on in the PHP configuration of the server. The easy thing to do would be to disable magic_quotes_gpc in the php.ini and that solves the issue. However this was not an option in my case, as I didn’t want to fiddle with the configuration in case it broke anything else.
I had a look around for a solution and found one on Phil Brown’s Web Development Blog his post
Zend Framework Forms and magic_quotes_gpc which explains how to use Zend Filters to combat this issue. His solution works perfectly but you have to set the filter for each form element individually and I found this a bit of a chaw.
So I looked around to find a way of applying it to all elements within the form.

Here is the solution I came up with this is all the code you need to get it working. I am doing this for the Strip Slashes filter but will work with any standard or non standard filters.

Read & Comment ›››

NetBeans 6.9

By Mark Davidson on March 17th, 2010

I am a massive NetBeans fan and since NetBeans 6.9 is in the pipeline I thought I would do a quick post to point out some of the new features that are coming with the new release, which should be out some time in June.

So Whats New

You can check out a full list of whats new in 6.9 on the NetBeans Wiki New & Note Worthy Page. I will just be pointing out in this post a few of the features that paticularly interest me.

Build & Run JDK 6 Only

This has been coming for a long time I hadn’t read any release information when I first downloaded the latested source from mercurial and took me a bit to reliase I neeed to build with JDK 6. This is really good although slightly annoying if your running certain versions of OSX that don’t support Java 6.

Zend Framework Support (PHP)

This is one of the features I am most excited about since I am just starting to develop some web appliations using Zend its great to have my favourite IDE intergrate so well with the framework. As well as the obvious features such as being able to create a Zend Project and Syntax Completion there is also integration with all the Zend Commands that you would normally do with the zf.sh script. For more details check out the NetBeans PHP Blog most on Zend Framework Support.

Improved PHPDoc in Code Completion (PHP)

A minor feature in some respects but I personally think a really good improvment. As I think people should use PHPDoc a lot more and this can only encourage people to use it to full effect.

PHP Code Formatting Improvments (PHP)

Finally it looks like NetBeans code formatting for PHP now has caught up to how customisable it is with Java. I am really pleased about this as it can be paticually annoying on some big projects if you cant easily enforce coding standards.

CSS Refactoring / Find Usages Support & CSS Code Completion

I can’t even begin to explain how pleased I am about this. CSS has always been a bit of a pain paticually when it came to restructuring or making any significant changes. Now with refactoring support its got 100x easier. This combined with CSS code completion I belive makes NetBeans a Web Developers dream.

JDK 7 Support

JDK 7 Support is also being added to this release this is really awesome. There is some really interesting new features in JDK 7 I will probably do an article about them at some point but for now check out the notes on the features that are currently being added to the editor.


Thats all I want to cover for now lots of awesome new features as always with a NetBeans release do check it out. You either want to download Milestone 1 or compile the latest version from source which I wrote a guide on a few weeks ago for doing it under OSX.

Also check out these links for more details

http://wiki.netbeans.org/NetBeans_69
http://wiki.netbeans.org/NewAndNoteWorthy

WordPress Suhosin Memory Limit

By Mark Davidson on February 27th, 2010

On my last post I was uploading some images to include in the post using WordPress. I noticed in my error logs that while resizing the images the PHP script attempts to raise the memory limit.

Feb 26 22:52:29 host suhosin[9636]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'XXX.XXX.XXX.XXX', file '/var/www/wordpress/wp-admin/includes/image.php', line 161)

This is fair enough and is a good idea for security and to stop your server getting overloaded by a single script. So I looked into how to fix this and its a very simple process.

You need to edit your suhosin config. I am doing this under Ubuntu 9.04 mine is located ‘/etc/php5/apache2/conf.d/suhosin.ini’. To fix it for WordPress just add the setting `suhosin.memory_limit` to the config file with the appropriate value in the case of WordPress it needs to be set to 256.

Your config should end up looking like this

extension=suhosin.so
[suhosin]
suhosin.memory_limit = 256M

that is it really very simple. I am going to have a bit of a tweak with suhosin config later I think the default config can be improved a lot.