Annotation of embedaddon/php/ext/posix/tests/posix_strerror_variation1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test posix_strerror() function : usage variations
! 3: --SKIPIF--
! 4: <?php
! 5: if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
! 6: ?>
! 7: --FILE--
! 8: <?php
! 9: /* Prototype : proto string posix_strerror(int errno)
! 10: * Description: Retrieve the system error message associated with the given errno.
! 11: * Source code: ext/posix/posix.c
! 12: * Alias to functions:
! 13: */
! 14:
! 15: echo "*** Testing posix_strerror() : usage variations ***\n";
! 16:
! 17: // Initialise function arguments not being substituted (if any)
! 18:
! 19: //get an unset variable
! 20: $unset_var = 10;
! 21: unset ($unset_var);
! 22:
! 23: //array of values to iterate over
! 24: $values = array(
! 25:
! 26: // float data
! 27: 10.5,
! 28: -10.5,
! 29: 10.1234567e10,
! 30: 10.7654321E-10,
! 31: .5,
! 32:
! 33: // array data
! 34: array(),
! 35: array(0),
! 36: array(1),
! 37: array(1, 2),
! 38: array('color' => 'red', 'item' => 'pen'),
! 39:
! 40: // null data
! 41: NULL,
! 42: null,
! 43:
! 44: // boolean data
! 45: true,
! 46: false,
! 47: TRUE,
! 48: FALSE,
! 49:
! 50: // empty data
! 51: "",
! 52: '',
! 53:
! 54: // string data
! 55: "string",
! 56: 'string',
! 57:
! 58: // undefined data
! 59: $undefined_var,
! 60:
! 61: // unset data
! 62: $unset_var,
! 63:
! 64: // object data
! 65: new stdclass(),
! 66: );
! 67:
! 68: // loop through each element of the array for errno
! 69:
! 70: foreach($values as $value) {
! 71: echo "\nArg value $value \n";
! 72: echo gettype( posix_strerror($value) )."\n";
! 73: };
! 74:
! 75: echo "Done";
! 76: ?>
! 77: --EXPECTF--
! 78: *** Testing posix_strerror() : usage variations ***
! 79:
! 80: Notice: Undefined variable: undefined_var in %s on line %d
! 81:
! 82: Notice: Undefined variable: unset_var in %s on line %d
! 83:
! 84: Arg value 10.5
! 85: string
! 86:
! 87: Arg value -10.5
! 88: string
! 89:
! 90: Arg value 101234567000
! 91: string
! 92:
! 93: Arg value 1.07654321E-9
! 94: string
! 95:
! 96: Arg value 0.5
! 97: string
! 98:
! 99: Arg value Array
! 100:
! 101: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
! 102: boolean
! 103:
! 104: Arg value Array
! 105:
! 106: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
! 107: boolean
! 108:
! 109: Arg value Array
! 110:
! 111: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
! 112: boolean
! 113:
! 114: Arg value Array
! 115:
! 116: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
! 117: boolean
! 118:
! 119: Arg value Array
! 120:
! 121: Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
! 122: boolean
! 123:
! 124: Arg value
! 125: string
! 126:
! 127: Arg value
! 128: string
! 129:
! 130: Arg value 1
! 131: string
! 132:
! 133: Arg value
! 134: string
! 135:
! 136: Arg value 1
! 137: string
! 138:
! 139: Arg value
! 140: string
! 141:
! 142: Arg value
! 143:
! 144: Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
! 145: boolean
! 146:
! 147: Arg value
! 148:
! 149: Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
! 150: boolean
! 151:
! 152: Arg value string
! 153:
! 154: Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
! 155: boolean
! 156:
! 157: Arg value string
! 158:
! 159: Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
! 160: boolean
! 161:
! 162: Arg value
! 163: string
! 164:
! 165: Arg value
! 166: string
! 167:
! 168: Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>