Compare commits

...
134 Commits
Author SHA1 Message Date
SVN Migration c89cf742c4 This commit was manufactured by cvs2svn to create tag 'php_5_2_6'. 2008-04-30 18:27:57 +00:00
Ilia Alshanetsky 6a7f02001d 5.2.6 2008-04-30 18:27:56 +00:00
Ant Phillips ab211d72a3 Fix session test failures as reported by Antony Dovgal.
These were caused by the tests assuming default values for some session
configuration settings, in particular session.save_path and session.name.
The tests now explicitly set these settings in the --INI-- section.
2008-04-30 15:20:16 +00:00
Ant Phillips 3946b4727b Break up complicated rename tests into some smaller more consumable chunks 2008-04-30 13:53:49 +00:00
Ant Phillips 3a30d703c0 Fix session test failures as reported by Antony Dovgal.
These were caused by the tests assuming default values for some session
configuration settings, in particular session.save_path and session.name.
The tests now explicitly set these settings in the --INI-- section.
2008-04-30 09:27:59 +00:00
Scott MacVicar ad86c485cd MFH Fixed bug #44720 (Prevent infinite recursion within session_register) 2008-04-29 14:42:38 +00:00
Ant Phillips 597adbfef1 More session tests to improve code coverage for untested extension code 2008-04-29 09:24:17 +00:00
Ant Phillips 2d2ad8e8d3 More session tests to improve code coverage for untested extension code 2008-04-29 08:57:12 +00:00
Jani Taskinen f2c9167ebb MFH 2008-04-28 12:30:33 +00:00
Ant Phillips 0ccb772f10 Extra open_basedir tests 2008-04-24 16:40:53 +00:00
Ant Phillips 138a1160ab Allow for chmod() to fail on symbolic links 2008-04-24 13:58:29 +00:00
Ant Phillips e9da49eaf5 open_basedir tests for file system functions (v5.2, 5.3 and 6.0 branches) 2008-04-23 14:10:23 +00:00
Ant Phillips 64de2d2d45 New set of session extension tests for PHP 5.2 branch.
These hopefully test a reasonable set of basic, error and variations for
the twenty or so session functions. Note however that they do not
test all the session configuration settings, nor do they test anything
with register_globals enabled.
2008-04-22 16:04:00 +00:00
Ant Phillips 1f4fa0ba1f These tests were backported from the PHP 6.0 branch, which in turn were ported from this branch and then updated to remove any dependencies on register_globals. With register_globals removed they are useful tests to run against the 5.X branches. 2008-04-22 15:58:34 +00:00
Robin Fernandes 1d943ee85e Fix some ereg tests for 64bit platforms. 2008-04-22 15:31:56 +00:00
Felipe Pena 5c605854b8 - Fixed tests 2008-04-20 01:55:05 +00:00
Felipe Pena 11d09ac646 - Better error message 2008-04-20 01:43:18 +00:00
Antony Dovgal 269aac9ee9 fix test 2008-04-18 08:22:01 +00:00
Ilia Alshanetsky 7204e7ba5a BFN 2008-04-18 01:00:56 +00:00
Antony Dovgal 59dde7cbeb make Matt happy =) 2008-04-17 11:48:53 +00:00
Felipe Pena 11a13337ff - Fix typo 2008-04-17 11:04:49 +00:00
Derick Rethans 8649483a69 - Fixed bug #44703 (htmlspecialchars() does not detect bad character set
argument).
2008-04-16 17:21:46 +00:00
Antony Dovgal d9b443095f change %d to %ld and silence the warning 2008-04-16 08:54:44 +00:00
Felipe Pena 9db0be61ad Fixed bug #44703 (htmlspecialchars() does not detect bad character set argument) (patch by Andy Wharmby) 2008-04-11 19:01:25 +00:00
Robin Fernandes 29c12bd254 Fix test parse_url_variation_002.phpt for 64bit platforms. 2008-04-11 14:35:04 +00:00
Antony Dovgal ef1f2c1b7b fix tests 2008-04-11 11:06:18 +00:00
Antony Dovgal 1e20b1ed7d MFH: fix 2 segfaults in ZTS mode 2008-04-11 11:00:24 +00:00
Steve Seear 9d700f942f POSIX extension error tests 2008-04-11 09:32:32 +00:00
Steve Seear 35ca4a5cb4 POSIX extension variation tests 2008-04-11 09:27:42 +00:00
Robin Fernandes fdb9b9d8c8 Adding some tests for ereg and url functions. 2008-04-11 08:57:11 +00:00
Ilia Alshanetsky a1f0e80436 Back to dev 2008-04-10 22:31:09 +00:00
Ilia Alshanetsky 1e29c1716d 5.2.6RC5 2008-04-10 22:24:05 +00:00
Christopher Jones 7788b67557 Bump OCI8 version to 1.2.5 (This change is for 5.2 branch only) 2008-04-10 21:53:46 +00:00
Nuno Lopes 5baa766b21 MFB53 2008-04-10 19:16:00 +00:00
Nuno Lopes 60d622bdb0 MFB5.3: fix SKIPIF 2008-04-10 19:09:49 +00:00
Philip Olson 63ca897356 MFH: Updated the documentation credits 2008-04-10 05:32:26 +00:00
Scott MacVicar b584600e1d Fix heredoc handling. (Patch by Matt Wilmas) 2008-04-09 21:40:13 +00:00
Felipe Pena 52127174e2 Fixed bug #44678 (spliti error message includes wrong function name) 2008-04-09 13:47:35 +00:00
Dmitry Stogov a548d2f19b Fixed bug #44673 (With CGI argv/argc starts from arguments, not from script) 2008-04-09 09:16:40 +00:00
Ilia Alshanetsky edf54b5468 MFB: Bug #44650 escaepshellscmd() does not check arg count (port from 5.3) 2008-04-08 17:17:07 +00:00
Joe Orton 8611785073 MFH: Fixed bug #32979 (OpenSSL stream->fd casts broken in 64-bit build)
(stotty at tvnet dot hu)
MFH: Fix another case of a broken stream->fd cast in 64-bit builds.
2008-04-08 14:11:49 +00:00
Jani Taskinen 8f6f281866 MFH: Fixed test on systems where order is not guaranteed 2008-04-08 10:35:36 +00:00
Jani Taskinen a9f2587716 MFH: - Fixed bug #44667 (proc_open() does not handle pipes with the mode "wb" correctly) 2008-04-08 08:45:52 +00:00
Jani Taskinen 5f7df8099a MF53: Fix tests 2008-04-08 08:45:04 +00:00
Ilia Alshanetsky b615180021 MFB: various bug fixes 2008-04-08 00:03:34 +00:00
Antony Dovgal 7a4f2f9a00 fix test 2008-04-07 12:14:46 +00:00
Antony Dovgal 339414deea initialize variable 2008-04-07 10:44:03 +00:00
Marcus Boerger 98f4d8c5f6 - MFH add new tests 2008-04-06 17:53:35 +00:00
Felipe Pena e8795126ea Fixed bug #44591 (imagegif's filename parameter) 2008-04-04 17:39:52 +00:00
Derick Rethans d80a51181a - Fixed typo. 2008-04-04 07:26:41 +00:00
Ilia Alshanetsky cb9be83c31 Back to dev 2008-04-04 00:16:53 +00:00
Ilia Alshanetsky 62c865e21f 5.2.6RC4 2008-04-04 00:12:22 +00:00
Felipe Pena 1054bfbb0b - Fixed tests 2008-04-03 22:01:59 +00:00
Dmitry Stogov 889ba3c824 fixed name 2008-04-03 14:44:19 +00:00
Dmitry Stogov 1dd17ad54a - Fixed possible stack buffer overflow in FastCGI SAPI. (Andrey Nigmatulin)
- Fixed sending of uninitialized paddings which may contain some information.
  (Andrey Nigmatulin)
