|
News News regarding BSD and related. |
|
Thread Tools | Display Modes |
|
|
|||
PHP 5.4 approaches with first release candidate
From http://h-online.com/-1378615
Quote:
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
Quote:
Code:
#!/bin/env perl my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); printf "%d-$mon-$mday\n", $year + 1900; Code:
#!/bin/env perl my ($year, $mon, $mday) = (localtime time)[5,4,3]; printf "%d-$mon-$mday\n", $year + 1900; |
|
|||
I still wonder why PHP still cannot tag data retrieved from the net,as tainted, like in Perl. See http://en.wikipedia.org/wiki/Taint_checking
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
||||
Right, that sounds pretty useful.
At least in Python and Javascript, and I suspect in Ruby and Perl, this would actually be fairly easy to implement, for example in Python you can use: Code:
>>> class Myint(int): ... myprop = 0 ... >>> var = MyInt(42) >>> var 42 >>> var.myprop 0 >>> var.myprop = 1 >>> var 42 >>> var.myprop 1 >>> Anyhow, I once looked at implementing something like this in PHP. At my previous employer I had built a webshop, originally, all the prices should be displayed with VAT, but then later (naturally, after the whole thing was finished & was live ) there was a request for users to toggle prices display with or without VAT. My original idea was similar to the above: Create a new int type, add a flag "VAT", and use that to calculate the correct price on invoices and so forth, this would provide the maximal flexibility and the least coding. As far as I could find, there is no real way to do this in PHP There are workarounds: you can extend the ArrayObject or StdObject, and using that you can *simulate* "custom types" and flag if the variable was escaped, but IMHO it's a lot less cleaner than the above example in Python ... But with sufficient planning and design, you could use it to implement taint checking ... Perhaps some of the frameworks like Doctrine already do something like this (Or use a different approach?).
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
jQuery 1.5 nears with release candidate | J65nko | News | 1 | 1st February 2011 06:34 PM |
FreeBSD PC-BSD 8.2 approaches with first release candidate | J65nko | News | 0 | 11th January 2011 05:14 PM |
Ruby 1.9.2 gets a second release candidate | J65nko | News | 0 | 12th July 2010 05:57 PM |
Ruby 1.9.2 approaches with release candidate | J65nko | News | 2 | 9th July 2010 06:13 PM |
Python 2.6.5 gets a release candidate | J65nko | News | 0 | 3rd March 2010 12:39 AM |