From c62323a40a833d991c091f8cd99bf9a4f29bfc6c Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 1 Aug 2006 12:27:41 +0000 Subject: Changed PHP minimum requirement to 5.1.0 --- HISTORY | 1 + UPGRADE | 3 + .../phing/tasks/BuildPradoPEARPackageTask.php | 30 ++++---- framework/Collections/TDummyDataSource.php | 12 ++- framework/Collections/TList.php | 15 +++- framework/Collections/TMap.php | 15 +++- framework/Collections/TPagedDataSource.php | 12 ++- framework/Collections/TStack.php | 12 ++- framework/PradoBase.php | 86 ++-------------------- framework/Web/THttpRequest.php | 12 ++- framework/Web/THttpSession.php | 15 +++- framework/Web/UI/TTemplateControl.php | 2 +- index.html | 2 +- requirements/index.php | 7 +- requirements/messages-bg.txt | 3 +- requirements/messages-zh.txt | 3 +- requirements/messages.txt | 3 +- .../tickets/protected/pages/Ticket220.page | 2 +- 18 files changed, 115 insertions(+), 120 deletions(-) diff --git a/HISTORY b/HISTORY index 5f38f43e..7e28aaad 100644 --- a/HISTORY +++ b/HISTORY @@ -11,6 +11,7 @@ BUG: Ticket#306 - Prado::localize function may fail when localized string passed BUG: Ticket#311 - Several bugs in TDatePicker (Wei) BUG: Ticket#312 - TDatePicker's ReadOnly property bug (Wei) CHG: Ticket#206 - TBaseValidator.OnValidate is raised only when the validator is visible (Qiang) +CHG: Raised PHP version requirement to 5.1 and above (Qiang) ENH: Ticket#178 - Added TRadioButton.UniqueGroupName property (Qiang) ENH: Ticket#220 - TClientScripts method to import custom javascript files (Wei) ENH: Ticket#225 - TRadioButton::getRadioButtonsInGroup() added (Wei) diff --git a/UPGRADE b/UPGRADE index ae0fcf6b..6e9c262d 100644 --- a/UPGRADE +++ b/UPGRADE @@ -16,6 +16,9 @@ for both A and B. Upgrading from v3.0.2 --------------------- +- The minimum PHP version required is raised to 5.1.0 and above. + If your server is installed with a lower version of PHP, you will + have to upgrade it in order to run PRADO applications. - The signature of TControl::broadcastEvent() is changed from broadcastEvent($sender,TBroadCastEventParameter $param) to broadcastEvent($name,$sender,$param). diff --git a/buildscripts/phing/tasks/BuildPradoPEARPackageTask.php b/buildscripts/phing/tasks/BuildPradoPEARPackageTask.php index 72ad8798..a8128d12 100644 --- a/buildscripts/phing/tasks/BuildPradoPEARPackageTask.php +++ b/buildscripts/phing/tasks/BuildPradoPEARPackageTask.php @@ -8,12 +8,12 @@ require_once 'PEAR/PackageFileManager/File.php'; /** * Task for creating a PEAR package definition file package.xml to be used with * the PEAR distribution of PRADO. - * + * * @author Knut Urdalen * @package phing.tasks.ext */ class BuildPradoPEARPackageTask extends MatchingTask { - + /* Base directory for reading files. */ private $dir; @@ -24,7 +24,7 @@ class BuildPradoPEARPackageTask extends MatchingTask { private $state = 'stable'; private $notes; private $filesets = array(); - + /* Package file */ private $packageFile; @@ -43,21 +43,21 @@ class BuildPradoPEARPackageTask extends MatchingTask { * * @param PEAR_PackageFileManager2 $pkg */ - private function setOptions($pkg) { + private function setOptions($pkg) { $options['baseinstalldir'] = 'prado3'; $options['packagedirectory'] = $this->dir->getAbsolutePath(); - + if(empty($this->filesets)) { throw new BuildException("You must use a tag to specify the files to include in the package.xml"); } - + // Use PEAR_PackageFileManager_Fileset from phing as file list generator $options['filelistgenerator'] = 'Fileset'; - + // Some Phing-specific options needed by our Fileset reader $options['phing_project'] = $this->getProject(); $options['phing_filesets'] = $this->filesets; - + if($this->packageFile !== null) { // Create one with full path $f = new PhingFile($this->packageFile->getAbsolutePath()); @@ -81,7 +81,7 @@ class BuildPradoPEARPackageTask extends MatchingTask { if($this->dir === null) { throw new BuildException("You must specify the \"dir\" attribute for PEAR package task."); } - + if($this->version === null) { throw new BuildException("You must specify the \"version\" attribute for PEAR package task."); } @@ -110,21 +110,21 @@ o Team Integration - PRADO enables separation of content and presentation. Compo $package->setReleaseVersion($this->version); $package->setAPIVersion($this->version); - + $package->setReleaseStability($this->state); $package->setAPIStability($this->state); - + $package->setNotes($this->notes); - + $package->setLicense('BSD', 'http://www.opensource.org/licenses/bsd-license.php'); - + // Add package maintainers $package->addMaintainer('lead', 'qxue', 'Qiang Xue', 'qiang.xue@gmail.com'); $package->addMaintainer('lead', 'jrags', 'Jason Ragsdale', 'jrags@jasrags.net'); $package->addMaintainer('lead', 'knut', 'Knut Urdalen', 'knut.urdalen@gmail.com'); // "core" dependencies - $package->setPhpDep('5.0.4'); + $package->setPhpDep('5.1.0'); $package->setPearinstallerDep('1.4.7'); $package->generateContents(); @@ -175,7 +175,7 @@ o Team Integration - PRADO enables separation of content and presentation. Compo public function setState($v) { $this->state = $v; } - + /** * Sets release notes field. * @param string $v diff --git a/framework/Collections/TDummyDataSource.php b/framework/Collections/TDummyDataSource.php index 46e625ab..d7fee4a9 100644 --- a/framework/Collections/TDummyDataSource.php +++ b/framework/Collections/TDummyDataSource.php @@ -26,7 +26,7 @@ * @package System.Collections * @since 3.0 */ -class TDummyDataSource extends TComponent implements IteratorAggregate +class TDummyDataSource extends TComponent implements IteratorAggregate, Countable { private $_count; @@ -54,6 +54,16 @@ class TDummyDataSource extends TComponent implements IteratorAggregate { return new TDummyDataSourceIterator($this->_count); } + + /** + * Returns the number of (virtual) items in the data source. + * This method is required by Countable interface. + * @return integer number of (virtual) items in the data source. + */ + public function count() + { + return $this->getCount(); + } } /** diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php index 015781cb..1104ec47 100644 --- a/framework/Collections/TList.php +++ b/framework/Collections/TList.php @@ -25,9 +25,8 @@ * unset($list[$index]); // remove the item at $index * if(isset($list[$index])) // if the list has an item at $index * foreach($list as $index=>$item) // traverse each item in the list + * $n=count($list); // returns the number of items in the list * - * Note, count($list) will always return 1. You should use {@link getCount()} - * to determine the number of items in the list. * * To extend TList by doing additional operations with each addition or removal * operation, override {@link insertAt()}, and {@link removeAt()}. @@ -37,7 +36,7 @@ * @package System.Collections * @since 3.0 */ -class TList extends TComponent implements IteratorAggregate,ArrayAccess +class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countable { /** * internal data storage @@ -94,6 +93,16 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess return new TListIterator($this->_d); } + /** + * Returns the number of items in the list. + * This method is required by Countable interface. + * @return integer number of items in the list. + */ + public function count() + { + return $this->getCount(); + } + /** * @return integer the number of items in the list */ diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php index e3a26e5f..ef393866 100644 --- a/framework/Collections/TMap.php +++ b/framework/Collections/TMap.php @@ -24,16 +24,15 @@ * unset($map[$key]); // remove the value with the specified key * if(isset($map[$key])) // if the map contains the key * foreach($map as $key=>$value) // traverse the items in the map + * $n=count($map); // returns the number of items in the map * - * Note, count($map) will always return 1. You should use {@link getCount()} - * to determine the number of items in the map. * * @author Qiang Xue * @version $Revision: $ $Date: $ * @package System.Collections * @since 3.0 */ -class TMap extends TComponent implements IteratorAggregate,ArrayAccess +class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable { /** * @var array internal data storage @@ -84,6 +83,16 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess return new TMapIterator($this->_d); } + /** + * Returns the number of items in the map. + * This method is required by Countable interface. + * @return integer number of items in the map. + */ + public function count() + { + return $this->getCount(); + } + /** * @return integer the number of items in the map */ diff --git a/framework/Collections/TPagedDataSource.php b/framework/Collections/TPagedDataSource.php index 6192b1f7..a2bce9e3 100644 --- a/framework/Collections/TPagedDataSource.php +++ b/framework/Collections/TPagedDataSource.php @@ -28,7 +28,7 @@ * @package System.Collections * @since 3.0 */ -class TPagedDataSource extends TComponent implements IteratorAggregate +class TPagedDataSource extends TComponent implements IteratorAggregate,Countable { /** * @var mixed original data source @@ -182,6 +182,16 @@ class TPagedDataSource extends TComponent implements IteratorAggregate return $this->_pageSize; } + /** + * Returns the number of items in the current page. + * This method is required by Countable interface. + * @return integer number of items in the current page. + */ + public function count() + { + return $this->getCount(); + } + /** * @return integer number of pages */ diff --git a/framework/Collections/TStack.php b/framework/Collections/TStack.php index 79d17902..f1118d90 100644 --- a/framework/Collections/TStack.php +++ b/framework/Collections/TStack.php @@ -31,7 +31,7 @@ * @package System.Collections * @since 3.0 */ -class TStack extends TComponent implements IteratorAggregate +class TStack extends TComponent implements IteratorAggregate,Countable { /** * internal data storage @@ -160,6 +160,16 @@ class TStack extends TComponent implements IteratorAggregate { return $this->_c; } + + /** + * Returns the number of items in the stack. + * This method is required by Countable interface. + * @return integer number of items in the stack. + */ + public function count() + { + return $this->getCount(); + } } /** diff --git a/framework/PradoBase.php b/framework/PradoBase.php index efac53ac..6ce6ad0d 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -563,86 +563,16 @@ class PradoBase } /** - * The following code is meant to fill the gaps between different PHP versions. + * TReflectionClass class. + * This class was originally written to cope with the incompatibility between different PHP versions. + * It is equivalent to ReflectionClass for PHP version >= 5.1.0 + * @author Qiang Xue + * @version $Revision: $ $Date: $ + * @package System + * @since 3.0 */ -if(version_compare(phpversion(),'5.1.0','>=')) +class TReflectionClass extends ReflectionClass { - /** - * TReflectionClass class. - * This class is written to cope with the incompatibility between different PHP versions. - * It is equivalent to ReflectionClass if PHP version >= 5.1.0 - * @author Qiang Xue - * @version $Revision: $ $Date: $ - * @package System - * @since 3.0 - */ - class TReflectionClass extends ReflectionClass - { - } -} -else // PHP < 5.1.0 -{ - /** - * TReflectionClass class. - * This class is written to cope with the incompatibility between different PHP versions. - * It mainly provides a way to detect if a method exists for a given class name. - * - * @author Qiang Xue - * @version $Revision: $ $Date: $ - * @package System - * @since 3.0 - */ - class TReflectionClass extends ReflectionClass - { - /** - * @param string method name - * @return boolean whether the method exists - */ - public function hasMethod($method) - { - try - { - return $this->getMethod($method)!==null; - } - catch(Exception $e) - { - return false; - } - } - - /** - * @param string property name - * @return boolean whether the property exists - */ - public function hasProperty($property) - { - try - { - return $this->getProperty($property)!==null; - } - catch(Exception $e) - { - return false; - } - } - } - - if(!function_exists('property_exists')) - { - /** - * Detects whether an object contains the specified member variable. - * @param object - * @param string member variable (property) name - * @return boolean - */ - function property_exists($object, $property) - { - if(is_object($object)) - return array_key_exists($property, get_object_vars($object)); - else - return false; - } - } } ?> \ No newline at end of file diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index d251f6ab..130dc3cf 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -57,7 +57,7 @@ * @package System.Web * @since 3.0 */ -class THttpRequest extends TApplicationComponent implements IteratorAggregate,ArrayAccess,IModule +class THttpRequest extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule { /** * Separator used to separate GET variable name and value when URL format is Path. @@ -660,6 +660,16 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar return count($this->_items); } + /** + * Returns the number of items in the request. + * This method is required by Countable interface. + * @return integer number of items in the request. + */ + public function count() + { + return $this->getCount(); + } + /** * @return array the key list */ diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php index 4439cf57..19473cda 100644 --- a/framework/Web/THttpSession.php +++ b/framework/Web/THttpSession.php @@ -61,7 +61,7 @@ * @package System.Web * @since 3.0 */ -class THttpSession extends TApplicationComponent implements IteratorAggregate,ArrayAccess,IModule +class THttpSession extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule { /** * @var boolean whether this module has been initialized @@ -139,7 +139,8 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar session_set_save_handler(array($this,'_open'),array($this,'_close'),array($this,'_read'),array($this,'_write'),array($this,'_destroy'),array($this,'_gc')); if($this->_cookie!==null) session_set_cookie_params($this->_cookie->getExpire(),$this->_cookie->getPath(),$this->_cookie->getDomain(),$this->_cookie->getSecure()); - session_start(); + if(ini_get('session.auto_start')!=='1') + session_start(); $this->_started=true; } } @@ -486,6 +487,16 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar return count($_SESSION); } + /** + * Returns the number of items in the session. + * This method is required by Countable interface. + * @return integer number of items in the session. + */ + public function count() + { + return $this->getCount(); + } + /** * @return array the list of session variable names */ diff --git a/framework/Web/UI/TTemplateControl.php b/framework/Web/UI/TTemplateControl.php index c7364d4b..3bbe52c5 100644 --- a/framework/Web/UI/TTemplateControl.php +++ b/framework/Web/UI/TTemplateControl.php @@ -129,7 +129,7 @@ class TTemplateControl extends TCompositeControl */ public function createChildControls() { - if($tpl=$this->getTemplate(true)) + if($tpl=$this->getTemplate()) { foreach($tpl->getDirective() as $name=>$value) { diff --git a/index.html b/index.html index 076be2bb..b353db52 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@ All Rights Reserved.

Requirements

-The sole requirement for PRADO is PHP 5.0.4 or higher. +The sole requirement for PRADO is PHP 5.1.0 or higher. Please run requirement checker to obtain more detailed requirement information.

diff --git a/requirements/index.php b/requirements/index.php index 38f9bc07..14a0f35b 100644 --- a/requirements/index.php +++ b/requirements/index.php @@ -32,13 +32,8 @@ $requirements = array( array( true, - version_compare(PHP_VERSION,"5.0.4",">="), - 'PHP version check', - 'PHP 5.0.4 or higher required'), - array( - false, version_compare(PHP_VERSION,"5.1.0",">="), - 'PHP version check','PHP 5.1.0 or higher preferred'), + 'PHP version check','PHP 5.1.0 or higher required'), array( true, isset($_SERVER["HTTP_ACCEPT"]), diff --git a/requirements/messages-bg.txt b/requirements/messages-bg.txt index ea54f02c..e1be6b5d 100644 --- a/requirements/messages-bg.txt +++ b/requirements/messages-bg.txt @@ -2,8 +2,7 @@ passed with warnings = Конфигурацията на вашия сървър удовлетворява минималните изисквания на PRADO. Моля, обърнете внимание на предупрежденията по-долу. failed = За съжаление, вашият сървър не удовлетворява изискванията на PRADO. PHP version check = Проверка за версията на PHP -PHP 5.0.4 or higher required = Изисква се PHP 5.0.4 или по-висока версия. -PHP 5.1.0 or higher preferred = Препоръчва се PHP 5.1.0 или по-висока версия. Това ще предотврати грешката предизвикана от рекурсивните __get/__set извиквания. +PHP 5.1.0 or higher required = Изисква се PHP 5.1.0 или по-висока версия. SQLite extension check = Проверка за SQLite SQLite extension optional = SQLite разширението е незадължително. Ако не е заредено, няма да можете да ползвате TSqliteCache. Memcache extension check = Проверка за Memcache diff --git a/requirements/messages-zh.txt b/requirements/messages-zh.txt index a64caebe..806d685a 100644 --- a/requirements/messages-zh.txt +++ b/requirements/messages-zh.txt @@ -2,8 +2,7 @@ passed with warnings = 您的服务器配置符合PRADO的最低要求。请关注以下的警告信息。 failed = 对不起,您的服务器配置不符合PRADO的要求。 PHP version check = PHP版本检查 -PHP 5.0.4 or higher required = PRADO需要PHP 5.0.4或更高版本。 -PHP 5.1.0 or higher preferred = PRADO推荐使用PHP 5.1.0或更高版本。它将避免由于递归调用__get/__call引起的错误。 +PHP 5.1.0 or higher required = PRADO需要PHP 5.1.0或更高版本。 SQLite extension check = SQLite模块检查 SQLite extension optional = SQLite模块是可选的。如果它不存在,您将无法使用TSQLiteCache。 Memcache extension check = Memcache模块检查 diff --git a/requirements/messages.txt b/requirements/messages.txt index 83c50dbb..c8761373 100644 --- a/requirements/messages.txt +++ b/requirements/messages.txt @@ -2,8 +2,7 @@ all passed = Congratulations! Your server configuration satisfies all requ passed with warnings = Your server configuration satisfies minimum requirements by PRADO. Please pay attention to the warnings listed below. failed = Sorry, your server configuration does not satisfy the requirements by PRADO. PHP version check = PHP version check -PHP 5.0.4 or higher required = PHP version 5.0.4 or higher is required by PRADO. -PHP 5.1.0 or higher preferred = PHP version 5.1.0 or higher is preferred by PRADO. It eliminates the error caused by recursive __get/__set calls. +PHP 5.1.0 or higher required = PHP version 5.1.0 or higher is required by PRADO. SQLite extension check = SQLite extension check SQLite extension optional = SQLite extension is optional. If it is absent, you will not be able to use TSqliteCache. Memcache extension check = Memcache extension check diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket220.page b/tests/FunctionalTests/tickets/protected/pages/Ticket220.page index d5b6e182..e4c8fa95 100644 --- a/tests/FunctionalTests/tickets/protected/pages/Ticket220.page +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket220.page @@ -16,7 +16,7 @@ - + Event.observe("button1", "click", function() { element = $("<%= $this->label1->ClientID %>"); -- cgit v1.2.3