<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thomas Falkner &#187; php</title>
	<atom:link href="http://blog.thomas-falkner.de/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thomas-falkner.de</link>
	<description>Marginalien zu  Linux, Webdesign und Softwareentwicklung</description>
	<lastBuildDate>Sun, 24 Apr 2011 12:11:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>PHP-Fehlermeldungen mit .htaccess steuern</title>
		<link>http://blog.thomas-falkner.de/2011/04/11/php-fehlermeldungen-mit-htaccess-steuern/</link>
		<comments>http://blog.thomas-falkner.de/2011/04/11/php-fehlermeldungen-mit-htaccess-steuern/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 10:13:15 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[.htacess]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sicherheit]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/?p=329</guid>
		<description><![CDATA[Grunds&#228;tzlich kann es zu einem Sicherheitsrisiko werden PHP-Fehlermeldungen auf der Website anzeigen zu lassen, da mit R&#252;ckschl&#252;ssen auf den Code, die Verzeichnisstruktur oder Datenbankstruktur der Fehler ausgenutzt werden k&#246;nnte. Mit folgenden Eintr&#228;gen in der .htaccess lassen sich die PHP-Fehlermeldungen unterdr&#252;cken. php_flag display_startup_errors off php_flag display_errors off php_flag html_errors off php_value docref_root 0 php_value docref_ext 0 [...]]]></description>
			<content:encoded><![CDATA[<p>Grunds&#228;tzlich kann es zu einem Sicherheitsrisiko werden PHP-Fehlermeldungen auf der Website anzeigen zu lassen, da mit R&#252;ckschl&#252;ssen auf den Code, die Verzeichnisstruktur oder Datenbankstruktur der Fehler ausgenutzt werden k&#246;nnte.<br />
Mit folgenden Eintr&#228;gen in der <tt>.htaccess</tt> lassen sich die PHP-Fehlermeldungen unterdr&#252;cken. </p>
<pre name="code" class="php">
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0
</pre>
<p>Sinnvoll ist es hingegen die Fehler in eine Logdatei zu schreiben:</p>
<pre name="code" class="php">
php_flag  log_errors on
php_value error_log  /path/to/website/PHP_errors.log
</pre>
<p>Sinnvoll ist es zudem den Zugriff &#252;ber den Browser auf die Logdatei zu verbieten:</p>
<pre name="code" class="php">
<files PHP_errors.log>
 Order allow,deny
 Deny from all
 Satisfy All
</files>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2011/04/11/php-fehlermeldungen-mit-htaccess-steuern/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTML-Eingaben in eigenen Joomla Komponenten gestatten</title>
		<link>http://blog.thomas-falkner.de/2010/07/12/joomla-html-komponenten/</link>
		<comments>http://blog.thomas-falkner.de/2010/07/12/joomla-html-komponenten/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 16:14:10 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/?p=268</guid>
		<description><![CDATA[Die Methode JRequest::get filtert per default HTML- und PHP-Code aus den Request. M&#246;chte man beispielsweise ein HTML-Eingabefeld in der eigenen Komponente nutzen, l&#228;sst sich dies &#252;ber die MethodeJRequest::getVar mit dem Parameter JREQUEST_ALLOWRAW erreichen. Zum Beispiel so: $description = JRequest::getVar('description','','post','string', JREQUEST_ALLOWRAW);]]></description>
			<content:encoded><![CDATA[<p>Die Methode <tt>JRequest::get</tt> filtert per default HTML- und PHP-Code aus den Request. M&#246;chte man beispielsweise ein HTML-Eingabefeld in der eigenen Komponente nutzen, l&#228;sst sich dies &#252;ber die <tt>MethodeJRequest::getVar</tt> mit dem Parameter <tt>JREQUEST_ALLOWRAW</tt> erreichen.</p>
<p>Zum Beispiel so:</p>
<p><code> $description = JRequest::getVar('description','','post','string', JREQUEST_ALLOWRAW);</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2010/07/12/joomla-html-komponenten/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TurboDbAdmin, die Web 2.0 Alternative zu phpMyAdmin</title>
		<link>http://blog.thomas-falkner.de/2007/09/30/turbodbadmin-die-web-20-alternative-zu-phpmyadmin/</link>
		<comments>http://blog.thomas-falkner.de/2007/09/30/turbodbadmin-die-web-20-alternative-zu-phpmyadmin/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 19:50:39 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/2007/09/30/turbodbadmin-die-web-20-alternative-zu-phpmyadmin/</guid>
		<description><![CDATA[TruboDbAdmin versprich eine interessante Alternative zu phpMyAdmin zu werden. Zwar kann TurboDbAdmin noch nicht mit dem Funktionsumfang von phpMyAdmin gleichziehen, jedoch bietet es dank extensiven Einsatz von AJAX-Technologie einen wesentlich h&#246;heren Komfort.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.turboajax.com/products/turbodbadmin/">TruboDbAdmin</a> versprich eine interessante Alternative zu <a href="http://www.phpmyadmin.net/home_page/index.php">phpMyAdmin</a> zu werden. Zwar kann TurboDbAdmin noch nicht mit dem Funktionsumfang von phpMyAdmin gleichziehen, jedoch bietet es dank extensiven Einsatz von AJAX-Technologie einen wesentlich h&#246;heren Komfort.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2007/09/30/turbodbadmin-die-web-20-alternative-zu-phpmyadmin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>suPHP</title>
		<link>http://blog.thomas-falkner.de/2007/06/07/suphp/</link>
		<comments>http://blog.thomas-falkner.de/2007/06/07/suphp/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 13:43:21 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rootserver]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/2007/06/07/suphp/</guid>
		<description><![CDATA[Interessante Alternative zu PHP als CGI]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.suphp.org/Home.html">Interessante Alternative</a> zu <a href="http://blog.thomas-falkner.de/2007/05/20/bye-bye-mod_php/">PHP als CGI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2007/06/07/suphp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unable to create temporary directory</title>
		<link>http://blog.thomas-falkner.de/2007/04/13/unable-to-create-temporary-directory/</link>
		<comments>http://blog.thomas-falkner.de/2007/04/13/unable-to-create-temporary-directory/#comments</comments>
		<pubDate>Fri, 13 Apr 2007 16:46:38 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Netzwelt]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/2007/04/13/unable-to-create-temporary-directory/</guid>
		<description><![CDATA[Wenn Windowsuser PHP lernen und daf&#252;r gleich einen Rootserver anmieten, muss das in einer Katastrophe enden.]]></description>
			<content:encoded><![CDATA[<p>Wenn Windowsuser PHP lernen und daf&#252;r gleich einen Rootserver anmieten, muss das in einer <a href="http://www.rootforum.de/forum/viewtopic.php?t=40195">Katastrophe</a> enden.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2007/04/13/unable-to-create-temporary-directory/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ultimate Tag Warrior: URL-Rewriting</title>
		<link>http://blog.thomas-falkner.de/2007/04/08/ultimate-tag-warrior-url-rewriting/</link>
		<comments>http://blog.thomas-falkner.de/2007/04/08/ultimate-tag-warrior-url-rewriting/#comments</comments>
		<pubDate>Sun, 08 Apr 2007 12:26:51 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/2007/04/08/ultimate-tag-warrior-url-rewriting/</guid>
		<description><![CDATA[UTW ist ein tolles Plugin f&#252;r WordPress, um Postings mit Tags zu versehen und Tagclouds als Navigationsmittel zu erzeugen. Dabei ist sogar eine Option vorgesehen, mit der sich sch&#246;ne URL in Form von BASEURL/tag/tag erzeugen lassen. Bislang blieb diese Funktionalit&#228;t meiner WordPress Installation jedoch versagt. Zwar konnte ich die Option aktivieren, die Tag Links verweisen [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.neato.co.nz/ultimate-tag-warrior"><acronym title="Ultimate Tag Warrior">UTW</acronym></a> ist ein tolles Plugin f&#252;r WordPress, um Postings mit Tags zu versehen und <a href="http://de.wikipedia.org/wiki/Wortwolke">Tagclouds</a> als Navigationsmittel zu erzeugen. Dabei ist sogar eine Option vorgesehen, mit der sich sch&#246;ne URL in Form von <tt>BASEURL/tag/tag</tt> erzeugen lassen. Bislang blieb diese Funktionalit&#228;t meiner WordPress Installation jedoch versagt. Zwar konnte ich die Option aktivieren, die Tag Links verweisen auch auf URLs wie <tt>BASEURL/tag/linux</tt>, aber WordPress vermochte sie nicht auf den eigentliche URL <tt>BASEURL/index.php?tag=linux</tt> umzuschreiben.<br />
Des R&#228;tsels L&#246;sung fand ich w&#228;hrend ich mich in das Rewriting von WordPress einarbeitete.<br />
Wenn Permalinks (so der von WordPress gew&#228;hlte Name f&#252;r scheinbar statische, saubere URLs) aktiviert werden, schreibt WordPress eine <tt>.htaccess</tt> mit folgendem Inhalt (gek&#252;rzt):</p>
<div class="igBar"><span id="lcode-3"><a href="#" onclick="javascript:showPlainTxt('code-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-3">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteEngine On</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteBase /</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %<span style="color:#006600; font-weight:bold;">&#123;</span>REQUEST_FILENAME<span style="color:#006600; font-weight:bold;">&#125;</span> !-f</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %<span style="color:#006600; font-weight:bold;">&#123;</span>REQUEST_FILENAME<span style="color:#006600; font-weight:bold;">&#125;</span> !-d</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteRule . /index.<span style="">php</span> <span style="color:#006600; font-weight:bold;">&#91;</span>L<span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Sofern es sich bei der angeforderten Ressource nicht um ein tats&#228;chlich auf dem Webspace vorhandenes Verzeichnis oder File handelt, wird die Anfrage auf die <tt>index.php</tt> umgeschrieben.<br />
Hier &#252;bernimmt dann die Klasse <tt>WP_Rewrite</tt>, die mit eigenen Regelwerk die sonst an <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html">mod_rewrite</a> delegierte Aufgabe &#252;bernimmt statische URLs in dynamische umzusetzen. Geparster PHP-Code ist zwar nicht ansatzweise so effizient wie das in C implementiere und bew&#228;hrte mod_rewrite, bringt aber den entscheidenden Vorteil einer durch Plugins nutzbaren API mit sich. Von der macht der Entwickler des Ultimate Tag Warrior auch Gebrauch, indem er in der Funktion <tt>ultimate_rewrite_rules</tt> (zu finden in der Datei <tt>ultimate-tag-warrior-actions.php</tt>) ein neues Rewrite-Tag registriert und zwei neue Rewrite-Regeln hinzuf&#252;gt. </p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$wp_rewrite</span>-&gt;<span style="color:#006600;">add_rewrite_tag</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'%tag%'</span>, <span style="color:#FF0000;">'([^/]+)'</span>, <span style="color:#FF0000;">'tag='</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// without trailing slash</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rules</span> += <span style="color:#0000FF;">$wp_rewrite</span>-&gt;<span style="color:#006600;">generate_rewrite_rules</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$baseurl</span> . <span style="color:#FF0000;">"%tag%"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// with trailing slash</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rules</span> += <span style="color:#0000FF;">$wp_rewrite</span>-&gt;<span style="color:#006600;">generate_rewrite_rules</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$baseurl</span> . <span style="color:#FF0000;">"%tag%/"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Soweit so gut, funktioniert nur leider nicht. Ich vermutete, dass die von UTW registrierte Rewrite-Regel mit anderen, zuvor hinterlegten, kollidierte. Darum passte ich versuchsweise den Code dahingehend an, dass die UTW-Rewrite-Regeln vor allen anderen abgearbeitete w&#252;rden.</p>
<div class="igBar"><span id="lphp-5"><a href="#" onclick="javascript:showPlainTxt('php-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-5">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$wp_rewrite</span>-&gt;<span style="color:#006600;">add_rewrite_tag</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'%tag%'</span>, <span style="color:#FF0000;">'([^/]+)'</span>, <span style="color:#FF0000;">'tag='</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// without trailing slash</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rules</span> = <span style="color:#0000FF;">$wp_rewrite</span>-&gt;<span style="color:#006600;">generate_rewrite_rules</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$baseurl</span> . <span style="color:#FF0000;">"%tag%"</span><span style="color:#006600; font-weight:bold;">&#41;</span> + <span style="color:#0000FF;">$rules</span>;</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// with trailing slash</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rules</span> = <span style="color:#0000FF;">$wp_rewrite</span>-&gt;<span style="color:#006600;">generate_rewrite_rules</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$baseurl</span> . <span style="color:#FF0000;">"%tag%/"</span><span style="color:#006600; font-weight:bold;">&#41;</span> + <span style="color:#0000FF;">$rules</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Und tats&#228;chlich: Nun sind auch saubere URLs mit dem Ultimate Tag Warrior m&#246;glich. Alles andere scheint auch zu funktionieren. Jedoch ist das weder eine saubere noch befriedigende L&#246;sung. Ich w&#252;sste gerne, warum und mit welchen Regeln die von UTW registrierten zusammensto&#223;en. Mir fehlt es momentan allerdings an Zeit und Lust den Code zu debuggen - zumal ich mir nicht sicher bin, ob UTW kaputt ist, <tt>WP_Rewrite</tt> oder mir nur ein anderes Plugin in die Quere kommt. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2007/04/08/ultimate-tag-warrior-url-rewriting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mr Wong codes wrong</title>
		<link>http://blog.thomas-falkner.de/2007/03/29/mr-wong-codes-wrong/</link>
		<comments>http://blog.thomas-falkner.de/2007/03/29/mr-wong-codes-wrong/#comments</comments>
		<pubDate>Thu, 29 Mar 2007 06:53:05 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Netzwelt]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programmieren]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/2007/03/29/mr-wong-codes-wrong/</guid>
		<description><![CDATA[Mich erschreckt immer mehr, wie dilletantisch proffessionelle Websites mit hohen Bekanntheitsgrad und Besucherzahl implementiert sind. Heute Morgen zum Beispiel hat der Social-Bookmarking-Dienst Mr Wong einen Totalausfall: Das kann passieren, auch bei Profis. Die Frage ist nur, wie man mit solchen Fehlern umgeht. PHP-Fehlermeldungen in einem Produktivsystem &#252;ber den Browser auszugeben, ist eine schlechte Idee. Oftmals [...]]]></description>
			<content:encoded><![CDATA[<p>Mich erschreckt immer mehr, wie dilletantisch proffessionelle Websites mit hohen Bekanntheitsgrad und Besucherzahl implementiert sind. Heute Morgen zum Beispiel hat der <a href="http://de.wikipedia.org/wiki/Social_Bookmarks">Social-Bookmarking</a>-Dienst <a href="http://www.mister-wong.de/">Mr Wong</a> einen Totalausfall:</p>
<p><img src='http://blog.thomas-falkner.de/wp-content/uploads/2007/03/mrwong.png' alt='Mr Wong Fehlermeldung' /></p>
<p>Das kann passieren, auch bei Profis. Die Frage ist nur, wie man mit solchen Fehlern umgeht. PHP-Fehlermeldungen in einem Produktivsystem &#252;ber den Browser auszugeben, ist eine schlechte Idee. Oftmals geben diese Fehlermeldungen Auskunft &#252;ber Implementierungsdetails aus, die einem potentiellen Angreifer Sicherheitsl&#252;cken offenbaren k&#246;nnen. Normale Benutzer k&#246;nnen mit Fehlermeldungen des PHP-Interpreters gar nichts anfangen, darum sollten sie in verst&#228;ndlichen Worten dar&#252;ber informiert werden, warum der Dienst momentan nicht funktioniert. Etwa in der Form von: "Unsere Datenbank ist ausgefallen. Unser Administrator wurde informiert. In K&#252;rze wird der Dienst wieder zur Verf&#252;gung stehen. Wir bitten den Ausfall zu entschuldigen." Und bevor solche Meldungen &#252;berhaupt ausgegeben werden, sollte der Administrator benachrichtigt werden. Mit <a href="http://www.devshed.com/c/a/PHP/Error-Handling-in-PHP-Introducing-Exceptions-in-PHP-5/">Exceptions</a> w&#228;re das alles kein Problem: </p>
<div class="igBar"><span id="lphp-7"><a href="#" onclick="javascript:showPlainTxt('php-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-7">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">try <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Hier kann was schiefgehen!</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> catch <span style="color:#006600; font-weight:bold;">&#40;</span>Exception <span style="color:#0000FF;">$fehler</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Gib was sinnvolles aus, informiere den Sysadmin, don't panic!</span></div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Um keinen Code duplizieren zu m&#252;ssen und Exceptions gezielter behandeln zu k&#246;nnen, lassen sich in PHP5 sogar eigene Exceptions implementieren. Au&#223;erdem bringt die <a href="http://www.php.net/~helly/php/ext/spl/">PHP-SPL</a> vordefinierte <a href="http://www.php.net/~helly/php/ext/spl/classException.html">Exceptionklassen</a> mit. Doch dazu wann anders mehr.</p>
<p>Ironischerweise hat die Agentur hinter Mr Wong vor kurzem eine Stelle f&#252;r PHP-Entwickler <a href="http://www.mister-wong.de/blog/mister-wong-sucht-php-entwickler/2007/01/04/">ausgeschrieben</a>. <img src='http://blog.thomas-falkner.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2007/03/29/mr-wong-codes-wrong/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Professionelle Softwareentwicklung mit PHP5</title>
		<link>http://blog.thomas-falkner.de/2007/03/25/professionelle-softwareentwicklung-mit-php5/</link>
		<comments>http://blog.thomas-falkner.de/2007/03/25/professionelle-softwareentwicklung-mit-php5/#comments</comments>
		<pubDate>Sun, 25 Mar 2007 22:53:29 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[openbooks]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programmieren]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/2007/03/25/professionelle-softwareentwicklung-mit-php5/</guid>
		<description><![CDATA[Der Code der meisten in PHP implementierten Anwendungen ist schlecht. Schlecht bedeutet nicht etwa, dass er nicht funktionieren w&#252;rde. Aber er ist schlecht zu warten, kaum wiederverwendbar und anf&#228;llig f&#252;r Fehler. Die Objektorientierung bietet Paradigmen und Patterns, die konsequent angewandt zu guten Code f&#252;hren, doch bis zu Version 4 wurde ein objektorientierter Ansatz in PHP [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://blog.thomas-falkner.de/wp-content/uploads/2007/03/389864229101_aa137_sclzzzzzzz_.jpg' alt='Professionelle Softwareentwicklung mit PHP5' style="float:right" />Der Code der meisten in PHP implementierten Anwendungen ist schlecht. Schlecht bedeutet nicht etwa, dass er nicht funktionieren w&#252;rde. Aber er ist schlecht zu warten, kaum wiederverwendbar und anf&#228;llig f&#252;r Fehler. Die Objektorientierung bietet Paradigmen und Patterns, die konsequent angewandt zu guten Code f&#252;hren, doch bis zu Version 4 wurde ein objektorientierter Ansatz in PHP gar nicht oder nur nominell unterst&#252;tzt. Seit Version 5 beginnt die popul&#228;re Scriptsprache sich zu professionalisieren, allerdings k&#246;nnen nur wenige Entwicklern einen Nutzen daraus ziehen. Denn viele, wenn nicht die meisten PHP-Programmierer lernten PHP als erste Programmiersprache und sind nicht mit professionellen Entwurfs- und Implementierungstechniken vertraut. Abhilfe schafft das Buch <em>Professionelle Softwareentwicklung mit PHP5</em> von <a href="http://sebastian-bergmann.de/">Sebastian Bergmann</a>: Der Autor richtet sich an den fortgeschrittenen PHP-Entwickler und erl&#228;utert ihm Objektorientierung, Entwurfsmuster und Modellierung mit UML aufs Wesentliche reduziert, abstrakt und doch praxisnah. Wer professionell in PHP entwickeln m&#246;chte, meistert mit diesem Buch den bequemen Einstieg.</p>
<p>Die erste Auflage des Buchs stellt der Autor auf seiner <a href="http://www.professionelle-softwareentwicklung-mit-php5.de/">Website</a> als <a href="http://www.professionelle-softwareentwicklung-mit-php5.de/erste_auflage/">HTML-Version</a> kostenlos zur Verf&#252;gung. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2007/03/25/professionelle-softwareentwicklung-mit-php5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Das PHP-Manual l&#252;gt</title>
		<link>http://blog.thomas-falkner.de/2007/03/06/das-php-manual-luegt/</link>
		<comments>http://blog.thomas-falkner.de/2007/03/06/das-php-manual-luegt/#comments</comments>
		<pubDate>Mon, 05 Mar 2007 23:11:29 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/2007/03/06/das-php-manual-luegt/</guid>
		<description><![CDATA[Gehen wir von folgendem Codeschnippsel aus: PLAIN TEXT PHP: $a = 'a'; $a++; echo $a; &#160; $b = 'a'; $b = $b + 1; echo $b; Wer vermag ohne Ausprobieren zu sagen, welchen Wert $a und welchen Wert $b hat? W&#228;re PHP eine konsistente Programmiersprache, sollten $a und $b den gleiche Wert haben. Gem&#228;&#223; der [...]]]></description>
			<content:encoded><![CDATA[<p>Gehen wir von folgendem Codeschnippsel aus:</p>
<div class="igBar"><span id="lphp-9"><a href="#" onclick="javascript:showPlainTxt('php-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-9">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$a</span> = <span style="color:#FF0000;">'a'</span>;</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$a</span>++;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$a</span>;</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$b</span> = <span style="color:#FF0000;">'a'</span>;</div>
</li>
<li style="font-weight: bold;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$b</span> = <span style="color:#0000FF;">$b</span> + <span style="color:#CC66CC;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:PROJECT;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$b</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Wer vermag ohne Ausprobieren zu sagen, welchen Wert $a und welchen Wert $b hat?<br />
W&#228;re PHP eine konsistente Programmiersprache, sollten $a und $b den gleiche Wert haben. Gem&#228;&#223; der Logik von PHP ist jedoch <code>a == 'b'</code> und <code>b == 1</code>.<br />
Eine Sprache, die zu solchen &#220;berraschungen f&#252;hrt, wird tats&#228;chlich als besonders einsteigerfreundlich gehandelt. Als Argument f&#252;r PHP wird neben der flachen Lernkurve immer wieder auf die hervorragende Dokumentation verwiesen. Wie gut kann wohl ein Manual sein, dass zu oben genannten Ph&#228;nomen folgendes <a href="http://de.php.net/manual/en/language.operators.increment.php">verkl&#228;rt</a>?</p>
<blockquote><p>PHP follows Perl's convention when dealing with arithmetic operations on character variables and not C's. For example, in Perl 'Z'+1 turns into 'AA', while in C 'Z'+1 turns into '[' ( ord('Z') == 90, ord('[') == 91 ). Note that character variables can be incremented but not decremented and even so only plain ASCII characters (a-z and A-Z) are supported.</p></blockquote>
<p>Dass 'Z'+1 'AA' ergeben soll, halte ich f&#252;r eine L&#252;ge.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2007/03/06/das-php-manual-luegt/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP nervt</title>
		<link>http://blog.thomas-falkner.de/2007/02/22/php-nervt/</link>
		<comments>http://blog.thomas-falkner.de/2007/02/22/php-nervt/#comments</comments>
		<pubDate>Thu, 22 Feb 2007 19:58:21 +0000</pubDate>
		<dc:creator>Thomas Falkner</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.thomas-falkner.de/2007/02/22/php-nervt/</guid>
		<description><![CDATA[Gibt es eigentlich irgendeinen logischen Grund, warum es keine einheitliche Namensgebung f&#252;r PHP-Funktionen gibt? Jedes mal sitze ich vor der Tastatur und &#252;berlege, wie denn nun der Funktionsname geschrieben wird. Hei&#223;t es nun stripcslashes oder strip_cslashes? Und wenn es stripcslashes, warum hei&#223;t es dann strip_tags und nicht striptages? Das gleiche Problem bei strtolower und bin2hex. [...]]]></description>
			<content:encoded><![CDATA[<p>Gibt es eigentlich irgendeinen logischen Grund, warum es keine einheitliche Namensgebung f&#252;r PHP-Funktionen gibt? Jedes mal sitze ich vor der Tastatur und &#252;berlege, wie denn nun der Funktionsname geschrieben wird. Hei&#223;t es nun <tt>stripcslashes</tt> oder <tt>strip_cslashes</tt>? Und wenn es <tt><a href="http://www.php.net/manual/de/function.stripcslashes.php">stripcslashes</a></tt>, warum hei&#223;t es dann <tt><a href="http://www.php.net/manual/de/function.strip-tags.php">strip_tags</a></tt> und nicht striptages? Das gleiche Problem bei <tt><a href="http://www.php.net/manual/de/function.strtolower.php">strtolower</a></tt> und <tt><a href="http://www.php.net/manual/de/function.bin2hex.php">bin2hex</a></tt>. Klar: PHP ist eine gewachsene Sprache und wurde von Version zu Version um Funktionalit&#228;t erweitert; da lassen sich Innkonsistenzen nicht immer vermeiden. Aber was hindert das Entwicklerteam daran die Namensgebung zu vereinheitlichen, indem sie Synonyme zulassen und von der Norm abweichenden Funktionsnamen als deprecated kennzeichnen?   </p>
<p>PHP unterst&#252;tzt mittlerweile eine sinnvolle Fehlerbehandlung durch Exceptions - dumm nur, dass kritische Funktionen wie <tt><a href="http://www.php.net/manual/de/function.file.php">file()</a></tt> keine Exception werfen. </p>
<p><a href="http://php.net/~derick/meeting-notes.html">PHP6</a> l&#228;sst zumindest hoffen, dass in kommenden Versionen die Sprache endlich von den Altlasten befreit werden kann. Denn es ist zwar sch&#246;n, dass mensch seit PHP5 fortgeschrittene objektorientierte Implementierungstechniken anwenden kann, aber es macht eben wenig Spa&#223;, diese auf Relikten der strukturierten Programmierung aufsetzen. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thomas-falkner.de/2007/02/22/php-nervt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

