Exemple #1
0
 /**
  * Creates a URL query from a query string or as empty.
  *
  * Just like in any valid URL, a provided query string is not expected to contain characters that cannot be
  * represented literally and percent-encoding is expected to be used for any such characters. The query string
  * should not contain a leading "?" because it's rather a delimiter that is used to separate the query string from
  * the preceding URL part.
  *
  * @param  string $queryString **OPTIONAL. Default is** *create an empty URL query*. The source query string.
  * @param  reference $parsingWasFruitful **OPTIONAL. OUTPUT.** After the object is constructed, this parameter,
  * which is of type `bool`, tells whether the parsing of the query string resulted in any valid fields.
  */
 public function __construct($queryString = null, &$parsingWasFruitful = null)
 {
     assert('!isset($queryString) || is_cstring($queryString)', vs(isset($this), get_defined_vars()));
     if (isset($queryString)) {
         if (!CString::isEmpty($queryString)) {
             // Before parsing, normalize field delimiters to the default one (e.g. make ";" to be "&").
             $delimiters = CString::splitIntoChars(self::$ms_fieldDelimiters);
             $fields = CString::split($queryString, $delimiters);
             $queryString = CArray::join($fields, self::$ms_fieldDelimiters[0]);
             // Parse the query string.
             parse_str($queryString, $this->m_query);
             if (!is_cmap($this->m_query)) {
                 $this->m_query = CMap::make();
             }
             // Recursively convert any PHP's associative array with sequential keys into a CArray.
             foreach ($this->m_query as &$value) {
                 $value = self::recurseQueryValueAfterParsing($value, 0);
             }
             unset($value);
         } else {
             $this->m_query = CMap::make();
         }
         $parsingWasFruitful = !CMap::isEmpty($this->m_query);
     } else {
         $this->m_query = CMap::make();
     }
 }
Exemple #2
0
 /**
  * Returns the keyword-value pairs of a locale.
  *
  * @return CMapObject The locale's keyword-value pairs, with values of type `CUStringObject`.
  */
 public function keywords()
 {
     assert('$this->hasKeywords()', vs(isset($this), get_defined_vars()));
     $keywords = Locale::getKeywords($this->m_name);
     return oop_m(is_cmap($keywords) ? $keywords : CMap::make());
 }
Exemple #3
0
 /**
  * Unites two or more arrays together and returns the new array.
  *
  * The arrays that need to be united are passed as arguments to this method. The order in which the arrays are
  * passed determines the order of elements in the resulting array.
  *
  * None of the source arrays is modified by this method.
  *
  * @return CArray The union array.
  */
 public static function union()
 {
     $funcNumArgs = func_num_args();
     assert('$funcNumArgs >= 2', vs(isset($this), get_defined_vars()));
     $resArray = CMap::make();
     $arguments = func_get_args();
     foreach ($arguments as $array) {
         assert('is_carray($array)', vs(isset($this), get_defined_vars()));
         $array = splarray($array);
         $resArray = array_merge($resArray, self::toPArray($array));
     }
     return self::fromPArray($resArray);
 }
