~ubuntu-dev/ubuntu/lucid/php5/lucid-201002101919

« back to all changes in this revision

Viewing changes to ext/filter/tests/045.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-11-06 01:44:25 UTC
  • mfrom: (1.1.15 upstream) (0.3.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106014425-5dsqjhbg303h3kfn
Tags: 5.2.11.dfsg.1-1ubuntu1
* Merge from debian testing, remaining changes:
  - debian/control, debian/rules: Disable a few build dependencies and
    accompanying, binary packages which we do not want to support in main:
    + firebird2-dev/php5-interbase (we have a seperate php-interbase source)
    + libc-client/php5-imap (we have a seperate php-imap source)
    + libmcrypt-dev/php5-mcrypt (seperate php-mycrpt source)
    + readline support again, now that the libedit issue is fixed.
  - debian/control: Add build dependency: libdedit-dev (>= 2.9.cvs.20050518-1)
    CLI readline support.
  - debian/rules:
    + Correctly mangle PHP5_* macros for lpia
  - debian/control:
    + Use libdb-4.6-dev.
    + Rename Vcs-Browser & Vcs-Git to XS-Original-Vcs-Browser & XS-Original-Vcs-Git (LP: #323731).
  - Dropped patches:
    - debian/patches/119-sybase-alias.patch: Use Debian's patch.
    - debian/patches/fix-autoconf-ftbfs.patch: Use Debian's patch
    - debian/patches/fix-zlib-decompression: Already in upstream
  - Use the default pear/install-pear-nozlib.phar in php 5.2.11
  - debian/control: Move php5-suhoshin to Suggests.
  - debian/rules: Fix broken symlink for pear.
  - Dropped dependency on autoconf2.13.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--TEST--
2
 
Options must not be changed by filter_var()
3
 
--SKIPIF--
4
 
<?php if (!extension_loaded("filter")) die("skip"); ?>
5
 
--FILE--
6
 
<?php
7
 
$a = array("flags"=>(string)FILTER_FLAG_ALLOW_HEX, "options" => array("min_range"=>"0", "max_range"=>"1024")); 
8
 
$ret = filter_var("0xff", FILTER_VALIDATE_INT, $a);
9
 
echo ($ret === 255 && $a["options"]["min_range"] === "0")?"ok\n":"bug\n";
10
 
echo ($ret === 255 && $a["options"]["max_range"] === "1024")?"ok\n":"bug\n";
11
 
echo ($ret === 255 && is_string($a["flags"]) && $a["flags"] == FILTER_FLAG_ALLOW_HEX)?"ok\n":"bug\n";
12
 
$a = (string)FILTER_FLAG_ALLOW_HEX;
13
 
$ret = filter_var("0xff", FILTER_VALIDATE_INT, $a);
14
 
echo ($ret === 255 && is_string($a) && $a == FILTER_FLAG_ALLOW_HEX)?"ok\n":"bug\n";
15
 
$a = array("test"=>array("filter"=>(string)FILTER_VALIDATE_INT, "flags"=>(string)FILTER_FLAG_ALLOW_HEX));
16
 
$ret = filter_var_array(array("test"=>"0xff"), $a);
17
 
echo ($ret["test"] === 255 && is_string($a["test"]["filter"]) && $a["test"]["filter"] == FILTER_VALIDATE_INT)?"ok\n":"bug\n";
18
 
echo ($ret["test"] === 255 && is_string($a["test"]["flags"]) && $a["test"]["flags"] == FILTER_FLAG_ALLOW_HEX)?"ok\n":"bug\n";
19
 
$a = array("test"=>(string)FILTER_VALIDATE_INT);
20
 
$ret = filter_var_array(array("test"=>"255"), $a);
21
 
echo ($ret["test"] === 255 && is_string($a["test"]) && $a["test"] == FILTER_VALIDATE_INT)?"ok\n":"bug\n";
22
 
?>
23
 
--EXPECT--
24
 
ok
25
 
ok
26
 
ok
27
 
ok
28
 
ok
29
 
ok
30
 
ok
 
1
--TEST--
 
2
Options must not be changed by filter_var()
 
3
--SKIPIF--
 
4
<?php if (!extension_loaded("filter")) die("skip"); ?>
 
5
--FILE--
 
6
<?php
 
7
$a = array("flags"=>(string)FILTER_FLAG_ALLOW_HEX, "options" => array("min_range"=>"0", "max_range"=>"1024")); 
 
8
$ret = filter_var("0xff", FILTER_VALIDATE_INT, $a);
 
9
echo ($ret === 255 && $a["options"]["min_range"] === "0")?"ok\n":"bug\n";
 
10
echo ($ret === 255 && $a["options"]["max_range"] === "1024")?"ok\n":"bug\n";
 
11
echo ($ret === 255 && is_string($a["flags"]) && $a["flags"] == FILTER_FLAG_ALLOW_HEX)?"ok\n":"bug\n";
 
12
$a = (string)FILTER_FLAG_ALLOW_HEX;
 
13
$ret = filter_var("0xff", FILTER_VALIDATE_INT, $a);
 
14
echo ($ret === 255 && is_string($a) && $a == FILTER_FLAG_ALLOW_HEX)?"ok\n":"bug\n";
 
15
$a = array("test"=>array("filter"=>(string)FILTER_VALIDATE_INT, "flags"=>(string)FILTER_FLAG_ALLOW_HEX));
 
16
$ret = filter_var_array(array("test"=>"0xff"), $a);
 
17
echo ($ret["test"] === 255 && is_string($a["test"]["filter"]) && $a["test"]["filter"] == FILTER_VALIDATE_INT)?"ok\n":"bug\n";
 
18
echo ($ret["test"] === 255 && is_string($a["test"]["flags"]) && $a["test"]["flags"] == FILTER_FLAG_ALLOW_HEX)?"ok\n":"bug\n";
 
19
$a = array("test"=>(string)FILTER_VALIDATE_INT);
 
20
$ret = filter_var_array(array("test"=>"255"), $a);
 
21
echo ($ret["test"] === 255 && is_string($a["test"]) && $a["test"] == FILTER_VALIDATE_INT)?"ok\n":"bug\n";
 
22
?>
 
23
--EXPECT--
 
24
ok
 
25
ok
 
26
ok
 
27
ok
 
28
ok
 
29
ok
 
30
ok