mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-09 10:10:50 +00:00
Compare commits
134
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c89cf742c4 | ||
|
|
6a7f02001d | ||
|
|
ab211d72a3 | ||
|
|
3946b4727b | ||
|
|
3a30d703c0 | ||
|
|
ad86c485cd | ||
|
|
597adbfef1 | ||
|
|
2d2ad8e8d3 | ||
|
|
f2c9167ebb | ||
|
|
0ccb772f10 | ||
|
|
138a1160ab | ||
|
|
e9da49eaf5 | ||
|
|
64de2d2d45 | ||
|
|
1f4fa0ba1f | ||
|
|
1d943ee85e | ||
|
|
5c605854b8 | ||
|
|
11d09ac646 | ||
|
|
269aac9ee9 | ||
|
|
7204e7ba5a | ||
|
|
59dde7cbeb | ||
|
|
11a13337ff | ||
|
|
8649483a69 | ||
|
|
d9b443095f | ||
|
|
9db0be61ad | ||
|
|
29c12bd254 | ||
|
|
ef1f2c1b7b | ||
|
|
1e20b1ed7d | ||
|
|
9d700f942f | ||
|
|
35ca4a5cb4 | ||
|
|
fdb9b9d8c8 | ||
|
|
a1f0e80436 | ||
|
|
1e29c1716d | ||
|
|
7788b67557 | ||
|
|
5baa766b21 | ||
|
|
60d622bdb0 | ||
|
|
63ca897356 | ||
|
|
b584600e1d | ||
|
|
52127174e2 | ||
|
|
a548d2f19b | ||
|
|
edf54b5468 | ||
|
|
8611785073 | ||
|
|
8f6f281866 | ||
|
|
a9f2587716 | ||
|
|
5f7df8099a | ||
|
|
b615180021 | ||
|
|
7a4f2f9a00 | ||
|
|
339414deea | ||
|
|
98f4d8c5f6 | ||
|
|
e8795126ea | ||
|
|
d80a51181a | ||
|
|
cb9be83c31 | ||
|
|
62c865e21f | ||
|
|
1054bfbb0b | ||
|
|
889ba3c824 | ||
|
|
1dd17ad54a | ||
|
|
357cadb362 | ||
|
|
8f16e0b75c | ||
|
|
b0b7f4eed1 | ||
|
|
3e663ebfef | ||
|
|
fd6f77d569 | ||
|
|
dd040e75c3 | ||
|
|
1de0c2f27c | ||
|
|
64af7df7d0 | ||
|
|
40655e4104 | ||
|
|
8cc6227b45 | ||
|
|
13a67db7f5 | ||
|
|
b103a34cda | ||
|
|
c6aef571dd | ||
|
|
00779cc424 | ||
|
|
94cfbb5448 | ||
|
|
193801fbda | ||
|
|
7e071024d3 | ||
|
|
03c3cfbde3 | ||
|
|
978886a3a8 | ||
|
|
708cbe15d1 | ||
|
|
28331f99e2 | ||
|
|
8c4653fbb6 | ||
|
|
5a94926037 | ||
|
|
4a4711eb36 | ||
|
|
3baf31907a | ||
|
|
83a3d76e37 | ||
|
|
bb4e8b10e3 | ||
|
|
bc8c649878 | ||
|
|
9e8d58e54b | ||
|
|
c441dafbf4 | ||
|
|
6744f65d51 | ||
|
|
946190d453 | ||
|
|
236b0c1bde | ||
|
|
9b8fdcf63f | ||
|
|
b781627d85 | ||
|
|
34f0981808 | ||
|
|
dc2a59a970 | ||
|
|
d202354263 | ||
|
|
7be2f35865 | ||
|
|
233c3ade12 | ||
|
|
5273e2163b | ||
|
|
9a859a31ab | ||
|
|
d1e3634d13 | ||
|
|
681859cdc4 | ||
|
|
27f2d54784 | ||
|
|
655610a5bb | ||
|
|
62b1449e47 | ||
|
|
a8fc46afa7 | ||
|
|
3958a09990 | ||
|
|
69663666c1 | ||
|
|
0befe23833 | ||
|
|
0f1e56bc3a | ||
|
|
f2c14fd8b0 | ||
|
|
a000cbd955 | ||
|
|
40f85eb585 | ||
|
|
c857ec6c98 | ||
|
|
02be1a8d19 | ||
|
|
052670121b | ||
|
|
2a93e109e1 | ||
|
|
031e443b44 | ||
|
|
977f7b6716 | ||
|
|
63c1185096 | ||
|
|
d4888d7410 | ||
|
|
14a393d6a2 | ||
|
|
d39fbb1548 | ||
|
|
ff962d9de1 | ||
|
|
4ec1845b52 | ||
|
|
ecf84f8b6b | ||
|
|
1c9c9daa78 | ||
|
|
e1cf7f0ca6 | ||
|
|
2e161037fa | ||
|
|
6d3101b8f4 | ||
|
|
1b07a0988b | ||
|
|
46db94819f | ||
|
|
f9f818959a | ||
|
|
216e57bf23 | ||
|
|
77f40d6d5b | ||
|
|
0d6cdac9ff | ||
|
|
3e51cc7a8c |
No files matched your search
@@ -1,17 +1,14 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
06 Mar 2008, PHP 5.2.6RC2
|
||||
- Fixed bug #44333 (SEGFAULT when using mysql_pconnect() with client_flags).
|
||||
(Felipe)
|
||||
- Fixed bug #44306 (Better detection of MIPS processors on Windows). (Ilia)
|
||||
- Fixed bug #44166 (Parameter handling flaw in PDO::getAvailableDrivers()).
|
||||
(Ilia)
|
||||
- Fixed bug #42505 (new sendmail default breaks on Netware platform)
|
||||
(Guenter Knauf)
|
||||
- Fixed bug #40013 (php_uname() does not return nodename on Netware
|
||||
(Guenter Knauf)
|
||||
|
||||
27 Feb 2008, PHP 5.2.6RC1
|
||||
01 May 2008, PHP 5.2.6
|
||||
- Fixed two possible crashes inside posix extension (Tony)
|
||||
- Fixed incorrect heredoc handling when label is used within the block.
|
||||
(Matt)
|
||||
- Fixed possible stack buffer overflow in FastCGI SAPI. (Andrei Nigmatulin)
|
||||
- Fixed sending of uninitialized paddings which may contain some information. (Andrei Nigmatulin)
|
||||
- Fixed a bug in formatting timestamps when DST is active in the default timezone (Derick)
|
||||
- Properly address incomplete multibyte chars inside escapeshellcmd() (Ilia, Stefan Esser)
|
||||
- Fix integer overflow in printf(). (Stas, Maksymilian Aciemowicz)
|
||||
- Fixed security issue detailed in CVE-2008-0599. (Rasmus)
|
||||
- Fixed potential memleak in stream filter parameter for zlib filter. (Greg)
|
||||
- Added Reflection API metadata for the methods of the DOM classes. (Sebastian)
|
||||
@@ -22,155 +19,128 @@ PHP NEWS
|
||||
which to group by data is specified. (Ilia)
|
||||
- Fixed segfault in filter extension when using callbacks. (Arnar Mar Sig,
|
||||
Felipe)
|
||||
- Fixed faulty fix for bug #40189 (endless loop in zlib.inflate stream filter). (Greg)
|
||||
- Upgraded PCRE to version 7.6 (Nuno)
|
||||
|
||||
|
||||
- Fixed bug #44742 (timezone_offset_get() causes segmentation faults). (Derick)
|
||||
- Fixed bug #44720 (Prevent crash within session_register()). (Scott)
|
||||
- Fixed bug #44703 (htmlspecialchars() does not detect bad character set argument). (Andy Wharmby)
|
||||
- Fixed bug #44673 (With CGI argv/argc starts from arguments, not from script) (Dmitry)
|
||||
- Fixed bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly). (Jani)
|
||||
- Fixed bug #44663 (Crash in imap_mail_compose if "body" parameter invalid). (Ilia)
|
||||
- Fixed bug #44650 (escaepshellscmd() does not check arg count). (Ilia)
|
||||
- Fixed bug #44613 (Crash inside imap_headerinfo()). (Ilia, jmessa)
|
||||
- Fixed bug #44603 (Order issues with Content-Type/Length headers on POST). (Ilia)
|
||||
- Fixed bug #44594 (imap_open() does not validate # of retries parameter). (Ilia)
|
||||
- Fixed bug #44591 (imagegif's filename parameter). (Felipe)
|
||||
- Fixed bug #44557 (Crash in imap_setacl when supplied integer as username) (Thomas Jarosch)
|
||||
- Fixed bug #44487 (call_user_method_array issues a warning when throwing an exception). (David Soria Parra)
|
||||
- Fixed bug #44478 (Inconsistent behaviour when assigning new nodes). (Rob, Felipe)
|
||||
- Fixed bug #44445 (email validator does not handle domains starting/ending with a -). (Ilia)
|
||||
- Fixed bug #44440 (st_blocks undefined under BeOS). (Felipe)
|
||||
- Fixed bug #44394 (Last two bytes missing from output). (Felipe)
|
||||
- Fixed bug #44388 (Crash inside exif_read_data() on invalid images) (Ilia)
|
||||
- Fixed bug #44373 (PDO_OCI extension compile failed). (Felipe)
|
||||
- Fixed bug #44333 (SEGFAULT when using mysql_pconnect() with client_flags). (Felipe)
|
||||
- Fixed bug #44306 (Better detection of MIPS processors on Windows). (Ilia)
|
||||
- Fixed bug #44242 (metaphone('CMXFXM') crashes PHP). (Felipe)
|
||||
- Fixed bug #44233 (MSG_PEEK undefined under BeOS R5). (jonathonfreeman at
|
||||
gmail dot com, Ilia)
|
||||
- Fixed bug #44233 (MSG_PEEK undefined under BeOS R5). (jonathonfreeman at gmail dot com, Ilia)
|
||||
- Fixed bug #44216 (strftime segfaults on large negative value). (Derick)
|
||||
- Fixed bug #44200 (A crash in PDO when no bound targets exists and yet
|
||||
bound parameters are present). (Ilia)
|
||||
- Fixed bug #44209 (strtotime() doesn't support 64 bit timestamps on 64 bit
|
||||
platforms). (Derick)
|
||||
- Fixed bug #44206 (OCI8 selecting ref cursors leads to ORA-1000 maximum
|
||||
open cursors reached). (Oracle Corp.)
|
||||
- Fixed bug #44209 (strtotime() doesn't support 64 bit timestamps on 64 bit platforms). (Derick)
|
||||
- Fixed bug #44206 (OCI8 selecting ref cursors leads to ORA-1000 maximum open cursors reached). (Oracle Corp.)
|
||||
- Fixed bug #44200 (A crash in PDO when no bound targets exists and yet bound parameters are present). (Ilia)
|
||||
- Fixed bug #44197 (socket array keys lost on socket_select). (Felipe)
|
||||
- Fixed bug #44191 (preg_grep messes up array index). (Felipe)
|
||||
- Fixed bug #44189 (PDO setAttribute() does not properly validate values for
|
||||
native numeric options). (Ilia)
|
||||
- Fixed bug #44189 (PDO setAttribute() does not properly validate values for native numeric options). (Ilia)
|
||||
- Fixed bug #44184 (Double free of loop-variable on exception). (Dmitry)
|
||||
- Fixed bug #44171 (Invalid FETCH_COLUMN index does not raise an error). (Ilia)
|
||||
- Fixed bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL)).
|
||||
(Felipe)
|
||||
- Fixed bug #44166 (Parameter handling flaw in PDO::getAvailableDrivers()). (Ilia)
|
||||
- Fixed bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL)). (Felipe)
|
||||
- Fixed bug #44152 (Possible crash with syslog logging on ZTS builds). (Ilia)
|
||||
- Fixed bug #44141 (private parent constructor callable through static
|
||||
function). (Dmitry)
|
||||
- Fixed bug #44113 (OCI8 new collection creation can fail with OCI-22303).
|
||||
(Oracle Corp.)
|
||||
- Fixed bug #44069 (Huge memory usage with concatenation using . instead of
|
||||
.=). (Dmitry)
|
||||
- Fixed bug #44046 (crash inside array_slice() function with an invalid
|
||||
by-ref offset). (Ilia)
|
||||
- Fixed bug #44028 (crash inside stream_socket_enable_crypto() when enabling
|
||||
encryption without crypto type). (Ilia)
|
||||
- Fixed bug #44141 (private parent constructor callable through static function). (Dmitry)
|
||||
- Fixed bug #44113 (OCI8 new collection creation can fail with OCI-22303). (Oracle Corp.)
|
||||
- Fixed bug #44069 (Huge memory usage with concatenation using . instead of .=). (Dmitry)
|
||||
- Fixed bug #44046 (crash inside array_slice() function with an invalid by-ref offset). (Ilia)
|
||||
- Fixed bug #44028 (crash inside stream_socket_enable_crypto() when enabling encryption without crypto type). (Ilia)
|
||||
- Fixed bug #44018 (RecursiveDirectoryIterator options inconsistancy). (Marcus)
|
||||
- Fixed bug #44008 (OCI8 incorrect usage of OCI-Lob->close crashes PHP).
|
||||
(Oracle Corp.)
|
||||
- Fixed bug #43998 (Two error messages returned for incorrect encoding for
|
||||
mb_strto[upper|lower]). (Rui)
|
||||
- Fixed bug #44008 (OCI8 incorrect usage of OCI-Lob->close crashes PHP). (Oracle Corp.)
|
||||
- Fixed bug #43998 (Two error messages returned for incorrect encoding for mb_strto[upper|lower]). (Rui)
|
||||
- Fixed bug #43994 (mb_ereg 'successfully' matching incorrect). (Rui)
|
||||
- Fixed bug #43954 (Memory leak when sending the same HTTP status code
|
||||
multiple times). (Scott)
|
||||
- Fixed bug #43927 (koi8r is missing from html_entity_decode()).
|
||||
(andy at demos dot su, Tony)
|
||||
- Fixed faulty fix for bug #40189 (endless loop in zlib.inflate stream filter).
|
||||
(Greg)
|
||||
- Fixed bug #43912 (Interbase column names are truncated to 31 characters).
|
||||
(Ilia)
|
||||
- Fixed bug #43875 (Two error messages returned for $new and $flag argument
|
||||
in mysql_connect()). (Hannes)
|
||||
- Fixed bug #43863 (str_word_count() breaks on cyrillic "ya" in locale cp1251).
|
||||
(phprus at gmail dot com, Tony)
|
||||
- Fixed bug #43954 (Memory leak when sending the same HTTP status code multiple times). (Scott)
|
||||
- Fixed bug #43927 (koi8r is missing from html_entity_decode()). (andy at demos dot su, Tony)
|
||||
- Fixed bug #43912 (Interbase column names are truncated to 31 characters). (Ilia)
|
||||
- Fixed bug #43875 (Two error messages returned for $new and $flag argument in mysql_connect()). (Hannes)
|
||||
- Fixed bug #43863 (str_word_count() breaks on cyrillic "ya" in locale cp1251). (phprus at gmail dot com, Tony)
|
||||
- Fixed bug #43841 (mb_strrpos offset is byte count for negative values). (Rui)
|
||||
- Fixed bug #43840 (mb_strpos bounds check is byte count rather than a character
|
||||
count). (Rui)
|
||||
- Fixed bug #43840 (mb_strpos bounds check is byte count rather than a character count). (Rui)
|
||||
- Fixed bug #43808 (date_create never fails (even when it should)). (Derick)
|
||||
- Fixed bug #43793 (zlib filter is unable to auto-detect gzip/zlib file headers).
|
||||
(Greg)
|
||||
- Fixed bug #43793 (zlib filter is unable to auto-detect gzip/zlib file headers). (Greg)
|
||||
- Fixed bug #43703 (Signature compatibility check broken). (Dmitry)
|
||||
- Fixed bug #43663 (Extending PDO class with a __call() function doesn't work).
|
||||
(David Soria Parra)
|
||||
- Fixed bug #43677 (Inconsistent behaviour of include_path set with php_value). (manuel at mausz dot at)
|
||||
- Fixed bug #43663 (Extending PDO class with a __call() function doesn't work). (David Soria Parra)
|
||||
- Fixed bug #43647 (Make FindFile use PATH_SEPARATOR instead of ";"). (Ilia)
|
||||
- Fixed bug #43635 (mysql extension ingores INI settings on NULL values
|
||||
passed to mysql_connect()). (Ilia)
|
||||
- Fixed bug #43620 (Workaround for a bug inside libcurl 7.16.2 that can result
|
||||
in a crash). (Ilia)
|
||||
- Fixed bug #43606 (define missing depencies of the exif extension).
|
||||
(crrodriguez at suse dot de)
|
||||
- Fixed bug #43635 (mysql extension ingores INI settings on NULL values passed to mysql_connect()). (Ilia)
|
||||
- Fixed bug #43620 (Workaround for a bug inside libcurl 7.16.2 that can result in a crash). (Ilia)
|
||||
- Fixed bug #43614 (incorrect processing of numerical string keys of array in arbitrary serialized data). (Dmitriy Buldakov, Felipe)
|
||||
- Fixed bug #43606 (define missing depencies of the exif extension). (crrodriguez at suse dot de)
|
||||
- Fixed bug #43589 (a possible infinite loop in bz2_filter.c). (Greg)
|
||||
- Fixed bug #43580 (removed bogus declaration of a non-existent php_is_url()
|
||||
function). (Ilia)
|
||||
- Fixed bug #43559 (array_merge_recursive() doesn't behave as expected with
|
||||
duplicate NULL values). (Felipe, Tony)
|
||||
- Fixed bug #43580 (removed bogus declaration of a non-existent php_is_url() function). (Ilia)
|
||||
- Fixed bug #43559 (array_merge_recursive() doesn't behave as expected with duplicate NULL values). (Felipe, Tony)
|
||||
- Fixed bug #43533 (escapeshellarg('') returns null). (Ilia)
|
||||
- Fixed bug #43527 (DateTime created from a timestamp reports environment
|
||||
timezone). (Derick)
|
||||
- Fixed bug #43522 (stream_get_line() eats additional characters). (Felipe,
|
||||
Ilia, Tony)
|
||||
- Fixed bug #43507 (SOAPFault HTTP Status 500 - would like to be able to set
|
||||
the HTTP Status). (Dmitry)
|
||||
- Fixed bug #43527 (DateTime created from a timestamp reports environment timezone). (Derick)
|
||||
- Fixed bug #43522 (stream_get_line() eats additional characters). (Felipe, Ilia, Tony)
|
||||
- Fixed bug #43507 (SOAPFault HTTP Status 500 - would like to be able to set the HTTP Status). (Dmitry)
|
||||
- Fixed bug #43505 (Assign by reference bug). (Dmitry)
|
||||
- Fixed bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory).
|
||||
(Chris)
|
||||
- Fixed bug #43495 (array_merge_recursive() crashes with recursive arrays).
|
||||
(Ilia)
|
||||
- Fixed bug #43498 (file_exists() on a proftpd server got SIZE not
|
||||
allowed in ASCII mode). (Ilia, crrodriguez at suse dot de)
|
||||
- Fixed bug #43493 (pdo_pgsql does not send username on connect when password
|
||||
is not available). (Ilia)
|
||||
- Fixed bug #43491 (Under certain conditions, file_exists() never returns).
|
||||
(Dmitry)
|
||||
- Fixed bug #43483 (get_class_methods() does not list all visible methods).
|
||||
(Dmitry)
|
||||
- Fixed bug #43482 (array_pad() does not warn on very small pad numbers).
|
||||
(Ilia)
|
||||
- Fixed bug #43457 (Prepared statement with incorrect parms doesn't throw
|
||||
exception with pdo_pgsql driver). (Ilia)
|
||||
- Fixed bug #43450 (Memory leak on some functions with implicit object
|
||||
__toString() call). (David C.)
|
||||
- Fixed bug #43498 (file_exists() on a proftpd server got SIZE not allowed in ASCII mode). (Ilia, crrodriguez at suse dot de)
|
||||
- Fixed bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory). (Chris)
|
||||
- Fixed bug #43495 (array_merge_recursive() crashes with recursive arrays). (Ilia)
|
||||
- Fixed bug #43493 (pdo_pgsql does not send username on connect when password is not available). (Ilia)
|
||||
- Fixed bug #43491 (Under certain conditions, file_exists() never returns). (Dmitry)
|
||||
- Fixed bug #43483 (get_class_methods() does not list all visible methods). (Dmitry)
|
||||
- Fixed bug #43482 (array_pad() does not warn on very small pad numbers). (Ilia)
|
||||
- Fixed bug #43457 (Prepared statement with incorrect parms doesn't throw exception with pdo_pgsql driver). (Ilia)
|
||||
- Fixed bug #43450 (Memory leak on some functions with implicit object __toString() call). (David C.)
|
||||
- Fixed bug #43386 (array_globals not reset to 0 properly on init). (Ilia)
|
||||
- Fixed bug #43377 (PHP crashes with invalid argument for DateTimeZone). (Ilia)
|
||||
- Fixed bug #43373 (pcntl_fork() should not raise E_ERROR on error). (Ilia)
|
||||
- Fixed bug #43364 (recursive xincludes don't remove internal xml nodes
|
||||
properly). (Rob, patch from ddb@bitxtender.de)
|
||||
- Fixed bug #43092 (curl_copy_handle() crashes with > 32 chars long URL).
|
||||
(Jani)
|
||||
- Fixed bug #43301 (mb_ereg*_replace() crashes when replacement string is
|
||||
invalid PHP expression and 'e' option is used). (Jani)
|
||||
- Fixed bug #43003 (Invalid timezone reported for DateTime objects constructed
|
||||
using a timestamp). (Derick)
|
||||
- Fixed bug #43295 (crash because of uninitialized SG(sapi_headers).mimetype).
|
||||
(Dmitry)
|
||||
- Fixed bug #43364 (recursive xincludes don't remove internal xml nodes properly). (Rob, patch from ddb@bitxtender.de)
|
||||
- Fixed bug #43301 (mb_ereg*_replace() crashes when replacement string is invalid PHP expression and 'e' option is used). (Jani)
|
||||
- Fixed bug #43295 (crash because of uninitialized SG(sapi_headers).mimetype). (Dmitry)
|
||||
- Fixed bug #43293 (Multiple segfaults in getopt()). (Hannes)
|
||||
- Fixed bug #43279 (pg_send_query_params() converts all elements in 'params'
|
||||
to strings). (Ilia)
|
||||
- Fixed bug #43276 (Incomplete fix for bug #42739, mkdir() under safe_mode).
|
||||
(Ilia)
|
||||
- Fixed bug #43279 (pg_send_query_params() converts all elements in 'params' to strings). (Ilia)
|
||||
- Fixed bug #43276 (Incomplete fix for bug #42739, mkdir() under safe_mode). (Ilia)
|
||||
- Fixed bug #43248 (backward compatibility break in realpath()). (Dmitry)
|
||||
- Fixed bug #43221 (SimpleXML adding default namespace in addAttribute). (Rob)
|
||||
- Fixed bug #43216 (stream_is_local() returns false on "file://"). (Dmitry)
|
||||
- Fixed bug #43201 (Crash on using uninitialized vals and __get/__set). (Dmitry)
|
||||
- Fixed bug #43182 (file_put_contents() LOCK_EX does not work properly on file
|
||||
truncation). (Ilia)
|
||||
- Fixed bug #43175 (__destruct() throwing an exception with __call() causes
|
||||
segfault). (Dmitry)
|
||||
- Fixed bug #43182 (file_put_contents() LOCK_EX does not work properly on file truncation). (Ilia)
|
||||
- Fixed bug #43175 (__destruct() throwing an exception with __call() causes segfault). (Dmitry)
|
||||
- Fixed bug #43128 (Very long class name causes segfault). (Dmitry)
|
||||
- Fixed bug #43105 (PHP seems to fail to close open files). (Hannes)
|
||||
- Fixed bug #42978 (mismatch between number of bound params and values causes
|
||||
a crash in pdo_pgsql). (Ilia)
|
||||
- Fixed bug #43092 (curl_copy_handle() crashes with > 32 chars long URL). (Jani)
|
||||
- Fixed bug #43003 (Invalid timezone reported for DateTime objects constructed using a timestamp). (Derick)
|
||||
- Fixed bug #42978 (mismatch between number of bound params and values causes a crash in pdo_pgsql). (Ilia)
|
||||
- Fixed bug #42945 (preg_split() swallows part of the string). (Nuno)
|
||||
- Fixed bug #42937 (__call() method not invoked when methods are called on
|
||||
parent from child class). (Dmitry)
|
||||
- Fixed bug #42937 (__call() method not invoked when methods are called on parent from child class). (Dmitry)
|
||||
- Fixed bug #42841 (REF CURSOR and oci_new_cursor() crash PHP). (Chris)
|
||||
- Fixed Bug #42838 (Wrong results in array_diff_uassoc) (Felipe)
|
||||
- Fixed bug #42779 (Incorrect forcing from HTTP/1.0 request to HTTP/1.1
|
||||
response). (Ilia)
|
||||
- Fixed bug #42838 (Wrong results in array_diff_uassoc) (Felipe)
|
||||
- Fixed bug #42779 (Incorrect forcing from HTTP/1.0 request to HTTP/1.1 response). (Ilia)
|
||||
- Fixed bug #42736 (xmlrpc_server_call_method() crashes). (Tony)
|
||||
- Fixed bug #42692 (Procedure 'int1' not present with doc/lit SoapServer).
|
||||
(Dmitry)
|
||||
- Fixed bug #42692 (Procedure 'int1' not present with doc/lit SoapServer). (Dmitry)
|
||||
- Fixed bug #42548 (mysqli PROCEDURE calls can't return result sets). (Hartmut)
|
||||
- Fixed bug #42369 (Implicit conversion to string leaks memory).
|
||||
(David C., Rob).
|
||||
- Fixed bug #42505 (new sendmail default breaks on Netware platform) (Guenter Knauf)
|
||||
- Fixed bug #42369 (Implicit conversion to string leaks memory). (David C., Rob).
|
||||
- Fixed bug #42272 (var_export() incorrectly escapes char(0)). (Derick)
|
||||
- Fixed bug #42261 (Incorrect lengths for date and boolean data types).
|
||||
(Ilia)
|
||||
- Fixed bug #42190 (Constructing DateTime with TimeZone Indicator invalidates
|
||||
DateTimeZone). (Derick)
|
||||
- Fixed bug #42261 (Incorrect lengths for date and boolean data types). (Ilia)
|
||||
- Fixed bug #42190 (Constructing DateTime with TimeZone Indicator invalidates DateTimeZone). (Derick)
|
||||
- Fixed bug #42177 (Warning "array_merge_recursive(): recursion detected" comes again...). (Felipe)
|
||||
- Fixed bug #41941 (oci8 extension not lib64 savvy). (Chris)
|
||||
- Fixed bug #41828 (Failing to call RecursiveIteratorIterator::__construct() causes a sefault). (Etienne)
|
||||
- Fixed bug #41599 (setTime() fails after modify() is used). (Derick)
|
||||
- Fixed bug #41562 (SimpleXML memory issue). (Rob)
|
||||
- Fixed bug #40013 (php_uname() does not return nodename on Netware (Guenter Knauf)
|
||||
- Fixed bug #38468 (Unexpected creation of cycle). (Dmitry)
|
||||
- Fixed bug #32979 (OpenSSL stream->fd casts broken in 64-bit build) (stotty at tvnet dot hu)
|
||||
|
||||
08 Nov 2007, PHP 5.2.5
|
||||
- Upgraded PCRE to version 7.3 (Nuno)
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Zend Multibyte and ShiftJIS
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!in_array("detect_unicode", array_keys(ini_get_all()))) {
|
||||
die("skip Requires configure --enable-zend-multibyte option");
|
||||
}
|
||||
if (!extension_loaded("mbstring")) {
|
||||
die("skip Requires mbstring extension");
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
mbstring.internal_encoding=SJIS
|
||||
--FILE--
|
||||
<?php
|
||||
declare(encoding='Shift_JIS');
|
||||
$s = "•\"; // 0x95+0x5c in script, not somewhere else "
|
||||
printf("%x:%x\n", ord($s[0]), ord($s[1]));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
95:5c
|
||||
===DONE===
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Zend Multibyte and UTF-8 BOM
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!in_array("detect_unicode", array_keys(ini_get_all()))) {
|
||||
die("skip Requires configure --enable-zend-multibyte option");
|
||||
}
|
||||
if (!extension_loaded("mbstring")) {
|
||||
die("skip Requires mbstring extension");
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
mbstring.internal_encoding=iso-8859-1
|
||||
--FILE--
|
||||
<?php
|
||||
print "Hello World\n";
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
Hello World
|
||||
===DONE===
|
||||
BIN
Binary file not shown.
+11
-3
@@ -63,6 +63,9 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
|
||||
ini_entry->modified = 0;
|
||||
ini_entry->orig_value = NULL;
|
||||
ini_entry->orig_value_length = 0;
|
||||
if (ini_entry->modifiable >= (1 << 3)) {
|
||||
ini_entry->modifiable >>= 3;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -244,6 +247,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
char *duplicate;
|
||||
zend_bool modifiable;
|
||||
zend_bool modified;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
@@ -251,8 +255,12 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
modifiable = ini_entry->modifiable;
|
||||
modified = ini_entry->modified;
|
||||
|
||||
if (stage == ZEND_INI_STAGE_ACTIVATE && modify_type == ZEND_INI_SYSTEM) {
|
||||
ini_entry->modifiable = ZEND_INI_SYSTEM;
|
||||
/* only touch lower bits */
|
||||
ini_entry->modifiable = (ini_entry->modifiable & (ZEND_INI_ALL << 3)) | ZEND_INI_SYSTEM;
|
||||
}
|
||||
|
||||
if (!force_change) {
|
||||
@@ -261,8 +269,6 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
|
||||
}
|
||||
}
|
||||
|
||||
modified = ini_entry->modified;
|
||||
|
||||
if (!EG(modified_ini_directives)) {
|
||||
ALLOC_HASHTABLE(EG(modified_ini_directives));
|
||||
zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
|
||||
@@ -270,6 +276,8 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
|
||||
if (!modified) {
|
||||
ini_entry->orig_value = ini_entry->value;
|
||||
ini_entry->orig_value_length = ini_entry->value_length;
|
||||
/* store orginial value in the upper bits */
|
||||
ini_entry->modifiable = (modifiable << 3) | ini_entry->modifiable;
|
||||
ini_entry->modified = 1;
|
||||
zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry*), NULL);
|
||||
}
|
||||
|
||||
@@ -740,13 +740,13 @@ r_variable:
|
||||
|
||||
|
||||
w_variable:
|
||||
variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $$ = $1; }
|
||||
{ zend_check_writable_variable(&$1); }
|
||||
variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $$ = $1;
|
||||
zend_check_writable_variable(&$1); }
|
||||
;
|
||||
|
||||
rw_variable:
|
||||
variable { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; }
|
||||
{ zend_check_writable_variable(&$1); }
|
||||
variable { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1;
|
||||
zend_check_writable_variable(&$1); }
|
||||
;
|
||||
|
||||
variable:
|
||||
|
||||
@@ -723,7 +723,7 @@ ZEND_API int zend_multibyte_yyinput(zend_file_handle *file_handle, char *buf, si
|
||||
|
||||
/* TODO: support widechars */
|
||||
|
||||
for (n = 0; n < sizeof(buf) && (c = zend_stream_getc(yyin TSRMLS_CC)) != EOF && c != '\n'; ++n) {
|
||||
for (n = 0; n < len && (c = zend_stream_getc(yyin TSRMLS_CC)) != EOF && c != '\n'; ++n) {
|
||||
buf[n] = (char)c;
|
||||
}
|
||||
if (c == '\n') {
|
||||
@@ -731,8 +731,8 @@ ZEND_API int zend_multibyte_yyinput(zend_file_handle *file_handle, char *buf, si
|
||||
}
|
||||
|
||||
SCNG(script_org_size) = n;
|
||||
SCNG(script_org) = (char*)emalloc(SCNG(script_org_size)+1);
|
||||
memcpy(SCNG(script_org)+SCNG(script_org_size)-n, buf, n);
|
||||
SCNG(script_org) = (char*)emalloc(SCNG(script_org_size) + 1);
|
||||
memcpy(SCNG(script_org), buf, n);
|
||||
|
||||
return n;
|
||||
}
|
||||
@@ -749,29 +749,18 @@ ZEND_API int zend_multibyte_read_script(TSRMLS_D)
|
||||
SCNG(script_org) = NULL;
|
||||
SCNG(script_org_size) = 0;
|
||||
|
||||
for (;;) {
|
||||
n = zend_stream_read(yyin, buf, sizeof(buf) TSRMLS_CC);
|
||||
if (n <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (; (n = zend_stream_read(yyin, buf, sizeof(buf) TSRMLS_CC)) > 0; ) {
|
||||
SCNG(script_org_size) += n;
|
||||
if (SCNG(script_org)) {
|
||||
SCNG(script_org) = (char*)erealloc(SCNG(script_org), SCNG(script_org_size)+1);
|
||||
} else {
|
||||
SCNG(script_org) = (char*)emalloc(SCNG(script_org_size)+1);
|
||||
}
|
||||
memcpy(SCNG(script_org)+SCNG(script_org_size)-n, buf, n);
|
||||
SCNG(script_org) = (char*)erealloc(SCNG(script_org), SCNG(script_org_size));
|
||||
memcpy(SCNG(script_org) + SCNG(script_org_size) - n, buf, n);
|
||||
}
|
||||
|
||||
if (n < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!SCNG(script_org)) {
|
||||
SCNG(script_org) = emalloc(SCNG(script_org_size)+1);
|
||||
}
|
||||
*(SCNG(script_org)+SCNG(script_org_size)) = (char)NULL;
|
||||
SCNG(script_org) = (char*)erealloc(SCNG(script_org), SCNG(script_org_size) + 1);
|
||||
*(SCNG(script_org)+SCNG(script_org_size)) = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1930,8 +1919,13 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({
|
||||
if (yyleng > CG(heredoc_len) && !memcmp(end - CG(heredoc_len), CG(heredoc), CG(heredoc_len))) {
|
||||
int len = yyleng - CG(heredoc_len) - 2; /* 2 for newline before and after label */
|
||||
|
||||
if (len > 0 && yytext[len - 1] == '\r' && yytext[len] == '\n') {
|
||||
len--;
|
||||
/* May have matched fooLABEL; make sure there's a newline before it */
|
||||
if (yytext[len] != '\n') {
|
||||
if (yytext[len] != '\r') {
|
||||
goto wrong_label;
|
||||
}
|
||||
} else if (len > 0 && yytext[len - 1] == '\r') {
|
||||
len--; /* Windows newline */
|
||||
}
|
||||
|
||||
/* Go back before last label char, to match in ST_END_HEREDOC state */
|
||||
@@ -1948,6 +1942,7 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({
|
||||
} else {
|
||||
/* Go back to end of label, so the next match works correctly in case of
|
||||
* a variable or another label at the beginning of the next line */
|
||||
wrong_label:
|
||||
yyless(yyleng - 1);
|
||||
yymore();
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=2
|
||||
PHP_RELEASE_VERSION=6
|
||||
PHP_EXTRA_VERSION="RC2"
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_alnum() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alnum(mixed $c)
|
||||
* Description: Checks for alphanumeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alnum() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = 'abcXYZ';
|
||||
$c2 = ' \t*@';
|
||||
|
||||
var_dump(ctype_alnum($c1));
|
||||
var_dump(ctype_alnum($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alnum() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Test ctype_alnum() function : error conditions - Incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alnum(mixed $c)
|
||||
* Description: Checks for alphanumeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to ctype_alnum() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alnum() : error conditions ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_alnum() function with Zero arguments --\n";
|
||||
var_dump( ctype_alnum() );
|
||||
|
||||
//Test ctype_alnum with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_alnum() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_alnum($c, $extra_arg) );
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alnum() : error conditions ***
|
||||
|
||||
-- Testing ctype_alnum() function with Zero arguments --
|
||||
|
||||
Warning: ctype_alnum() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_alnum() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_alnum() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_alnum() function : usage variations - Different data types as $c arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alnum(mixed $c)
|
||||
* Description: Checks for alphanumeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_alnum() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alnum() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "xyz";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
123
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "pqr",
|
||||
'LMN',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_alnum()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_alnum($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alnum() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,92 @@
|
||||
--TEST--
|
||||
Test ctype_alnum() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alnum(mixed $c)
|
||||
* Description: Checks for alphanumeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_alnum() to test which character codes are considered
|
||||
* valid alphanumeric characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alnum() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($i = 0; $i < 256; $i++) {
|
||||
if (ctype_alnum($i)) {
|
||||
echo "character code $i is alpha numeric\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alnum() : usage variations ***
|
||||
character code 48 is alpha numeric
|
||||
character code 49 is alpha numeric
|
||||
character code 50 is alpha numeric
|
||||
character code 51 is alpha numeric
|
||||
character code 52 is alpha numeric
|
||||
character code 53 is alpha numeric
|
||||
character code 54 is alpha numeric
|
||||
character code 55 is alpha numeric
|
||||
character code 56 is alpha numeric
|
||||
character code 57 is alpha numeric
|
||||
character code 65 is alpha numeric
|
||||
character code 66 is alpha numeric
|
||||
character code 67 is alpha numeric
|
||||
character code 68 is alpha numeric
|
||||
character code 69 is alpha numeric
|
||||
character code 70 is alpha numeric
|
||||
character code 71 is alpha numeric
|
||||
character code 72 is alpha numeric
|
||||
character code 73 is alpha numeric
|
||||
character code 74 is alpha numeric
|
||||
character code 75 is alpha numeric
|
||||
character code 76 is alpha numeric
|
||||
character code 77 is alpha numeric
|
||||
character code 78 is alpha numeric
|
||||
character code 79 is alpha numeric
|
||||
character code 80 is alpha numeric
|
||||
character code 81 is alpha numeric
|
||||
character code 82 is alpha numeric
|
||||
character code 83 is alpha numeric
|
||||
character code 84 is alpha numeric
|
||||
character code 85 is alpha numeric
|
||||
character code 86 is alpha numeric
|
||||
character code 87 is alpha numeric
|
||||
character code 88 is alpha numeric
|
||||
character code 89 is alpha numeric
|
||||
character code 90 is alpha numeric
|
||||
character code 97 is alpha numeric
|
||||
character code 98 is alpha numeric
|
||||
character code 99 is alpha numeric
|
||||
character code 100 is alpha numeric
|
||||
character code 101 is alpha numeric
|
||||
character code 102 is alpha numeric
|
||||
character code 103 is alpha numeric
|
||||
character code 104 is alpha numeric
|
||||
character code 105 is alpha numeric
|
||||
character code 106 is alpha numeric
|
||||
character code 107 is alpha numeric
|
||||
character code 108 is alpha numeric
|
||||
character code 109 is alpha numeric
|
||||
character code 110 is alpha numeric
|
||||
character code 111 is alpha numeric
|
||||
character code 112 is alpha numeric
|
||||
character code 113 is alpha numeric
|
||||
character code 114 is alpha numeric
|
||||
character code 115 is alpha numeric
|
||||
character code 116 is alpha numeric
|
||||
character code 117 is alpha numeric
|
||||
character code 118 is alpha numeric
|
||||
character code 119 is alpha numeric
|
||||
character code 120 is alpha numeric
|
||||
character code 121 is alpha numeric
|
||||
character code 122 is alpha numeric
|
||||
===DONE===
|
||||
@@ -0,0 +1,127 @@
|
||||
--TEST--
|
||||
Test ctype_alnum() function : usage variations - different string values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alnum(mixed $c)
|
||||
* Description: Checks for alphanumeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different strings to ctype_alnum to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alnum() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
'abc123\n',
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
/*23*/ base64_decode("w4DDoMOHw6fDiMOo") // non-ascii characters
|
||||
);
|
||||
|
||||
|
||||
// loop through each element of $values to test behaviour of ctype_alnum()
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_alnum($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alnum() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
Test ctype_alnum() function : usage variations - octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alnum(mixed $c)
|
||||
* Description: Checks for alphanumeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass octal and hexadecimal values to ctype_alnum() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alnum() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array (060, 061, 062, 063);
|
||||
$hex_values = array(0x30, 0x31, 0x32, 0x33);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_alnum($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_alnum($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alnum() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_alpha() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alpha(mixed $c)
|
||||
* Description: Checks for alphabetic character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alpha() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = 'abcXYZ';
|
||||
$c2 = "Hello, World!";
|
||||
|
||||
var_dump(ctype_alpha($c1));
|
||||
var_dump(ctype_alpha($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alpha() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Test ctype_alpha() function : error conditions - Incorrect number of arguments
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alpha(mixed $c)
|
||||
* Description: Checks for alphabetic character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass an incorrect number of arguments to ctype_alpha() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alpha() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_alpha() function with Zero arguments --\n";
|
||||
var_dump( ctype_alpha() );
|
||||
|
||||
//Test ctype_alpha with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_alpha() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_alpha($c, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alpha() : error conditions ***
|
||||
|
||||
-- Testing ctype_alpha() function with Zero arguments --
|
||||
|
||||
Warning: ctype_alpha() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_alpha() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_alpha() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_alpha() function : usage variations - different data types as $c arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alpha(mixed $c)
|
||||
* Description: Checks for alphabetic character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_alpha() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alpha() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "abcdef";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
XYZ
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_alpha()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_alpha($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alpha() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,82 @@
|
||||
--TEST--
|
||||
Test ctype_alpha() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alpha(mixed $c)
|
||||
* Description: Checks for alphabetic character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_alpha() to test which character codes are considered
|
||||
* valid alphabetic characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alpha() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($i = 0; $i < 256; $i++) {
|
||||
if (ctype_alpha($i)) {
|
||||
echo "character code $i is alphabetic\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alpha() : usage variations ***
|
||||
character code 65 is alphabetic
|
||||
character code 66 is alphabetic
|
||||
character code 67 is alphabetic
|
||||
character code 68 is alphabetic
|
||||
character code 69 is alphabetic
|
||||
character code 70 is alphabetic
|
||||
character code 71 is alphabetic
|
||||
character code 72 is alphabetic
|
||||
character code 73 is alphabetic
|
||||
character code 74 is alphabetic
|
||||
character code 75 is alphabetic
|
||||
character code 76 is alphabetic
|
||||
character code 77 is alphabetic
|
||||
character code 78 is alphabetic
|
||||
character code 79 is alphabetic
|
||||
character code 80 is alphabetic
|
||||
character code 81 is alphabetic
|
||||
character code 82 is alphabetic
|
||||
character code 83 is alphabetic
|
||||
character code 84 is alphabetic
|
||||
character code 85 is alphabetic
|
||||
character code 86 is alphabetic
|
||||
character code 87 is alphabetic
|
||||
character code 88 is alphabetic
|
||||
character code 89 is alphabetic
|
||||
character code 90 is alphabetic
|
||||
character code 97 is alphabetic
|
||||
character code 98 is alphabetic
|
||||
character code 99 is alphabetic
|
||||
character code 100 is alphabetic
|
||||
character code 101 is alphabetic
|
||||
character code 102 is alphabetic
|
||||
character code 103 is alphabetic
|
||||
character code 104 is alphabetic
|
||||
character code 105 is alphabetic
|
||||
character code 106 is alphabetic
|
||||
character code 107 is alphabetic
|
||||
character code 108 is alphabetic
|
||||
character code 109 is alphabetic
|
||||
character code 110 is alphabetic
|
||||
character code 111 is alphabetic
|
||||
character code 112 is alphabetic
|
||||
character code 113 is alphabetic
|
||||
character code 114 is alphabetic
|
||||
character code 115 is alphabetic
|
||||
character code 116 is alphabetic
|
||||
character code 117 is alphabetic
|
||||
character code 118 is alphabetic
|
||||
character code 119 is alphabetic
|
||||
character code 120 is alphabetic
|
||||
character code 121 is alphabetic
|
||||
character code 122 is alphabetic
|
||||
===DONE===
|
||||
@@ -0,0 +1,128 @@
|
||||
--TEST--
|
||||
Test ctype_alpha() function : usage variations - different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alpha(mixed $c)
|
||||
* Description: Checks for alphabetic character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_alpha() to test
|
||||
* which are considered valid alphabetic character only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alpha() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
'abc123\n',
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
/*23*/ base64_decode("w4DDoMOHw6fDiMOo") // non-ascii characters
|
||||
);
|
||||
|
||||
|
||||
// loop through each element of $values to test behaviour of ctype_alnum()
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_alpha($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alpha() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
Test ctype_alpha() function : usage variations - Octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_alpha(mixed $c)
|
||||
* Description: Checks for alphabetic character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass octal and hexadecimal values to ctype_alpha() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_alpha() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array (0101, 0102, 0103, 0104);
|
||||
$hex_values = array (0x41, 0x42, 0x43, 0x44);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_alpha($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_alpha($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_alpha() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_cntrl() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_cntrl(mixed $c)
|
||||
* Description: Checks for control character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_cntrl() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = "\r\n\t";
|
||||
$c2 = "Hello, World!\n";
|
||||
|
||||
var_dump(ctype_cntrl($c1));
|
||||
var_dump(ctype_cntrl($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_cntrl() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Test ctype_cntrl() function : error conditions - Incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_cntrl(mixed $c)
|
||||
* Description: Checks for control character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass an incorrect number of arguments to ctype_cntrl() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_cntrl() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_cntrl() function with Zero arguments --\n";
|
||||
var_dump( ctype_cntrl() );
|
||||
|
||||
//Test ctype_cntrl with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_cntrl() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_cntrl($c, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_cntrl() : error conditions ***
|
||||
|
||||
-- Testing ctype_cntrl() function with Zero arguments --
|
||||
|
||||
Warning: ctype_cntrl() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_cntrl() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_cntrl() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,178 @@
|
||||
--TEST--
|
||||
Test ctype_cntrl() function : usage variations - Different data types as $c arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_cntrl(mixed $c)
|
||||
* Description: Checks for control character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_cntrl() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_cntrl() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "\n\r\t";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
\t\r\n
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "\t\r\n",
|
||||
'
|
||||
',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_cntrl()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_cntrl($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_cntrl() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,63 @@
|
||||
--TEST--
|
||||
Test ctype_cntrl() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_cntrl(mixed $c)
|
||||
* Description: Checks for control character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_cntrl() to test which character codes are considered
|
||||
* valid control characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_cntrl() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($i = 0; $i < 256; $i++) {
|
||||
if (ctype_cntrl($i)) {
|
||||
echo "character code $i is control character\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_cntrl() : usage variations ***
|
||||
character code 0 is control character
|
||||
character code 1 is control character
|
||||
character code 2 is control character
|
||||
character code 3 is control character
|
||||
character code 4 is control character
|
||||
character code 5 is control character
|
||||
character code 6 is control character
|
||||
character code 7 is control character
|
||||
character code 8 is control character
|
||||
character code 9 is control character
|
||||
character code 10 is control character
|
||||
character code 11 is control character
|
||||
character code 12 is control character
|
||||
character code 13 is control character
|
||||
character code 14 is control character
|
||||
character code 15 is control character
|
||||
character code 16 is control character
|
||||
character code 17 is control character
|
||||
character code 18 is control character
|
||||
character code 19 is control character
|
||||
character code 20 is control character
|
||||
character code 21 is control character
|
||||
character code 22 is control character
|
||||
character code 23 is control character
|
||||
character code 24 is control character
|
||||
character code 25 is control character
|
||||
character code 26 is control character
|
||||
character code 27 is control character
|
||||
character code 28 is control character
|
||||
character code 29 is control character
|
||||
character code 30 is control character
|
||||
character code 31 is control character
|
||||
character code 127 is control character
|
||||
===DONE===
|
||||
@@ -0,0 +1,156 @@
|
||||
--TEST--
|
||||
Test ctype_cntrl() function : usage variations - Different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_cntrl(mixed $c)
|
||||
* Description: Checks for control character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_cntrl() to test
|
||||
* which are considered valid control character only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_cntrl() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
'abc123\n',
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
|
||||
"\n",
|
||||
/*25*/ "\r",
|
||||
"\t",
|
||||
"0xD",
|
||||
"0xA",
|
||||
"0xE",
|
||||
/*30*/ "\t\r\n",
|
||||
);
|
||||
|
||||
|
||||
// loop through each element of $values to test behaviour of ctype_cntrl()
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_cntrl($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_cntrl() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 27 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 28 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 29 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 30 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
Test ctype_cntrl() function : usage variations - Octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_cntrl(mixed $c)
|
||||
* Description: Checks for control character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass hexadecimal and octal values to ctype_cntrl() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_cntrl() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array(01, 02, 03, 04);
|
||||
$hex_values = array(0x1, 0x2, 0x3, 0x4);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_cntrl($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_cntrl($c));
|
||||
$iterator++;
|
||||
}
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_cntrl() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_digit() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_digit(mixed $c)
|
||||
* Description: Checks for numeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_digit() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = '1234';
|
||||
$c2 = 'abc123';
|
||||
|
||||
var_dump(ctype_digit($c1));
|
||||
var_dump(ctype_digit($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_digit() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Test ctype_digit() function : error conditions - incorrect number of arguments
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_digit(mixed $c)
|
||||
* Description: Checks for numeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass an incorrect number of arguments to ctype_digit() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_digit() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_digit() function with Zero arguments --\n";
|
||||
var_dump( ctype_digit() );
|
||||
|
||||
//Test ctype_digit with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_digit() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_digit($c, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_digit() : error conditions ***
|
||||
|
||||
-- Testing ctype_digit() function with Zero arguments --
|
||||
|
||||
Warning: ctype_digit() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_digit() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_digit() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_digit() function : usage variations - different data types as $c arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_digit(mixed $c)
|
||||
* Description: Checks for numeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_digit() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_digit() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "123456";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
1
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "2",
|
||||
'309',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_digit()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_digit($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_digit() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Test ctype_digit() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_digit(mixed $c)
|
||||
* Description: Checks for numeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_digit() to test which character codes are considered
|
||||
* valid decimal digits
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_digit() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($i = 0; $i < 256; $i++) {
|
||||
if (ctype_digit($i)) {
|
||||
echo "character code $i is a numeric digit\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_digit() : usage variations ***
|
||||
character code 48 is a numeric digit
|
||||
character code 49 is a numeric digit
|
||||
character code 50 is a numeric digit
|
||||
character code 51 is a numeric digit
|
||||
character code 52 is a numeric digit
|
||||
character code 53 is a numeric digit
|
||||
character code 54 is a numeric digit
|
||||
character code 55 is a numeric digit
|
||||
character code 56 is a numeric digit
|
||||
character code 57 is a numeric digit
|
||||
===DONE===
|
||||
@@ -0,0 +1,158 @@
|
||||
--TEST--
|
||||
Test ctype_digit() function : usage variations - different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_digit(mixed $c)
|
||||
* Description: Checks for numeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_digit() to test
|
||||
* which are considered valid decimal digit only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_digit() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
"0",
|
||||
/*15*/ "3",
|
||||
"9",
|
||||
"1234",
|
||||
"7890",
|
||||
"0677",
|
||||
/*20*/ '0',
|
||||
'3',
|
||||
'9',
|
||||
'1234',
|
||||
'7890',
|
||||
/*25*/ "123abc",
|
||||
"abc123",
|
||||
"123\r\t",
|
||||
"123 ",
|
||||
" 123",
|
||||
/*30*/ "123E4",
|
||||
/*31*/ "0x3F",
|
||||
);
|
||||
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_digit($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_digit() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 27 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 28 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 29 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 30 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 31 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
Test ctype_digit() function : usage variations - octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_digit(mixed $c)
|
||||
* Description: Checks for numeric character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass octal and hexadecimal values as $c argument to ctype_digit() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_digit() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array(061, 062, 063, 064);
|
||||
$hex_values = array (0x31, 0x32, 0x33, 0x34);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_digit($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_digit($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_digit() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_graph() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_graph(mixed $c)
|
||||
* Description: Checks for any printable character(s) except space
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_graph() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = 'helloWorld!';
|
||||
$c2 = "Hello, world!\n";
|
||||
|
||||
var_dump(ctype_graph($c1));
|
||||
var_dump(ctype_graph($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_graph() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Test ctype_graph() function : error conditions - incorrect number of arguments
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_graph(mixed $c)
|
||||
* Description: Checks for any printable character(s) except space
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass an incorrect number of arguments to ctype_graph() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_graph() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_graph() function with Zero arguments --\n";
|
||||
var_dump( ctype_graph() );
|
||||
|
||||
//Test ctype_graph with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_graph() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_graph($c, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_graph() : error conditions ***
|
||||
|
||||
-- Testing ctype_graph() function with Zero arguments --
|
||||
|
||||
Warning: ctype_graph() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_graph() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_graph() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_graph() function : usage variations - different data types as $c arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_graph(mixed $c)
|
||||
* Description: Checks for any printable character(s) except space
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_graph() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_graph() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "myClass";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hiWorld!
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_graph()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_graph($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_graph() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,124 @@
|
||||
--TEST--
|
||||
Test ctype_graph() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_graph(mixed $c)
|
||||
* Description: Checks for any printable character(s) except space
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_graph() to test which character codes are considered
|
||||
* valid visibly printable characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_graph() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($i = 0; $i < 256; $i++) {
|
||||
if (ctype_graph($i)) {
|
||||
echo "character code $i is a printable character\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_graph() : usage variations ***
|
||||
character code 33 is a printable character
|
||||
character code 34 is a printable character
|
||||
character code 35 is a printable character
|
||||
character code 36 is a printable character
|
||||
character code 37 is a printable character
|
||||
character code 38 is a printable character
|
||||
character code 39 is a printable character
|
||||
character code 40 is a printable character
|
||||
character code 41 is a printable character
|
||||
character code 42 is a printable character
|
||||
character code 43 is a printable character
|
||||
character code 44 is a printable character
|
||||
character code 45 is a printable character
|
||||
character code 46 is a printable character
|
||||
character code 47 is a printable character
|
||||
character code 48 is a printable character
|
||||
character code 49 is a printable character
|
||||
character code 50 is a printable character
|
||||
character code 51 is a printable character
|
||||
character code 52 is a printable character
|
||||
character code 53 is a printable character
|
||||
character code 54 is a printable character
|
||||
character code 55 is a printable character
|
||||
character code 56 is a printable character
|
||||
character code 57 is a printable character
|
||||
character code 58 is a printable character
|
||||
character code 59 is a printable character
|
||||
character code 60 is a printable character
|
||||
character code 61 is a printable character
|
||||
character code 62 is a printable character
|
||||
character code 63 is a printable character
|
||||
character code 64 is a printable character
|
||||
character code 65 is a printable character
|
||||
character code 66 is a printable character
|
||||
character code 67 is a printable character
|
||||
character code 68 is a printable character
|
||||
character code 69 is a printable character
|
||||
character code 70 is a printable character
|
||||
character code 71 is a printable character
|
||||
character code 72 is a printable character
|
||||
character code 73 is a printable character
|
||||
character code 74 is a printable character
|
||||
character code 75 is a printable character
|
||||
character code 76 is a printable character
|
||||
character code 77 is a printable character
|
||||
character code 78 is a printable character
|
||||
character code 79 is a printable character
|
||||
character code 80 is a printable character
|
||||
character code 81 is a printable character
|
||||
character code 82 is a printable character
|
||||
character code 83 is a printable character
|
||||
character code 84 is a printable character
|
||||
character code 85 is a printable character
|
||||
character code 86 is a printable character
|
||||
character code 87 is a printable character
|
||||
character code 88 is a printable character
|
||||
character code 89 is a printable character
|
||||
character code 90 is a printable character
|
||||
character code 91 is a printable character
|
||||
character code 92 is a printable character
|
||||
character code 93 is a printable character
|
||||
character code 94 is a printable character
|
||||
character code 95 is a printable character
|
||||
character code 96 is a printable character
|
||||
character code 97 is a printable character
|
||||
character code 98 is a printable character
|
||||
character code 99 is a printable character
|
||||
character code 100 is a printable character
|
||||
character code 101 is a printable character
|
||||
character code 102 is a printable character
|
||||
character code 103 is a printable character
|
||||
character code 104 is a printable character
|
||||
character code 105 is a printable character
|
||||
character code 106 is a printable character
|
||||
character code 107 is a printable character
|
||||
character code 108 is a printable character
|
||||
character code 109 is a printable character
|
||||
character code 110 is a printable character
|
||||
character code 111 is a printable character
|
||||
character code 112 is a printable character
|
||||
character code 113 is a printable character
|
||||
character code 114 is a printable character
|
||||
character code 115 is a printable character
|
||||
character code 116 is a printable character
|
||||
character code 117 is a printable character
|
||||
character code 118 is a printable character
|
||||
character code 119 is a printable character
|
||||
character code 120 is a printable character
|
||||
character code 121 is a printable character
|
||||
character code 122 is a printable character
|
||||
character code 123 is a printable character
|
||||
character code 124 is a printable character
|
||||
character code 125 is a printable character
|
||||
character code 126 is a printable character
|
||||
===DONE===
|
||||
@@ -0,0 +1,146 @@
|
||||
--TEST--
|
||||
Test ctype_graph() function : usage variations - different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_graph(mixed $c)
|
||||
* Description: Checks for any printable character(s) except space
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_graph() to test
|
||||
* which are considered valid printable character only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_graph() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
"abc123\n",
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
|
||||
"!$%^&*()_+-={}[]:;@~'#<,>.?/",
|
||||
/*25*/ "\"ABC\"",
|
||||
"String\twith\ttabs",
|
||||
"Sample string with newline\n",
|
||||
/*28*/ "123 ABC XYZ",
|
||||
);
|
||||
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_graph($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_graph() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 27 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 28 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
Test ctype_graph() function : usage variations - octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_graph(mixed $c)
|
||||
* Description: Checks for any printable character(s) except space
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass octal and hexadecimal values to ctype_graph() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_graph() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array(061, 062, 063, 064);
|
||||
$hex_values = array (0x31, 0x32, 0x33, 0x34);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_graph($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_graph($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_graph() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_lower() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_lower(mixed $c)
|
||||
* Description: Checks for lowercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_lower() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = 'helloworld';
|
||||
$c2 = "Hello, world!\n";
|
||||
|
||||
var_dump(ctype_lower($c1));
|
||||
var_dump(ctype_lower($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_lower() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Test ctype_lower() function : error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_lower(mixed $c)
|
||||
* Description: Checks for lowercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to ctype_lower() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_lower() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_lower() function with Zero arguments --\n";
|
||||
var_dump( ctype_lower() );
|
||||
|
||||
//Test ctype_lower with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_lower() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_lower($c, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_lower() : error conditions ***
|
||||
|
||||
-- Testing ctype_lower() function with Zero arguments --
|
||||
|
||||
Warning: ctype_lower() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_lower() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_lower() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_lower() function : usage variations - different data types as $c arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_lower(mixed $c)
|
||||
* Description: Checks for lowercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_lower() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_lower() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "class";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
heredoc
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_lower()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_lower($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_lower() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,56 @@
|
||||
--TEST--
|
||||
Test ctype_lower() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_lower(mixed $c)
|
||||
* Description: Checks for lowercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_lower() to test which character codes are considered
|
||||
* valid lowercase characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_lower() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($i = 0; $i < 256; $i++) {
|
||||
if (ctype_lower($i)) {
|
||||
echo "character code $i is a lower case character\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_lower() : usage variations ***
|
||||
character code 97 is a lower case character
|
||||
character code 98 is a lower case character
|
||||
character code 99 is a lower case character
|
||||
character code 100 is a lower case character
|
||||
character code 101 is a lower case character
|
||||
character code 102 is a lower case character
|
||||
character code 103 is a lower case character
|
||||
character code 104 is a lower case character
|
||||
character code 105 is a lower case character
|
||||
character code 106 is a lower case character
|
||||
character code 107 is a lower case character
|
||||
character code 108 is a lower case character
|
||||
character code 109 is a lower case character
|
||||
character code 110 is a lower case character
|
||||
character code 111 is a lower case character
|
||||
character code 112 is a lower case character
|
||||
character code 113 is a lower case character
|
||||
character code 114 is a lower case character
|
||||
character code 115 is a lower case character
|
||||
character code 116 is a lower case character
|
||||
character code 117 is a lower case character
|
||||
character code 118 is a lower case character
|
||||
character code 119 is a lower case character
|
||||
character code 120 is a lower case character
|
||||
character code 121 is a lower case character
|
||||
character code 122 is a lower case character
|
||||
===DONE===
|
||||
@@ -0,0 +1,138 @@
|
||||
--TEST--
|
||||
Test ctype_lower() function : usage variations - different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_lower(mixed $c)
|
||||
* Description: Checks for lowercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_lower() to test
|
||||
* which are considered valid lowercase character only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_lower() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
'abc123\n',
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
|
||||
"abcXYZ",
|
||||
/*25*/ "abc xyz",
|
||||
/*26*/ "abc+efg*xyz",
|
||||
);
|
||||
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_lower($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_lower() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
Test ctype_lower() function : usage variations - octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_lower(mixed $c)
|
||||
* Description: Checks for lowercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass octal and hexadecimal values to ctype_lower() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_lower() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array(0141, 0142, 0143, 0144);
|
||||
$hex_values = array (0x61, 0x62, 0x63, 0x64);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_lower($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_lower($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_lower() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_print() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_print(mixed $c)
|
||||
* Description: Checks for printable character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_print() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = "Hello, World!";
|
||||
$c2 = null;
|
||||
|
||||
var_dump(ctype_print($c1));
|
||||
var_dump(ctype_print($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_print() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Test ctype_print() function : error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_print(mixed $c)
|
||||
* Description: Checks for printable character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to ctype_print() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_print() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_print() function with Zero arguments --\n";
|
||||
var_dump( ctype_print() );
|
||||
|
||||
//Test ctype_print with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_print() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_print($c, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_print() : error conditions ***
|
||||
|
||||
-- Testing ctype_print() function with Zero arguments --
|
||||
|
||||
Warning: ctype_print() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_print() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_print() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_print() function : usage variations - different data types as $c arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_print(mixed $c)
|
||||
* Description: Checks for printable character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_print() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_print() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_print()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_print($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_print() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,125 @@
|
||||
--TEST--
|
||||
Test ctype_print() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_print(mixed $c)
|
||||
* Description: Checks for printable character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_print() to test which character codes are considered
|
||||
* valid printable characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_print() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($i = 0; $i < 256; $i++) {
|
||||
if (ctype_print($i)) {
|
||||
echo "character code $i is a printable character\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_print() : usage variations ***
|
||||
character code 32 is a printable character
|
||||
character code 33 is a printable character
|
||||
character code 34 is a printable character
|
||||
character code 35 is a printable character
|
||||
character code 36 is a printable character
|
||||
character code 37 is a printable character
|
||||
character code 38 is a printable character
|
||||
character code 39 is a printable character
|
||||
character code 40 is a printable character
|
||||
character code 41 is a printable character
|
||||
character code 42 is a printable character
|
||||
character code 43 is a printable character
|
||||
character code 44 is a printable character
|
||||
character code 45 is a printable character
|
||||
character code 46 is a printable character
|
||||
character code 47 is a printable character
|
||||
character code 48 is a printable character
|
||||
character code 49 is a printable character
|
||||
character code 50 is a printable character
|
||||
character code 51 is a printable character
|
||||
character code 52 is a printable character
|
||||
character code 53 is a printable character
|
||||
character code 54 is a printable character
|
||||
character code 55 is a printable character
|
||||
character code 56 is a printable character
|
||||
character code 57 is a printable character
|
||||
character code 58 is a printable character
|
||||
character code 59 is a printable character
|
||||
character code 60 is a printable character
|
||||
character code 61 is a printable character
|
||||
character code 62 is a printable character
|
||||
character code 63 is a printable character
|
||||
character code 64 is a printable character
|
||||
character code 65 is a printable character
|
||||
character code 66 is a printable character
|
||||
character code 67 is a printable character
|
||||
character code 68 is a printable character
|
||||
character code 69 is a printable character
|
||||
character code 70 is a printable character
|
||||
character code 71 is a printable character
|
||||
character code 72 is a printable character
|
||||
character code 73 is a printable character
|
||||
character code 74 is a printable character
|
||||
character code 75 is a printable character
|
||||
character code 76 is a printable character
|
||||
character code 77 is a printable character
|
||||
character code 78 is a printable character
|
||||
character code 79 is a printable character
|
||||
character code 80 is a printable character
|
||||
character code 81 is a printable character
|
||||
character code 82 is a printable character
|
||||
character code 83 is a printable character
|
||||
character code 84 is a printable character
|
||||
character code 85 is a printable character
|
||||
character code 86 is a printable character
|
||||
character code 87 is a printable character
|
||||
character code 88 is a printable character
|
||||
character code 89 is a printable character
|
||||
character code 90 is a printable character
|
||||
character code 91 is a printable character
|
||||
character code 92 is a printable character
|
||||
character code 93 is a printable character
|
||||
character code 94 is a printable character
|
||||
character code 95 is a printable character
|
||||
character code 96 is a printable character
|
||||
character code 97 is a printable character
|
||||
character code 98 is a printable character
|
||||
character code 99 is a printable character
|
||||
character code 100 is a printable character
|
||||
character code 101 is a printable character
|
||||
character code 102 is a printable character
|
||||
character code 103 is a printable character
|
||||
character code 104 is a printable character
|
||||
character code 105 is a printable character
|
||||
character code 106 is a printable character
|
||||
character code 107 is a printable character
|
||||
character code 108 is a printable character
|
||||
character code 109 is a printable character
|
||||
character code 110 is a printable character
|
||||
character code 111 is a printable character
|
||||
character code 112 is a printable character
|
||||
character code 113 is a printable character
|
||||
character code 114 is a printable character
|
||||
character code 115 is a printable character
|
||||
character code 116 is a printable character
|
||||
character code 117 is a printable character
|
||||
character code 118 is a printable character
|
||||
character code 119 is a printable character
|
||||
character code 120 is a printable character
|
||||
character code 121 is a printable character
|
||||
character code 122 is a printable character
|
||||
character code 123 is a printable character
|
||||
character code 124 is a printable character
|
||||
character code 125 is a printable character
|
||||
character code 126 is a printable character
|
||||
===DONE===
|
||||
@@ -0,0 +1,126 @@
|
||||
--TEST--
|
||||
Test ctype_print() function : usage variations - different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_print(mixed $c)
|
||||
* Description: Checks for printable character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_print() to test
|
||||
* which are considered valid printable character only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_print() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
"abc123\n",
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
/*23*/ base64_decode("w4DDoMOHw6fDiMOo") // non-ascii characters
|
||||
);
|
||||
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_print($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_print() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
Test ctype_print() function : usage variations - octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_print(mixed $c)
|
||||
* Description: Checks for printable character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass octal and hexadecimal values to ctype_print() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_print() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array(040, 041, 042, 043);
|
||||
$hex_values = array (0x20, 0x21, 0x23, 0x24);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_print($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_print($c));
|
||||
$iterator++;
|
||||
}
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_print() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Test ctype_punct() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_punct(mixed $c)
|
||||
* Description: Checks for any printable character which is not whitespace
|
||||
* or an alphanumeric character
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_punct() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = '@!$*';
|
||||
$c2 = 'hello, world!';
|
||||
|
||||
var_dump(ctype_punct($c1));
|
||||
var_dump(ctype_punct($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_punct() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
Test ctype_punct() function : error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_punct(mixed $c)
|
||||
* Description: Checks for any printable character which is not whitespace
|
||||
* or an alphanumeric character
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to ctype_punct() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_punct() : error conditions ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_punct() function with Zero arguments --\n";
|
||||
var_dump( ctype_punct() );
|
||||
|
||||
//Test ctype_punct with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_punct() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_punct($c, $extra_arg) );
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_punct() : error conditions ***
|
||||
|
||||
-- Testing ctype_punct() function with Zero arguments --
|
||||
|
||||
Warning: ctype_punct() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_punct() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_punct() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,178 @@
|
||||
--TEST--
|
||||
Test ctype_punct() function : usage variations - different data types as $c argument
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_punct(mixed $c)
|
||||
* Description: Checks for any printable character which is not whitespace
|
||||
* or an alphanumeric character
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_punt() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_punct() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return ",<.>";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
[{}]
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ ";:'@",
|
||||
'#~/?',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_punct
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_punct($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_punct() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,63 @@
|
||||
--TEST--
|
||||
Test ctype_punct() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_punct(mixed $c)
|
||||
* Description: Checks for any printable character which is not whitespace
|
||||
* or an alphanumeric character
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_punct() to test which character codes are considered
|
||||
* valid punctuation characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_punct() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($c = 1; $c < 256; $c++) {
|
||||
if (ctype_punct($c)) {
|
||||
echo "character code $c is punctuation\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_punct() : usage variations ***
|
||||
character code 33 is punctuation
|
||||
character code 34 is punctuation
|
||||
character code 35 is punctuation
|
||||
character code 36 is punctuation
|
||||
character code 37 is punctuation
|
||||
character code 38 is punctuation
|
||||
character code 39 is punctuation
|
||||
character code 40 is punctuation
|
||||
character code 41 is punctuation
|
||||
character code 42 is punctuation
|
||||
character code 43 is punctuation
|
||||
character code 44 is punctuation
|
||||
character code 45 is punctuation
|
||||
character code 46 is punctuation
|
||||
character code 47 is punctuation
|
||||
character code 58 is punctuation
|
||||
character code 59 is punctuation
|
||||
character code 60 is punctuation
|
||||
character code 61 is punctuation
|
||||
character code 62 is punctuation
|
||||
character code 63 is punctuation
|
||||
character code 64 is punctuation
|
||||
character code 91 is punctuation
|
||||
character code 92 is punctuation
|
||||
character code 93 is punctuation
|
||||
character code 94 is punctuation
|
||||
character code 95 is punctuation
|
||||
character code 96 is punctuation
|
||||
character code 123 is punctuation
|
||||
character code 124 is punctuation
|
||||
character code 125 is punctuation
|
||||
character code 126 is punctuation
|
||||
===DONE===
|
||||
@@ -0,0 +1,138 @@
|
||||
--TEST--
|
||||
Test ctype_punct() function : usage variations - different punctuation
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_punct(mixed $c)
|
||||
* Description: Checks for any printable character which is not whitespace
|
||||
* or an alphanumeric character
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_punct() to test
|
||||
* which are considered valid punctuation character only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_punct() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
"abc123\n",
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
|
||||
"!$%@\n",
|
||||
/*25*/ "\"?!\"",
|
||||
/*26*/ "|\ @~",
|
||||
);
|
||||
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_punct($value) );
|
||||
$iterator++;
|
||||
};
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_punct() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,63 @@
|
||||
--TEST--
|
||||
Test ctype_punct() function : usage variations - Octal and Hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_punct(mixed $c)
|
||||
* Description: Checks for any printable character which is not whitespace
|
||||
* or an alphanumeric character
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different octal and hexadecimal values to ctype_punct() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_punct() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array(041, 042, 043, 044);
|
||||
$hex_values = array(0x21, 0x22, 0x23, 0x24);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_punct($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_punct($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_punct() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_space() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_space(mixed $c)
|
||||
* Description: Checks for whitespace character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_space() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = " \t\r\n";
|
||||
var_dump(ctype_space($c1));
|
||||
|
||||
$c2 = "Hello, world!\n";
|
||||
var_dump(ctype_space($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_space() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Test ctype_space() function : error conditions - Incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_space(mixed $c)
|
||||
* Description: Checks for whitespace character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass an incorrect number of arguments to ctype_space() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_space() : error conditions ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_space() function with Zero arguments --\n";
|
||||
var_dump( ctype_space() );
|
||||
|
||||
//Test ctype_space with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_space() function with more than expected no. of arguments --\n";
|
||||
$c = " ";
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_space($c, $extra_arg) );
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_space() : error conditions ***
|
||||
|
||||
-- Testing ctype_space() function with Zero arguments --
|
||||
|
||||
Warning: ctype_space() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_space() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_space() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_space() function : usage variations - different data types as $c argument
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_space(mixed $c)
|
||||
* Description: Checks for whitespace character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_space() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_space() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "\n\t\r";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "\n\t\r",
|
||||
' ',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_space()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_space($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_space() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Test ctype_space() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_space(mixed $c)
|
||||
* Description: Checks for whitespace character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_space() to test which character codes are considered
|
||||
* valid whitespace characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_space() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($c = 1; $c < 256; $c++) {
|
||||
if (ctype_space($c)) {
|
||||
echo "character code $c is a space character\n";
|
||||
}
|
||||
}
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_space() : usage variations ***
|
||||
character code 9 is a space character
|
||||
character code 10 is a space character
|
||||
character code 11 is a space character
|
||||
character code 12 is a space character
|
||||
character code 13 is a space character
|
||||
character code 32 is a space character
|
||||
===DONE===
|
||||
@@ -0,0 +1,138 @@
|
||||
--TEST--
|
||||
Test ctype_space() function : usage variations - different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_space(mixed $c)
|
||||
* Description: Checks for whitespace character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_space() to test
|
||||
* which are considered valid whitespace character only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_space() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
"abc123\n",
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
|
||||
"\"\n",
|
||||
/*25*/ " \t\r\n",
|
||||
/*26*/ "\v\f",
|
||||
);
|
||||
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_space($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_space() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,69 @@
|
||||
--TEST--
|
||||
Test ctype_space() function : usage variations - octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_space(mixed $c)
|
||||
* Description: Checks for whitespace character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass octal and hexadecimal values as $c to ctype_space() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_space() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array (011, 012, 013, 014, 015, 040);
|
||||
$hex_values = array (0x9, 0xA, 0xB, 0xC, 0xD, 0x20);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_space($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_space($c));
|
||||
$iterator++;
|
||||
}
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_space() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test ctype_upper() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_upper(mixed $c)
|
||||
* Description: Checks for uppercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_upper() : basic functionality ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = 'HELLOWORLD';
|
||||
$c2 = "Hello, World!\n";
|
||||
|
||||
var_dump(ctype_upper($c1));
|
||||
var_dump(ctype_upper($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_upper() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Test ctype_upper() function : error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_upper(mixed $c)
|
||||
* Description: Checks for uppercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to ctype_upper() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_upper() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_upper() function with Zero arguments --\n";
|
||||
var_dump( ctype_upper() );
|
||||
|
||||
//Test ctype_upper with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_upper() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_upper($c, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_upper() : error conditions ***
|
||||
|
||||
-- Testing ctype_upper() function with Zero arguments --
|
||||
|
||||
Warning: ctype_upper() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_upper() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_upper() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_upper() function : usage variations - different data types
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_upper(mixed $c)
|
||||
* Description: Checks for uppercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_upper() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_upper() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "HELLO";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
HI
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "STRING",
|
||||
'STRING',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_upper()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_upper($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_upper() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,55 @@
|
||||
--TEST--
|
||||
Test ctype_upper() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_upper(mixed $c)
|
||||
* Description: Checks for uppercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_upper() to test which character codes are considered
|
||||
* valid uppercase characters
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_upper() : usage variations ***\n";
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for ($i = 0; $i < 256; $i++) {
|
||||
if (ctype_upper($i)) {
|
||||
echo "character code $i is a uppercase character\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_upper() : usage variations ***
|
||||
character code 65 is a uppercase character
|
||||
character code 66 is a uppercase character
|
||||
character code 67 is a uppercase character
|
||||
character code 68 is a uppercase character
|
||||
character code 69 is a uppercase character
|
||||
character code 70 is a uppercase character
|
||||
character code 71 is a uppercase character
|
||||
character code 72 is a uppercase character
|
||||
character code 73 is a uppercase character
|
||||
character code 74 is a uppercase character
|
||||
character code 75 is a uppercase character
|
||||
character code 76 is a uppercase character
|
||||
character code 77 is a uppercase character
|
||||
character code 78 is a uppercase character
|
||||
character code 79 is a uppercase character
|
||||
character code 80 is a uppercase character
|
||||
character code 81 is a uppercase character
|
||||
character code 82 is a uppercase character
|
||||
character code 83 is a uppercase character
|
||||
character code 84 is a uppercase character
|
||||
character code 85 is a uppercase character
|
||||
character code 86 is a uppercase character
|
||||
character code 87 is a uppercase character
|
||||
character code 88 is a uppercase character
|
||||
character code 89 is a uppercase character
|
||||
character code 90 is a uppercase character
|
||||
===DONE===
|
||||
@@ -0,0 +1,137 @@
|
||||
--TEST--
|
||||
Test ctype_upper() function : usage variations - different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_upper(mixed $c)
|
||||
* Description: Checks for uppercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_upper() to test
|
||||
* which are considered valid uppercase character only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_upper() : usage variations ***\n";
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
'abc123\n',
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
|
||||
"abcXYZ",
|
||||
/*25*/ "ABC XYZ",
|
||||
/*26*/ "ABC+EFG*XYZ",
|
||||
);
|
||||
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_upper($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_upper() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
Test ctype_upper() function : usage variations - octal and hexadecimal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_upper(mixed $c)
|
||||
* Description: Checks for uppercase character(s)
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass octal and hexadecimal values to ctype_upper() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_upper() : usage variations ***\n";
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$octal_values = array(0101, 0102, 0103, 0104);
|
||||
$hex_values = array(0x41, 0x42, 0x43, 0x44);
|
||||
|
||||
echo "\n-- Octal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($octal_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_upper($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal Values --\n";
|
||||
$iterator = 1;
|
||||
foreach($hex_values as $c) {
|
||||
echo "-- Iteration $iterator --\n";
|
||||
var_dump(ctype_upper($c));
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_upper() : usage variations ***
|
||||
|
||||
-- Octal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal Values --
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Test ctype_xdigit() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_xdigit(mixed $c)
|
||||
* Description: Checks for character(s) representing a hexadecimal digit
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_xdigit() : basic functionality ***\n";
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$c1 = 'abcdefABCDEF0123456789';
|
||||
$c2 = 'face 034';
|
||||
|
||||
var_dump(ctype_xdigit($c1));
|
||||
var_dump(ctype_xdigit($c2));
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_xdigit() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Test ctype_xdigit() function : error conditions - Incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_xdigit(mixed $c)
|
||||
* Description: Checks for character(s) representing a hexadecimal digit
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to ctype_xdigit() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_xdigit() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ctype_xdigit() function with Zero arguments --\n";
|
||||
var_dump( ctype_xdigit() );
|
||||
|
||||
//Test ctype_xdigit with one more than the expected number of arguments
|
||||
echo "\n-- Testing ctype_xdigit() function with more than expected no. of arguments --\n";
|
||||
$c = 1;
|
||||
$extra_arg = 10;
|
||||
var_dump( ctype_xdigit($c, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_xdigit() : error conditions ***
|
||||
|
||||
-- Testing ctype_xdigit() function with Zero arguments --
|
||||
|
||||
Warning: ctype_xdigit() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ctype_xdigit() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ctype_xdigit() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -0,0 +1,177 @@
|
||||
--TEST--
|
||||
Test ctype_xdigit() function : usage variations - different data typse as $c arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_xdigit(mixed $c)
|
||||
* Description: Checks for character(s) representing a hexadecimal digit
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $c argument to ctype_xdigit() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_xdigit() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "ABcd";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
234
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $c argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "456",
|
||||
'def',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of ctype_xdigit()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_xdigit($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_xdigit() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
Test ctype_xdigit() function : usage variations - different integers
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_xdigit(mixed $c)
|
||||
* Description: Checks for character(s) representing a hexadecimal digit
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different integers to ctype_xdigit() to test which character codes are considered
|
||||
* valid hexadecimal 'digits'
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_xdigit() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
for($c = 1; $c < 256; $c++) {
|
||||
if (ctype_xdigit($c)) {
|
||||
echo "character code $c is a hexadecimal 'digit'\n";
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_xdigit() : usage variations ***
|
||||
character code 48 is a hexadecimal 'digit'
|
||||
character code 49 is a hexadecimal 'digit'
|
||||
character code 50 is a hexadecimal 'digit'
|
||||
character code 51 is a hexadecimal 'digit'
|
||||
character code 52 is a hexadecimal 'digit'
|
||||
character code 53 is a hexadecimal 'digit'
|
||||
character code 54 is a hexadecimal 'digit'
|
||||
character code 55 is a hexadecimal 'digit'
|
||||
character code 56 is a hexadecimal 'digit'
|
||||
character code 57 is a hexadecimal 'digit'
|
||||
character code 65 is a hexadecimal 'digit'
|
||||
character code 66 is a hexadecimal 'digit'
|
||||
character code 67 is a hexadecimal 'digit'
|
||||
character code 68 is a hexadecimal 'digit'
|
||||
character code 69 is a hexadecimal 'digit'
|
||||
character code 70 is a hexadecimal 'digit'
|
||||
character code 97 is a hexadecimal 'digit'
|
||||
character code 98 is a hexadecimal 'digit'
|
||||
character code 99 is a hexadecimal 'digit'
|
||||
character code 100 is a hexadecimal 'digit'
|
||||
character code 101 is a hexadecimal 'digit'
|
||||
character code 102 is a hexadecimal 'digit'
|
||||
===DONE===
|
||||
@@ -0,0 +1,138 @@
|
||||
--TEST--
|
||||
Test ctype_xdigit() function : usage variations - Different strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_xdigit(mixed $c)
|
||||
* Description: Checks for character(s) representing a hexadecimal digit
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass strings containing different character types to ctype_xdigit() to test
|
||||
* which are considered valid hexadecimal 'digit' only strings
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_xdigit() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
$values = array(
|
||||
/*1*/ "This string contains just letters and spaces", // Simple string
|
||||
"but this one contains some numbers too 123+456 = 678", // Mixed string
|
||||
"",
|
||||
" ",
|
||||
/*5*/ "a",
|
||||
"ABCXYZ",
|
||||
"abcxyz",
|
||||
"ABCXYZ123DEF456",
|
||||
"abczyz123DEF456",
|
||||
/*10*/ "\r\n",
|
||||
"123",
|
||||
"03F", // hexadecimal 'digits'
|
||||
")speci@! ch@r$(",
|
||||
'@!$*',
|
||||
/*15*/ 'ABC',
|
||||
'abc',
|
||||
'ABC123',
|
||||
'abc123',
|
||||
'abc123\n',
|
||||
/*20*/ 'abc 123',
|
||||
'',
|
||||
' ',
|
||||
base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
|
||||
'ABCdef07',
|
||||
"56ea\tFB",
|
||||
"0x2A"
|
||||
);
|
||||
|
||||
$iterator = 1;
|
||||
foreach($values as $value) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( ctype_xdigit($value) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_xdigit() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 25 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 26 --
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,81 @@
|
||||
--TEST--
|
||||
Test ctype_xdigit() function : usage variations - heaxadecimal and octal values
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool ctype_xdigit(mixed $c)
|
||||
* Description: Checks for character(s) representing a hexadecimal digit
|
||||
* Source code: ext/ctype/ctype.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different hexadecimal and octal values that:
|
||||
* 1. contain hexadecimal digits
|
||||
* 2. correspond to character codes recognised as hexadecimal digits (see variation2)
|
||||
* referred to as 'correct' integers below
|
||||
*/
|
||||
|
||||
echo "*** Testing ctype_xdigit() : usage variations ***\n";
|
||||
|
||||
$orig = setlocale(LC_CTYPE, "C");
|
||||
|
||||
// contain hexadecimal digits but do not correspond to 'correct' ints
|
||||
$octal_values1 = array(012, 013, 014, 015);
|
||||
|
||||
// correspond to 'correct' integers
|
||||
$octal_values2 = array(061, 062, 063, 064);
|
||||
|
||||
// contain hexadecimal digits but do not correspond to 'correct' ints
|
||||
$hex_values1 = array(0x1A, 0x1B, 0x1C, 0x1D);
|
||||
|
||||
//correspond to 'correct' integers
|
||||
$hex_values2 = array(0x61, 0x62, 0x63, 0x64);
|
||||
|
||||
echo "\n-- Octal values --\n";
|
||||
echo "'Incorrect' Integers: \n";
|
||||
foreach($octal_values1 as $c) {
|
||||
var_dump(ctype_xdigit($c));
|
||||
}
|
||||
echo "'Correct' Integers: \n";
|
||||
foreach($octal_values2 as $c) {
|
||||
var_dump(ctype_xdigit($c));
|
||||
}
|
||||
|
||||
echo "\n-- Hexadecimal values --\n";
|
||||
echo "'Incorrect' Integers: \n";
|
||||
foreach($hex_values1 as $c) {
|
||||
var_dump(ctype_xdigit($c));
|
||||
}
|
||||
echo "'Correct' Integers: \n";
|
||||
foreach($hex_values2 as $c) {
|
||||
var_dump(ctype_xdigit($c));
|
||||
}
|
||||
setlocale(LC_CTYPE, $orig);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ctype_xdigit() : usage variations ***
|
||||
|
||||
-- Octal values --
|
||||
'Incorrect' Integers:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
'Correct' Integers:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
-- Hexadecimal values --
|
||||
'Incorrect' Integers:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
'Correct' Integers:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
===DONE===
|
||||
+596
-566
File diff suppressed because it is too large.
Load diff
+15
-5
@@ -746,9 +746,9 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
offset->abbr = strdup(t->tz_abbr);
|
||||
} else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) {
|
||||
offset = timelib_time_offset_ctor();
|
||||
offset->offset = (t->z - (t->dst * 60)) * -60;
|
||||
offset->offset = (t->z) * -60;
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = t->dst;
|
||||
offset->is_dst = 0;
|
||||
offset->abbr = malloc(9); /* GMT±xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
@@ -2271,9 +2271,19 @@ PHP_FUNCTION(timezone_offset_get)
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(dateobject TSRMLS_CC);
|
||||
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
|
||||
|
||||
offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz);
|
||||
RETVAL_LONG(offset->offset);
|
||||
timelib_time_offset_dtor(offset);
|
||||
switch (tzobj->type) {
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz);
|
||||
RETVAL_LONG(offset->offset);
|
||||
timelib_time_offset_dtor(offset);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
RETURN_LONG(tzobj->tzi.utc_offset * -60);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #44742 (timezone_offset_get() causes segmentation faults)
|
||||
--FILE--
|
||||
<?php
|
||||
date_default_timezone_set('Europe/London');
|
||||
$dates = array(
|
||||
"2008-04-11 00:00:00+0000",
|
||||
"2008-04-11 00:00:00+0200",
|
||||
"2008-04-11 00:00:00+0330",
|
||||
"2008-04-11 00:00:00-0500",
|
||||
"2008-04-11 00:00:00-1130",
|
||||
"2008-04-11 00:00:00 CEST",
|
||||
"2008-04-11 00:00:00 CET",
|
||||
"2008-04-11 00:00:00 UTC",
|
||||
"2008-04-11 00:00:00 America/New_York",
|
||||
"2008-04-11 00:00:00 Europe/Oslo",
|
||||
"2008-04-11 00:00:00 Asia/Singapore",
|
||||
);
|
||||
foreach ($dates as $date)
|
||||
{
|
||||
$date = date_create($date);
|
||||
var_dump(timezone_offset_get(date_timezone_get($date), $date));
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(7200)
|
||||
int(12600)
|
||||
int(-18000)
|
||||
int(-41400)
|
||||
int(7200)
|
||||
int(3600)
|
||||
int(0)
|
||||
int(-14400)
|
||||
int(7200)
|
||||
int(28800)
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Format timestamp in DST test
|
||||
--INI--
|
||||
date.timezone=CEST
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL); // hide e_strict warning about timezones
|
||||
var_dump( date_create( '@1202996091' )->format( 'c' ) );
|
||||
?>
|
||||
--EXPECT--
|
||||
string(25) "2008-02-14T13:34:51+00:00"
|
||||
@@ -1,7 +1,12 @@
|
||||
--TEST--
|
||||
Bug #38474 (getAttribute select attribute by order, even when prefixed) (OK to fail with libxml2 < 2.6.2x)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
if (version_compare(LIBXML_DOTTED_VERSION, "2.6.20", "<")) {
|
||||
print "skip libxml version " . LIBXML_DOTTED_VERSION;
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = '<node xmlns:pre="http://foo.com/tr/pre"
|
||||
|
||||
+2
-2
@@ -242,7 +242,7 @@ PHP_MSHUTDOWN_FUNCTION(exif)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ exif dependencies */
|
||||
static const zend_module_dep exif_module_deps[] = {
|
||||
static zend_module_dep exif_module_deps[] = {
|
||||
ZEND_MOD_REQUIRED("standard")
|
||||
#if EXIF_USE_MBSTRING
|
||||
ZEND_MOD_REQUIRED("mbstring")
|
||||
@@ -2877,7 +2877,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
/* exception are IFD pointers */
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, byte_count, offset_val+byte_count, IFDlength);
|
||||
}
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
if (byte_count>sizeof(cbuf)) {
|
||||
/* mark as outside range and get buffer */
|
||||
|
||||
@@ -469,7 +469,7 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
{
|
||||
/* From http://cvs.php.net/co.php/pear/HTML_QuickForm/QuickForm/Rule/Email.php?r=1.4 */
|
||||
const char regexp[] = "/^((\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\\-])+\\.)+[A-Za-z\\-]+))$/D";
|
||||
const char regexp[] = "/^((\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9])(([A-Za-z0-9\\-])*([A-Za-z0-9]))?\\.)+[A-Za-z\\-]+))$/D";
|
||||
|
||||
pcre *re = NULL;
|
||||
pcre_extra *pcre_extra = NULL;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #44445 (email validator does not handle domains starting/ending with a -)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(filter_var("foo@-foo.com",FILTER_VALIDATE_EMAIL));
|
||||
var_dump(filter_var("foo@foo-.com",FILTER_VALIDATE_EMAIL));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
+1
-1
@@ -2813,7 +2813,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
}
|
||||
}
|
||||
|
||||
if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) {
|
||||
if (argc >= 2 && Z_STRLEN_PP(file)) {
|
||||
PHP_GD_CHECK_OPEN_BASEDIR(fn, "Invalid filename");
|
||||
|
||||
fp = VCWD_FOPEN(fn, "wb");
|
||||
|
||||
+12
-7
@@ -792,7 +792,11 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
#ifdef SET_MAXLOGINTRIALS
|
||||
if (myargc == 5) {
|
||||
convert_to_long_ex(retries);
|
||||
mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) Z_LVAL_PP(retries));
|
||||
if (Z_LVAL_PP(retries) < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING ,"Retries must be greater or equal to 0");
|
||||
} else {
|
||||
mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) Z_LVAL_PP(retries));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1051,6 +1055,7 @@ PHP_FUNCTION(imap_setacl)
|
||||
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
|
||||
|
||||
convert_to_string_ex(mailbox);
|
||||
convert_to_string_ex(id);
|
||||
convert_to_string_ex(rights);
|
||||
|
||||
RETURN_BOOL(imap_setacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), Z_STRVAL_PP(id), Z_STRVAL_PP(rights)));
|
||||
@@ -1582,8 +1587,8 @@ PHP_FUNCTION(imap_headerinfo)
|
||||
convert_to_long_ex(msgno);
|
||||
if (myargc >= 3) {
|
||||
convert_to_long_ex(fromlength);
|
||||
if (Z_LVAL_PP(fromlength) < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "From length has to be greater than or equal to 0");
|
||||
if (Z_LVAL_PP(fromlength) < 0 || Z_LVAL_PP(fromlength) >= MAILTMPLEN) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "From length has to be between 1 and %i", MAILTMPLEN);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
@@ -1591,8 +1596,8 @@ PHP_FUNCTION(imap_headerinfo)
|
||||
}
|
||||
if (myargc >= 4) {
|
||||
convert_to_long_ex(subjectlength);
|
||||
if (Z_LVAL_PP(subjectlength) < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject length has to be greater than or equal to 0");
|
||||
if (Z_LVAL_PP(subjectlength) < 0 || Z_LVAL_PP(subjectlength) >= MAILTMPLEN) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject length has to be between 1 and %i", MAILTMPLEN);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
@@ -3036,8 +3041,8 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(body));
|
||||
if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) != SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter cannot be empty");
|
||||
if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) != SUCCESS || Z_TYPE_PP(data) != IS_ARRAY) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter must be a non-empty array");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ PHP_MSHUTDOWN_FUNCTION(mysql)
|
||||
#ifdef PHP_WIN32
|
||||
unsigned long client_ver = mysql_get_client_version();
|
||||
/* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
|
||||
if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
|
||||
if ((client_ver >= 50046 && client_ver < 50100) || client_ver > 50122) {
|
||||
mysql_server_end();
|
||||
}
|
||||
#else
|
||||
@@ -586,7 +586,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
client_flags ^= CLIENT_LOCAL_FILES;
|
||||
}
|
||||
|
||||
hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s_%d", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
|
||||
hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s_%ld", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
|
||||
}
|
||||
|
||||
/* We cannot use mysql_port anymore in windows, need to use
|
||||
|
||||
+1
-1
@@ -669,7 +669,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli)
|
||||
#ifdef PHP_WIN32
|
||||
unsigned long client_ver = mysql_get_client_version();
|
||||
/* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
|
||||
if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
|
||||
if ((client_ver >= 50046 && client_ver < 50100) || client_ver > 50122) {
|
||||
mysql_server_end();
|
||||
}
|
||||
#else
|
||||
|
||||
+2
-2
@@ -377,7 +377,7 @@ zend_module_entry oci8_module_entry = {
|
||||
PHP_RINIT(oci), /* per-request startup function */
|
||||
PHP_RSHUTDOWN(oci), /* per-request shutdown function */
|
||||
PHP_MINFO(oci), /* information function */
|
||||
"1.2.4",
|
||||
"1.2.5",
|
||||
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
|
||||
PHP_MODULE_GLOBALS(oci), /* globals descriptor */
|
||||
PHP_GINIT(oci), /* globals ctor */
|
||||
@@ -673,7 +673,7 @@ PHP_MINFO_FUNCTION(oci)
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "OCI8 Support", "enabled");
|
||||
php_info_print_table_row(2, "Version", "1.2.4");
|
||||
php_info_print_table_row(2, "Version", "1.2.5");
|
||||
php_info_print_table_row(2, "Revision", "$Revision$");
|
||||
|
||||
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
|
||||
|
||||
@@ -1511,10 +1511,6 @@ PHP_FUNCTION(oci_free_statement)
|
||||
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
|
||||
|
||||
zend_list_delete(statement->id);
|
||||
if (statement->parent_stmtid) {
|
||||
zend_list_delete(statement->parent_stmtid);
|
||||
}
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -776,7 +776,11 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
|
||||
zend_hash_destroy(statement->defines);
|
||||
efree(statement->defines);
|
||||
}
|
||||
|
||||
|
||||
if (statement->parent_stmtid) {
|
||||
zend_list_delete(statement->parent_stmtid);
|
||||
}
|
||||
|
||||
zend_list_delete(statement->connection->rsrc_id);
|
||||
efree(statement);
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
--TEST--
|
||||
PECL Bug #6109 (Error messages not kept)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
echo "Once Oracle has popped the message from its stack, the message is\n";
|
||||
echo "no longer available.\n";
|
||||
|
||||
|
||||
$s = oci_parse($c, 'delete from table_does_not_exist');
|
||||
$r = @oci_execute($s);
|
||||
|
||||
if ($r) {
|
||||
echo "whoops - table does exist\n";
|
||||
} else {
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$err = oci_error($s);
|
||||
echo ($i) .' -> '.$err['message'] ."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1
|
||||
Once Oracle has popped the message from its stack, the message is
|
||||
no longer available.
|
||||
0 -> ORA-00942: %s
|
||||
1 ->
|
||||
2 ->
|
||||
3 ->
|
||||
4 ->
|
||||
Done
|
||||
@@ -1962,7 +1962,7 @@ PHP_FUNCTION(openssl_csr_sign)
|
||||
X509 * cert = NULL, *new_cert = NULL;
|
||||
X509_REQ * csr;
|
||||
EVP_PKEY * key = NULL, *priv_key = NULL;
|
||||
long csr_resource, certresource, keyresource;
|
||||
long csr_resource, certresource = 0, keyresource;
|
||||
int i;
|
||||
struct php_x509_request req;
|
||||
|
||||
|
||||
@@ -728,7 +728,7 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret TS
|
||||
|
||||
case PHP_STREAM_AS_FD_FOR_SELECT:
|
||||
if (ret) {
|
||||
*ret = (void*)sslsock->s.socket;
|
||||
*(int *)ret = sslsock->s.socket;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
@@ -738,7 +738,7 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret TS
|
||||
return FAILURE;
|
||||
}
|
||||
if (ret) {
|
||||
*ret = (void*)sslsock->s.socket;
|
||||
*(int *)ret = sslsock->s.socket;
|
||||
}
|
||||
return SUCCESS;
|
||||
default:
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
--TEST--
|
||||
PDO Common: Bug #43663 (__call on classes derived from PDO)
|
||||
--FILE--
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
if (!extension_loaded('pdo')) die('skip');
|
||||
if (!extension_loaded('pdo_sqlite')) die('skip no pdo_sqlite');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
--TEST--
|
||||
Bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL))
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_sqlite')) die('skip no pdo_sqlite');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -494,7 +494,7 @@ static int oci_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_valu
|
||||
OCIClientVersion(&major, &minor, &update, &patch, &port_update);
|
||||
slprintf(verstr, sizeof(verstr), "%d.%d.%d.%d.%d", major, minor, update, patch, port_update);
|
||||
ZVAL_STRING(return_value, verstr, 1);
|
||||
#elif PHP_PDO_OCI_CLIENT_VERSION
|
||||
#elif defined(PHP_PDO_OCI_CLIENT_VERSION)
|
||||
/* Compile time client version */
|
||||
ZVAL_STRING(return_value, PHP_PDO_OCI_CLIENT_VERSION, 1);
|
||||
#else
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.3.17
|
||||
3.3.7
|
||||
+3
-3
@@ -875,7 +875,7 @@ PHP_FUNCTION(posix_getgrgid)
|
||||
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
|
||||
int ret;
|
||||
struct group _g;
|
||||
struct group *retgrptr;
|
||||
struct group *retgrptr = NULL;
|
||||
long grbuflen;
|
||||
char *grbuf;
|
||||
#endif
|
||||
@@ -894,7 +894,7 @@ PHP_FUNCTION(posix_getgrgid)
|
||||
grbuf = emalloc(grbuflen);
|
||||
|
||||
ret = getgrgid_r(gid, &_g, grbuf, grbuflen, &retgrptr);
|
||||
if (ret) {
|
||||
if (ret || retgrptr == NULL) {
|
||||
POSIX_G(last_error) = ret;
|
||||
efree(grbuf);
|
||||
RETURN_FALSE;
|
||||
@@ -1009,7 +1009,7 @@ PHP_FUNCTION(posix_getpwuid)
|
||||
pwbuf = emalloc(pwbuflen);
|
||||
|
||||
ret = getpwuid_r(uid, &_pw, pwbuf, pwbuflen, &retpwptr);
|
||||
if (ret) {
|
||||
if (ret || retpwptr == NULL) {
|
||||
POSIX_G(last_error) = ret;
|
||||
efree(pwbuf);
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test posix_get_last_error() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto int posix_get_last_error(void)
|
||||
* Description: Retrieve the error number set by the last posix function which failed.
|
||||
* Source code: ext/posix/posix.c
|
||||
* Alias to functions: posix_errno
|
||||
*/
|
||||
|
||||
echo "*** Testing posix_get_last_error() : error conditions ***\n";
|
||||
|
||||
// One argument
|
||||
echo "\n-- Testing posix_get_last_error() function with one argument --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( posix_get_last_error($extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing posix_get_last_error() : error conditions ***
|
||||
|
||||
-- Testing posix_get_last_error() function with one argument --
|
||||
|
||||
Warning: Wrong parameter count for posix_get_last_error() in %s on line %d
|
||||
NULL
|
||||
Done
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test posix_getgid() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto int posix_getgid(void)
|
||||
* Description: Get the current group id (POSIX.1, 4.2.1)
|
||||
* Source code: ext/posix/posix.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing posix_getgid() : error conditions ***\n";
|
||||
|
||||
// One argument
|
||||
echo "\n-- Testing posix_getgid() function with one argument --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( posix_getgid($extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing posix_getgid() : error conditions ***
|
||||
|
||||
-- Testing posix_getgid() function with one argument --
|
||||
|
||||
Warning: Wrong parameter count for posix_getgid() in %s on line %d
|
||||
NULL
|
||||
Done
|
||||
@@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
Test posix_getgrgid() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto array posix_getgrgid(long gid)
|
||||
* Description: Group database access (POSIX.1, 9.2.1)
|
||||
* Source code: ext/posix/posix.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
/*
|
||||
* add a comment here to say what the test is supposed to do
|
||||
*/
|
||||
|
||||
echo "*** Testing posix_getgrgid() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing posix_getgrgid() function with Zero arguments --\n";
|
||||
var_dump( posix_getgrgid() );
|
||||
|
||||
//Test posix_getgrgid with one more than the expected number of arguments
|
||||
echo "\n-- Testing posix_getgrgid() function with more than expected no. of arguments --\n";
|
||||
|
||||
$extra_arg = 10;
|
||||
$gid = 0;
|
||||
var_dump( posix_getgrgid($gid, $extra_arg) );
|
||||
|
||||
echo "\n-- Testing posix_getgrgid() function with a negative group id --\n";
|
||||
$gid = -999;
|
||||
var_dump( posix_getgrgid($gid));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing posix_getgrgid() : error conditions ***
|
||||
|
||||
-- Testing posix_getgrgid() function with Zero arguments --
|
||||
|
||||
Warning: posix_getgrgid() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Testing posix_getgrgid() function with more than expected no. of arguments --
|
||||
|
||||
Warning: posix_getgrgid() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Testing posix_getgrgid() function with a negative group id --
|
||||
bool(false)
|
||||
Done
|
||||
Loaded 100 of 531 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user