Exemple #4
0
 public function leaveNode(PhpParser\Node $node)
 {
     if ($node->hasAttribute("_insertGetMMethodAfterMe") || $node->hasAttribute("_insertSetMMethodAfterMe")) {
         $statements = [$node];
         if ($node->hasAttribute("_insertGetMMethodAfterMe")) {
             $subStatements = CMap::make();
             $len = CArray::length($this->m_propsToWrap);
             for ($i = 0; $i < $len; $i++) {
                 $propName = $this->m_propsToWrap[$i];
                 $subCondition = new PhpParser\Node\Expr\BooleanNot(new PhpParser\Node\Expr\FuncCall(new PhpParser\Node\Name(self::$ms_isFwCallFuncName)));
                 $return0 = new PhpParser\Node\Stmt\Return_(new PhpParser\Node\Expr\PropertyFetch(new PhpParser\Node\Expr\Variable("this"), $propName));
                 $return1 = new PhpParser\Node\Stmt\Return_(new PhpParser\Node\Expr\FuncCall(new PhpParser\Node\Name(self::$ms_toOopFuncName), [new PhpParser\Node\Expr\PropertyFetch(new PhpParser\Node\Expr\Variable("this"), $propName)]));
                 $else = new PhpParser\Node\Stmt\Else_([$return1]);
                 $subIf = new PhpParser\Node\Stmt\If_($subCondition, ["stmts" => [$return0], "else" => $else]);
                 $condition = new PhpParser\Node\Expr\BinaryOp\Identical(new PhpParser\Node\Expr\Variable("name"), new PhpParser\Node\Scalar\String($propName));
                 $if = new PhpParser\Node\Stmt\If_($condition, ["stmts" => [$subIf]]);
                 CMap::insertValue($subStatements, $if);
             }
             $method = new PhpParser\Node\Stmt\ClassMethod("__get", ["type" => PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC, "byRef" => true, "params" => [new PhpParser\Node\Param("name")], "stmts" => $subStatements]);
             CMap::insertValue($statements, $method);
         }
         if ($node->hasAttribute("_insertSetMMethodAfterMe")) {
             $subStatements = CMap::make();
             $len = CArray::length($this->m_propsToWrap);
             for ($i = 0; $i < $len; $i++) {
                 $propName = $this->m_propsToWrap[$i];
                 $subCondition = new PhpParser\Node\Expr\BooleanNot(new PhpParser\Node\Expr\FuncCall(new PhpParser\Node\Name(self::$ms_isFwCallFuncName)));
                 $assignment0 = new PhpParser\Node\Expr\Assign(new PhpParser\Node\Expr\PropertyFetch(new PhpParser\Node\Expr\Variable("this"), $propName), new PhpParser\Node\Expr\Variable("value"));
                 $assignment1 = new PhpParser\Node\Expr\Assign(new PhpParser\Node\Expr\PropertyFetch(new PhpParser\Node\Expr\Variable("this"), $propName), new PhpParser\Node\Expr\FuncCall(new PhpParser\Node\Name(self::$ms_fromOopFuncName), [new PhpParser\Node\Expr\Variable("value")]));
                 $else = new PhpParser\Node\Stmt\Else_([$assignment1]);
                 $subIf = new PhpParser\Node\Stmt\If_($subCondition, ["stmts" => [$assignment0], "else" => $else]);
                 $condition = new PhpParser\Node\Expr\BinaryOp\Identical(new PhpParser\Node\Expr\Variable("name"), new PhpParser\Node\Scalar\String($propName));
                 $if = new PhpParser\Node\Stmt\If_($condition, ["stmts" => [$subIf]]);
                 CMap::insertValue($subStatements, $if);
             }
             $method = new PhpParser\Node\Stmt\ClassMethod("__set", ["type" => PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC, "params" => [new PhpParser\Node\Param("name"), new PhpParser\Node\Param("value")], "stmts" => $subStatements]);
             CMap::insertValue($statements, $method);
         }
         return $statements;
     }
 }
