From 9161f8a32ef09b4eb11e8c854c165a05a592eed4 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Thu, 6 Jun 2002 10:16:42 +0000 Subject: [PATCH] * add PEAR_COMMON_PACKAGE_NAME_PREG constant --- pear/PEAR/Common.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php index b75486e1a2..0c3f495306 100644 --- a/pear/PEAR/Common.php +++ b/pear/PEAR/Common.php @@ -24,7 +24,9 @@ require_once 'Archive/Tar.php'; require_once 'System.php'; require_once 'PEAR/Config.php'; -// {{{ globals +// {{{ constants and globals + +define('PEAR_COMMON_PACKAGE_NAME_PREG', '/^([A-Z][a-zA-Z0-9_]+|[a-z][a-z0-9_]+)$/'); /** * List of temporary files and directories registered by @@ -481,6 +483,7 @@ class PEAR_Common extends PEAR case 'name': switch ($this->prev_element) { case 'package': + // XXX should we check the package name here? $this->pkginfo['package'] = ereg_replace('[^a-zA-Z0-9._]', '_', $data); break; case 'maintainer': @@ -1355,7 +1358,7 @@ class PEAR_Common extends PEAR */ function validPackageName($name) { - return (bool)preg_match('/^[A-Z][A-Za-z0-9_]+$/', $name); + return (bool)preg_match(PEAR_COMMON_PACKAGE_NAME_PREG, $name); } -- 2.40.0