<?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>osCommerce &#187; PHP</title>
	<atom:link href="http://blogs.oscommerce.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.oscommerce.com</link>
	<description>Open Source E-Commerce Solutions</description>
	<lastBuildDate>Sat, 07 Nov 2009 13:52:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ensuring Database Integrity With Foreign Keys</title>
		<link>http://blogs.oscommerce.com/2009/06/18/ensuring-database-integrity-with-foreign-keys/</link>
		<comments>http://blogs.oscommerce.com/2009/06/18/ensuring-database-integrity-with-foreign-keys/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 11:06:07 +0000</pubDate>
		<dc:creator>Harald Ponce de Leon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[osCommerce]]></category>

		<guid isPermaLink="false">http://blogs.oscommerce.com/?p=379</guid>
		<description><![CDATA[The database schema for osCommerce Online Merchant v3.0 has been updated to include foreign key relationships between related tables. This update allows MySQL to natively support foreign keys on InnoDB databases that are directly defined in the database schema, and uses a fallback mechanism for MyISAM databases where foreign key relationships are defined in a [...]]]></description>
			<content:encoded><![CDATA[<p>The database schema for osCommerce Online Merchant v3.0 has been updated to include foreign key relationships between related tables. This update allows MySQL to natively support foreign keys on InnoDB databases that are directly defined in the database schema, and uses a fallback mechanism for MyISAM databases where foreign key relationships are defined in a database table.</p>
<p>Foreign key relationships allows records to be linked together through multiple database tables, for example, linking products to categories. Until now, when a product was to be deleted using the Administration Tool, extra PHP code had to be written within the delete function to also delete entries in other database tables that shared a relationship with the product being deleted.</p>
<p>This is fine for standard installations where the relationships between database tables are known, however when add-ons create new database tables during installation, changes were required in core source code files to also perform database actions on the tables they created.</p>
<p>Now with foreign key relationships, changes to core source code files are no longer required and changes to the related database tables are performed natively on InnoDB databases or automatically through the database class for MyISAM databases. This cleans the codebase considerably and allows one simple query to take care of the whole database. For example:</p>
<p><code>delete from osc_products where products_id = 1</code></p>
<p>This one simple query now automatically takes care of deleting the product language definitions, product reviews, category assignments, special prices, shopping cart entries, and any other product table relationships without any additional queries or PHP code necessary.</p>
<p>The following foreign key constraints are supported for MyISAM databases for both <strong>ON UPDATE</strong> and <strong>ON DELETE</strong> operations:</p>
<ul>
<li><strong>CASCADE</strong>, automatically update or delete child records when a parent record is being updated or deleted (eg, delete all product related information when a product is being deleted)</li>
<li><strong>SET NULL</strong>, automatically sets the child record field value to null when a parent record is being updated or deleted (eg, clear the product manufacturer value when a manufacturer is being deleted)</li>
<li><strong>RESTRICT</strong>, prevents a parent record from being updated or deleted if child records depend on it (eg, don&#8217;t allow order status levels to be deleted if they are in use by orders)</li>
</ul>
<p>Add-On developers can take advantage of foreign keys by defining relationships directly in the database schema for InnoDB databases, and by entering relationships in the osc_fk_relationships table for MyISAM databases. Examples of foreign keys defined in the osc_fk_relationships table are:</p>
<p><img src="http://blogs.oscommerce.com/wp-content/uploads/2009/06/fk.gif" alt="fk" title="fk" width="624" height="99" class="aligncenter size-full wp-image-392" /></p>
<p>The osc_fk_relationships table is only used for MyISAM databases and is used by the database class to check on the defined constraints when <strong>UPDATE</strong> and <strong>DELETE</strong> queries are being performed.</p>
<p>There are currently 68 foreign key relationships defined that will be introduced in the osCommerce Online Merchant v3.0 Beta 1 release.</p>
<p>The changes are currently available in my development branch at GitHub and will be pushed to the main development branch after further testing and code clean up has been performed. My branch is available at:</p>
<p><a href="http://github.com/haraldpdl/oscommerce/" target="_blank">http://github.com/haraldpdl/oscommerce/</a></p>
<p>Documentation on MySQL&#8217;s foreign key implementation can be found here:</p>
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html" target="_blank">http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.oscommerce.com/2009/06/18/ensuring-database-integrity-with-foreign-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error Reporting in osCommerce Online Merchant v3.0 Alpha 5</title>
		<link>http://blogs.oscommerce.com/2009/03/18/error-reporting-in-oscommerce-online-merchant-v30-alpha-5/</link>
		<comments>http://blogs.oscommerce.com/2009/03/18/error-reporting-in-oscommerce-online-merchant-v30-alpha-5/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 14:04:31 +0000</pubDate>
		<dc:creator>Harald Ponce de Leon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[error logging]]></category>

		<guid isPermaLink="false">http://blogs.oscommerce.com/?p=270</guid>
		<description><![CDATA[osCommerce Online Merchant v3.0 Alpha 5 introduces a strict level of error reporting directly in the core framework. This is performed by setting the PHP error reporting setting to E_ALL and by setting the MySQL sql_mode to STRICT_ALL_TABLES at runtime.
All warnings and errors are logged in a text file located in the &#8220;work&#8221; directory and [...]]]></description>
			<content:encoded><![CDATA[<p>osCommerce Online Merchant v3.0 Alpha 5 introduces a strict level of error reporting directly in the core framework. This is performed by setting the PHP error reporting setting to <a href="http://www.php.net/manual/en/errorfunc.constants.php">E_ALL</a> and by setting the MySQL sql_mode to <a href="http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html">STRICT_ALL_TABLES</a> at runtime.</p>
<p>All warnings and errors are logged in a text file located in the &#8220;work&#8221; directory and can be easily viewed in the Administration Tool -> Tools -> Error Log application and summary module.</p>
<p>This is the only Administration Tool application where it&#8217;s a good sign when it doesn&#8217;t show anything. It gives a nice feeling knowing that any sort of warning or error in the core framework has been checked for, from uninitialized PHP variables to problems with MySQL queries.</p>
<p>Setting the error reporting at such strict levels ensures a high quality of coding standards is kept in the core framework and passes this along to add-ons that are developed and installed.</p>
<p>This makes it easier for developers working on addons where they can see where warnings and errors are occuring in what they have been working on, and motivates them to fix the problems to improve the quality of the finalized work.</p>
<p>A configuration parameter will be introduced in v3.0 Beta 1 to disable the output of PHP warnings and errors on the catalog frontend. This allows the output of warnings and errors to occur under development environments, and to be disabled on production servers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.oscommerce.com/2009/03/18/error-reporting-in-oscommerce-online-merchant-v30-alpha-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minimum Requirements for osCommerce Online Merchant v3.0 Alpha 5</title>
		<link>http://blogs.oscommerce.com/2009/03/16/minimum-requirements-for-oscommerce-online-merchant-v30-alpha-5/</link>
		<comments>http://blogs.oscommerce.com/2009/03/16/minimum-requirements-for-oscommerce-online-merchant-v30-alpha-5/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 01:04:43 +0000</pubDate>
		<dc:creator>Harald Ponce de Leon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[osCommerce]]></category>

		<guid isPermaLink="false">http://blogs.oscommerce.com/?p=260</guid>
		<description><![CDATA[osCommerce Online Merchant v3.0 Alpha 5 has taken a big step forward in utilizing newer PHP and MySQL features. The minimum requirements to run v3.0 Alpha 5 are PHP v5.2.0+ and MySQL v4.1.13+ or v5.0.7+. A further requirement is the mysqli extension in PHP as the normal mysql database class was removed from v3.0 Alpha [...]]]></description>
			<content:encoded><![CDATA[<p>osCommerce Online Merchant v3.0 Alpha 5 has taken a big step forward in utilizing newer PHP and MySQL features. The minimum requirements to run v3.0 Alpha 5 are PHP v5.2.0+ and MySQL v4.1.13+ or v5.0.7+. A further requirement is the mysqli extension in PHP as the normal mysql database class was removed from v3.0 Alpha 5.</p>
<p>Both <a href="http://www.php.net/manual/en/mysqli.overview.php">PHP</a> and <a href="http://forge.mysql.com/wiki/Which_PHP_Driver_for_MySQL_should_I_use">MySQL</a> highly recommend the use of the newer mysqli extension over the older mysql extension.</p>
<p>It&#8217;s been <a href="http://forums.oscommerce.com/index.php?s=&#038;showtopic=331314&#038;view=findpost&#038;p=1380316">reported</a> that there are still service providers using MySQL v5.0.67. This is actually fine as it is a much newer version than the minimum requirement of v5.0.7.</p>
<p>To clarify the <a href="http://dev.mysql.com/doc/refman/5.1/en/choosing-version.html">MySQL versioning scheme</a>, the third number in the version string (&#8221;7&#8243;) is incremented for each new release in the release level.</p>
<p>MySQL v5.0.7 was actually a beta released on the <a href="http://lists.mysql.com/announce/289">15th June 2005</a>, and v5.0.67 was released on the <a href="http://lists.mysql.com/announce/542">8th August 2008</a>.</p>
<p>There have also been some reports that some service providers are still using PHP v5.1.6. RedHat Enterprise Linux and CentOS are vendors still using PHP v5.1.6. This is unfortunate as it does not meet the minimum PHP v5.2.0 requirement to install and use osCommerce Online Merchant v3.0 Alpha 5.</p>
<p>PHP v5.2.0 was released on the 2nd November 2006.</p>
<p>The <a href="http://forums.oscommerce.com/index.php?showtopic=331276">first reports</a> of v3.0 Alpha 5 not running properly was due to the use of PHP v5.1.6 which does not contain the <a href="http://www.php.net/json_encode">json_encode()</a> function introduced in PHP v5.2.0. This function is used heavily in the Administration Tool with the new dynamic table listing and live search features.</p>
<p>A <a href="http://www.boutell.com/scripts/jsonwrapper.html">compatibility function</a> exists that might be the saviour to the json_encode() problem for earlier PHP v5.X versions. If you are interested in testing this out, feel free to <a href="https://github.com/osCommerce/oscommerce/tree">fork osCommerce on Github</a> and report back of your findings.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.oscommerce.com/2009/03/16/minimum-requirements-for-oscommerce-online-merchant-v30-alpha-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimizing for PHP 5; Object Visibility</title>
		<link>http://blogs.oscommerce.com/2007/07/20/optimizing-for-php-5-object-visibility/</link>
		<comments>http://blogs.oscommerce.com/2007/07/20/optimizing-for-php-5-object-visibility/#comments</comments>
		<pubDate>Fri, 20 Jul 2007 16:45:44 +0000</pubDate>
		<dc:creator>Harald Ponce de Leon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[osCommerce]]></category>

		<guid isPermaLink="false">http://blogs.oscommerce.com/2007/07/20/optimizing-for-php-5-object-visibility/</guid>
		<description><![CDATA[With our recent announcement of optimizing the osCommerce Online Merchant v3.0 release for PHP 5, I will begin blogging about the changes performed here for the v3.0 Alpha 5 and v3.0 Alpha 6 releases to serve as a guide for our community developers. This should help in understanding how the v3.0 framework is designed and [...]]]></description>
			<content:encoded><![CDATA[<p>With our recent announcement of <a href="http://www.oscommerce.com/about/news,128">optimizing the osCommerce Online Merchant v3.0 release for PHP 5</a>, I will begin blogging about the changes performed here for the v3.0 Alpha 5 and v3.0 Alpha 6 releases to serve as a guide for our community developers. This should help in understanding how the v3.0 framework is designed and how add-ons can take advantage of the optimized framework.</p>
<p><a href="http://www.gophp5.org" target="_blank"><img id="image195" src="http://blogs.oscommerce.com/wp-content/uploads/2007/07/gophp5-100x33.png" alt="gophp5-100x33.png" align="right" hspace="5" vspace="5" /></a>Our decision to optimize the v3.0 framework for PHP 5 is based on the <a href="http://www.php.net/index.php#2007-07-13-1" target="_blank">end of life support cycle for PHP 4</a> which ends at the end of this year. The announcement the PHP Group made regarding this coincides with the efforts of the <a href="http://www.gophp5.org" target="_blank">GoPHP5</a> initiative whom which we are also supporting.</p>
<p>This allows us to concentrate on a PHP 5 optimized framework for future releases in the v3.x release series without the need to spend resources on PHP 4 compatibility past its end of life cycle.</p>
<p>The first PHP 5 optimized commits have already been performed in our development repository which reflects the classes and Object Oriented design of the framework. The new Object Model of PHP 5 allows us to tighten the design of the framework with the use of &#8220;object visibility&#8221;, and will be the first step in optimizing the framework for PHP 5.</p>
<p>Object visibility is in regard to defining class members and methods into three different visibility levels: public, protected, and private, which reflect how they can be accessed from outside the class, within the class, and within its inherited children.</p>
<p>The three levels function as:</p>
<p><b>public</b> &#8211; this element can be accessed from inside and outside the class object<br />
<b>protected</b> &#8211; this element can be accessed from inside the class object and its inherited children<br />
<b>private</b> &#8211; this element can only be accessed from inside the class object</p>
<p>We&#8217;ll take a look at a shortened version of the session class to describe how each three visibility levels work.</p>
<p><code><?php<br />
  class osC_Session {<br />
    protected $_id = null;<br />
    protected $_name = 'osCsid';</p>
<p>    public function __construct($name = null) {<br />
      $this->setName($name);<br />
      $this->_setCookieParameters(SERVICE_SESSION_EXPIRATION_TIME);<br />
    }</p>
<p>    public function getID() {<br />
      return $this->_id;<br />
    }</p>
<p>    public function getName() {<br />
      return $this->_name;<br />
    }</p>
<p>    public function setName($name) {<br />
      session_name($name);</p>
<p>      $this->_name = session_name();<br />
    }</p>
<p>    protected function _setCookieParameters($lifetime = 0, $path = null, $domain = null, $secure = false, $httponly = false) {<br />
      return session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);<br />
    }<br />
  }<br />
?></code></p>
<p>The class members $_id and $_name are both protected and allow only to be accessed from within the class and its inherited children. This disallows accessing these members from outside the class as shown in the following example:</p>
<p><code><?php<br />
  $osC_Session = new osC_Session();</p>
<p>  echo $osC_Session->_id; // not allowed<br />
  $osC_Session->_name = 'test'; // not allowed<br />
?></code></p>
<p>To allow access to these members from outside the class they must be defined with the public visibility level. As we don&#8217;t allow this as part of our coding standards, get and set methods are defined in the class that allow public access to the class members, as shown in the following example:</p>
<p><code><?php<br />
  $osC_Session = new osC_Session();</p>
<p>  echo $osC_Session->getID(); // allowed<br />
  $osC_Session->setName('test'); // allowed<br />
?></code></p>
<p>Accessing the getID() and setName() class methods from outside the class object is allowed as these have been defined with the public visibility level.</p>
<p>On the other hand, the _setCookieParameters() class method is defined with a protected visibility level and cannot be accessed from outside the class object. The _setCookieParameters() class method can therefore only be accessed from within the class and its inherited children, as is being done in the class constructor.</p>
<p>The session implementation in v3.0 (Alpha 5) has been impoved to allow modules to be loaded that define how the storage of the session data is accessed. An example session module is the database module that stores the session data in the database. Each session module is an extension to the osC_Session class and therefore inherits its class members and methods.</p>
<p>This allows the database session module, named osC_Session_database, to access the public and protected class members and methods from the main osC_Session class.</p>
<p>If there were class members and methods defined in the osC_Session class with the private visibility level, its inherited children such as the osC_Session_database class would not be allowed to access it.</p>
<p>The default behaviour in PHP 4 is to allow full public access to all class members and methods. By using the visibility levels PHP 5 provides, it is possible to disallow public access to class members and methods to keep certain functionality for internal use by the framework only.</p>
<p>Further information regarding object visibility levels can be read at the <a href="http://www.php.net/manual/en/language.oop5.visibility.php" target="_blank">PHP Manual</a>.</p>
<p>As each class is being updated in the framework, phpDocumentation is also being written to provide a developers API guide with the v3.0 release, that describes each class member and method. This documentation will be completed during v3.0 Alpha 5 and v3.0 Alpha 6.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.oscommerce.com/2007/07/20/optimizing-for-php-5-object-visibility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BSD Posix Bug In PHP 5.2.1</title>
		<link>http://blogs.oscommerce.com/2007/02/28/bsd-posix-bug-in-php-521/</link>
		<comments>http://blogs.oscommerce.com/2007/02/28/bsd-posix-bug-in-php-521/#comments</comments>
		<pubDate>Wed, 28 Feb 2007 15:40:39 +0000</pubDate>
		<dc:creator>Harald Ponce de Leon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[osCommerce]]></category>

		<guid isPermaLink="false">http://blogs.oscommerce.com/2007/02/28/bsd-posix-bug-in-php-521/</guid>
		<description><![CDATA[There&#8217;s a posix related bug in PHP 5.2.1 that affects BSD systems. The closest bug report is 40410 which was reported for 5.2.1 RC 4 and is marked as closed.
Although 40410 fixed a posix related compilation error, usage of the PHP function posix_getgrgid() in PHP 5.2.1 returns the following fatal error:
Fatal error:  Out of [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a posix related bug in PHP 5.2.1 that affects BSD systems. The closest bug report is <a href="http://bugs.php.net/40410" target="_blank">40410</a> which was reported for 5.2.1 RC 4 and is marked as closed.</p>
<p>Although 40410 fixed a posix related compilation error, usage of the PHP function <a href="http://www.php.net/posix_getgrgid" target="_blank">posix_getgrgid()</a> in PHP 5.2.1 returns the following fatal error:</p>
<p>Fatal error:  Out of memory (allocated 2097152) (tried to allocate -1 bytes) in /tmp/test.php</p>
<p>This was reported to Anthony Dovgal, who took care of 40410, and confirmed that this problem was fixed in 5.2.2-dev (php5.2-200702281330).</p>
<p>I came across this problem today while working on the Administration Tool -> Tools -> File Manager section, which uses the posix_getgrgid() function to display the group owner name of the files and directories. As Mac OS X is based on BSD, it also affected my development environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.oscommerce.com/2007/02/28/bsd-posix-bug-in-php-521/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5.2.0 Compatibility</title>
		<link>http://blogs.oscommerce.com/2006/11/06/php-520-compatibility/</link>
		<comments>http://blogs.oscommerce.com/2006/11/06/php-520-compatibility/#comments</comments>
		<pubDate>Mon, 06 Nov 2006 15:46:07 +0000</pubDate>
		<dc:creator>Harald Ponce de Leon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[osCommerce]]></category>

		<guid isPermaLink="false">http://blogs.oscommerce.com/?p=4</guid>
		<description><![CDATA[PHP 5.2.0 was recently released which &#8220;includes a large number of new features, bug fixes and security enhancements&#8221; to the PHP 5.x series. The PHP Group also published an upgrade guide for existing PHP 5 users that documents the (incompatibility) changes the new release brings.
osCommerce 2.2 Milestone 2 Update 060817 works fine with PHP 5.2.0 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.php.net/releases/5_2_0.php" target="_blank">PHP 5.2.0</a> was recently released which &#8220;includes a large number of new features, bug fixes and security enhancements&#8221; to the PHP 5.x series. The PHP Group also published an <a href="http://www.php.net/UPDATE_5_2.txt" target="_blank">upgrade guide</a> for existing PHP 5 users that documents the (incompatibility) changes the new release brings.</p>
<p>osCommerce 2.2 Milestone 2 Update 060817 works fine with PHP 5.2.0 (with register_globals and register_long_arrays enabled).</p>
<p>There is however one change that 5.2.0 brings in that causes osCommerce 3.0 Alpha 3 to produce a PHP FATAL error in the sessions implementation, specifically when the session data is stored in the database (by default for osCommerce 3.0).</p>
<p>This is due to a change in <a href="http://www.php.net/session_set_save_handler" target="_blank">session_set_save_handler()</a> where the &#8220;write&#8221; and &#8220;close&#8221; handlers are called <b>after</b> objects have been destructed.</p>
<p>As the sessions implementation in osCommerce 3.0 is done in a class/object, writing session data and closing the session are no longer possible as the registered object would be destructed and no longer exist to perform those duties.</p>
<p>The proper solution here is to use <a href="http://www.php.net/session_write_close" target="_blank">session_write_close()</a> in the destructor of the osC_Session class:</p>
<p><code>class osC_Session {<br />
  ...</p>
<p>  function __destruct() {<br />
    session_write_close();<br />
  }<br />
}</code></p>
<p>As <a href="http://www.php.net/language.oop5.decon" target="_blank">__destruct()</a> is a PHP 5 feature only, an alternative solution is needed for PHP 4 compatibility (the minimum requirement for osCommerce 3.0 will be PHP 4.1), and that is to register session_write_close() as a shutdown function:</p>
<p><code>session_set_save_handler(array(&#038;$this, '_open'),<br />
                         array(&#038;$this, '_close'),<br />
                         array(&#038;$this, '_read'),<br />
                         array(&#038;$this, '_write'),<br />
                         array(&#038;$this, '_destroy'),<br />
                         array(&#038;$this, '_gc'));</p>
<p>register_shutdown_function('session_write_close');</code></p>
<p>This has already been reported at our new <a href="http://svn.oscommerce.com/jira/browse/OSC-58" target="_blank">Issue Tracker</a> and has been fixed at <a href="http://svn.oscommerce.com/fisheye/changelog/osCommerce?cs=1107" target="_blank">r1107</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.oscommerce.com/2006/11/06/php-520-compatibility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>String In String Reverse</title>
		<link>http://blogs.oscommerce.com/2006/07/25/string-in-string-reverse/</link>
		<comments>http://blogs.oscommerce.com/2006/07/25/string-in-string-reverse/#comments</comments>
		<pubDate>Tue, 25 Jul 2006 16:27:59 +0000</pubDate>
		<dc:creator>Harald Ponce de Leon</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blogs.oscommerce.com/?p=10</guid>
		<description><![CDATA[I just experienced another nasty PHP4 / PHP5 compatibility issue that plagued the logging features of the support site administration tool (which is planned to be introduced in the 3.0 Alpha 4 release).
The implementation uses the strrpos() function to grab the end of a string from a string searched starting point. The opposite function is [...]]]></description>
			<content:encoded><![CDATA[<p>I just experienced another nasty PHP4 / PHP5 compatibility issue that plagued the logging features of the support site administration tool (which is planned to be introduced in the 3.0 Alpha 4 release).</p>
<p>The implementation uses the <a href="http://www.php.net/strrpos" target="_blank">strrpos()</a> function to grab the end of a string from a string searched starting point. The opposite function is <a href="http://www.php.net/strpos" target="_blank">strpos()</a> that searches from the start of the string instead from the end.</p>
<p>The string to search for, the needle, can be a character or a string for the normal strpos() function in both PHP 4 and PHP 5.</p>
<p>There is however a difference with the strrpos() function where PHP 4 accepts the needle as a character only, and can first be a string from PHP 5 onwards.</p>
<p>This took some time to debug where my local server is running on PHP 5 with the logging features working fine, and the support site running PHP 4 where the issue was first evident.</p>
<p>There is a warning about this on the documentation page which I overlooked during the implementation phase. Such incompatibility warnings should be marked with the infamous &lt;blink&gt; tag so they stand out better <img src='http://blogs.oscommerce.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </p>
<p>The positive side to this is the valuable user comments on the php documentation pages where numerous functions are provided to workaround the problem.</p>
<p>Workaround functions are obviously not elegant solutions to use, and will look at improving the logic further for the 3.0 Alpha 4 release.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.oscommerce.com/2006/07/25/string-in-string-reverse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Constant Bite</title>
		<link>http://blogs.oscommerce.com/2006/05/18/constant-bite/</link>
		<comments>http://blogs.oscommerce.com/2006/05/18/constant-bite/#comments</comments>
		<pubDate>Thu, 18 May 2006 15:22:45 +0000</pubDate>
		<dc:creator>Harald Ponce de Leon</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blogs.oscommerce.com/?p=12</guid>
		<description><![CDATA[It looks like we have to use another compatibility function due to inconsistencies between PHP versions.
For PHP versions below 4.3.5, defined() returns an integer (1 or 0), whereas from 4.3.5 onwards it returns a boolean (true or false).
This makes it impossible for us to use the following:
if (defined('CONSTANT') === true) {
  ...
}
A note has [...]]]></description>
			<content:encoded><![CDATA[<p>It looks like we have to use another compatibility function due to inconsistencies between PHP versions.</p>
<p>For PHP versions below 4.3.5, defined() returns an integer (1 or 0), whereas from 4.3.5 onwards it returns a boolean (true or false).</p>
<p>This makes it impossible for us to use the following:</p>
<p><code>if (defined('CONSTANT') === true) {<br />
  ...<br />
}</code></p>
<p>A note has been added to the PHP documentation page to warn others of this inconsistency.</p>
<p>Relevant bug report:</p>
<p><a href="http://bugs.php.net/bug.php?id=27443" target="_blank">http://bugs.php.net/bug.php?id=27443</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.oscommerce.com/2006/05/18/constant-bite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