Exemple #5
0
 /**
  * Adds the email address and, optionally, the name of a "blind carbon copy" recipient who should receive a copy of
  * a message so that this recipient is not visible to any other recipients.
  *
  * @param  string $address The email address of the recipient.
  * @param  string $name **OPTIONAL.** The name of the recipient.
  *
  * @return void
  */
 public function addBcc($address, $name = null)
 {
     assert('is_cstring($address) && (!isset($name) || is_cstring($name))', vs(isset($this), get_defined_vars()));
     if (!isset($this->m_bcc)) {
         $this->m_bcc = CMap::make();
     }
     if (!isset($name)) {
         CMap::insertValue($this->m_bcc, $address);
     } else {
         $this->m_bcc[$address] = $name;
     }
 }
 /**
  * @ignore
  */
 public function setInternalOptions(&$success, $cookiesFp = null, $newCookieSession = null)
 {
     $success = true;
     if ($this->m_hasError) {
         $success = false;
         $this->finalize();
         return;
     }
     $options = CMap::make();
     // How to deal with the response.
     if (!$this->m_echoResponse) {
         $options[CURLOPT_RETURNTRANSFER] = true;
         $this->m_isReturnTransferSet = true;
     } else {
         $options[CURLOPT_RETURNTRANSFER] = false;
         $this->m_isReturnTransferSet = false;
     }
     if (isset($this->m_verboseOutput) && $this->m_verboseOutput) {
         $options[CURLOPT_VERBOSE] = true;
     }
     // The destination URL and port.
     $options[CURLOPT_URL] = $this->m_url;
     if (isset($this->m_port)) {
         $options[CURLOPT_PORT] = $this->m_port;
     }
     // Avoid response caching and reuse, which might happen because of any unconventional caching strategies used
     // by cURL.
     $options[CURLOPT_FORBID_REUSE] = true;
     $options[CURLOPT_FRESH_CONNECT] = true;
     if ($this->m_type != self::HTTP_HEAD) {
         $options[CURLOPT_HEADER] = false;
     }
     if ($this->isHttp()) {
         if ($this->m_type == self::HTTP_GET) {
             $options[CURLOPT_HTTPGET] = true;
         } else {
             if ($this->m_type == self::HTTP_DOWNLOAD || $this->m_type == self::ANY_DOWNLOAD) {
                 $options[CURLOPT_HTTPGET] = true;
                 assert('isset($this->m_downloadDestinationFp)', vs(isset($this), get_defined_vars()));
                 $this->m_downloadFile = new CFile($this->m_downloadDestinationFp, CFile::WRITE_NEW);
                 $options[CURLOPT_FILE] = $this->m_downloadFile->systemResource();
             } else {
                 if ($this->m_type == self::HTTP_POST) {
                     // POST.
                     $options[CURLOPT_POST] = true;
                     // At least one POST variable needs to be set in order to make a POST request.
                     assert('isset($this->m_postQuery)', vs(isset($this), get_defined_vars()));
                     // POST variables use the same format as the query string (application/x-www-form-urlencoded).
                     $options[CURLOPT_POSTFIELDS] = $this->m_postQuery->queryString();
                 } else {
                     if ($this->m_type == self::HTTP_UPLOAD) {
                         // File upload via POST and using the CURLFile class.
                         $options[CURLOPT_POST] = true;
                         assert('isset($this->m_postFileUploadRecord)', vs(isset($this), get_defined_vars()));
                         $options[CURLOPT_POSTFIELDS] = $this->m_postFileUploadRecord;
                     } else {
                         if ($this->m_type == self::HTTP_PUT) {
                             // PUT.
                             assert('isset($this->m_nonPostFileUploadFp)', vs(isset($this), get_defined_vars()));
                             $options[CURLOPT_PUT] = true;
                             $this->m_uploadFile = new CFile($this->m_nonPostFileUploadFp, CFile::READ);
                             $options[CURLOPT_INFILE] = $this->m_uploadFile->systemResource();
                             $options[CURLOPT_INFILESIZE] = CFile::size($this->m_nonPostFileUploadFp);
                         } else {
                             if ($this->m_type == self::HTTP_DELETE) {
                                 // DELETE.
                                 $options[CURLOPT_CUSTOMREQUEST] = "DELETE";
                             } else {
                                 if ($this->m_type == self::HTTP_HEAD) {
                                     // HEAD.
                                     $options[CURLOPT_HEADER] = true;
                                     $options[CURLOPT_NOBODY] = true;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         // HTTP redirections.
         $options[CURLOPT_FOLLOWLOCATION] = $this->m_redirection;
         if ($this->m_redirection) {
             if (isset($this->m_maxNumRedirections)) {
                 $options[CURLOPT_MAXREDIRS] = $this->m_maxNumRedirections;
             }
             if (isset($this->m_redirectionAutoReferer)) {
                 $options[CURLOPT_AUTOREFERER] = $this->m_redirectionAutoReferer;
             }
             if (isset($this->m_redirectionKeepAuth)) {
                 $options[CURLOPT_UNRESTRICTED_AUTH] = $this->m_redirectionKeepAuth;
             }
         }
         // HTTP response code treatment.
         $options[CURLOPT_FAILONERROR] = $this->m_failOn400ResponseCodeOrGreater;
         // HTTP headers.
         if ($this->m_sendDefaultAcceptEncodingHeader && !(isset($this->m_requestHeaders) && $this->hasHeader(CHttpRequest::ACCEPT_ENCODING))) {
             $options[CURLOPT_ENCODING] = "";
         }
         if ($this->m_sendDefaultUserAgentHeader && !(isset($this->m_requestHeaders) && $this->hasHeader(CHttpRequest::USER_AGENT))) {
             $userAgent = self::$ms_defaultUserAgent;
             $curlVersion = self::curlVersion();
             $sslVersion = self::openSslVersion();
             $sslVersion = CRegex::remove($sslVersion, "/OpenSSL(\\/|\\h+)/i");
             $userAgent = CString::replaceCi($userAgent, "curl/x.x.x", "curl/{$curlVersion}");
             $userAgent = CString::replaceCi($userAgent, "libcurl x.x.x", "libcurl {$curlVersion}");
             $userAgent = CString::replaceCi($userAgent, "OpenSSL x.x.x", "OpenSSL {$sslVersion}");
             $this->addHeader(CHttpRequest::USER_AGENT, $userAgent);
         }
         if (isset($this->m_requestHeaders) && !CArray::isEmpty($this->m_requestHeaders)) {
             $options[CURLOPT_HTTPHEADER] = CArray::toPArray($this->m_requestHeaders);
         }
         if (isset($this->m_requestCookies) && !CArray::isEmpty($this->m_requestCookies)) {
             // Custom HTTP cookies.
             $cookieHeaderValue = CArray::join($this->m_requestCookies, "; ");
             $options[CURLOPT_COOKIE] = $cookieHeaderValue;
         }
         if (isset($cookiesFp)) {
             $options[CURLOPT_COOKIEFILE] = $cookiesFp;
             $options[CURLOPT_COOKIEJAR] = $cookiesFp;
         }
         if (isset($newCookieSession) && $newCookieSession) {
             $options[CURLOPT_COOKIESESSION] = true;
         }
         // Needed for the retrieval of information regarding the data transfer after it is complete.
         $options[CURLINFO_HEADER_OUT] = true;
         // Needed for the retrieval of response headers.
         $options[CURLOPT_HEADERFUNCTION] = [$this, "headerFunction"];
         if (isset($this->m_userAndPassword)) {
             // HTTP authentication. Let cURL pick any authentication method it finds suitable (it will
             // automatically select the one it finds most secure).
             $options[CURLOPT_HTTPAUTH] = CURLAUTH_ANY;
         }
     } else {
         if ($this->m_type == self::FTP_LIST) {
             $options[CURLOPT_FTPLISTONLY] = true;
         } else {
             if ($this->m_type == self::FTP_DOWNLOAD || $this->m_type == self::ANY_DOWNLOAD) {
                 assert('isset($this->m_downloadDestinationFp)', vs(isset($this), get_defined_vars()));
                 $this->m_downloadFile = new CFile($this->m_downloadDestinationFp, CFile::WRITE_NEW);
                 $options[CURLOPT_FILE] = $this->m_downloadFile->systemResource();
             } else {
                 if ($this->m_type == self::FTP_UPLOAD) {
                     // File upload via FTP.
                     assert('isset($this->m_nonPostFileUploadFp)', vs(isset($this), get_defined_vars()));
                     $this->m_uploadFile = new CFile($this->m_nonPostFileUploadFp, CFile::READ);
                     $options[CURLOPT_UPLOAD] = true;
                     $options[CURLOPT_INFILE] = $this->m_uploadFile->systemResource();
                     $options[CURLOPT_INFILESIZE] = CFile::size($this->m_nonPostFileUploadFp);
                     if ($this->m_ftpCreateMissingDirectoriesForUpload) {
                         $options[CURLOPT_FTP_CREATE_MISSING_DIRS] = true;
                     }
                     if (isset($this->m_ftpAppendUpload) && $this->m_ftpAppendUpload) {
                         $options[CURLOPT_FTPAPPEND] = true;
                     }
                 }
             }
         }
         if (isset($this->m_ftpQuoteCommands) && !CArray::isEmpty($this->m_ftpQuoteCommands)) {
             $options[CURLOPT_QUOTE] = CArray::toPArray($this->m_ftpQuoteCommands);
         }
         if (isset($this->m_ftpPostQuoteCommands) && !CArray::isEmpty($this->m_ftpPostQuoteCommands)) {
             $options[CURLOPT_POSTQUOTE] = CArray::toPArray($this->m_ftpPostQuoteCommands);
         }
         if (isset($this->m_ftpUseEpsv) && !$this->m_ftpUseEpsv) {
             $options[CURLOPT_FTP_USE_EPSV] = false;
         }
         if (isset($this->m_ftpActiveModeBackAddress)) {
             $options[CURLOPT_FTPPORT] = $this->m_ftpActiveModeBackAddress;
         }
         if (isset($this->m_ftpUseEprt) && !$this->m_ftpUseEprt) {
             $options[CURLOPT_FTP_USE_EPRT] = false;
         }
     }
     // Timeouts.
     if (isset($this->m_requestTimeoutSeconds)) {
         $options[CURLOPT_TIMEOUT] = $this->m_requestTimeoutSeconds;
     }
     if (isset($this->m_connectionTimeoutSeconds)) {
         $options[CURLOPT_CONNECTTIMEOUT] = $this->m_connectionTimeoutSeconds;
     }
     if (isset($this->m_dnsCacheTimeoutSeconds)) {
         $options[CURLOPT_DNS_CACHE_TIMEOUT] = $this->m_dnsCacheTimeoutSeconds;
     }
     // The byte range(s) of interest.
     if (isset($this->m_requestedByteRange)) {
         $options[CURLOPT_RANGE] = $this->m_requestedByteRange;
     }
     // SSL certificate verification options.
     $options[CURLOPT_SSL_VERIFYPEER] = $this->m_certificateVerification;
     if (isset($this->m_alternateCertificateFpOrDp)) {
         if (CFile::isFile($this->m_alternateCertificateFpOrDp)) {
             $options[CURLOPT_CAINFO] = $this->m_alternateCertificateFpOrDp;
         } else {
             if (CFile::isDirectory($this->m_alternateCertificateFpOrDp)) {
                 $options[CURLOPT_CAPATH] = $this->m_alternateCertificateFpOrDp;
             } else {
                 assert('false', vs(isset($this), get_defined_vars()));
             }
         }
     }
     if (!$this->m_hostVerification) {
         // The default should be the highest setting, so only set this option to `0` if host verification is
         // disabled.
         $options[CURLOPT_SSL_VERIFYHOST] = 0;
     }
     if (isset($this->m_userAndPassword)) {
         $options[CURLOPT_USERPWD] = $this->m_userAndPassword;
     }
     // SSL options.
     if (isset($this->m_sslCertificateFp)) {
         $options[CURLOPT_SSLCERT] = $this->m_sslCertificateFp;
     }
     if (isset($this->m_sslPrivateKeyFp)) {
         $options[CURLOPT_SSLKEY] = $this->m_sslPrivateKeyFp;
     }
     if (isset($this->m_sslCertificateFormat)) {
         $options[CURLOPT_SSLCERTTYPE] = $this->m_sslCertificateFormat;
     }
     if (isset($this->m_sslPrivateKeyFormat)) {
         $options[CURLOPT_SSLKEYTYPE] = $this->m_sslPrivateKeyFormat;
     }
     if (isset($this->m_sslCertificatePassphrase)) {
         $options[CURLOPT_SSLCERTPASSWD] = $this->m_sslCertificatePassphrase;
     }
     if (isset($this->m_sslPrivateKeyPassphrase)) {
         $options[CURLOPT_SSLKEYPASSWD] = $this->m_sslPrivateKeyPassphrase;
     }
     if (isset($this->m_sslVersion)) {
         $options[CURLOPT_SSLVERSION] = $this->m_sslVersion;
     }
     if (isset($this->m_sslCipherList)) {
         $options[CURLOPT_SSL_CIPHER_LIST] = $this->m_sslCipherList;
     }
     if (isset($this->m_sslEngine)) {
         $options[CURLOPT_SSLENGINE] = $this->m_sslEngine;
     }
     if (isset($this->m_sslDefaultEngine)) {
         $options[CURLOPT_SSLENGINE_DEFAULT] = $this->m_sslDefaultEngine;
     }
     if (isset($this->m_useKerberos) && $this->m_useKerberos) {
         $options[CURLOPT_KRBLEVEL] = $this->m_kerberosLevel;
     }
     if (isset($this->m_proxyAddress)) {
         // Use a proxy.
         $options[CURLOPT_PROXY] = $this->m_proxyAddress;
         if (isset($this->m_proxyUserAndPassword)) {
             $options[CURLOPT_PROXYUSERPWD] = $this->m_proxyUserAndPassword;
         }
         if (isset($this->m_proxyType)) {
             $proxyType;
             switch ($this->m_proxyType) {
                 case self::PROXY_HTTP:
                     $proxyType = CURLPROXY_HTTP;
                     break;
                 case self::PROXY_SOCKS_5:
                     $proxyType = CURLPROXY_SOCKS5;
                     break;
                 default:
                     assert('false', vs(isset($this), get_defined_vars()));
                     break;
             }
             $options[CURLOPT_PROXYTYPE] = $proxyType;
         }
         if (isset($this->m_proxyPort)) {
             $options[CURLOPT_PROXYPORT] = $this->m_proxyPort;
         }
         if (isset($this->m_proxyTunneling) && $this->m_proxyTunneling) {
             $options[CURLOPT_HTTPPROXYTUNNEL] = true;
         }
         if (isset($this->m_proxyConnectOnly) && $this->m_proxyConnectOnly) {
             $options[CURLOPT_CONNECT_ONLY] = true;
         }
     }
     if (isset($this->m_outgoingInterface)) {
         $options[CURLOPT_INTERFACE] = $this->m_outgoingInterface;
     }
     // Speed limits.
     if (isset($this->m_maxDownloadSpeed)) {
         $options[CURLOPT_MAX_RECV_SPEED_LARGE] = $this->m_maxDownloadSpeed;
     }
     if (isset($this->m_maxUploadSpeed)) {
         $options[CURLOPT_MAX_SEND_SPEED_LARGE] = $this->m_maxUploadSpeed;
     }
     // Set cURL options.
     $res = curl_setopt_array($this->m_curl, $options);
     if (!$res || !CString::isEmpty(curl_error($this->m_curl))) {
         // Should never get in here as long as cURL options are being set correctly, hence the assertion.
         assert('false', vs(isset($this), get_defined_vars()));
         $this->m_hasError = true;
         $curlError = curl_error($this->m_curl);
         $this->m_errorMessage = !CString::isEmpty($curlError) ? $curlError : "The 'curl_setopt_array' function failed.";
         $success = false;
         $this->finalize();
         return;
     }
 }
Exemple #7
0
 public function testFindScalar()
 {
     $map = ["one" => "a", "two" => "b", "three" => "c", "four" => "d", "five" => "e"];
     $found = CMap::findScalar($map, "c");
     $this->assertTrue($found);
     $foundUnderKey;
     $found = CMap::findScalar($map, "d", $foundUnderKey);
     $this->assertTrue($found);
     $this->assertTrue($foundUnderKey === "four");
     $found = CMap::findScalar($map, "C");
     $this->assertFalse($found);
     $found = CMap::findScalar($map, "f");
     $this->assertFalse($found);
     // Special case.
     $map = CMap::make();
     $found = CMap::findScalar($map, "a");
     $this->assertFalse($found);
 }
 /**
  * Creates a filter suited for a specified data type to be outputted.
  *
  * @param  enum $expectedType The output data type that is expected (see [Summary](#summary)).
  * @param  mixed $collectionInputFilters **OPTIONAL.** *Required only when the expected type is `CARRAY` or
  * `CMAP`*. The array or map containing the filters to be applied to the elements in the input array if the
  * expected type is `CARRAY` or to the values in the input map if the expected type is `CMAP`. If the input value
  * is going to be an array, the number of filters in this parameter should match the length of the input array, and
  * if the input value is going to be a map, the keys in this parameter should match the keys in the input map. Same
  * as input arrays and maps, this parameter can be multidimensional in order to correspond with the input value.
  */
 public function __construct($expectedType, $collectionInputFilters = null)
 {
     assert('is_enum($expectedType) && !($expectedType != self::CARRAY && $expectedType != self::CMAP && ' . 'isset($collectionInputFilters)) && !($expectedType == self::CARRAY && ' . '!is_carray($collectionInputFilters)) && !($expectedType == self::CMAP && ' . '!is_cmap($collectionInputFilters))', vs(isset($this), get_defined_vars()));
     $this->m_expectedType = $expectedType;
     $this->m_collectionInputFilters = $collectionInputFilters;
     switch ($expectedType) {
         case self::BOOL:
             $this->m_defaultValue = false;
             break;
         case self::INT:
             $this->m_defaultValue = 0;
             break;
         case self::FLOAT:
             $this->m_defaultValue = 0.0;
             break;
         case self::CSTRING:
         case self::CUSTRING:
             $this->m_defaultValue = "";
             break;
         case self::CARRAY:
             $this->m_defaultValue = CArray::make();
             break;
         case self::CMAP:
             $this->m_defaultValue = CMap::make();
             break;
         case self::EMAIL:
         case self::URL:
         case self::IP:
             $this->m_defaultValue = "";
             break;
         default:
             assert('false', vs(isset($this), get_defined_vars()));
             break;
     }
 }