2008-04-03 10:24:44 +00:00
Ilia Alshanetsky 357cadb362 MFB: imap bug fixes 2008-04-02 16:31:51 +00:00
Antony Dovgal 8f16e0b75c MFH 2008-04-02 14:56:43 +00:00
Derick Rethans b0b7f4eed1 - MFH: Fixed a bug in formatting timestamps when DST is active in the default
timezone.
2008-03-31 09:12:15 +00:00
Felipe Pena 3e663ebfef Fixed bug #44564 (escapeshellarg removes UTF-8 multi-byte characters) 2008-03-30 12:17:39 +00:00
Felipe Pena fd6f77d569 Fixed bug #44557 (Crash in imap_setacl when supplied integer as username) (patch by Thomas Jarosch) 2008-03-28 16:43:49 +00:00
Ilia Alshanetsky dd040e75c3 Back to dev 2008-03-27 22:53:49 +00:00
Ilia Alshanetsky 1de0c2f27c 5.2.6RC3 2008-03-27 22:44:02 +00:00
Andrey Hristov 64af7df7d0 Recreate 2008-03-27 14:48:00 +00:00
Jani Taskinen 40655e4104 MF53:- Fix test (readdir() does not sort the results..) 2008-03-27 10:45:06 +00:00
Steve Seear 8cc6227b45 Adding tests for gethostbyaddr() and gethostbynamel() 2008-03-26 18:18:07 +00:00
Marcus Boerger 13a67db7f5 MFH:
- Fix memory leak found by Osman
- Merge strlen to sizof change from CLI
2008-03-26 13:21:57 +00:00
Antony Dovgal b103a34cda MFH: check if return value of write() is -1 and abort upload, setting the correct error status 2008-03-26 12:59:42 +00:00
Dmitry Stogov c6aef571dd Fixed test (removed leaks becaue of cyrcular references) 2008-03-25 07:01:22 +00:00
Antony Dovgal 00779cc424 MFH: disabled mmap() when copying files to memory 2008-03-24 16:28:56 +00:00
Derick Rethans 94cfbb5448 - Updated to version 2008.2 (2008b) 2008-03-24 13:01:10 +00:00
Dmitry Stogov 193801fbda Fixed tests (file order is undefined, so we need to sort() them) 2008-03-24 09:00:18 +00:00
Marcus Boerger 7e071024d3 - MFH Add .cvsignore 2008-03-23 16:53:57 +00:00
Marcus Boerger 03c3cfbde3 - MFH Add tests 2008-03-23 13:39:27 +00:00
Marcus Boerger 978886a3a8 - Make multibyte a tad bit less crappy 2008-03-22 18:53:08 +00:00
Antony Dovgal 708cbe15d1 add missing .cvsignore 2008-03-21 08:30:02 +00:00
Antony Dovgal 28331f99e2 fix ZTS build 2008-03-21 08:28:36 +00:00
Ilia Alshanetsky 8c4653fbb6 MFB: Refine fix for multibyte char hanling inside command names and args 2008-03-20 23:25:42 +00:00
Rob Richards 5a94926037 BFN
re-order
2008-03-20 16:49:41 +00:00
Rob Richards 4a4711eb36 MFH: fix bug #44478 (Inconsistent behaviour when assigning new nodes)
add test
2008-03-20 16:48:45 +00:00
Antony Dovgal 3baf31907a MFH 2008-03-20 12:14:15 +00:00
Antony Dovgal 83a3d76e37 fix tests 2008-03-20 11:34:50 +00:00
David Soria Parra bb4e8b10e3 MFH: Fix bug #44487 (call_user_method_array issues a warning when throwing an exception). 2008-03-20 00:55:26 +00:00
Steve Seear bc8c649878 Adding language tests. 2008-03-19 18:06:26 +00:00
Steve Seear 9e8d58e54b Added some class tests; Replaced some hardcoded instance ids with %d. 2008-03-19 17:56:12 +00:00
Steve Seear c441dafbf4 Adding tokenizer test 2008-03-19 17:43:52 +00:00
Steve Seear 6744f65d51 Adding streams tests 2008-03-19 17:38:25 +00:00
Steve Seear 946190d453 Adding filesystem tests 2008-03-19 17:23:29 +00:00
Antony Dovgal 236b0c1bde fix test 2008-03-19 12:36:17 +00:00
Dmitry Stogov 9b8fdcf63f Fixed test 2008-03-19 09:17:21 +00:00
Felipe Pena b781627d85 Fixed bug #43614 (incorrect processing of numerical string keys of array in arbitrary serialized data) 2008-03-19 03:00:40 +00:00
Ilia Alshanetsky 34f0981808 MFB: Bug #44445 (email validator does not handle domains starting/ending
with a -)
2008-03-18 23:32:42 +00:00
Robin Fernandes dc2a59a970 Adding more tests for serialize() and unserialize(). 2008-03-18 15:11:12 +00:00
Felipe Pena d202354263 Fix build 2008-03-18 00:25:24 +00:00
Stanislav Malyshev 7be2f35865 report printf fix 2008-03-17 23:09:06 +00:00
Ilia Alshanetsky 233c3ade12 MFB: Properly address incomplete multibyte chars inside escapeshellcmd() 2008-03-17 23:02:26 +00:00
Stanislav Malyshev 5273e2163b fix integer overflow in length calculation 2008-03-17 23:00:41 +00:00
Josie Messa 9a859a31ab - new tests for ctype functions 2008-03-17 09:50:42 +00:00
Derick Rethans d1e3634d13 - Updated to version 2008.1 (2008a) 2008-03-16 07:22:10 +00:00
Felipe Pena 681859cdc4 BFN: #41828, #44440 2008-03-15 10:46:48 +00:00
Felipe Pena 27f2d54784 Fixed bug #44440 (st_blocks undefined under BeOS) 2008-03-15 10:28:53 +00:00
Felipe Pena 655610a5bb Add SKIPIF (32bit platform only) 2008-03-14 23:13:07 +00:00
Ilia Alshanetsky 62b1449e47 Fixed bug #43677 (Inconsistent behaviour of include_path set with
php_value).
2008-03-13 15:56:21 +00:00
Felipe Pena a8fc46afa7 Fix valgrind version validation (accepting "valgrind-3.2.1-Debian") 2008-03-13 13:51:40 +00:00
Felipe Pena 3958a09990 Sync with fix for #44394 2008-03-12 19:33:46 +00:00
Felipe Pena 69663666c1 Fixed bug #42177 (Warning "array_merge_recursive(): recursion detected" comes again...) 2008-03-12 19:13:00 +00:00
Christopher Jones 0befe23833 MFH: New test for existing behavior 2008-03-12 17:52:48 +00:00
Ilia Alshanetsky 0f1e56bc3a MFB: Fixed bug #44388 (Crash inside exif_read_data() on invalid images) 2008-03-12 17:33:14 +00:00
Etienne Kneuss f2c14fd8b0 Fix bug #41828 (Fix crash on wrong instantiation) 2008-03-12 13:24:24 +00:00
Felipe Pena a000cbd955 Fixed bug #44394 (Last two bytes missing from output) 2008-03-12 11:27:42 +00:00
Antony Dovgal 40f85eb585 MFH: fix segfault - error_string may be NULL, in this case we have to follow the old behavior 2008-03-11 10:27:23 +00:00
Josie Messa c857ec6c98 - Replace with previous commit 2008-03-11 10:15:18 +00:00
Josie Messa 02be1a8d19 - Fix test 2008-03-11 10:01:31 +00:00
Josie Messa 052670121b - Modified tests 2008-03-11 09:55:26 +00:00
Josie Messa 2a93e109e1 - Added extra whitespace around error messages in expected output 2008-03-11 09:45:30 +00:00
Andrey Hristov 031e443b44 char **error_string was passed but not used. This causes problems in cases
of getaddrinfo() failure, because the upper layers don't get the error.
initialize a variable because we were reading initialized in case of error.
2008-03-10 20:09:22 +00:00
Josie Messa 977f7b6716 - New tests for getcwd() function 2008-03-10 15:21:17 +00:00
Josie Messa 63c1185096 - Modified expected output to allow tests to work on all platforms 2008-03-10 15:07:20 +00:00
Felipe Pena d4888d7410 Fixed compilation warnings 2008-03-10 14:54:47 +00:00
Josie Messa 14a393d6a2 - New tests for scandir() function 2008-03-10 14:09:05 +00:00
Felipe Pena d39fbb1548 Fix typo (#44381) 2008-03-09 16:06:33 +00:00
David Coallier ff962d9de1 - MFH . Libxml version < 2.6.21 it fails. Patch from scoates 2008-03-08 19:14:38 +00:00
Zoe Slattery 4ec1845b52 Countable requires SPL 2008-03-08 17:13:06 +00:00
Andrey Hristov ecf84f8b6b Fix introduced in 5.0.46, not in 5.0.42 2008-03-08 14:59:37 +00:00
Felipe Pena 1c9c9daa78 BFN: #44373 2008-03-08 14:10:34 +00:00
Felipe Pena e1cf7f0ca6 Fixed bug #44373 (PDO_OCI extension compile failed) 2008-03-08 14:01:49 +00:00
Nuno Lopes 2e161037fa MFB53 skipif patch as asked by gentoo guys 2008-03-08 12:12:22 +00:00
Pierre Joye 6d3101b8f4 - #44355, compilation breaks due illegal const usage (Guenter Knauf)
I suppose it must break on other platform, it is not used anywhere else
  but here, and it was introduced after 5.2.5 (why no news)
2008-03-07 18:41:02 +00:00
Josie Messa 1b07a0988b - Tests awaiting fix of bug #44246 2008-03-07 16:19:40 +00:00
Josie Messa 46db94819f - New tests for rewinddir() function 2008-03-07 16:08:59 +00:00
Josie Messa f9f818959a - New tests for closedir() function 2008-03-07 15:58:39 +00:00
Scott MacVicar 216e57bf23 Typo, bundled version is really 3.3.7 2008-03-07 10:38:33 +00:00
Antony Dovgal 77f40d6d5b fix build 2008-03-07 08:56:45 +00:00
Stanislav Malyshev 0d6cdac9ff improve seed calculation
# better solution would be to port mt's multi-value seed procedure
2008-03-07 03:34:47 +00:00
Ilia Alshanetsky 3e51cc7a8c Back to dev 2008-03-07 00:36:12 +00:00
531 changed files with 42904 additions and 1229 deletions

No files matched your search

+94 -124
View File
@@ -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
View File
@@ -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
View File
@@ -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===
Binary file not shown.
+11 -3
View File
@@ -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);
}
+4 -4
View File
@@ -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:
+16 -21
View File
@@ -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
View File
@@ -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`
+27
View File
@@ -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===
+43
View File
@@ -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===
+177
View File
@@ -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===
+127
View File
@@ -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===
+27
View File
@@ -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===
+39
View File
@@ -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===
+177
View File
@@ -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===
+128
View File
@@ -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===
+27
View File
@@ -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===
+39
View File
@@ -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===
+178
View File
@@ -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===
+156
View File
@@ -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===
+27
View File
@@ -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===
+39
View File
@@ -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===
+177
View File
@@ -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===
+158
View File
@@ -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===
+27
View File
@@ -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===
+39
View File
@@ -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===
+177
View File
@@ -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===
+124
View File
@@ -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===
+146
View File
@@ -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===
+27
View File
@@ -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===
+39
View File
@@ -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===
+177
View File
@@ -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===
+138
View File
@@ -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===
+27
View File
@@ -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===
+39
View File
@@ -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===
+177
View File
@@ -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===
+125
View File
@@ -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===
+126
View File
@@ -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===
+28
View File
@@ -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===
+44
View File
@@ -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===
+178
View File
@@ -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===
+138
View File
@@ -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===
+27
View File
@@ -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===
+43
View File
@@ -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===
+177
View File
@@ -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===
+138
View File
@@ -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===
+27
View File
@@ -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===
+39
View File
@@ -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===
+177
View File
@@ -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===
+137
View File
@@ -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===
+26
View File
@@ -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===
+39
View File
@@ -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
View File
File diff suppressed because it is too large. Load diff
+15 -5
View File
@@ -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;
}
}
/* }}} */
+36
View File
@@ -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)
+11
View File
@@ -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"
+6 -1
View File
@@ -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
View File
@@ -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 */
+1 -1
View File
@@ -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;
+12
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
+2 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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));
-4
View File
@@ -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;
}
/* }}} */
+5 -1
View File
@@ -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);
+46
View File
@@ -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
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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 -2
View File
@@ -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
+4
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -1 +1 @@
3.3.17
3.3.7
+3 -3
View File
@@ -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
+31
View File
@@ -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
+53
View File
@@ -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