John CoxRegular Expression Tutorial (7.1.2006, 13:02 UTC)

From Learning to use Regular Expressions:

This tutorial is aimed at users and programmers who have begun to work with tools that use regular expressions, but who are not quite comfortable with the intricacies of them. Even users who may have used regular expressions in the past, but have forgotten some of the details can benefit from this as a refresher.

Though not PHP specific, this tutorial is well written, with attention span in mind. I tend to lose interest when I have to go through countless pages. This one is simple, easy and all on one page. Good introduction for those (who doesn't) that have some struggles with regular expressions.

Link
Bertrand MansionGuide to PHP Security, small book review (7.1.2006, 10:50 UTC)

I ordered Ilia Alshanetsky book - php|architect's Guide to PHP Security - about a month ago. I did so because php|architect said there would be books with Ilia's signature for the first ones being ordered. I thought it would be nice to have one, for the fun and because I enjoyed Ilia's speaks at the International PHP conferences (in Amsterdam).

Anyway, I received the book without the signature so I was a bit disappointed. I thought I misunderstood the ad. I did not really ordered the book for its content because I thought, with 6 years of PHP programming, I now knew enough about PHP security and stuff like that. I admit my first web applications really sucked in this matter, but now I think they should be ok.

As I take the underground everyday, I sometimes find myself without anything to read and having nothing to read in Paris underground is pretty boring, so I picked up Ilia's book for the ride.

Now that I reached the middle of the book (took me approx. 8 underground rides), I can say it's very good and I have discovered many ways to further improve my applications. I learned something new about PHP on almost every page. This book is not exactly for newbies, it sometimes goes into PHP internals and give you excellent tricks on how to improve both your scripts security and performance. The code examples are very short and illustrative. This makes the book very easy and fast to read.

Ilia definitely knows what he writes about and goes well beyond security by also giving you useful tricks on PHP performance and how PHP works internally.

The only thing I thought was missing is a chapter about backup strategies, because if your server gets compromised, the only recourse you'll have in most cases are your backups. It would be nice to have this as a free chapter :)

The good thing is that today (only), php|architect is making a special offer on the book.



Link
SitePoint Blogsa simple wiki with web.py (7.1.2006, 00:05 UTC)

Ran into web.py here, while it was still unreleased and got hooked by the API design and the comment Aaron made here

The third principle is that web.py should, by default, do the right thing by the Web. This means distinguishing between GET and POST properly. It means simple, canonical URLs which synonyms redirect to. It means readable HTML with the proper HTTP headers.

Since then web.py has been released with an initial reaction here—agree with those remarks so don’t need to repeat.

More interesting was hacking something together with it—a very simple wiki which took about 2 hours to get to where it is (below), while reading the docs and tutorial. Note this isn’t pretty code—the HTML in embedded directly, violating Aaron’s principle (didn’t want to have to mess with Cheetah as well), plus my Python skills are not the greatest but perhaps it makes a useful beginners example.

To install and run (Linux) to a file like wiki.py then do the following;


$ wget http://webpy.org/web.py
$ wget http://webpy.org/markdown.py
$ mkdir pages
$ chmod +x wiki.py
$ ./wiki.py

Then point your browser at http://localhost:8080/pages/somepage to get started

The code;


#!/usr/bin/python

import web
from markdown import Markdown
import os, time, re, cgi

# For debugging use only
web.internalerror = web.debugerror

urls = (
    '/', 'WikiPages',
    '/page/([a-zA-Z_]+)', 'WikiPage',
    '/editor/([a-zA-Z_]+)', 'WikiEditor'
)

wikidir = os.path.realpath('./pages')

class WikiPages:
        
        def GET(self):
                web.header("Content-Type","text/html; charset=utf-8")
                t = re.compile('^[a-zA-Z_]+$')
                wikipages = os.listdir(wikidir)
                print "<html><head><title>wiki pages</title></head><body>"
                print "<h1>Wiki Pages:</h1><ul>"
                for wikipage in wikipages:
                        if os.path.isfile(os.path.join(wikidir, wikipage)) and t.match(wikipage):
                                print "<li><a href=\"%(path)s/page/%(page)s\">%(page)s</a></li>" \
                                        % {'path':web.ctx.home+web.ctx.path[1:],'page':wikipage}
                print "</ul></body></html>"

class WikiPage:
        
        def GET(self, name):
                page = os.path.join(wikidir,name)
                web.header("Content-Type","text/html; charset=utf-8")
                if os.path.exists(page):
                        print "<html><head><title>%s</title></head><body>" % name
                        print "<h1>%s</h1>" % name
                        print "<p>"
                        print "[<a href=\"%s\">Pages</a>] " \
                                        % (web.ctx.home+"/")
                        print "[<a href=\"%s\">Edit</a>] " \
                                        % (web.ctx.home+'/editor/'+name)
                        print "</p>"
                        print Markdown(open(page).read())
                        print "</body></html>"
                else:
                        web.ctx.status = '404 Not Found'
                        print "<html><head><title>Does not exist: %s</title></head><body>" % name
                        print "<p>Page %s does not yet exist - " % name
                        print "<a href=\"%s\">Create</a>" % (web.ctx.home+'/editor/'+name)
        
        def POST(self,name):
                page = os.path.join(wikidir,name)
                if os.path.exists(page):
                        newpage = page+'.'+time.strftime("%Y%m%d%H%M%S", time.gmtime())
                        os.rename(page,newpage)
                f = open(page, "w")
                f.write(web.input(page='').page)
                f.close()
                web.redirect(web.ctx.home+'/page/'+name)

class WikiEditor:

        def GET(self,name):
                web.header("Content-Type","text/html; charset=utf-8")
                print "<html><head><title>Editing %s</title></head><body>" % name;
                print "<h1>Editing: %s</h1>" % name
                print "<form method=\"POST\" accept-charset=\"utf-8\" action=\"%s\">" \
                        % (web.ctx.home+'/page/'+name)
                print "<textarea name=\"page\" cols=\"100\" rows=\"20\">"

                page = os.path.join(wikidir,name)
                if os.path.exists(page):
                        print cgi.escape(open(page).read())
                print "</textarea><br><input type=\"submit\" value=\"Update\"></form>"
                print "<p><a href=\&quo

Truncated by Planet PHP, read more at the original (another 664 bytes)

Link
Stuart HerbertGentoo Web-Apps Meeting Tomorrow (6.1.2006, 19:29 UTC)

We have the first of our new monthly Gentoo web-apps project meetings tomorrow night, at 19:00 UTC in #gentoo-web on irc.freenode.net. I've put the agenda up on the wiki.

If there's anything important that needs adding to the agenda, please let me know before the meeting.

Link
Andrei ZmievskiHe saves... but does he commit? (6.1.2006, 17:32 UTC)

Looking through the email inbox this morning I saw these headers, which provided a low-yield amusement factor.

Good to know that even the deities have to go through formalities.

Happy New 2006 to y'all by the way!

Link
Greg BeaverWhy it is very important to upgrade to PEAR 1.4.6 from PEAR 1.3.x (6.1.2006, 16:39 UTC)

PEAR 1.4.6 was just released at pear.php.net (http://pear.php.net/PEAR). This is a minor bugfix release and complete details are available at pear.php.net, but I must stress two points with extreme seriousness:

  1. PEAR 1.4.6 fixes make install-pear INSTALL_ROOT=/rpm/packaging and introduces the --packagingroot option to install, which works like --installroot worked in PEAR 1.3.x
  2. PEAR 1.3.x has several serious bugs and at least 2 serious security vulnerabilities.  Using PEAR 1.3.x on a production machine is EXTREMELY dangerous

The second point applies to all people who think that the latest vulnerability in PEAR can be fixed in 1.3.5 with a simple patch.  There are several unpublished serious bugs.  A few days back, I was contacted by a diligent developer of a linux distribution who was wondering how serious the vulnerability in PEAR 1.4.2 and earlier is, and whether it would be possible to get a patch for PEAR 1.3.5.  After reflection on the serious bugs in PEAR 1.3.x that were fixed in PEAR 1.4.x with unit testing, I came to realize that there is yet another serious security vulnerability in PEAR 1.3.x.  I will publish the details shortly.pear.php

Don't hesitate, upgrade to PEAR 1.4.6 at your earliest convenience.


Link
Christian StockerPHP 5, OS X, fink and iconv (6.1.2006, 11:58 UTC)

If you want to get the iconv extension properly running with PHP 5 and fink on OS X, you need the following configure option

--with-iconv=/sw/

and then it should work.

Hope that helps others, too.



Link
Derick RethansPHPCon UK, London (6.1.2006, 09:18 UTC)

On Friday the 10th of February 2006 I will be presenting a talk on the eZ components at the PHPCon in London. In this talk I will explain the structure, contents and workings of the eZ components library. It should give a good overview of its architecture and at the same time give you an introduction on how to use the components. This conference is extremely cheap (£50) and there is a good line up of speakers. If you have time, please join !

Link
Derick RethansPHP 4.4.2RC2 Released (6.1.2006, 09:17 UTC)

Yesterday I released PHP 4.4.2RC2, which should be the final release candidate for PHP 4.4.2. The major fixes in this release will be the problems with current() and key(), the problem with Apache 2 subrequests and we modified the behavior of header() so that it does not allow more than one header to be set at once. This prevents header injection. Please test !

Link
Ilia AlshanetskyPHP 5.1.2RC2 Released! (6.1.2006, 01:02 UTC)
The second and final RC of 5.1.2 was packaged today and is now available for download. This has been a purely bug fix RC that addresses a number of crash bugs and does a bit of further tweaking on the date
functionality. Please test it as much as you can, since pending any major problems this becomes the final release on January 12th.

The sources can be downloaded from:
http://downloads.php.net/ilia/php-5.1.2RC2.tar.bz2
0a24a22552ae966afa3e0f3da2f1c47d

http://downloads.php.net/ilia/php-5.1.2RC2.tar.gz
7aee42982a8a16a0d600e1ef46dadec6

Win32 binaries should be available shortly from
http://downloads.php.net/ilia/ as well.

If you know of any regressions introduced by this release, please let me know.
Link
LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP