Development category listing. ­ Textpattern CMS

FAQ: Development

"Notice: undefined variable.." and similar messages

When your Production Status is set to Debugging, it’s not uncommon to see PHP Notices similar to this:

Notice: Undefined index: permlink in 
	.../textpattern/lib/txplib_misc.php(412) : 
	eval()'d code on line 26

Debugging mode is intended for just that: debugging problems. If everything is working fine, there’s no reason to turn on Debugging.

Notices in debug mode are not unusual, and by themselves aren’t an indicator of something wrong. If the only symptom you have is that there are notices produced when Production Status is set to Debugging, then there’s nothing wrong, and you can safely ignore them.

By itself, with no other symptoms, a Notice is not a bug, so please don’t report it as such.

On the other hand, if something is failing to work, the messages produced in debug mode might be helpful in tracking down the source of the problem.

Subversion (now Github)

The Textpattern source code is maintained on Github. From there you can clone the repo, make changes to it and issue a Pull Request so we can merge your amendments in. You can also raise an issue if you find a defect or have a feature request.

There are beginner guides for using git but if you need any specific help that’s not answered elsewhere, head on over to the forum and ask your question there.

IMPORTANT: The remainder of this article is for historical purposes only. It is no longer current, so please ignore it.

The following assumes you have a properly installed copy of Subversion, and a working knowledge of the command line.

Warning: Textpattern-current is the developers’ working copy of the Textpattern source code. It includes the latest bug fixes and features, but the most recent updates have usually received only light testing. It is not recommended for use on a live site. Use at your own risk, make backups first, etc.

How do I fetch the current version of Textpattern?

> cd /path/to/txp
> svn co
A 4.x/textpattern
A 4.x/textpattern/license.txt
A 4.x/textpattern/tmp

How do I find out which subversion revision I have?

> cd /path/to/txp/4.x
> svn log -q -r BASE
r105 | zem | 2005-02-25 11:17:30 +1100 (Fri, 25 Feb 2005)

How do I find out what the latest available revision is?

> cd /path/to/txp/4.x
> svn log -q -r HEAD
r108 | zem | 2005-02-26 10:41:17 +1100 (Sat, 26 Feb 2005)

How do I update to the latest revision?

> cd /path/to/txp/4.x
> svn update
U textpattern/include/txp_prefs.php
U textpattern/lib/txplib_misc.php
U textpattern/_update.php
Updated to revision 108.

How do I see what’s changed between my last update and the latest revision?

> cd /path/to/txp/4.x
> svn log -r BASE:HEAD
r105 | zem | 2005-02-25 11:17:30 +1100 (Fri, 25 Feb 2005) | 1 line
fix date permlinks in recent_articles and some other tags
r106 | zem | 2005-02-25 14:34:22 +1100 (Fri, 25 Feb 2005) | 1 line
fix typo in get_uploaded_file() (thanks Manfre)
r107 | zem | 2005-02-26 10:33:18 +1100 (Sat, 26 Feb 2005) | 1 line
remove extra stripslashes
r108 | zem | 2005-02-26 10:41:17 +1100 (Sat, 26 Feb 2005) | 1 line
fix handling of Windows tempdir paths

How do I update to a specific revision, or revert to a previous revision?

> cd /path/to/txp/4.x
> svn update -r 105
U textpattern/include/txp_prefs.php
U textpattern/lib/txplib_misc.php
U textpattern/_update.php
Updated to revision 105.

What’s the best way to upload a copy of Textpattern-current to my web site?

> cd /path/to/txp
> svn export 4.x test

Then zip or tar the contents of /path/to/txp/test, upload it to your web site, and unzip/untar in the appropriate place.

Subversion export won’t overwrite an existing directory, so you’ll need to erase or rename /path/to/txp/test before each subsequent export, or use svn export --force 4.x test.

How do I submit a patch to the developers?

After editing files in /path/to/txp/4.x:

> cd /path/to/txp/4.x
> svn update
> svn diff > /path/to/txp/myfile.patch

…then email /path/to/txp/myfile.patch to the developers. Use a descriptive filename, including the current revision number (e.g. “fix_category_bug_r108.patch”). If your update includes new files, use svn add path/to/myfile.php to make sure they’re included in the patch.

Make sure you examine the patch file to ensure it doesn’t include any unintentional changes. In particular, whitespace differences (typically caused by a text editor converting tabs to spaces) can inflate the size of a patch. If that seems to be the case, try this instead:

> svn diff --diff-cmd diff -x -w > /path/to/txp/myfile.patch


While a patch may include changes to multiple files, each patch should include only one thing – one bugfix, or one new feature. If you have more than one independent bugfix or feature to submit, you should break them up and send them as separate patches.

Make sure each patch is against a clean copy of the current revision, i.e. it doesn’t include the changes submitted in previous patches. svn revert -R will restore a pristine working copy from the repository (this will overwrite your local changes, so back them up elsewhere first).


For those of you who use windows, there is a nice GUI client called TortoiseSVN – with a good user manual too. It-s a right-click menu integrated tool which makes your life easy if you don-t know too much about SVN.

Just install it, create an empty folder, and right click TortoiseSVN > Checkout… on the new SVN menu.

Point there to the URL of the repo you want to browse contents from, and you’ve got the repo contents on your directory.

You can do all things listed above with TortoiseSVN, but be sure to read the manual first.