Feed aggregator
Escaping in iCalendar and vCard
The #1 bug report in my vObject library (a library to parse and create iCalendar and vCard objects in PHP) is that it does a bad job escaping/un-escaping of values.
In particular, it double-escapes certain values, changing things like ; into
\\; and in other cases it's a bit too liberal un-escaping.
It's gotten to a point where I got so frustrated about this bug, I've been working all week on a new version of the parser.
Determined to do things right this time, I wanted to make sure I complied with all the relevant standards, in particular:
When I first wrote the vObject I naively thought that these formats were more or less the same. On the surface it does indeed seem that way, everything does seem to follow this basic structure:
BEGIN:VCARD
VERSION:4.0
FN:Evert Pot
END:VCARD
The nuances and slight difference between the specifications are enough to drive a simple person to madness though.
Just on the topic of ecaping values (the part after the :) the
specifications have the following to say:
vCard 2.1, as well as the other specs have a concept of 'compound' or multi-value properties. An example:
BEGIN:VCARD
VERSION:2.1
N:Pot;Evert;Middle;Dr.;M.D.
END:VCARD
As you can see, the N property has multiple values. Any of these values
may also contain a ;, which must be escaped as \;. So we also cannot
blindly encode a string and automatically add backslashes to any ; we see.
The semi-colons should only be escaped in the ADR, ORG and N fields,
but we can assume that backslashed semi-colons may also appear in other values.
Any property may have a parameter, a parameter looks a bit like this:
BEGIN:VCARD
VERSION:2.1
NOTE;ENCODING=QUOTED-PRINTABLE:Handsome guy, for sure..
END:VCARD
A parameter in vCard starts with a ;, has a name and a value. Only the colon
may be escaped in parameters, using \:.
If you somehow wanted to encode a real backslash though, there's no mention of escaping it as a double-backslash.
If you need newlines in any values, quoted-printable encoding must be used.
Other specs all encode newlines as \n or \N.
rfc2425 says that backslashes (\\), newlines (\N or \n) and comma's (\,)
must always be escaped, no exceptions.. Well except when the comma is used as
a delimiter for multiple values.
rfc2426 add semi-colon (\;) to this list, except when it's used as a
delimiter. Semi-colon is used as a delimiter in the N, ADR, GEO and
ORG fields. NICKNAME and CATEGORIES use comma's.
vCard also says that individual parts of ADR, and N may also contain
multiple values themselves, which are themselves split by a comma.
Quoted-printable is now deprecated, and should no longer be used.
Parameters have also changed. The new rule is that parameters must not
contain ;, : or ", unless they are surrounded by double-quotes, in which
case only " may not appear. Escaping of the colon character (\:) has
disappeared.
vCard 4 changes the interpretation of 3.0 a bit, and now states that semi-colons may be escaped, depending on the property.
The implication is that we need to maintain lists of properties, if they
support multiple- or compound-values and which delimiter they use
(, or ;).
Semi-colons are now used by N, ADR, ORG and CLIENTPIDMAP. Comma's are
used by NICKNAME, RELATED, CATEGORIES and PID.
Even though the spec does say that comma's must always be escaped, it does
appear to violate this rule in it's own examples, specifically the example
for GEO (which is no longer a compound float value, but a url).
iCalendar 2
Truncated by Planet PHP, read more at the original (another 1860 bytes)
NetTuts.com: 10 Tips for Learning a New Technology
On NetTuts.com today they've posted a list of tips they think will help you learn a new technology faster. They've broken it up into ten different steps, some which could be done at any time but some have a bit more of an order.
We live in a very exciting time. Never before has education been so cheaply available to the masses (if not free). The medium, itself, has made tectonic shifts from a classroom setting, to blogs, screencasts and complete university classes, as a set of videos and interactive forums. Given these resources, there's absolutely no excuse not to dive in and learn. However, with such a wealth of resources, filtering through the options can often become overwhelming. In this article, I will outline a simple process to kick-start your education.Among the items in their list there's things like:
- "Let the Information Flow Begin"
- "Listen and Watch"
- "Blogging"
- "Feel the Pulse"
- "Meetups and Conferences"
Each tip comes with a bit of description and some links to other resources and tools that can help you along your way.
Link: http://net.tutsplus.com/articles/general/10-tips-for-learning-a-new-technologyPHP.net: PHP 5.4.15 and PHP 5.3.25 released!
On the PHP.net site they've announced the release of version 5.4.15 & 5.3.25 (fully released after some propagation issues with the mirror servers).
The PHP development team announces the immediate availability of PHP 5.4.15 and PHP 5.3.25. These releases fix about 10 bugs aswell as upgrading the bundled libmagic library. All users of PHP are encouraged to upgrade to PHP 5.4.15. [...] The list of changes are recorded in the ChangeLog.Changes include updates to debug_backtrace for a segfault issue, a change to the dns_get_record function for negative length values and a fix for a fd leak on Solaris. You can download this latest release from the downloads section (source) or the Windows QA site (binaries).
Link: http://php.net/archive/2013.php#id2013-05-09-1Community News: Packagist Latest Releases for 05.10.2013
- mparaiso/simpleuserserviceprovider (0.0.0, 0.0.9, 0.0.8, 0.0.7, 0.0.6, 0.0.5, 0.0.4)
Simple User management for Silex intended to mimic FOSUserBundle features, work in progress , not production ready yet !
- mparaiso/doctrineodmserviceprovider (0.0.4)
Doctrine ODM service provider for Silex
- superdweebie/authentication-module (0.3)
Zend Framework 2 Module that provides authentication functionality
- evolic/loculus (v0.3.0, v0.2.2.2)
Zend Framework extensions
- rgou/bootstrap-bundle (v0.7.2)
Twitter Bootstrap Symfony2 bundle with generator for Doctrine ORM and ODM
- net_bazzline/classmap_generator (v1.4.1)
php classmap and autoloader generator for psr-0 and previous php files - it should find all classes in every php file
- pihi/industrial (0.4.3, 0.4.2)
Dependency Injection for PHP 5.3
- league/oauth2server (2.0.5, 2.0.4, 2.0.3)
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
- phly/phly-restfully (2.0.0beta4)
ZF2 Module providing structure for RESTful resources
- stefanotorresi/my-error-handler (1.02)
A ZF2 module that introduces custom exceptions and error strategies for XHR requests
- caseysoftware/contactually-helper (v0.8.0)
A PHP wrapper for the Contactually API
- metamodels/attribute_tags (1.0.0)
MetaModels attribute for selects
- metamodels/attribute_select (1.0.0)
MetaModels attribute for selects
- metamodels/attribute_longtext (1.0.0)
MetaModels attribute for longtext
- metamodels/attribute_file (1.0.0)
MetaModels attribute for files
- league/capsule (2.2.1, 2.2.0)
A simple wrapper class for the Laravel Database package. This is only to be used outside of a Laravel application.
- zweifisch/zf (v0.1.3)
a micro php web/cli framework/router
- metamodels/attribute_url (1.0.0)
MetaModels attribute for urls
- metamodels/attribute_timestamp (1.0.0)
MetaModels attribute for timestamps
- metamodels/attribute_numeric (1.0.0)
MetaModels attribute for numeric values
- metamodels/attribute_langcode (1.0.0)
MetaModels attribute for langcodes
- metamodels/attribute_decimal (1.0.0)
MetaModels attribute for decimal values
- metamodels/filter_text (1.0.0)
MetaModels text filter
- metamodels/filter_tags (1.0.0)
MetaModels tags filter
- juriansluiman/slm-mail (v1.0.0-rc1)
Integration of various email service providers in the Zend Framework ZendMail
- slm/mail (v1.0.0-rc1)
Integration of various email service providers in the Zend Framework ZendMail
- metamodels/filter_select (1.0.0)
MetaModels select filter
- kenkataiwa/gatekeeper (0.1.1)
Open Authentiation Abstration
- gabordemooij/redbean (v3.4.4)
Easy ORM for PHP
- textpattern/installer (1.0.3)
Textpattern plugin and theme installer
- zircote/swagger-php (0.6.0)
Swagger-PHP library implementing the swagger.wordnik.com specification to describe web services, operations/actions and models enabling a uniform means of producing, consuming, and visualizing RESTful web services.
- alexeyshockov/clock (v0.1.0)
Date & time manupulation library for PHP
- bluetools/moneybird-php-api (v2.2.0, v2.1.6)
A PHP Library for the MoneyBird API
- bshaffer/oauth2-server-php (v0.7)
OAuth2 Server for PHP
Site News: Popular Posts for the Week of 05.10.2013
- Reddit.com: Zend2 vs Symfony2
- Site News: Popular Posts for the Week of 05.03.2013
- Phil Sturgeon: Testing and Contributing with Composer Packages
- PHPMaster.com: Goodbye CodeIgniter, Hello Laravel
- 7PHP.com: Know Thy PHP Conference Know The Dutch PHP Conference (DPC) & The Dutch Mobile Conference
- Sameer Borate: Efficiently Replicating RETS data to MySQL
- Community News: Latest PEAR Releases for 05.06.2013
- Francesca Krihely: On the Developer Experience
- 7PHP.com: Win (TWO) Free Tickets To Hear Rob Allen Introduce Zend Framework 2 (Nomad PHP)
- Community News: Packagist Latest Releases for 05.04.2013
Making better object oriented design decisions
Aura: New Site, New Logo, New Releases
Web & PHP Magazine: May 2013 Issue - "Time Travel"
The Web & PHP Magazine has officially released their latest issue - the May 2013 edition, "Time Travel".
You may already be familiar with Git, but did you know that it can rewrite time itself? GitHubber Ben Straub explains all in this month's issue, which also features tutorials on extracting XML data from RSS, using Composer to manage project dependencies and using the PHP Content Repository. If you've ever thought about starting a PHP user group, Atlanta PHP User Group co-organiser Kevin Roberts shares his secrets - plus, there's our regular columns on agile, big data and testing.Articles included in this latest issue include:
- "Change the Past" (Ben Straub)
- "Why do User Groups?" (Kevin Roberts)
- "Sprint Retrospective Primer" (Steffan Surdek)
- "Urban Legends and Error Handling" (Stefan Priebsch)
- "Managing your project's dependencies with Composer" (Jefersson Nathan de O. Chaves)
As always, this issue is available free of charge and can be downloaded directly from their site.
Link: http://webandphp.com/May2013PHPMaster.com: Maven and PHP
PHPMaster.com has a new tutorial posted that introduces you to a build tool that's more common in the Java world but can easily support PHP projects, Apache's Maven.
Apache Maven is a build automation tool with the purpose of building, reporting, and creating documentation of projects. It builds projects using a Project Object Model (POM) and a set of plugins shared by all projects using Maven, thus providing a uniform build system. Once you familiarize yourself with how one Maven project builds, you automatically know how all Maven projects build. [...] Through this article you will gain familiarity with Maven for PHP, and how to install and use the PHP-Maven plugin from the command line and in Eclipse.The tutorial walks you first through the basic install of Maven and get you started with an example "settings.xml" file helping to set up the PHP-Maven plugin. They help you create your first project using the Archetype plugin and its related "pom.xml" file. The project already has a defined structure (similar to what you might see in a Composer-loadable PHP repo on Github) for the source of your app and the tests. They show you how to hook in PHPUnit and phpDocumentor for testing/dcumentation builds and, finally, how to integrate it all into Eclipse to allow for easier, in-IDE interactions.
Link: http://phpmaster.com/maven-and-phpScript-Tutorials.com: Functional Programming - How to Write Functional Code in PHP
On the Script-Tutorial.com site today there's a new post looking at functional programming in PHP - some of the concepts involved and example code showing how to make it work.
Functional programming can be defined in simple terms as a programming paradigm that do not change the state of a program instead it uses pure functions. A pure function is a function that has the ability to accept a value and return another value without changing the input supplied to it. It is characterized by its ability to support functions that are of high order. [...] A programming paradigm that is functional has the following attributes: do not alter the states which make parallelism easier, deals mostly with a function which is the smallest unit hence enhances readability of code, has deterministic functions that enable stability of a program.He talks some about anonymous/lambda functions (closures) and their role in PHP's implementation of functional programming. He also talks some about partial functions, currying, higher order functions and recursion. He finishes off the article with a look at some of the advantages this method of development can bring as well as some of the disadvantages that come with things like recursion and the learning curve of the method.
Link: http://www.script-tutorials.com/functional-programming-phpPHP.net: PHP 5.5.0RC1 is available
As is mentioned on PHP.net today, the first release candidate for the PHP 5.5.x series, PHP 5.5.0RC1, has been released for testing:
The PHP development team announces the availability of the first release candidate of PHP 5.5. This release fixes some bugs as well as some possible leaks from our last beta. This is a development preview - do not use it in production!Some of the more major changes in this release include an update to the FPM SAPI for QUERY_STRING, a fix for a build issue with libgd, bugs in SNMP and a problem with stream_select on Windows x64 systems. You can find the full list of changes in the NEWS file. Please download and test (Windows binaries here) this latest release to help the development team find issues and move along with the PHP 5.5.x releases.
Link: http://php.net/index.php#id2013-05-09-2PHPClasses.org: Lately in PHP, Episode 35 - Better Documentation for PHP internals
On PHPClasses.org today they've posted the latest episode of their "Lately in PHP" podcast series - Episode #35, "Better Documentation for PHP internals".
With the inclusion of Zend Optimizer+ extension in PHP 5.5, the need for better documentation of PHP internals became more evident, so PHP contributors can write extensions that take the most of the core PHP features. That is one of the topics discussed by Manuel Lemos and Ernani Joppert in the episode 35 of the Lately In PHP podcast. They also talked about having more optimized PHP opcodes, some interesting PHP feature proposals that got rejected, as well the article about the top version control systems used by PHP developers.You can listen to this episode in a few different ways - either through the in-page player, by downloading the mp3 or by watching the video of the recorded Google Hangout session.
Link: http://www.phpclasses.org/blog/post/207-Better-Documentation-for-PHP-internals--Lately-in-PHP-podcast-episode-35.htmlCommunity News: Packagist Latest Releases for 05.09.2013
- rgou/bootstrap-bundle (v0.7.1, v0.7.0, v0.6.1, v0.6.0)
Twitter Boostrap Bundle for Symfony 2
- league/oauth2server (2.0.2, 2.0)
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
- codeception/codeception (1.6.1)
BDD-style testing framework
- jtgrimes/less4laravel (v0.1.4, 0.1.4)
Bringing lessphp into Laravel
- khal3d/phpline (v0.1)
Execute command line using php
- pihi/industrial (0.4.1)
Dependency Injection for PHP 5.3
- manhim/cervo (2.2.0, 2.1.1)
A lightweight and highly modular structure framework for PHP.
- rah/rah_terminal_markdown (0.1.3)
Markdown module for rah_terminal
- leedavis81/altr-ego (v1.0.0)
Access an objects protected / private properties and methods
- rah/rah_autoload (0.1.0)
Loads the autoload file Composer generated in Textpattern CMS
- jadeit/catalogd-bundle (0.1)
A Bundle defining Items, Categories and Tags
- herrera-io/yaml-hint (1.0.0)
A code hint file for the YAML extension.
- ncsuwebdev/base-otf-app (1.0.3)
Base app for creating an OTF app
- instaclick/gherkincs (v1.0.0)
Code Sniffer and Semantic Analyzer for Gherkin
- ncsuwebdev/otframework (3.0.3)
Base application framework
- ncsuwebdev/ncsubootstrap (1.0.2)
An NCSU-brand override for Twitter Bootstrap
- brtriver/dbup (v0.4)
simple migration tool with PDO
- affinitydev/auth (0.1.0)
Decoupled, interface-based Authentication component for PHP 5.4.
- mparaiso/doctrineodmserviceprovider (0.0.3, 0.0.2, 0.0.1)
Doctrine ODM service provider for Silex
- diff/diff (0.6)
Library for computing and representing diffs between JSON like data structures
- vich/uploader-bundle (v0.8.1)
Ease file uploads attached to entities
- bit3/remote-objects (1.2)
Remote object method invokation framework
- mikealmond/coverartarchive (v0.1.1)
A PHP library for accessing the CoverArtArchive API
- candycms/core (3.0.5, 3.0.4)
Core elements for candyCMS.
- conradkleinespel/database-log-laravel4 (v1.0.2)
A Laravel 4 Service Provider that saves logs to the database asynchronously with a queue.
- conradkleinespel/twig-laravel4 (v1.0.2)
- rampage-php/framework (1.0.0-alpha3)
Rampage PHP Framework based on Zend Framework 2
- castanet/userid (0.0.6)
Emulate Nginx's HTTP Userid module
- davidbadura/fixtures-bundle (v1.0.7)
A Symfony2 bundle to load yaml fixtures. Easy extendable, resolve object dependency and validate objects.
- lazy/db (1.0b8, 1.0b7, 1.0b6, 1.0b5)
ORM for PHP >= 5.3.0
- aoyagikouhei/pg (0.0.4)
PHP Class for PostgreSQL
- lox/pheasant (v1.1.1)
A lightweight data mapper for MySQL and PHP 5.3+
- alexshelkov/simpleacl (2.0.15)
Simple Access Control List (ACL) for PHP.
- xi/fixtures (1.1.0)
Convenient creation of Doctrine entities in tests. Like Ruby's FactoryGirl.
- symfony-cmf/block-bundle (1.0.0-alpha3)
Symfony CMF Block Bundle
Site News: Blast from the Past - One Year Ago in PHP
- ZetCode.com: PostgreSQL PHP Tutorial
- Lorna Mitchell's Blog: Using an Existing Vagrant Setup for PHP Development
- Martin Sikora's Blog: Silex + Doctrine 2 ORM
- Tom Barrett's Blog: WordPress is more than a CMS, it is a PHP Framework
- Evan Coury's Blog: Module-specific layouts in Zend Framework 2
- Michael Nitschinger's Blog: Writing a simple lexer in PHP
- Community News: Drafts of PSR-1 (and prelim PSR-2)
- Phil Sturgeon's Blog: Composer with CodeIgniter
- Developer.com: Creating a Custom ACL in PHP
- NetTuts.com: Aspect-Oriented Programming in PHP
- Ibuildings techPortal: Conference Report: Whisky Web
- Sameer Borate's Blog: Downloading Gmail attachments using PHP
- PHP.net: PHP 5.4.3 and PHP 5.3.13 Released!
- Anson Cheung's Blog: Create nodes in eZ Publish using PHP
- Rob Allen's Blog: Vagrant in Zend Framework 1
Better Documentation for PHP internals - Lately in PHP podcast episode 35
That is one of the topics discussed by Manuel Lemos and Ernani Joppert in the episode 35 of the Lately In PHP podcast.
They also talked about having more optimized PHP opcodes, some interesting PHP feature proposals that got rejected, as well the article about the top version control systems used by PHP developers.
Listen to this podcast, or watch the hangout video, or read the transcript to learn more about this and other interesting PHP discussions.
Seriously: PHP 5.4.15 and PHP 5.3.25 really were released!
PHP 5.5.0RC1 is available
PHP 5.4.15 and PHP 5.3.25 released!
Christopher Martinez: Static code analysis tools for PHP
Christopher Martinez has a recent post to his site that covers some of the static analysis tools available for PHP including the PHP Mess Detector, PHP CodeSniffer and the PHP Analyzer.
I believe in writing code that is easy to understand, easy to test, and easy to refactor. Yes, I realize that the statement above is pretty general and open to interpretation. Not everyone needs external tools to ensure quality in their code...but, I work on things from time to time that have absolutely no tests. [...] For whatever reason, this happens a lot more frequently in the PHP world. I'm guilty of not writing tests and checking how I write code, sometimes, too. Things are bright, though, for the PHP community - for quite some time now, we've had fantastic tools that assist us in writing better code.He covers each of the tools, talks some about what they're good for and gives examples of their use, including output. He also talks some about the Pfff set of tools created by Facebook. He also talks some about how these tools fit into his daily work as a part of his pre-commit hooks in git.
Link: http://chrsm.org/2013/05/05/code-analysis-tools-for-php