Compare commits

..
Author SHA1 Message Date
SVN Migration 674328d1fa This commit was manufactured by cvs2svn to create tag 'php_4_1_2'. 2002-02-27 09:06:34 +00:00
Zeev Suraski ef03277c51 Go with 4.1.2 2002-02-27 09:06:33 +00:00
Derick Rethans 02cc197a77 - Bring error message back 2002-02-26 19:32:52 +00:00
Rasmus Lerdorf 253b53296c There are no fdf changes in this branch as far as I can see. Not
sure where this NEWS item came from.
2002-02-26 18:01:37 +00:00
Rasmus Lerdorf 40796e5be2 Remove gd NEWS item 2002-02-26 17:55:33 +00:00
Rasmus Lerdorf bcdbc527b6 This line makes no sense to me 2002-02-26 17:52:36 +00:00
Zeev Suraski 7e5fd5048a Beautify 2002-02-26 17:46:15 +00:00
Yasuo Ohgaki 2da6392297 Fix pspell function entry 2002-02-25 23:00:11 +00:00
Yasuo Ohgaki 5ead13b0d7 Add news for mm save handler and multiple SAPI start up problem fix 2002-02-25 00:25:07 +00:00
Yasuo Ohgaki e0108f79e1 MFH
- Fixed CGI (or other SAPI) start up failure when mm save handler is used
# More fixes will be merged when I commit session & output control patch
2002-02-25 00:21:14 +00:00
Rui Hirokawa d28453af34 NEWS updated. 2002-02-23 08:36:11 +00:00
Rui Hirokawa bb369d7f91 - fixed configuration problem as shared extension for fdf.
- fixed configuration problem as shared extension for gd with freetype1.
- default output encoding of mbstring changed to pass to fix initialization problem.
2002-02-23 02:01:41 +00:00
Rasmus Lerdorf f8159f4f20 Keep track of what has gone into 4.1.2 so far 2002-02-22 18:00:22 +00:00
Yasuo Ohgaki f7a54490c0 Fix crash bug. 4th parameter is not incremental value, but it's assigned.
# Are we going to have 4.1.2?
2002-02-22 15:01:20 +00:00
Stefan Esser d1336b2fce fixing boundary check before someone other does it... 2002-02-21 18:46:45 +00:00
Yasuo Ohgaki cfe1d84628 MFH 2002-02-03 00:38:00 +00:00
Stefan Esser 882415354a MFH: fix for bug #14776 2002-01-14 13:43:03 +00:00
Yasuo Ohgaki c4f239e6ab Revert last commit 2002-01-10 08:48:23 +00:00
Yasuo Ohgaki 3ea732bb4f MFH 2002-01-10 06:15:46 +00:00
Yasuo Ohgaki f4a3603d48 MFH.
Bugs 10530,10656,14784
2002-01-09 08:40:13 +00:00
Yasuo Ohgaki 2da3aa1e3c MFH
# Disable bogus error message when external session save handler
# (mm, msession, pgsql) is specified in php.ini.
# This is not a real fix, but a tmp workaround.
2002-01-07 08:20:08 +00:00
Yasuo Ohgaki debfb9626c Fix crash (MFH) 2001-12-30 01:44:17 +00:00
Markus Fischer 647ecadc0e - MFH fix for crash in get_defined_constants(). 2001-12-27 01:10:08 +00:00
Derick Rethans 3256f775cd - MFH for bug 14690 2001-12-26 10:36:11 +00:00
Derick Rethans e5f7ed8d21 - MFH: Remove redundant code 2001-12-25 16:35:41 +00:00
Derick Rethans 1e5919277c - Fix for bug 14691: Invalidate mcrypt resource if the key size is 0 2001-12-25 16:31:44 +00:00
Derick Rethans 5385e1f258 - Last fixes to NEWS 2001-12-23 01:27:41 +00:00
Zeev Suraski 0f958cdf3b Update NEWS 2001-12-22 03:14:18 +00:00
Zeev Suraski e835de81f2 MFH 2001-12-22 03:12:37 +00:00
Derick Rethans 05fc73701f - More cleanup 2001-12-21 13:31:57 +00:00
Derick Rethans e28724787b - Typo 2001-12-21 13:20:54 +00:00
Derick Rethans 0e5b273b0f Go with 4.1.1 2001-12-20 21:18:34 +00:00
Derick Rethans 7e15bdcb58 Make it look purty 2001-12-17 21:41:09 +00:00
Derick Rethans 25fa7f7411 MFH 2001-12-17 21:19:51 +00:00
Derick Rethans adffaad9f4 MFH backward compability issues with libmcrypt 2001-12-17 20:23:38 +00:00
Stefan Esser e2fb9282aa fixed: fix for my broken patch 2001-12-16 23:20:07 +00:00
Derick Rethans f04e7b251c - More MHFs 2001-12-16 22:41:36 +00:00
Derick Rethans dfa94d4b9f Update NEWS 2001-12-16 22:32:42 +00:00
Stefan Esser 2fdac23dfb whitespace. 2001-12-16 21:46:20 +00:00
Stefan Esser 86bb6388c0 MFH : one byte heap corruption fixed 2001-12-16 21:41:25 +00:00
Derick Rethans 0215d17907 Make this compile again 2001-12-16 19:06:20 +00:00
Stefan Esser 2c25be52f4 MFH : fixed bufferoverflow in sapi_add_header_ex 2001-12-16 16:09:04 +00:00
Derick Rethans b337bf3f97 MFH for bug #14??? (pow() thing) 2001-12-16 11:05:28 +00:00
Derick Rethans f63dd3cc7e - MFH for bug 14162 2001-12-15 13:19:37 +00:00
Markus Fischer bb31b98137 - MFH fix for possible crash in xslt_set_scheme_handlers() with
invalid handler names.
2001-12-15 13:08:24 +00:00
Derick Rethans a686d91177 - MFH crash bug fix in xslt_error 2001-12-15 12:30:24 +00:00
Sebastian Bergmann 34f95edd9b Change version to 4.1.1-dev. 2001-12-14 12:23:49 +00:00
Markus Fischer f5ce52c8f1 - MFH bug fixes. 2001-12-14 10:45:46 +00:00
Vlad Krupin 6a92f0dcc5 MFH 2001-12-14 10:21:04 +00:00
Sterling Hughes 0d46db0ded the datetime.c fixes 2001-12-14 10:14:16 +00:00
Sterling Hughes 5ba92f6b53 MFH'ed::
use zval macro's (not exactly necessary, but not harmful).
    jmoore's fix for timezones.
2001-12-14 10:08:43 +00:00
Sterling Hughes 6b13a53a20 Derick MFH'ed 2001-12-14 10:03:42 +00:00
Derick Rethans 31be1c0ce1 - Remove debug crap 2001-12-13 21:11:32 +00:00
Derick Rethans 605e8a0502 - MFH for bugs 10324, 12777, 14488, 13399 and probably 13239 2001-12-13 21:04:57 +00:00
Sterling Hughes a9914c9a99 Fix mcrypt compile on systems that don't have mcrypt 2001-12-13 16:23:59 +00:00
Sterling Hughes 52a26baead MFH 2001-12-13 13:51:42 +00:00
Sterling Hughes e152dd3cee MFH timezone fix 2001-12-13 12:17:32 +00:00
Zeev Suraski cbce251dab Go with 4.1.0 2001-12-10 15:21:43 +00:00
Zeev Suraski c939250414 Go with 4.1.0 2001-12-09 23:02:07 +00:00
Zeev Suraski a36c434dbb MFH - fix unbuffered queries 2001-12-09 13:53:56 +00:00
Thies C. Arntzen 8e46600166 fix #13801 (imap_rfc822_parse_adrlist changes arg1) 2001-12-07 16:47:59 +00:00
Derick Rethans d07a60c3d0 - MFH for the session fix 2001-12-06 14:23:29 +00:00
Zeev Suraski 0858af07ec Here we go again 2001-12-03 10:56:13 +00:00
Sterling Hughes a096235f8f MFH 2001-12-03 09:26:02 +00:00
Sterling Hughes 8244f0f628 No need to create this, automatically done (automagically even) by
call_user_function_ex()
2001-12-03 08:12:18 +00:00
SVN Migration 3cdc24790e This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'. 2001-12-02 21:17:56 +00:00
Thies C. Arntzen 80df8e6b0a MFH
fix for $_SESSION
!!! please TEST, TEST, TEST !!!
2001-12-02 12:21:54 +00:00
Thies C. Arntzen b228115b64 fix problem when __sleep() returned non-existant variables 2001-12-01 15:22:24 +00:00
Stig Venaas cdedea01c1 Fixing ldap_first/next_attribute() 2001-12-01 14:17:43 +00:00
Thies C. Arntzen c0e263c1a1 MFH - make sockets extension usable 2001-11-30 18:18:01 +00:00
Zeev Suraski 91889eeb93 go with RC4 2001-11-30 14:44:56 +00:00
Sterling Hughes 5c74aa0f0f Cleanup the function entries a tidbit 2001-11-30 09:04:49 +00:00
Zeev Suraski 501aa09789 Prepare 4.1.0 2001-11-25 22:47:50 +00:00
Rui Hirokawa 16d5e9f108 restriction is relaxed because output handler couldn't be used even if zlib.output_compression is set to off. 2001-11-23 02:37:27 +00:00
Derick Rethans 195a756477 - MFH crash bug in shm_remove (not critical enough to include in the release,
but critical enough to MFH)
2001-11-22 14:35:55 +00:00
Derick Rethans 09fb81a8f3 - MFH for crash bug #14169
#- IMO, this should be included in the release. The fix has little impact
#  on the release in a whole.
2001-11-22 07:49:46 +00:00
Sebastian Bergmann 21ff8ec819 MFH (Remove sablot from php_modules.dsw, its no longer in repository) 2001-11-20 18:18:57 +00:00
Sterling Hughes 6d1374480e Temporary fix not for the HEAD branch, this is the only way to avoid the
segfault and *really* not fuck up the release cycle
2001-11-20 11:55:34 +00:00
Sterling Hughes 7e33f0b17b MFH latest cURL fixes, these are tested and important 2001-11-20 11:32:50 +00:00
Zeev Suraski 0be29a4861 Go with final RC 2001-11-19 20:53:26 +00:00
Derick Rethans bcf3204bd3 - Add bugfix 2001-11-19 15:19:39 +00:00
Zeev Suraski dee465139f MFH 2001-11-19 15:00:42 +00:00
foobar f5b7714238 MFH 2001-11-19 00:52:02 +00:00
foobar 747258e34f MFH 2001-11-18 23:54:57 +00:00
Derick Rethans 66c1d632c1 - Fix typo 2001-11-18 13:52:08 +00:00
Derick Rethans b9d6136a28 - Updated NEWS to reflect removal of ext/sablotron 2001-11-18 13:50:56 +00:00
Sterling Hughes aaa9baa57f Remove the sablotron extension from the release branch 2001-11-18 13:27:32 +00:00
Derick Rethans 549164e1fe - MFH (fix build under FreeBSD) 2001-11-18 12:02:34 +00:00
foobar 36f572a5b9 Some typos.. 2001-11-18 03:11:06 +00:00
Andrei Zmievski 2a985b94e0 MFH 2001-11-18 01:23:14 +00:00
Derick Rethans 3f783ff20b - MFH 2001-11-18 00:33:19 +00:00
Zeev Suraski 43a661c2ac MFH 2001-11-17 21:15:57 +00:00
Rasmus Lerdorf 958a5a1311 MFH
(I wish people would stop committing whitespace fixes to code that has
 been around forever.  It really makes merging and checking diffs a pain
 in the ass as real changes end up hidden within a sea of useless
 whitespace fixes)
2001-11-16 12:02:30 +00:00
Derick Rethans 0aca2443d7 - MFH name change
#- This is to minimize BBC
2001-11-15 07:28:35 +00:00
Stig Bakken 032765f467 * install Archive_Tar 2001-11-14 15:01:37 +00:00
Christian Stocker ef3912a195 adding PEAR/Registry.php 2001-11-14 09:54:46 +00:00
Christian Stocker 0a862aff6f checking if package.xml.gz exists, before checking if it's writeable 2001-11-14 09:20:49 +00:00
foobar 38cd9d70d5 Added missing .cvsignore files and added *.reg into pear/tests/.cvsignore 2001-11-13 14:01:03 +00:00
Rasmus Lerdorf 5031e0dab8 MFH 2001-11-13 13:54:20 +00:00
Rasmus Lerdorf 40b988316b MFH 2001-11-13 13:13:26 +00:00
Rasmus Lerdorf bca8ddd083 Let's just use the quicktester from HEAD since it seems to work and the
one in this branch is quite broken.  Still plenty of failing tests we need
to work through here.
2001-11-13 12:57:26 +00:00
foobar 6d47a2d60f Partial MFH. 2001-11-13 12:42:11 +00:00
Rasmus Lerdorf 96c421553f MFH 2001-11-13 12:39:35 +00:00
foobar 30f0fa9262 MFH 2001-11-13 12:21:03 +00:00
foobar 2a1ac78a9d MFH 2001-11-13 12:07:25 +00:00
foobar 6b702ced00 MFH (the use of strings for locale setting is deprecated) 2001-11-13 11:54:13 +00:00
Derick Rethans edc32c8faa - Check for cURL >= 7.8.1 2001-11-13 11:53:01 +00:00
Zeev Suraski 18e7796470 Fix name 2001-11-13 11:48:28 +00:00
Zeev Suraski 4e7c35b1e2 Improve OpenSSL compatibility 2001-11-13 11:46:33 +00:00
foobar 5d1e3b81d4 MFH 2001-11-13 11:38:56 +00:00
James Moore e8a7dbe010 Lets cast this explicitly. 2001-11-13 11:27:42 +00:00
Derick Rethans d205634a58 - Fixed scheme/sax handlers (patch by Lenar Lõhmus <lenar@vision.ee>) 2001-11-13 09:53:18 +00:00
Derick Rethans 91f27074fc - MFH 2001-11-13 08:19:43 +00:00
Zeev Suraski c3a83e4c12 Go with RC2 2001-11-13 01:40:17 +00:00
Stig Bakken 989fc05c1c MFH: pear updates 2001-11-13 01:26:54 +00:00
Zeev Suraski 63f504192e MFH - SSL fixes 2001-11-13 01:15:51 +00:00
SVN Migration 07156d5fc5 This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'. 2001-11-13 01:06:49 +00:00
James Moore dd96ef8151 MFH 2001-11-13 00:00:18 +00:00
foobar f467121516 MFH 2001-11-12 23:16:00 +00:00
Rui Hirokawa 27592372cc fixed output problem with output buffering handler. 2001-11-12 14:52:17 +00:00
Rui Hirokawa b73a2081ab fixed a bug in http input processing patched by Yasuo Ohgaki. 2001-11-12 14:51:39 +00:00
Daniel Beulshausen 2b85be3c48 MFH latest changes 2001-11-12 10:52:16 +00:00
Stanislav Malyshev 87166f6978 MFH: Fix crash bug on malformed .ini file 2001-11-11 12:44:00 +00:00
Zeev Suraski cab6cfa680 MFH output buffering fixes 2001-11-11 09:03:47 +00:00
Rasmus Lerdorf 3c2de4ce6f MFH 2001-11-11 00:08:33 +00:00
Andrei Zmievski 896cf60aff MFH 2001-11-10 23:58:40 +00:00
Andrei Zmievski 2c7191b5ce Added crash fix news. 2001-11-10 23:56:16 +00:00
Andrei Zmievski 896e2e810d MFH 2001-11-10 23:50:53 +00:00
Derick Rethans 1a3f3309a5 - MFH (Bug #13918) 2001-11-03 21:26:27 +00:00
Christian Stocker 1bc5e9ffc4 typo 2001-11-02 17:56:20 +00:00
foobar 33e4ade668 MFH 2001-11-02 14:34:23 +00:00
foobar 2e8fc85965 MFH 2001-11-02 01:39:30 +00:00
foobar 4a04971bed MFH 2001-11-02 01:09:09 +00:00
foobar cd9e4f37a2 MFH 2001-10-30 23:22:52 +00:00
foobar 8a58067dd5 MFH 2001-10-29 16:45:38 +00:00
Derick Rethans 84f1093658 - MFH for bug fix of #9640 and #13789 2001-10-27 17:56:20 +00:00
foobar 1103c8306f MFH 2001-10-27 06:28:44 +00:00
Thies C. Arntzen 7755c18735 fix compile 2001-10-25 07:10:58 +00:00
foobar 19f20337f4 MFH 2001-10-24 10:43:26 +00:00
foobar 684c1fefc3 MFH 2001-10-23 11:18:48 +00:00
Zeev Suraski 45e8587fa3 MFH 2001-10-23 01:19:59 +00:00
Jeroen van Wolffelaar 120e9fa63f MFH (math tests pass now - at least on my system) 2001-10-22 09:46:23 +00:00
SVN Migration 8b4d5cefea This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'. 2001-10-22 09:44:28 +00:00
foobar f10d1f8f01 MFH 2001-10-22 02:36:04 +00:00
foobar 740073c795 MFH 2001-10-22 02:30:42 +00:00
Rasmus Lerdorf 8e0cad5b50 MFH 2001-10-21 17:59:35 +00:00
Sterling Hughes 040e59eb6d fix zts build 2001-10-21 17:17:18 +00:00
foobar e75fa38d9d MFH 2001-10-21 03:06:18 +00:00
Rasmus Lerdorf 0a1c75a106 MFH 2001-10-21 00:20:44 +00:00
Rasmus Lerdorf b9f4c04888 MFH
(oops, should have been in one commit)
2001-10-21 00:17:17 +00:00
Derick Rethans 49beadaa03 - MFH for bug #13413 2001-10-20 10:59:29 +00:00
Edin Kadribasic 2eee05cb5d Fixed last argument in strlcat() call. 2001-10-19 18:09:21 +00:00
Derick Rethans f5a5a7e518 - Fix for bug #13760 2001-10-19 17:59:24 +00:00
Edin Kadribasic 43f418accd Merged change strncpy=>strlcpy; strncat=>strlcat into the release brach. 2001-10-19 15:57:17 +00:00
Derick Rethans 725100424b - Fix bug in detecting libexpat with the sablotron extension 2001-10-19 09:22:13 +00:00
Derick Rethans 9261ba3e70 - MFH 2001-10-19 08:04:24 +00:00
Stig Bakken 73b91a7d8f * another update 2001-10-19 05:13:09 +00:00
Stig Bakken 0cb64cb8b6 * update NEWS file 2001-10-18 23:32:40 +00:00
Harald Radi 854223474e MFH 2001-10-18 08:26:45 +00:00
Stig Bakken 7c93ef371b MFH 2001-10-17 15:32:56 +00:00
Edin Kadribasic fa6a7710ca Meged fix for bug #13083 into the release branch. 2001-10-16 08:55:30 +00:00
Stig Bakken aaec7c8c2b * fix version number 2001-10-16 00:07:57 +00:00
Stig Bakken cde2734237 MFH 2001-10-15 19:37:45 +00:00
Stig Bakken b892e3c8f8 MFH 2001-10-14 07:19:09 +00:00
SVN Migration 031ce49972 This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'. 2001-10-13 06:22:10 +00:00
Stig Bakken b32cdd7637 MFH 2001-10-12 11:56:37 +00:00
Thies C. Arntzen 017856111c MFH 2001-10-12 08:02:42 +00:00
foobar 6994c80835 MFH 2001-10-12 00:22:38 +00:00
Stig Bakken 69f304f0ac MFH 2001-10-11 23:55:49 +00:00
Stig Bakken bd561b7f57 MFH: phpVersionIs -> version_compare 2001-10-11 22:28:26 +00:00
Stig Bakken 8aa81d5045 MFH: add versioning files 2001-10-11 19:05:52 +00:00
Stig Bakken 051623a43c MFH 2001-10-11 15:00:48 +00:00
Stig Bakken bdd9c56790 * add note about version_compare() 2001-10-11 10:46:04 +00:00
Stig Bakken bb5c3b8bcc MFH 2001-10-11 10:40:14 +00:00
Stig Bakken e1285b4f3c MFH 2001-10-11 10:31:12 +00:00
Stig Bakken 8bc67a4ec1 MFH: versioning test 2001-10-11 01:13:51 +00:00
Stig Bakken 444ec0f591 MFH 2001-10-11 01:03:27 +00:00
Stig Bakken cc9c4064ab MFH test fix 2001-10-11 00:46:34 +00:00
Stig Bakken 709a8d3a0d MFH: version_compare & friends 2001-10-10 22:23:16 +00:00
SVN Migration 3a4b329cc3 This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'. 2001-10-10 10:14:52 +00:00
Stig Bakken a3084031b1 * include the PEAR version of usefulinc's xmlrpc library in this release
too, with security fix (in case people overwrite their old installation)
2001-10-09 22:58:09 +00:00
Stig Bakken ce2a30427b MFH 2001-10-09 22:54:11 +00:00
SVN Migration af10fc656d This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'. 2001-10-06 23:22:38 +00:00
Harald Radi 5fd3346aac typo
TRUE -> FALSE
2001-10-06 10:39:57 +00:00
Harald Radi 5091a18158 MFH
fixed boolean -1 vs. 1 conflict
2001-10-05 09:49:45 +00:00
Derick Rethans 3c7529f4b8 MFH
# (thought this already has been done)
2001-10-04 06:42:45 +00:00
Rasmus Lerdorf 8c98829721 MFH 2001-10-04 06:24:13 +00:00
Derick Rethans 04d2d6b3bc - Fix build 2001-10-04 05:34:09 +00:00
Hartmut Holzgraefe 41b3015125 MFH 2001-10-01 12:51:12 +00:00
Rasmus Lerdorf 42b7601378 MFH 2001-09-30 04:43:19 +00:00
Jon Parise 86c32174be Build pear/scripts/phptar in the configure run. 2001-09-29 17:57:37 +00:00
Rasmus Lerdorf c5bf17f0a5 MFH 2001-09-27 07:39:24 +00:00
Zeev Suraski 730359dc4d MFH the list of 4.0.7 changes 2001-09-26 21:56:23 +00:00
Zeev Suraski 4053948470 MFH 2001-09-26 21:47:18 +00:00
Harald Radi 333ce2d050 changed flags 2001-09-25 16:29:45 +00:00
Andi Gutmans a84618a3de - MFH. File uploads need to be tested thoroughly in RC3! 2001-09-24 17:48:22 +00:00
Wez Furlong eff475de14 MFH 2001-09-20 15:05:37 +00:00
Joey Smith 7114dae40d MFH, Close bug #13322 2001-09-19 02:35:49 +00:00
Daniel Beulshausen ec9bda9e5c MFH 2001-09-17 13:43:15 +00:00
Daniel Beulshausen 74dbaf655b MFH 2001-09-17 13:21:58 +00:00
Daniel Beulshausen 137b57c5ba MFH 2001-09-17 12:23:43 +00:00
Thies C. Arntzen 6d00133ce2 fixed memory_peak reporting 2001-09-16 15:49:55 +00:00
Sascha Schumann 087fd4c609 this is not pure rc2 anymore 2001-09-13 21:52:40 +00:00
Sascha Schumann 1b740da6d4 MFH.. necessary fix 2001-09-13 21:41:30 +00:00
Jason Greene 0d3ce62b63 Merge recent socket fixes 2001-09-11 16:08:28 +00:00
Sascha Schumann d90cd52b89 MFH 2001-09-10 11:24:18 +00:00
Harald Radi 973dbce2b9 MFH 2001-09-10 09:28:55 +00:00
Sascha Schumann f51c000bac MFH 2001-09-09 14:53:38 +00:00
Sterling Hughes 39812d33f7 ws fix 2001-09-09 09:48:16 +00:00
Sterling Hughes 2e9991865e MFH 2001-09-09 09:45:10 +00:00
Harald Radi 016ac5d400 MFH 2001-09-08 21:02:35 +00:00
Sterling Hughes bf344046b3 add proto 2001-09-07 11:35:44 +00:00
Sterling Hughes 26a5bb3fc7 MFH 2001-09-07 10:47:44 +00:00
Derick Rethans c117b30950 - MFH (Fix for bug 13052) 2001-09-07 07:51:06 +00:00
Rasmus Lerdorf b7a1b19734 MFH 2001-09-07 06:44:21 +00:00
foobar 3ba574871c MFH 2001-09-07 00:28:28 +00:00
Zeev Suraski 6122d87789 Go with RC2 2001-09-06 23:17:05 +00:00
Rasmus Lerdorf 8dffa18aec Interbase fixes 2001-09-05 15:41:45 +00:00
Stanislav Malyshev f51e3d044a MFH 2001-09-04 14:12:11 +00:00
Rasmus Lerdorf 6cc67717b1 MFH 2001-09-03 19:08:49 +00:00
Zeev Suraski 30812e3707 MFH 2001-09-01 14:57:32 +00:00
Zeev Suraski 0550e954e0 MFH 2001-09-01 01:45:51 +00:00
Zeev Suraski 73941736ca Fix TSRM.dsp's line endings (was causing trouble if used with tools that
didn't have auto-conversion of line endings)
2001-08-30 18:08:29 +00:00
foobar 80754851bd MFH 2001-08-30 16:30:14 +00:00
Joey Smith 2ae1766c1c MFH 2001-08-29 22:26:53 +00:00
Wez Furlong 96462f90a0 MFH 2001-08-29 11:33:06 +00:00
Wez Furlong c4cc49f487 MFH 2001-08-28 22:19:52 +00:00
Rasmus Lerdorf 07b4a21631 MFH 2001-08-28 21:52:38 +00:00
Stig Bakken 9c30514661 * MFH: Archive_Tar is no longer experimental 2001-08-28 12:27:27 +00:00
Stig Bakken a9d8aa7e08 * MFH: Log/Observer.php rename fix 2001-08-28 12:12:24 +00:00
Stig Bakken 28caf732a7 * MFH PEAR stuff
* copied in Archive_Tar class from pear/Archive_Tar
2001-08-28 11:41:13 +00:00
Andrei Zmievski 513874acc7 MFH 2001-08-27 16:52:49 +00:00
Stig Bakken d2363cdd19 * be smarter when trying to locate PHP binary 2001-08-27 16:34:30 +00:00
Joey Smith 30cd11ced1 MFH: Fix 1st case reported in #9893. 2nd case was fixed in previous commit. 2001-08-26 11:56:41 +00:00
Rasmus Lerdorf 8bed40bc2f MFH 2001-08-26 01:12:07 +00:00
foobar 4c6c14ac5e MFH 2001-08-24 20:07:07 +00:00
Christian Stocker a85d4245a3 Merge From 1.84 (XML/RPC stuff has gone to /pear) 2001-08-24 09:06:26 +00:00
Christian Stocker afe0765c0a changed the URL from my testing server to pear.php.net 2001-08-24 07:46:33 +00:00
foobar 0e57f1324b MFH 2001-08-22 10:26:56 +00:00
Joey Smith 938b31d395 MFH: Make stat() act like stat, not filesize(). 2001-08-21 23:59:21 +00:00
Joey Smith f3ffe2d258 MFH
Some changes to help out previous users of domxml...
node::tagname == node::name.
Add property "type" to textnode types.
2001-08-21 21:51:22 +00:00
Zeev Suraski 1563fa9a67 MFH 2001-08-21 18:14:38 +00:00
Sascha Schumann a4cf06cecd MFH 2001-08-20 15:30:33 +00:00
Stanislav Malyshev bd5d7bba59 MFH 2001-08-20 15:28:53 +00:00
foobar b404501183 MFH 2001-08-20 14:08:04 +00:00
Harald Radi b3655b0e12 MFH 2001-08-20 08:56:14 +00:00
foobar e8f9edd7a7 MFH 2001-08-19 06:39:58 +00:00
SVN Migration 95061e9ad2 This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'. 2001-08-19 00:34:09 +00:00
foobar 0f5dea39ad MFH 2001-08-18 21:09:41 +00:00
foobar 8ca2454ce2 Fixed the NEWS. 2001-08-18 20:23:13 +00:00
foobar e455e7cbca MFH 2001-08-18 18:15:22 +00:00
Zeev Suraski b33f9a00d2 MFH 2001-08-18 17:00:30 +00:00
Zeev Suraski e017ca8b72 MFH 2001-08-17 16:54:16 +00:00
foobar 6e75cfbd8c MFH 2001-08-17 16:43:00 +00:00
Harald Radi a1c9bd2bfb MFH 2001-08-17 08:19:28 +00:00
foobar 70a7172018 MFH 2001-08-17 06:55:38 +00:00
foobar 0dcfb7341f MFH 2001-08-17 00:48:33 +00:00
Zeev Suraski 91bd1d25e1 MFH 2001-08-16 23:59:35 +00:00
Zeev Suraski 766eaa4078 MFH 2001-08-16 23:35:09 +00:00
Zeev Suraski 8248d8cf2c MFH 2001-08-16 21:09:10 +00:00
Rasmus Lerdorf 0fd9dcc4bc MFH 2001-08-16 20:35:33 +00:00
Chuck Hagenbuch b381ad0f9d MFH 2001-08-16 20:21:31 +00:00
Thies C. Arntzen e53366609d MFH: move php_shutdown_config further down 2001-08-16 09:41:25 +00:00
Zeev Suraski bace148543 MFH 2001-08-15 23:21:05 +00:00
foobar 6549c08dfe MFH 2001-08-15 21:41:01 +00:00
Jeroen van Wolffelaar 1910df096c MFH 2001-08-15 19:11:39 +00:00
Jeroen van Wolffelaar dda54f4271 It was agreed that log2, exp2 and exp10 shouldn't be added to PHP. log10
already existed.

# Forgot to do this yesterday :(
2001-08-15 18:59:20 +00:00
Harald Radi 37f511a835 com entry was missing 2001-08-15 17:49:14 +00:00
Thies C. Arntzen 00bb550264 MFH the recursion-hack 2001-08-15 16:12:00 +00:00
Zeev Suraski eb6428126b Reroll 4.0.7RC1 2001-08-15 15:18:25 +00:00
SVN Migration 896bbc92e5 This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'. 2001-08-15 10:40:00 +00:00
15162 changed files with 301091 additions and 2456096 deletions

No files matched your search

-605
View File
@@ -1,605 +0,0 @@
define ____executor_globals
if basic_functions_module.zts
set $tsrm_ls = ts_resource_ex(0, 0)
set $eg = ((zend_executor_globals) (*((void ***) $tsrm_ls))[executor_globals_id-1])
set $cg = ((zend_compiler_globals) (*((void ***) $tsrm_ls))[compiler_globals_id-1])
else
set $eg = executor_globals
set $cg = compiler_globals
end
end
document ____executor_globals
portable way of accessing executor_globals, set $eg
this also sets compiler_globals to $cg
ZTS detection is automatically based on ext/standard module struct
end
define printztype
____printz_type $arg0
printf "\n"
end
document printztype
prints the type name of a zval type
end
define ____printz_type
set $type = $arg0
if $type == 0
printf "NULL"
end
if $type == 1
printf "long"
end
if $type == 2
printf "double"
end
if $type == 3
printf "bool"
end
if $type == 4
printf "array"
end
if $type == 5
printf "object"
end
if $type == 6
printf "string"
end
if $type == 7
printf "resource"
end
if $type == 8
printf "constant"
end
if $type == 9
printf "const_array"
end
if $type == 10
printf "unicode string"
end
if $type > 10
printf "unknown type %d", $type
end
end
define printzv
set $ind = 1
____printzv $arg0 0
end
document printzv
prints zval contents
end
define printu
set $str = (UChar*)$arg0
if $arg1 > 0
set $max = $arg1
else
set $max = 1024
end
set $pos = 0
while $pos < $max && *(char*)(($str+$pos))
if $str[$pos] < 256
printf "%c", $str[$pos]
else
printf "\\u%04X", $str[$pos]
end
set $pos = $pos + 1
end
if $pos < $max && *((char*)($str+$pos))
printf "[...]"
end
end
document printu
prints a unicode string, optionally with given length
usage: printu str [len]
The function stops at the first zero byte (not char) or when len is reached.
If len is less than or equal to one then a maximum of 1024 characters are
printed.
end
define printt
if $arg0
printu $arg1 $arg2
else
set $len = strlen($arg1)
if $arg2 > 0 && $len > $arg2
set $copy = strdup($arg1)
printf "%p: %s\n", $copy, $copy
set ((char*)$copy)[$arg2] = 0
printf "%s[...]", $copy
call free($copy)
else
printf "%s", $arg1
end
end
end
document printt
prints a binary or unicode string, optionally with given length
usage: printt unicode str [len]
If unicode is 1 the function calls printu, else it uses printf.
end
define print_cvs
____executor_globals
set $p = $eg.current_execute_data.CVs
set $c = $eg.current_execute_data.op_array.last_var
set $v = $eg.current_execute_data.op_array.vars
set $i = 0
printf "Compiled variables count: %d\n", $c
while $i < $c
printf "%d = %s\n", $i, $v[$i].name
if $p[$i] != 0
printzv *$p[$i]
else
printf "*uninitialized*\n"
end
set $i = $i + 1
end
end
define dump_bt
set $t = $arg0
while $t
printf "[0x%08x] ", $t
if $t->function_state.function->common.function_name
printu $t->function_state.function->common.function_name.u 50
printf "() "
else
printf "??? "
end
if $t->op_array != 0
printf "%s:%d ", $t->op_array->filename, $t->opline->lineno
end
set $t = $t->prev_execute_data
printf "\n"
end
end
document dump_bt
dumps the current execution stack. usage: dump_bt executor_globals.current_execute_data
end
define ____printzv_contents
set $zvalue = $arg0
set $type = $zvalue->type
printf "(refcount=%d", $zvalue->refcount__gc
if $zvalue->is_ref__gc
printf ",is_ref"
end
printf ") "
if $type == 0
printf "NULL"
else
____printz_type $type
end
if $type == 1
printf ": %ld", $zvalue->value.lval
end
if $type == 2
printf ": %lf", $zvalue->value.dval
end
if $type == 3
if $zvalue->value.lval
printf ": true"
else
printf ": false"
end
end
if $type == 4
printf "(%d): ", $zvalue->value.ht->nNumOfElements
if ! $arg1
printf "{\n"
set $ind = $ind + 1
____print_ht $zvalue->value.ht 0 1
set $ind = $ind - 1
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
printf "}"
end
set $type = 0
end
if $type == 5
____executor_globals
set $handle = $zvalue->value.obj.handle
set $handlers = $zvalue->value.obj.handlers
if basic_functions_module.zts
set $zobj = zend_objects_get_address($zvalue, $tsrm_ls)
else
set $zobj = zend_objects_get_address($zvalue)
end
if $handlers->get_class_entry == &zend_std_object_get_class
set $cname = $zobj->ce.name.s
else
set $cname = "Unknown"
end
printf "(%s) #%d", $cname, $handle
if ! $arg1
if $handlers->get_properties == &zend_std_get_properties
set $ht = $zobj->properties
if $ht
printf "(%d): ", $ht->nNumOfElements
printf "{\n"
set $ind = $ind + 1
____print_ht $ht 1 1
set $ind = $ind - 1
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
printf "}"
else
echo "no properties found"
end
end
end
set $type = 0
end
if $type == 6
printf "(%d): \"%s\"", $zvalue->value.str.len, $zvalue->value.str.val
end
if $type == 7
printf ": #%d", $zvalue->value.lval
end
if $type == 8
end
if $type == 9
end
if $type == 10
printf "(%d): [%p]: \"", $zvalue->value.str.len, $zvalue->value.str.val
printu $zvalue->value.ustr.val $zvalue->value.str.len
printf "\""
end
if $type > 10
end
printf "\n"
end
define ____printzv
____executor_globals
set $zvalue = $arg0
printf "[0x%08x] ", $zvalue
if $zvalue == $eg.uninitialized_zval_ptr
printf "*uninitialized* "
end
set $zcontents = (zval*) $zvalue
if $arg1
____printzv_contents $zcontents $arg1
else
____printzv_contents $zcontents 0
end
end
define ____print_const_table
set $ht = $arg0
set $p = $ht->pListHead
while $p != 0
set $const = (zend_constant *) $p->pData
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
if $p->nKeyLength > 0
printf "\"%s\" => ", $p->key.arKey.s
else
printf "%d => ", $p->h
end
____printzv_contents &$const->value 0
set $p = $p->pListNext
end
end
define print_const_table
set $ind = 1
printf "[0x%08x] {\n", $arg0
____print_const_table $arg0
printf "}\n"
end
define ____print_ht
set $ht = $arg0
set $obj = $arg1
set $p = $ht->pListHead
set $unicode = $ht->unicode
while $p != 0
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
if $p->nKeyLength > 0
if $obj && $p->key.arKey.s[0] == 0
if $p->key.arKey.s[1] == '*'
printf "\"protected %s\" => ", $p->key.arKey.s+3
else
set $n = 1
while $n < $p->nKeyLength && $p->key.arKey.s[$n] != 0
set $n = $n + 1
end
printf "\"private %s::%s\" => ", $p->key.arKey.s+1, $p->key.arKey.s+$n+1
end
else
printf "\""
printt $p->key.type $p->key.arKey.s $p->nKeyLength
printf "\" => "
end
else
printf "%d => ", $p->h
end
if $arg1 == 0
printf "%p\n", (void*)$p->pData
end
if $arg1 == 1
set $zval = *(zval **)$p->pData
____printzv $zval 1
end
if $arg1 == 2
printf "%s\n", (char*)$p->pData
end
set $p = $p->pListNext
end
end
define print_ht
set $ind = 1
printf "[0x%08x] (%d) {\n", $arg0, $arg0->nNumOfElements
____print_ht $arg0 1
printf "}\n"
end
document print_ht
dumps elements of HashTable made of zval
end
define print_htptr
set $ind = 1
printf "[0x%08x] (%d) {\n", $arg0, $arg0->nNumOfElements
____print_ht $arg0 0
printf "}\n"
end
document print_htptr
dumps elements of HashTable made of pointers
end
define print_htstr
set $ind = 1
printf "[0x%08x] (%d) {\n", $arg0, $arg0->nNumOfElements
____print_ht $arg0 2
printf "}\n"
end
document print_htstr
dumps elements of HashTable made of strings
end
define ____print_ft
set $ht = $arg0
set $p = $ht->pListHead
set $unicode = $ht->unicode
while $p != 0
set $func = (zend_function*)$p->pData
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
if $p->nKeyLength > 0
printf "\""
if $p->key.arKey.u.s[1] == '\0'
printu $p->key.arKey.u $p->nKeyLength
else
printt $unicode $p->key.arKey.u $p->nKeyLength
end
printf "\" => "
else
printf "%d => ", $p->h
end
printf "[%p]: ", $func
if $func->common.fn_flags & 0x01
printf "static "
end
if $func->common.fn_flags & 0x02
printf "abstract "
end
if $func->common.fn_flags & 0x04
printf "final "
end
set $visibility = zend_visibility_string($func->common.fn_flags)
printf "%s", $visibility
if *$visibility
printf " "
end
if $func->common.return_reference
printf "& "
end
printt $unicode $func->common.function_name.s 0
printf "()\n"
set $p = $p->pListNext
end
end
define print_ft
set $ind = 1
printf "[0x%08x] (%d) {\n", $arg0, $arg0->nNumOfElements
____print_ft $arg0
printf "}\n"
end
document print_ft
dumps a function table (HashTable)
end
define printzn
____executor_globals
set $ind = 0
set $znode = $arg0
if $znode->op_type == 1
set $optype = "IS_CONST"
end
if $znode->op_type == 2
set $optype = "IS_TMP_VAR"
end
if $znode->op_type == 4
set $optype = "IS_VAR"
end
if $znode->op_type == 8
set $optype = "IS_UNUSED"
end
if $znode->op_type == 16
set $optype = "IS_CV"
end
printf "[0x%08x] %s", $znode, $optype
if $znode->op_type == 1
printf ": "
____printzv &$znode->u.constant 0
end
if $znode->op_type == 2
printf ": "
set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var)
____printzv ((union _temp_variable *)$tvar)->tmp_var 0
end
if $znode->op_type == 4
printf ": "
set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var)
____printzv *$tvar->var.ptr_ptr 0
end
if $znode->op_type == 8
printf "\n"
end
if $znode->op_type == 16
printf "\n"
end
end
document printzn
print type and content of znode.
usage: printzn &opline->op1
end
define printzops
printf "op1 => "
printzn &execute_data->opline.op1
printf "op2 => "
printzn &execute_data->opline.op2
printf "result => "
printzn &execute_data->opline.result
end
document printzops
dump operands of the current opline
end
define zbacktrace
____executor_globals
dump_bt $eg.current_execute_data
end
document zbacktrace
prints backtrace.
This command is almost a short cut for
> (gdb) ____executor_globals
> (gdb) dump_bt $eg.current_execute_data
end
define zmemcheck
set $p = alloc_globals.head
set $stat = "?"
set $total_size = 0
if $arg0 != 0
set $not_found = 1
else
set $not_found = 0
end
printf " block size status file:line\n"
printf "-------------------------------------------------------------------------------\n"
while $p
set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test)
if $arg0 == 0 || (void *)$aptr == (void *)$arg0
if $p->magic == 0x7312f8dc
set $stat = "OK"
end
if $p->magic == 0x99954317
set $stat = "FREED"
end
if $p->magic == 0xfb8277dc
set $stat = "CACHED"
end
set $filename = strrchr($p->filename, '/')
if !$filename
set $filename = $p->filename
else
set $filename = $filename + 1
end
printf " 0x%08x ", $aptr
if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10
printf "ZVAL?(%-2d) ", $p->size
else
printf "%-9d ", $p->size
end
set $total_size = $total_size + $p->size
printf "%-06s %s:%d", $stat, $filename, $p->lineno
if $p->orig_filename
set $orig_filename = strrchr($p->orig_filename, '/')
if !$orig_filename
set $orig_filename = $p->orig_filename
else
set $orig_filename = $orig_filename + 1
end
printf " <= %s:%d\n", $orig_filename, $p->orig_lineno
else
printf "\n"
end
if $arg0 != 0
set $p = 0
set $not_found = 0
else
set $p = $p->pNext
end
else
set $p = $p->pNext
end
end
if $not_found
printf "no such block that begins at 0x%08x.\n", $aptr
end
if $arg0 == 0
printf "-------------------------------------------------------------------------------\n"
printf " total: %d bytes\n", $total_size
end
end
document zmemcheck
show status of a memory block.
usage: zmemcheck [ptr].
if ptr is 0, all blocks will be listed.
end
+75 -134
View File
@@ -1,6 +1,6 @@
========================
PHP Coding Standards
========================
PHP Coding Standards
====================
This file lists several standards that any programmer, adding or changing
code in PHP, should follow. Since this file was added at a very late
@@ -9,38 +9,35 @@ follow it, but it's going in that general direction. Since we are now
well into the version 4 releases, many sections have been recoded to use
these rules.
Code Implementation
-------------------
0. Document your code in source files and the manual. [tm]
[1] Functions that are given pointers to resources should not free them
1. Functions that are given pointers to resources should not free them
For instance, ``function int mail(char *to, char *from)`` should NOT free
For instance, function int mail(char *to, char *from) should NOT free
to and/or from.
Exceptions:
- The function's designated behavior is freeing that resource. E.g. efree()
- The function is given a boolean argument, that controls whether or not
the function may free its arguments (if true - the function must free its
arguments, if false - it must not)
- Low-level parser routines, that are tightly integrated with the token
cache and the bison code for minimum memory copying overhead.
2. Functions that are tightly integrated with other functions within the
- The function's designated behavior is freeing that resource. E.g. efree()
- The function is given a boolean argument, that controls whether or not
the function may free its arguments (if true - the function must free its
arguments, if false - it must not)
- Low-level parser routines, that are tightly integrated with the token
cache and the bison code for minimum memory copying overhead.
[2] Functions that are tightly integrated with other functions within the
same module, and rely on each other non-trivial behavior, should be
documented as such and declared 'static'. They should be avoided if
possible.
3. Use definitions and macros whenever possible, so that constants have
[3] Use definitions and macros whenever possible, so that constants have
meaningful names and can be easily manipulated. The only exceptions
to this rule are 0 and 1, when used as false and true (respectively).
Any other use of a numeric constant to specify different behavior
or actions should be done through a #define.
4. When writing functions that deal with strings, be sure to remember
[4] When writing functions that deal with strings, be sure to remember
that PHP holds the length property of each string, and that it
shouldn't be calculated with strlen(). Write your functions in a such
a way so that they'll take advantage of the length property, both
@@ -49,47 +46,29 @@ Exceptions:
doing so, should return that new length, so it doesn't have to be
recalculated with strlen() (e.g. php_addslashes())
5. NEVER USE strncat(). If you're absolutely sure you know what you're doing,
[5] Use php_error() to report any errors/warnings during code execution.
Use descriptive error messages, and try to avoid using identical
error strings for different stages of an error. For example,
if in order to obtain a URL you have to parse the URL, connect,
and retreive the text, assuming something can go wrong at each
of these stages, don't report an error "Unable to get URL"
on all of them, but instead, write something like "Unable
to parse URL", "Unable to connect to URL server" and "Unable
to fetch URL text", respectively.
[6] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
check its man page again, and only then, consider using it, and even then,
try avoiding it.
6. Use ``PHP_*`` macros in the PHP source, and ``ZEND_*`` macros in the Zend
part of the source. Although the ``PHP_*`` macro's are mostly aliased to the
``ZEND_*`` macros it gives a better understanding on what kind of macro
you're calling.
7. When commenting out code using a #if statement, do NOT use 0 only. Instead
use "<svn username here>_0". For example, #if FOO_0, where FOO is your
svn user foo. This allows easier tracking of why code was commented out,
especially in bundled libraries.
8. Do not define functions that are not available. For instance, if a
library is missing a function, do not define the PHP version of the
function, and do not raise a run-time error about the function not
existing. End users should use function_exists() to test for the
existence of a function
9. Prefer emalloc(), efree(), estrdup(), etc. to their standard C library
counterparts. These functions implement an internal "safety-net"
mechanism that ensures the deallocation of any unfreed memory at the
end of a request. They also provide useful allocation and overflow
information while running in debug mode.
In almost all cases, memory returned to the engine must be allocated
using emalloc().
The use of malloc() should be limited to cases where a third-party
library may need to control or free the memory, or when the memory in
question needs to survive between multiple requests.
Naming Conventions
------------------
1. Function names for user-level functions should be enclosed with in
[1] Function names for user-level functions should be enclosed with in
the PHP_FUNCTION() macro. They should be in lowercase, with words
underscore delimited, with care taken to minimize the letter count.
Abbreviations should not be used when they greatly decrease the
readability of the function name itself::
readability of the function name itself.
Good:
'mcrypt_enc_self_test'
@@ -99,18 +78,19 @@ Naming Conventions
'mcrypt_module_get_algo_supported_key_sizes'
(could be 'mcrypt_mod_get_algo_sup_key_sizes'?)
'get_html_translation_table'
(could be 'html_get_trans_table'?)
(could be 'html_get_trans_table'?)
Bad:
'hw_GetObjectByQueryCollObj'
'pg_setclientencoding'
'jf_n_s_i'
2. If they are part of a "parent set" of functions, that parent should
[2] If they are part of a "parent set" of functions, that parent should
be included in the user function name, and should be clearly related
to the parent program or function family. This should be in the form
of ``parent_*``::
of parent_*.
A family of 'foo' functions, for example:
Good:
'foo_select_bar'
@@ -122,51 +102,23 @@ Naming Conventions
'fooinsertbaz'
'delete_foo_baz'
3. Function names used by user functions should be prefixed
with ``_php_``, and followed by a word or an underscore-delimited list of
[3] Function names used by user functions should be prefixed
with "_php_", and followed by a word or an underscore-delimited list of
words, in lowercase letters, that describes the function. If applicable,
they should be declared 'static'.
4. Variable names must be meaningful. One letter variable names must be
[4] Variable names must be meaningful. One letter variable names must be
avoided, except for places where the variable has no real meaning or
a trivial meaning (e.g. for (i=0; i<100; i++) ...).
5. Variable names should be in lowercase. Use underscores to separate
[5] Variable names should be in lowercase; Use underscores to seperate
between words.
6. Method names follow the 'studlyCaps' (also referred to as 'bumpy case'
or 'camel caps') naming convention, with care taken to minimize the
letter count. The initial letter of the name is lowercase, and each
letter that starts a new 'word' is capitalized::
Good:
'connect()'
'getData()'
'buildSomeWidget()'
Bad:
'get_Data()'
'buildsomewidget'
'getI()'
7. Classes should be given descriptive names. Avoid using abbreviations where
possible. Each word in the class name should start with a capital letter,
without underscore delimiters (CampelCaps starting with a capital letter).
The class name should be prefixed with the name of the 'parent set' (e.g.
the name of the extension)::
Good:
'Curl'
'FooBar'
Bad:
'foobar'
'foo_bar'
Syntax and indentation
----------------------
1. Never use C++ style comments (i.e. // comment). Always use C-style
[1] Never use C++ style comments (i.e. // comment). Always use C-style
comments instead. PHP is written in C, and is aimed at compiling
under any ANSI-C compliant compiler. Even though many compilers
accept C++-style comments in C code, you have to ensure that your
@@ -175,63 +127,53 @@ Syntax and indentation
because the Win32 port is MS-Visual C++ specific, and this compiler
is known to accept C++-style comments in C code.
2. Use K&R-style. Of course, we can't and don't want to
[2] Use K&R-style. Of course, we can't and don't want to
force anybody to use a style he or she is not used to, but,
at the very least, when you write code that goes into the core
of PHP or one of its standard modules, please maintain the K&R
style. This applies to just about everything, starting with
indentation and comment styles and up to function declaration
syntax. Also see Indentstyle_.
indentation and comment styles and up to function decleration
syntax.
[3] Be generous with whitespace and braces. Always prefer:
.. _Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
if (foo) {
bar;
}
3. Be generous with whitespace and braces. Keep one empty line between the
variable declaration section and the statements in a block, as well as
between logical statement groups in a block. Maintain at least one empty
line between two functions, preferably two. Always prefer::
to:
if (foo) {
bar;
}
if(foo)bar;
to:
Keep one empty line between the variable decleration section and
the statements in a block, as well as between logical statement
groups in a block. Maintain at least one empty line between
two functions, preferably two.
if(foo)bar;
4. When indenting, use the tab character. A tab is expected to represent
[4] When indenting, use the tab character. A tab is expected to represent
four spaces. It is important to maintain consistency in indenture so
that definitions, comments, and control structures line up correctly.
5. Preprocessor statements (#if and such) MUST start at column one. To
indent preprocessor directives you should put the # at the beginning
of a line, followed by any number of whitespace.
Testing
-------
1. Extensions should be well tested using *.phpt tests. Read about that
in README.TESTING.
Documentation and Folding Hooks
-------------------------------
In order to make sure that the online documentation stays in line with
the code, each user-level function should have its user-level function
prototype before it along with a brief one-line description of what the
function does. It would look like this::
function does. It would look like this:
/* {{{ proto int abs(int number)
Returns the absolute value of the number */
PHP_FUNCTION(abs)
{
...
}
/* }}} */
/* {{{ proto int abs(int number)
Return the absolute value of the number */
PHP_FUNCTION(abs)
{
...
}
/* }}} */
The {{{ symbols are the default folding symbols for the folding mode in
Emacs and vim (set fdm=marker). Folding is very useful when dealing with
large files because you can scroll through the file quickly and just unfold
the function you wish to work on. The }}} at the end of each function marks
Emacs and vim (set fdm=marker). Folding is very useful when dealing with
large files because you can scroll through the file quickly and just unfold
the function you wish to work on. The }}} at the end of each function marks
the end of the fold, and should be on a separate line.
The "proto" keyword there is just a helper for the doc/genfuncsummary script
@@ -239,10 +181,10 @@ which generates a full function summary. Having this keyword in front of the
function prototypes allows us to put folds elsewhere in the code without
messing up the function summary.
Optional arguments are written like this::
Optional arguments are written like this:
/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
Returns a header object with the defined parameters */
/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
Returns a header object with the defined parameters. */
And yes, please keep the prototype on a single line, even if that line
is massive.
@@ -256,16 +198,15 @@ in the function directory, and that the functions follow the
standard prefixing conventions during their initial implementation.
The file labelled 'EXPERIMENTAL' should include the following
information::
Any authoring information (known bugs, future directions of the module).
Ongoing status notes which may not be appropriate for SVN comments.
information:
Any authoring infomration (known bugs, future directions of the module).
Ongoing status notes which may not be appropriate for CVS comments.
Aliases & Legacy Documentation
-----------------------------------
You may also have some deprecated aliases with close to duplicate
names, for example, somedb_select_result and somedb_selectresult. For
documentation purposes, these will only be documented by the most
documentation puposes, these will only be documented by the most
current name, with the aliases listed in the documentation for
the parent function. For ease of reference, user-functions with
completely different names, that alias to the same function (such as
@@ -274,4 +215,4 @@ proto should still be included, describing which function is aliased.
Backwards compatible functions and names should be maintained as long
as the code can be reasonably be kept as part of the codebase. See
/phpdoc/README for more information on documentation.
/phpdoc/README for me information on documentation.
+1 -1
View File
@@ -1,2 +1,2 @@
For the list of people who've put work into PHP, please see
For the list of people who've put work into PHP 4.0, please see
http://www.php.net/credits.php
+17549 -157694
View File
File diff suppressed because it is too large. Load diff
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+191 -305
View File
@@ -36,62 +36,22 @@ PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: apache_hooks
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: apache2filter
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>
MAINTENANCE: Maintained
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: apache2handler
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>, Ilia Alshanetsky <iliaa@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: caudium
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: cgi
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: cli
MAINTENANCE: Marcus Boerger <helly@php.net>, Edin Kadribasic <edink@php.net>
STATUS: Working
SINCE: 4.3.0
-------------------------------------------------------------------------------
EXTENSION: continuity
PRIMARY MAINTAINER: Alex Leigh <aleigh@php.net>
EXTENSION: fhttpd
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: embed
PRIMARY MAINTAINER: Edin Kadribasic <edink@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: isapi
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: litespeed
PRIMARY MAINTAINER: George Wang <gwang@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: milter
EXTENSION: nsapi
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: nsapi
PRIMARY MAINTAINER: Uwe Schindler <thetaphi@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: phttpd
MAINTENANCE: Unknown
STATUS: Unknown
@@ -104,34 +64,57 @@ EXTENSION: roxen
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: thttpd
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Odd fixes
EXTENSION: servlet
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: tux
EXTENSION: thttpd
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: webjames
PRIMARY MAINTAINER: Alex Waugh <alex@alexwaugh.com>
MAINTENANCE: Maintained
STATUS: Experimental
-------------------------------------------------------------------------------
== Database extensions ==
-------------------------------------------------------------------------------
EXTENSION: dba
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>,Christopher Jones <sixd@php.net>, Pierre-Alain Joye <pajoye@php.net>
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: DBM abstraction for db2, db3, db4, dbm, ndbm, gdbm, ini
-------------------------------------------------------------------------------
EXTENSION: dbase
PRIMARY MAINTAINER: Jim Winstead <jimw@php.net>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: filepro
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: hyperwave
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: informix
PRIMARY MAINTAINER: Danny Heijl <Danny.Heijl@cevi.be>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: ingres_ii
PRIMARY MAINTAINER: David Hénot <henot@php.net>
MAINTENANCE: Maintained
STATUS: Experimental
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: interbase
PRIMARY MAINTAINER: Ard Biesheuvel <ard@ard.nu>, Jouni Ahto <jouni.ahto@exdec.fi>
MAINTENANCE: Odd fixes
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: msql
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mssql
@@ -141,231 +124,114 @@ STATUS: Working
COMMENT: Tested on phpts and isapi versions
-------------------------------------------------------------------------------
EXTENSION: mysql
PRIMARY MAINTAINER: Zak Greant <zak@mysql.com>, Georg Richter <georg@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
MAINTENANCE: Maintained
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mysqli
PRIMARY MAINTAINER: Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
MAINTENANCE: Maintained
EXTENSION: pgsql
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.0
-------------------------------------------------------------------------------
EXTENSION: mysqlnd
PRIMARY MAINTAINER: Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
MAINTENANCE: Maintained
EXTENSION: sybase
MAINTENANCE: Unknown
STATUS: Not Working
-------------------------------------------------------------------------------
EXTENSION: sybase_ct
MAINTENANCE: Unknown
STATUS: Working
SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: oci8
PRIMARY MAINTAINER: Christopher Jones <sixd@php.net>, Antony Dovgal <tony2001@php.net>
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: odbc
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net>
PRIMARY MAINTAINER: Andreas Karajannis <Karajannis@gmd.de>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Working
COMMENT: Working except for persistent connections
-------------------------------------------------------------------------------
EXTENSION: pdo
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_dblib
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_firebird
PRIMARY MAINTAINER: Lars Westermann <lwe@php.net>
EXTENSION: oracle
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_mysql
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>, Johannes Schlüter <johannes@php.net>, Andrey Hristov <andrey@php.net>, Ulf Wendel <uw@php.net>
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_odbc
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_oci
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_pgsql
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_sqlite
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pgsql
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Yasuo Ohgaki <yohgaki@php.net>
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug.
-------------------------------------------------------------------------------
EXTENSION: sqlite
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Wez Furlong <wez@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0 (Since 4.3.2 in PECL)
COMMENT: Integrates SQLite 2 embeddable SQL database engine.
-------------------------------------------------------------------------------
EXTENSION: sqlite3
PRIMARY MAINTAINER: Scott MacVicar <scottmac@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
COMMENT: Integrates SQLite 3 embeddable SQL database engine.
-------------------------------------------------------------------------------
EXTENSION: sybase_ct
PRIMARY MAINTAINER: Timm Friebe <thekid@thekid.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
== XML extensions ==
-------------------------------------------------------------------------------
EXTENSION: dom
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Boerger <helly@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0
-------------------------------------------------------------------------------
EXTENSION: simplexml
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0
-------------------------------------------------------------------------------
EXTENSION: soap
PRIMARY MAINTAINER: Dmitry Stogov <dmitry@zend.com>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: wddx
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
MAINTENANCE: Orphaned
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: xml
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>, Rob Richards <rrichards@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: libxml
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: xmlreader
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: xmlrpc
PRIMARY MAINTAINER: Dan Libby
MAINTENANCE: Orphaned
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: xmlwriter
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Pierre-Alain Joye <pajoye@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: xsl
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0
COMMENT: Using the new OCI8 driver is encouraged where possible.
-------------------------------------------------------------------------------
== Other extensions ==
-------------------------------------------------------------------------------
EXTENSION: bcmath
MAINTENANCE: Andi Gutmans <andi@zend.com>
EXTENSION: aspell
MAINTENANCE: Unknown
STATUS: Working
COMMENT: For aspell .27 and greater, check out the pspell extension
-------------------------------------------------------------------------------
EXTENSION: bcmath
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: bz2
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
MAINTENANCE: Odd Fixes
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.3
-------------------------------------------------------------------------------
EXTENSION: calendar
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
MAINTENANCE: Odd Fixes
STATUS: Working
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: com_dotnet
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
MAINTENANCE: Maintained
STATUS: Windows
SINCE: 5.0
EXTENSION: com
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: ctype
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
EXTENSION: cpdf
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: crack
MAINTENANCE: Unknown
STATUS: Experimental
SINCE: 4.0.5
-------------------------------------------------------------------------------
EXTENSION: curl
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>,Ilia Alshanetsky <iliaa@php.net>
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: date
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>
EXTENSION: cybercash
PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
MAINTENANCE: Maintained
STATUS: Working
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: domxml
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: dotnet
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
MAINTENANCE: Maintained
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: exif
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.2
MAINTENANCE: Unknown
STATUS: Unknown
SINCE: 4.0.1
-------------------------------------------------------------------------------
EXTENSION: fileinfo
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>
EXTENSION: fdf
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: filter
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>, Pierre-Alain Joye <pajoye@php.net>, Ilia Alshanetsky <iliaa@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.2
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: ftp
PRIMARY MAINTAINER: Stefan Esser <sesser@php.net>
MAINTENANCE: Odd fixes
STATUS: Working
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: gd
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net>
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -374,167 +240,187 @@ MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: gmp
PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net>, Antony Dovgal <tony2001@php.net>
MAINTENANCE: Maintained
STATUS: Working
MAINTENANCE: Unknown
STATUS: Unknown
SINCE: 4.0.4
-------------------------------------------------------------------------------
EXTENSION: iconv
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
MAINTENANCE: Maintained
STATUS: Working
EXTENSION: icap
MAINTENANCE: Unknown
STATUS: Obsolete
-------------------------------------------------------------------------------
EXTENSION: imap
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>, Ilia Alshanetsky <iliaa@php.net>, Pierre-Alain Joye <pajoye@php.net>
MAINTENANCE: Maintained
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: json
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
EXTENSION: java
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.2
-------------------------------------------------------------------------------
EXTENSION: ldap
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>, Douglas Goldstein <cardoe@php.net>, Pierre-Alain Joye <pajoye@php.net>
MAINTENANCE: Maintained
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mbstring
PRIMARY MAINTAINER: Rui Hirokawa <hirokawa@php.net>
MAINTENANCE: Maintained
EXTENSION: mcal
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mcrypt
PRIMARY MAINTAINER: Derick Rethans <derick@derickrethans.nl>
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mhash
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>, Scott MacVicar <scottmac@php.net>
MAINTENANCE: Unknown
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: mime_magic
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Deprecated
STATUS: Experimental
COMMENT: Use the fileinfo extension instead
-------------------------------------------------------------------------------
EXTENSION: ming
PRIMARY MAINTAINER: Frank M. Kromann
MAINTENANCE: Unknown
STATUS: Experimental
EXTENSION: muscat
PRIMARY MAINTAINER: Sam Liddicott <sam@ananova.com>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.5
COMMENT: Not tested against windows, only core API completed, rest under development
-------------------------------------------------------------------------------
EXTENSION: openssl
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>, Pierre-Alain Joye <pajoye@php.net>
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
MAINTENANCE: Maintained
STATUS: Working
STATUS: Experimental
SINCE: 4.0.4
-------------------------------------------------------------------------------
EXTENSION: pcntl
PRIMARY MAINTAINER: Arnaud Le Blanc <lbarnaud@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: pcre
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>, Nuno Lopes <nlopess@php.net>
PRIMARY MAINTAINER: Andrei Zmievski <andrei@ispi.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: phar
PRIMARY MAINTAINER: Greg Beaver <cellog@php.net>, Marcus Börger <helly@php.net>
EXTENSION: pdf
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: pfpro
PRIMARY MAINTAINER: David Croft <david@infotrek.co.uk>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: posix
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: printer
PRIMARY MAINTAINER: Daniel Beulshausen <daniel@php4win.de>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.4
COMMENT: Only for Win32
-------------------------------------------------------------------------------
EXTENSION: pspell
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
MAINTENANCE: Unknown
STATUS: Working
STATUS: Unknown
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: qtdom
MAINTENANCE: Unknown
STATUS: Experimental
SINCE: 4.0.4
-------------------------------------------------------------------------------
EXTENSION: readline
MAINTENANCE: Unknown
STATUS: Working
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: recode
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: reflection
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Johannes Schlüter <johannes@php.net>
EXTENSION: sablot
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Maintained
STATUS: Working
STATUS: Experimental
SINCE: 4.0.3
-------------------------------------------------------------------------------
EXTENSION: satellite
PRIMARY MAINTAINER: David Eriksson <eriksson@php.net>
MAINTENANCE: Odd Fixes
STATUS: Experimental
SINCE: 4.0.3
-------------------------------------------------------------------------------
EXTENSION: session
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>, Ilia Alshanetsky <iliaa@php.net>
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: shmop
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>
MAINTENANCE: Maintained
STATUS: Working
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Unknown
STATUS: Experimental
SINCE: 4.0.3
-------------------------------------------------------------------------------
EXTENSION: snmp
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>, Pierre-Alain Joye <pajoye@php.net>
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: sockets
PRIMARY MAINTAINER: Chris Vandomelen <chrisv@b0rked.dhs.org>
MAINTENANCE: Maintained
STATUS: Working
STATUS: Experimental
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: spl
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Etienne Kneuss <colder@php.net>
EXTENSION: swf
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.0.0
-------------------------------------------------------------------------------
EXTENSION: sysvmsg
MAINTENANCE: Unknown
STATUS: Working
STATUS: Depreciated (Use the ming swf extension instead)
COMMENT: Only for Unix (won't change)
-------------------------------------------------------------------------------
EXTENSION: sysvsem
MAINTENANCE: Unknown
STATUS: Working
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: sysvshm
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: tidy
PRIMARY MAINTAINER: John Coggeshall <john@php.net>, Ilia Alshanetsky <iliaa@php.net>, Nuno Lopes <nlopess@php.net>
EXTENSION: vpopmail
MAINTENANCE: Unknown
STATUS: Experimental
SINCE: 4.0.5
-------------------------------------------------------------------------------
EXTENSION: wddx
PRIMARY MAINTAINER: Andrei Zmievski <andrei@ispi.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: tokenizer
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
EXTENSION: xml
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: unicode
MAINTENANCE: Andrei Zmievski <andrei@php.net>
EXTENSION: yaz
PRIMARY MAINTAINER: Adam Dickmeiss <adam@indexdata.dk>
MAINTENANCE: Maintained
STATUS: Working
STATUS: Unknown
SINCE: 4.0.1
-------------------------------------------------------------------------------
EXTENSION: zip
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net>
MAINTENANCE: Maintained
STATUS: Working
EXTENSION: yp
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: zlib
PRIMARY MAINTAINER: Stefan Roehrich <sr@linux.de>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: zziplib
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
MAINTENANCE: Maintained
STATUS: Experimental
SINCE: 4.0.5
-------------------------------------------------------------------------------
# iptc?
+347 -1479
View File
File diff suppressed because it is too large. Load diff
+33 -26
View File
@@ -1,6 +1,6 @@
--------------------------------------------------------------------
The PHP License, version 3.01
Copyright (c) 1999 - 2009 The PHP Group. All rights reserved.
The PHP License, version 2.02
Copyright (c) 1999, 2000 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -8,38 +8,48 @@ modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact group@php.net.
4. Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net. You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior permission from the
PHP Group. This does not apply to add-on libraries or tools
that work in conjunction with PHP. In such a case the PHP
name may be used to indicate that the product supports PHP.
5. The PHP Group may publish revised and/or new versions of the
4. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the terms
of that version. You may also choose to use such covered code
under the terms of any subsequent version of the license
of the license, you may always continue to use it under the
terms of that version. You may also choose to use such covered
code under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
6. Redistributions of any form whatsoever must retain the following
5. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP software, freely available from
<http://www.php.net/software/>".
"This product includes PHP, freely available from
http://www.php.net/".
6. The software incorporates the Zend Engine, a product of Zend
Technologies, Ltd. ("Zend"). The Zend Engine is licensed to the
PHP Association (pursuant to a grant from Zend that can be
found at http://www.php.net/license/ZendGrant/) for
distribution to you under this license agreement, only as a
part of PHP. In the event that you separate the Zend Engine
(or any portion thereof) from the rest of the software, or
modify the Zend Engine, or any portion thereof, your use of the
separated or modified Zend Engine software shall not be governed
by this license, and instead shall be governed by the license
set forth at http://www.zend.com/license/ZendLicense/.
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -63,6 +73,3 @@ The PHP Group can be contacted via Email at group@php.net.
For more information on the PHP Group and the PHP project,
please see <http://www.php.net>.
PHP includes the Zend Engine, freely available at
<http://www.zend.com>.
-23
View File
@@ -1,23 +0,0 @@
#
# Zend
#
$(builddir)/zend_language_scanner.lo: $(srcdir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(srcdir)/zend_ini_parser.h
$(srcdir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
$(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c
$(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
@$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
$(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c
$(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
@$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
-79
View File
@@ -1,79 +0,0 @@
#
# LCOV
#
lcov: lcov-html
lcov-test: all
@echo "Running test suite"
@find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
NO_INTERACTION=1 \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(PHP_EXECUTABLE) -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php -d 'extension_dir=modules/' -d `( . $(PHP_MODULES) ; echo extension=$$dlname)` tests/; \
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
NO_INTERACTION=1 \
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi
php_lcov.info: lcov-test
@echo "Generating data for $@"
@rm -rf lcov_data/
@$(mkinstalldirs) lcov_data/
@echo
-@find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | uniq | while read x; do \
echo -n . ;\
y=`echo $$x | sed -e 's!\.libs/!!'`; \
dir=lcov_data/`dirname $$x`; \
test -d "$$dir" || $(mkinstalldirs) "$$dir"; \
if test -f "$(top_srcdir)/$$y.c"; then \
ln -f -s $(top_srcdir)/$$y.c lcov_data/$$y.c; \
fi; \
if test -f "$(top_srcdir)/$$y.h"; then \
ln -f -s $(top_srcdir)/$$y.h lcov_data/$$y.h; \
fi; \
if test -f "$(top_srcdir)/$$y.re"; then \
ln -f -s $(top_srcdir)/$$y.re lcov_data/$$y.re; \
fi; \
if test -f "$(top_srcdir)/$$y.y"; then \
ln -f -s $(top_srcdir)/$$y.y lcov_data/$$y.y; \
fi; \
if test -f "$(top_srcdir)/$$y.l"; then \
ln -f -s $(top_srcdir)/$$y.l lcov_data/$$y.l; \
fi; \
if test -f "$(top_srcdir)/$$y"; then \
ln -f -s $(top_srcdir)/$$y lcov_data/$$y; \
fi; \
if test -f "$(top_builddir)/$$y.c"; then \
ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
fi; \
test -f "$$x.gcno" && cp $$x.gcno lcov_data/$$y.gcno ; \
test -f "$$x.gcda" && cp $$x.gcda lcov_data/$$y.gcda ; \
test -f "$$x.da" && cp $$x.da lcov_data/$$y.da ; \
test -f "$$x.bb" && cp $$x.bb lcov_data/$$y.bb ; \
test -f "$$x.bbg" && cp $$x.bbg lcov_data/$$y.bbg ; \
done
for dir in ext/bcmath/libbcmath ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
test -d lcov_data/$$dir && rm -rf lcov_data/$$dir ; \
done
@echo
@echo "Generating $@"
@$(LTP) --directory lcov_data/ --capture --base-directory=lcov_data --output-file $@
lcov-html: php_lcov.info
@echo "Generating lcov HTML"
@$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info
lcov-clean:
rm -f php_lcov.info
rm -rf lcov_data/
rm -rf lcov_html/
-118
View File
@@ -1,118 +0,0 @@
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
all: $(all_targets)
@echo
@echo "Build complete."
@echo "Don't forget to run 'make test'."
@echo
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so
install: $(all_targets) $(install_targets)
install-sapi: $(OVERALL_TARGET)
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
-@if test ! -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); then \
for i in 0.0.0 0.0 0; do \
if test -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i; then \
$(LN_S) $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); \
break; \
fi; \
done; \
fi
@$(INSTALL_IT)
install-modules: build-modules
@test -d modules && \
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
@echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/"
@rm -f modules/*.la >/dev/null 2>&1
@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
install-headers:
-@if test "$(INSTALL_HEADERS)"; then \
for i in `echo $(INSTALL_HEADERS)`; do \
i=`$(top_srcdir)/build/shtool path -d $$i`; \
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
done; \
$(mkinstalldirs) $$paths && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
for i in `echo $(INSTALL_HEADERS)`; do \
if test "$(PHP_PECL_EXTENSION)"; then \
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
else \
src=$$i; \
fi; \
if test -f "$(top_srcdir)/$$src"; then \
$(INSTALL_DATA) $(top_srcdir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
elif test -f "$(top_builddir)/$$src"; then \
$(INSTALL_DATA) $(top_builddir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
else \
(cd $(top_srcdir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
cd $(top_builddir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
fi \
done; \
fi
PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1'
PHP_TEST_SHARED_EXTENSIONS = ` \
if test "x$(PHP_MODULES)" != "x"; then \
for i in $(PHP_MODULES)""; do \
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
done; \
fi; \
if test "x$(PHP_ZEND_EX)" != "x"; then \
for i in $(PHP_ZEND_EX)""; do \
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \
done; \
fi`
PHP_DEPRECATED_DIRECTIVES_REGEX = '^(define_syslog_variables|register_(globals|long_arrays)?|safe_mode|safe_mode_(gid|include_dir|exec_dir|allowed_env_vars|protected_env_vars)?|highlight_bg|enable_dl|detect_unicode|allow_call_time_pass_reference|magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
test: all
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
if test "$$INI_FILE"; then \
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
else \
echo > $(top_builddir)/tmp-php.ini; \
fi; \
INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
if test "$$INI_SCANNED_PATH"; then \
INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
fi; \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi
clean:
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
.PHONY: all clean install distclean test
.NOEXPORT:
+62
View File
@@ -0,0 +1,62 @@
ZEND_DIR = $(srcdir)/Zend
SUBDIRS = Zend main ext sapi $(TSRM_DIR) $(REGEX_DIR) . $(PEAR_DIR)
LTLIBRARY_NAME = libphp4.la
LTLIBRARY_SOURCES = stub.c
LTLIBRARY_DEPENDENCIES = \
Zend/libZend.la \
sapi/$(PHP_SAPI)/libsapi.la \
main/libmain.la \
$(REGEX_LIB) \
$(EXT_LTLIBS) \
$(TSRM_LIB)
LTLIBRARY_LDFLAGS = -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
PROGRAM_NAME = php
PROGRAM_SOURCES = stub.c
PROGRAM_LDADD = libphp4.la $(EXT_PROGRAM_LDADD)
PROGRAM_LDFLAGS = -export-dynamic
PROGRAM_DEPENDENCIES = $(PROGRAM_LDADD)
targets = $(LTLIBRARY_NAME) $(PHP_PROGRAM)
install_targets = install-sapi install-modules
include $(top_srcdir)/build/rules.mk
include $(top_srcdir)/build/library.mk
include $(top_srcdir)/build/program.mk
install-sapi:
@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
-@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
for i in 0.0.0 0.0 0; do \
if test -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i; then \
$(LN_S) $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); \
break; \
fi; \
done; \
fi
$(INSTALL_IT)
install-modules:
@test -d modules && \
$(mkinstalldirs) $(INSTALL_ROOT)$(moduledir) && \
echo "installing shared modules into $(moduledir)" && \
rm -f modules/*.la && \
cp modules/* $(INSTALL_ROOT)$(moduledir) >/dev/null 2>&1 || true
install-tester:
-$(mkinstalldirs) $(datadir)
$(INSTALL) -m 755 $(srcdir)/run-tests.php $(INSTALL_ROOT)$(datadir)
install-pear: install-modules
(cd pear && $(MAKE) install)
install-su: install-pear install-tester
.NOEXPORT:
+1680 -44
View File
File diff suppressed because it is too large. Load diff
+105
View File
@@ -0,0 +1,105 @@
This is the first file you should be reading after you get your CVS account.
We'll assume you're basically familiar with CVS, but feel free to post
your questions on the mailing list.
PHP is developed through the efforts of a large number of people.
Collaboration is a Good Thing(tm), and CVS lets us do this. Thus, following
some basic rules with regards to CVS usage will:
a. Make everybody happier, especially those responsible for maintaining
the CVS itself.
b. Keep the changes consistently well documented and easily trackable.
c. Prevent some of those 'Oops' moments.
d. Increase the general level of good will on planet Earth.
Having said that, here are the organizational rules:
1. Respect other people working on the project.
2. Discuss any significant changes on the list before committing.
3. Look at EXTENSIONS file to see who is the primary maintainer of
the code you want to contribute to.
4. If you "strongly disagree" about something another person did, don't
start fighting publicly - take it up in private email.
5. If you don't know how to do something, ask first!
6. Test your changes before committing them. We mean it. Really.
The next few rules are more of a technical nature.
1. DO NOT TOUCH ChangeLog! It is automagically updated from the commit
messages every day. Woe be to those who attempt to mess with it.
2. All news updates intended for public viewing, such as new features,
bug fixes, improvements, etc., should go into the NEWS file. Also see
the note below about automatically updating NEWS in your commit message.
3. Do not commit multiple file and dump all messages in one commit. If you
modified several unrelated files, commit each group separately and
provide a nice commit message for each one. See example below.
4. Do write your commit message in such a way that it makes sense even
without the corresponding diff. One should be able to look at it, and
immediately know what was modified. Definitely include the function name
in the message as shown below.
5. In your commit messages, keep each line shorter than 80 characters. And
try to align your lines vertically, if they wrap. It looks bad otherwise.
6. If you modified a function that is callable from PHP, prepend PHP to
the function name as shown below.
The format of the commit messages is pretty simple.
If a line begins with #, it is taken to be a comment and will not appear
in the ChangeLog. If the line begins with @, it will be redirected to the
NEWS file. Everything else goes into the ChangeLog.
It is important to note that if your comment or news logline spans multiple
lines, you have to put # or @ at the beginning of _every_ such line. Every
entry in NEWS has to have a name after it, so if you did it with someone's
help, put both your names there. Your name WILL NOT be automatically put
at the end of the NEWS entry - so, please provide it yourself.
Example. Say you modified two files, datetime.c and string.c. In datetime.c
you added a new format option for date() function, and in string.c you fixed
a memory leak in php_trim(). Don't commit both of these at once. Commit them
separately and try to make sure your commit messages look something like the
following.
For datetime.c:
(PHP date) Added new 'K' format modifier for printing out number of
days until New Year's Eve.
@- Added new 'K' format modifier that will output the number of days
@ until New Year's Eve. (Bob)
For string.c:
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
# Man, that thing was leaking all over the place!
@- Memory leak in trim() function has finally been fixed. (Bob)
The lines above marked with @ will go into NEWS file automagically, and the
# lines will be omitted from the ChangeLog. Alternatively, you might want
to modify NEWS file directly and not use the @ lines.
If you don't see your messages in ChangeLog and NEWS right away, don't worry!
These files are updated once a day, so your stuff will not show up until
somewhat later. Don't go adding stuff to NEWS by hand if you already put @
lines in the commit message.
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
to look at PHP CVS repository in various ways.
To receive daily updates to ChangeLog and NEWS, send an empty message to
php-cvs-daily-subscribe@lists.php.net.
Happy hacking,
PHP Team
+9 -19
View File
@@ -1,7 +1,3 @@
(NOTE: you may also want to take a look at the pear package
PECL_Gen, a PHP-only alternative for this script that
supports way more extension writing tasks and is
supposed to replace ext_skel completely in the long run ...)
WHAT IT IS
@@ -11,23 +7,17 @@ WHAT IT IS
HOW TO USE IT
Very simple. First, change to the ext/ directory of the PHP 4 sources. If
you just need the basic framework and will be writing all the code in your
functions yourself, you can now do
Very simple. First, cd do directory ext/ in PHP 4 sources. If you just need
the basic framework and will be writing all the code in your functions
yourself, you can now do
./ext_skel --extname=module_name
and everything you need is placed in directory module_name.
[ Note that GNU awk is likely required for this script to work. Debian
systems seem to default to using mawk, so you may need to change the
#! line in skeleton/create_stubs and the cat $proto | awk line in
ext_skel to use gawk explicitly. ]
If you don't need to test the existence of any external header files,
libraries or functions in them, the module is already almost ready to be
compiled in PHP. Just remove 3 comments in your_module_name/config.m4,
change back up to PHP sources top directory, and do
and everything you need is placed in directory module_name. In fact, if you
don't need to test the existence of any external header files, libraries or
functions in them, the module is already almost ready to be compiled in PHP.
Just remove 3 comments in your_module_name/config.m4, cd back up to PHP
sources top directory, and do
./buildconf; ./configure --enable-module_name; make
@@ -43,7 +33,7 @@ HOW TO USE IT
FORMAT OF FUNCTION DEFINITIONS FILE
All the definitions must be on one line. In it's simplest form, it's just
the function name, e.g.
the function name, ie.
my_function
-79
View File
@@ -1,79 +0,0 @@
====================
Mailinglist Rules
====================
This is the first file you should be reading before doing any posts on PHP
mailinglists. Following these rules is considered imperative to the success of
the PHP project. Therefore expect your contributions to be of much less positive
impact if you do not follow these rules. More importantly you can actually
assume that not following these rules will hurt the PHP project.
PHP is developed through the efforts of a large number of people.
Collaboration is a Good Thing(tm), and mailinglists lets us do this. Thus,
following some basic rules with regards to mailinglist usage will:
a. Make everybody happier, especially those responsible for developing PHP
itself.
b. Help in making sure we all use our time more efficiently.
c. Prevent you from making a fool of yourself in public.
d. Increase the general level of good will on planet Earth.
Having said that, here are the organizational rules:
1. Respect other people working on the project.
2. Do not post when you are angry. Any post can wait a few hours. Review
your post after a good breather or a good nights sleep.
3. Make sure you pick the right mailinglist for your posting. Please review
the descriptions on the mailinglist overview page
(http://www.php.net/mailing-lists.php). When in doubt ask a friend or
someone you trust on IRC.
4. Make sure you know what you are talking about. PHP is a very large project
that strives to be very open. The flip side is that the core developers
are faced with a lot of requests. Make sure that you have done your
research before posting to the entire developer community.
5. Patches have a much greater chance of acceptance than just asking the
PHP developers to implement a feature for you. For one it makes the
discussion more concrete and it shows that the poster put thought and time
into the request.
6. If you are posting to an existing thread, make sure that you know what
previous posters have said. This is even more important the longer the
thread is already.
7. Please configure your email client to use a real name and keep message
signatures to a maximum of 2 lines if at all necessary.
The next few rules are more some general hints:
1. If you notice that your posting ratio is much higher than that of other
people, double check the above rules. Try to wait a bit longer before
sending your replies to give other people more time to digest your answers
and more importantly give you the opportunity to make sure that you
aggregate your current position into a single mail instead of multiple
ones.
2. Consider taking a step back from a very active thread now and then. Maybe
talking to some friends and fellow developers will help in understanding
the other opinions better.
3. Do not top post. Place your answer underneath anyone you wish to quote
and remove any previous comment that is not relevant to your post.
4. Do not high-jack threads, by bringing up entirely new topics. Please
create an entirely new thread copying anything you wish to quote into the
new thread.
Finally, additional hints on how to behave inside the virtual community can be
found in RFC 1855 (http://www.faqs.org/rfcs/rfc1855.html).
Happy hacking,
PHP Team
-142
View File
@@ -1,142 +0,0 @@
$Id$
API adjustment to the old output control code:
Everything now resides beneath the php_output namespace,
and there's an API call for every output handler op.
Checking output control layers status:
// Using OG()
php_output_get_status(TSRMLS_C);
Starting the default output handler:
// php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
php_output_start_default(TSRMLS_C);
Starting an user handler by zval:
// php_start_ob_buffer(zhandler, chunk_size, erase TSRMLS_CC);
php_output_start_user(zhandler, chunk_size, flags TSRMLS_CC);
Starting an internal handler whithout context:
// php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase TSRMLS_CC);
php_output_start_internal(handler_name_zval, my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
Starting an internal handler with context:
// not possible with old API
php_output_handler *h;
h = php_output_handler_create_internal(handler_name_zval, my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
php_output_handler_set_context(h, my_context, my_context_dtor);
php_output_handler_start(h TSRMLS_CC);
Testing whether a certain output handler has already been started:
// php_ob_handler_used("output handler name" TSRMLS_CC);
php_output_handler_started(handler_name_zval TSRMLS_CC);
Flushing one output buffer:
// php_ob_end_buffer(1, 1 TSRMLS_CC);
php_output_flush(TSRMLS_C);
Flushing all output buffers:
// not possible with old API
php_output_flush_all(TSRMLS_C);
Cleaning one output buffer:
// php_ob_end_buffer(0, 1 TSRMLS_CC);
php_output_clean(TSRMLS_C);
Cleaning all output buffers:
// not possible with old API
php_output_clean_all(TSRMLS_C);
Discarding one output buffer:
// php_ob_end_buffer(0, 0 TSRMLS_CC);
php_output_discard(TSRMLS_C);
Discarding all output buffers:
// php_ob_end_buffers(0 TSRMLS_CC);
php_output_discard_all(TSRMLS_C);
Stopping (and dropping) one output buffer:
// php_ob_end_buffer(1, 0 TSRMLS_CC)
php_output_end(TSRMLS_C);
Stopping (and dropping) all output buffers:
// php_ob_end_buffers(1, 0 TSRMLS_CC);
php_output_end_all(TSRMLS_C);
Retrieving output buffers contents:
// php_ob_get_buffer(zstring TSRMLS_CC);
php_output_get_contents(zstring TSRMLS_CC);
Retrieving output buffers length:
// php_ob_get_length(zlength TSRMLS_CC);
php_output_get_length(zlength TSRMLS_CC);
Retrieving output buffering level:
// OG(nesting_level);
php_output_get_level(TSRMLS_C);
Issue a warning because of an output handler conflict:
// php_ob_init_conflict("to be started handler name", "to be tested if already started handler name" TSRMLS_CC);
php_output_handler_conflict(new_handler_name_zval, set_handler_name_zval TSRMLS_CC);
Registering a conflict checking function, which will be checked prior starting the handler:
// not possible with old API, unless hardcoding into output.c
php_output_handler_conflict_register(handler_name_zval, my_php_output_handler_conflict_check_t TSRMLS_CC);
Registering a reverse conflict checking function, which will be checked prior starting the specified foreign handler:
// not possible with old API
php_output_handler_reverse_conflict_register(foreign_handler_name_zval, my_php_output_handler_conflict_check_t TSRMLS_CC);
Facilitating a context from within an output handler callable with ob_start():
// not possible with old API
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr TSRMLS_CC);
Disabling of the output handler by itself:
//not possible with old API
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
Marking an output handler immutable by itself because of irreversibility of its operation:
// not possible with old API
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
Restarting the output handler because of a CLEAN operation:
// not possible with old API
if (flags & PHP_OUTPUT_HANDLER_CLEAN) { ... }
Recognizing by the output handler itself if it gets discarded:
// not possible with old API
if ((flags & PHP_OUTPUT_HANDLER_CLEAN) && (flags & PHP_OUTPUT_HANDLER_FINAL)) { ... }
Output handler hooks
The output handler can change its abilities at runtime. Eg. the gz handler can
remove the CLEANABLE and REMOVABLE bits when the first output has passed through it;
or handlers implemented in C to be used with ob_start() can contain a non-global
context:
PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ
pass a void*** pointer as second arg to receive the address of a pointer
pointer to the opaque field of the output handler context
PHP_OUTPUT_HANDLER_HOOK_GET_FLAGS
pass a int* pointer as second arg to receive the flags set for the output handler
PHP_OUTPUT_HANDLER_HOOK_GET_LEVEL
pass a int* pointer as second arg to receive the level of this output handler
(starts with 0)
PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE
the second arg is ignored; marks the output handler to be neither cleanable
nor removable
PHP_OUTPUT_HANDLER_HOOK_DISABLE
the second arg is ignored; marks the output handler as disabled
Open questions
Should the userland API be adjusted and unified?
Many bits of the manual (and very first implementation) do not comply
with the behaviour of the current (to be obsoleted) code, thus should
the manual or the behaviour be adjusted?
END
-281
View File
@@ -1,281 +0,0 @@
New parameter parsing functions
===============================
It should be easier to parse input parameters to an extension function.
Hence, borrowing from Python's example, there are now a set of functions
that given the string of type specifiers, can parse the input parameters
and store the results in the user specified variables. This avoids most
of the IS_* checks and convert_to_* conversions. The functions also
check for the appropriate number of parameters, and try to output
meaningful error messages.
Prototypes
----------
/* Implemented. */
int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
The zend_parse_parameters() function takes the number of parameters
passed to the extension function, the type specifier string, and the
list of pointers to variables to store the results in. The _ex() version
also takes 'flags' argument -- current only ZEND_PARSE_PARAMS_QUIET can
be used as 'flags' to specify that the function should operate quietly
and not output any error messages.
Both functions return SUCCESS or FAILURE depending on the result.
The auto-conversions are performed as necessary. Arrays, objects, and
resources cannot be auto-converted.
Type specifiers
---------------
The following list shows the type specifier, its meaning and the parameter
types that need to be passed by address. All passed paramaters are set
if the PHP parameter is non optional and untouched if optional and the
parameter is not present. The only exception is O where the zend_class_entry*
has to be provided on input and is used to verify the PHP parameter is an
instance of that class.
a - array (zval*)
A - array or object (zval *)
b - boolean (zend_bool)
C - class (zend_class_entry*)
d - double (double)
f - function or array containing php method call info (returned as
zend_fcall_info and zend_fcall_info_cache)
h - array (returned as HashTable*)
H - array or HASH_OF(object) (returned as HashTable*)
l - long (long)
L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (long)
o - object of any type (zval*)
O - object of specific type given by class entry (zval*, zend_class_entry)
r - resource (zval*)
s - string (with possible null bytes) and its length (char*, int)
S - binary string, does not allow conversion from Unicode strings
t - text (zstr (string union), int (length), zend_uchar (IS_STRING/..))
accepts either Unicode or binary string
T - text (zstr (string union), int (length), zend_uchar (IS_STRING/..))
coalesces all T parameters to common type (Unicode or binary)
u - unicode (UChar*, int)
U - Unicode string, does not allow conversion from binary strings
x - Unicode or binary string depending on UG(unicode). In unicode this
behaves like 'u' and in nonunicode mode it behaves like 's'.
z - the actual zval (zval*)
Z - the actual zval (zval**)
* - variable arguments list (0 or more)
+ - variable arguments list (1 or more)
The following characters also have a meaning in the specifier string:
| - indicates that the remaining parameters are optional, they
should be initialized to default values by the extension since they
will not be touched by the parsing function if they are not
passed to it.
/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
! - the parameter it follows can be of specified type or NULL (applies
to all specifiers except for 'b', 'l', and 'd'). If NULL is passed, the
results pointer is set to NULL as well.
& - alternate format (currently used for 's' only to specify a converter to
use when converting from Unicode strings)
^ - returns original string type before conversion (only for 's' and 'u'
specifiers)
Note on 64bit compatibility
---------------------------
Please do not forget that int and long are two different things on 64bit
OSes (int is 4 bytes and long is 8 bytes), so make sure you pass longs to "l"
and ints to strings length (i.e. for "s" you need to pass char * and int),
not the other way round!
Remember: "l" is the only case when you need to pass long (and that's why
it's "l", not "i" btw).
Both mistakes cause memory corruptions and segfaults on 64bit OSes:
1)
char *str;
long str_len; /* XXX THIS IS WRONG!! Use int instead. */
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len)
2)
int num; /* XXX THIS IS WRONG!! Use long instead. */
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num)
If you're in doubt, use check_parameters.php script to the parameters
and their types (it can be found in ./scripts/dev/ directory of PHP sources):
# php ./scripts/dev/check_parameters.php /path/to/your/sources/
Examples
--------
/* Gets a long, a string and its length, and a zval */
long l;
char *s;
int s_len;
zval *param;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
&l, &s, &s_len, &param) == FAILURE) {
return;
}
/* Gets an object of class specified by my_ce, and an optional double. */
zval *obj;
double d = 0.5;
zend_class_entry *my_ce;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
&obj, my_ce, &d) == FAILURE) {
return;
}
/* Gets an object or null, and an array.
If null is passed for object, obj will be set to NULL. */
zval *obj;
zval *arr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a",
&obj, &arr) == FAILURE) {
return;
}
/* Gets a separated array which can also be null. */
zval *arr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
&arr) == FAILURE) {
return;
}
/* Gets a binary string in UTF-8 */
char *str;
int str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &str, &str_len, UG(utf8_conv)) == FAILURE) {
return;
}
/* Gets a Unicode string */
UChar *str;
int len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, &len) == FAILURE) {
return;
}
/* Gets a Unicode or binary string */
zstr str;
int len;
zend_uchar type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &str, &len, &type) == FAILURE) {
return;
}
if (type == IS_UNICODE) {
/* process str.u as Unicode string */
} else {
/* process str.s binary string */
}
/* Gets two string parameters, both of which will be guaranteed to be of the same type */
zstr str1, str2;
int len1, len2;
zend_uchar type1, type2;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &str1, &len1,
&type1, &str2, &len2, &type2) == FAILURE) {
return;
}
if (type1 == IS_UNICODE) {
/* process as Unicode, str2 is guaranteed to be Unicode as well */
} else {
/* process as binary string, str2 is guaranteed to be the same */
}
/* Get either a set of 3 longs or a string. */
long l1, l2, l3;
char *s;
/*
* The function expects a pointer to a integer in this case, not a long
* or any other type. If you specify a type which is larger
* than a 'int', the upper bits might not be initialized
* properly, leading to random crashes on platforms like
* Tru64 or Linux/Alpha.
*/
int length;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
"lll", &l1, &l2, &l3) == SUCCESS) {
/* manipulate longs */
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
"s", &s, &length) == SUCCESS) {
/* manipulate string */
} else {
/* output error */
return;
}
/* Function that accepts only varargs (0 or more) */
int i, num_varargs;
zval ***varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &varargs, &num_varargs) == FAILURE) {
return;
}
for (i = 0; i < num_varargs; i++) {
/* do something with varargs[i] */
}
if (varargs) {
efree(varargs);
}
/* Function that accepts a string, followed by varargs (1 or more) */
char *str;
int str_len;
int i, num_varargs;
zval ***varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
return;
}
for (i = 0; i < num_varargs; i++) {
/* do something with varargs[i] */
}
if (varargs) {
efree(varargs);
}
/* Function that takes an array, followed by varargs, and ending with a long */
long num;
zval *array;
int i, num_varargs;
zval ***varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
return;
}
for (i = 0; i < num_varargs; i++) {
/* do something with varargs[i] */
}
if (varargs) {
efree(varargs);
}
-11
View File
@@ -1,11 +0,0 @@
To install the PEAR installer, please use go-pear.
On linux:
$ lynx -source http://pear.php.net/go-pear | php
or save the setup script under go-pear.php and run:
php go-pear.php
For more informations see the PEAR manual:
http://pear.php.net/manual/en/installation.getting.php
-155
View File
@@ -1,155 +0,0 @@
1. strrpos() and strripos() now use the entire string as a needle. Be aware
that the existing scripts may no longer work as you expect.
EX :
<?php
var_dump(strrpos("ABCDEF","DEF"));
var_dump(strrpos("ABCDEF","DAF"));
?>
Will give you different results. The former returns 3 while the latter
returns false rather than the position of the last occurrence of 'D'.
The same applies to strripos().
2. Illegal use of string offsets causes E_ERROR instead of E_WARNING.
EX :
<?php
$a = "foo";
unset($a[0][1][2]);
?>
Fatal error: Cannot use string offset as an array in ... on line 1
3. array_merge() was changed to accept only arrays. If a non-array variable is
passed, a E_WARNING will be thrown for every such parameter. Be careful
because your code may start emitting E_WARNING out of the blue.
4. Be careful when porting from ext/mysql to ext/mysqli. The following
functions return NULL when no more data is available in the result set
(ext/mysql's functions return FALSE).
- mysqli_fetch_row()
- mysqli_fetch_array()
- mysqli_fetch_assoc()
5. PATH_TRANSLATED server variable is no longer set implicitly under
Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the
same value as the SCRIPT_FILENAME server variable when it is not populated
by Apache. This change was made to comply with the CGI specification.
Please refer to bug #23610 for further information.
6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the
ext/tokenizer extension. If error_reporting is set to E_ALL notices will
be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant
is used, thus both // and /* */ are resolved as the T_COMMENT constant.
However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed
by PHP, are recongnized as T_DOC_COMMENT.
7. $_SERVER should be populated with argc and argv if variables_order
includes "S". If you have specifically configured your system to not
create $_SERVER, then of course it shouldn't be there. The change was to
always make argc and argv available in the CLI version regardless of the
variables_order setting. As in, the CLI version will now always populate
the global $argc and $argv variables.
8. In some cases classes must be declared before used. It only happens only
if some of the new features of PHP 5 are used. Otherwise the behaviour is
the old.
Example 1 (works with no errors):
<?php
$a = new a();
class a {
}
?>
Example 2 (throws an error):
<?php
$a = new a();
interface b{
}
class a implements b {
}
?>
Output (example 2) :
Fatal error: Class 'a' not found in /tmp/cl.php on line 2
9. get_class() starting PHP 5 returns the name of the class as it was
declared which may lead to problems in older scripts that rely on
the previous behaviour - the class name is lowercased. Expect the
same behaviour from get_parent_class() when applicable.
Example :
<?php
class FooBar {
}
class ExtFooBar extends FooBar{}
$a = new FooBar();
var_dump(get_class($a), get_parent_class($a));
?>
Output (PHP 4):
string(6) "foobar"
string(9) "extfoobar"
Output (PHP 5):
string(6) "FooBar"
string(9) "ExtFooBar"
----------------------------------------------------------------------
Example code that will break :
//....
function someMethod($p) {
if (get_class($p) != 'helpingclass') {
return FALSE;
}
//...
}
//...
Possible solution is to search for get_class() and get_parent_class() in
all your scripts and use strtolower().
10. get_class_methods() returns the names of the methods of a class as they
declared. In PHP4 the names are all lowercased.
Example code :
<?php
class Foo{
function doFoo(){}
function hasFoo(){}
}
var_dump(get_class_methods("Foo"));
?>
Output (PHP4):
array(2) {
[0]=>
string(5) "dofoo"
[1]=>
string(6) "hasfoo"
}
Output (PHP5):
array(2) {
[0]=>
string(5) "doFoo"
[1]=>
string(6) "hasFoo"
}
11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special
meaning in class methods and is recognized by the PHP parser. The latter
will generate a parse error when assignment to $this is found
Example code :
<?php
class Foo {
function assignNew($obj) {
$this = $obj;
}
}
$a = new Foo();
$b = new Foo();
$a->assignNew($b);
echo "I was executed\n";
?>
Output (PHP 4):
I was executed
Output (PHP 5):
PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4
-429
View File
@@ -1,429 +0,0 @@
1. libmagic (ext/fileinfo) see ext/fileinfo/libmagic/LICENSE
2. Oniguruma (ext/mbstring) see ext/mbstring/oniguruma/COPYING
3. libmbfl (ext/mbstring) see ext/mbstring/libmbfl/LICENSE
4. pcrelib (ext/pcre) see ext/pcre/pcrelib/LICENCE
5. ext/standard crypt
6. ext/standard crypt's blowfish implementation
7. Sqlite/Sqlite3 ext/sqlite3 ext/sqlite
8. ext/json/json_parser
9. ext/standard/rand
10. ext/standard/scanf
11. ext/standard/strnatcmp.c
12. ext/standard/uuencode
13. libxmlrpc ext/xmlrpc
14. libzip ext/zip
15. main/snprintf.c
16. main/strlcat
17. main/strlcpy
18. libgd see ext/gd/libgd/COPYING
5. ext/standard crypt
FreeSec: libcrypt for NetBSD
Copyright (c) 1994 David Burren
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of other contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
6. ext/standard crypt's blowfish implementation
This code comes from John the Ripper password cracker, with reentrant
and crypt(3) interfaces added, but optimizations specific to password
cracking removed.
Written by Solar Designer <solar at openwall.com> in 1998-2002 and
placed in the public domain.
There's absolutely no warranty.
It is my intent that you should be able to use this on your system,
as a part of a software package, or anywhere else to improve security,
ensure compatibility, or for any other purpose. I would appreciate
it if you give credit where it is due and keep your modifications in
the public domain as well, but I don't require that in order to let
you place this code and any modifications you make under a license
of your choice.
This implementation is compatible with OpenBSD bcrypt.c (version 2a)
by Niels Provos <provos at citi.umich.edu>, and uses some of his
ideas. The password hashing algorithm was designed by David Mazieres
<dm at lcs.mit.edu>.
There's a paper on the algorithm that explains its design decisions:
http://www.usenix.org/events/usenix99/provos.html
Some of the tricks in BF_ROUND might be inspired by Eric Young's
Blowfish library (I can't be sure if I would think of something if I
hadn't seen his code).
7. Sqlite/Sqlite3 ext/sqlite3 ext/sqlite
The author disclaims copyright to this source code. In place of
a legal notice, here is a blessing:
May you do good and not evil.
May you find forgiveness for yourself and forgive others.
May you share freely, never taking more than you give.
8. ext/json/json_parser
Copyright (c) 2005 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9. ext/standard/rand
The following php_mt_...() functions are based on a C++ class MTRand by
Richard J. Wagner. For more information see the web page at
http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html
Mersenne Twister random number generator -- a C++ class MTRand
Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
Richard J. Wagner v1.0 15 May 2003 rjwagner@writeme.com
The Mersenne Twister is an algorithm for generating random numbers. It
was designed with consideration of the flaws in various other generators.
The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
are far greater. The generator is also fast; it avoids multiplication and
division, and it benefits from caches and pipelines. For more information
see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html
Reference
M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on
Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
Copyright (C) 2000 - 2003, Richard J. Wagner
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10. ext/standard/scanf
scanf.c --
This file contains the base code which implements sscanf and by extension
fscanf. Original code is from TCL8.3.0 and bears the following copyright:
This software is copyrighted by the Regents of the University of
California, Sun Microsystems, Inc., Scriptics Corporation,
and other parties. The following terms apply to all files associated
with the software unless explicitly disclaimed in individual files.
The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
11. ext/standard/strnatcmp.c
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
12. ext/standard/uuencode
Portions of this code are based on Berkeley's uuencode/uudecode
implementation.
Copyright (c) 1983, 1993
The Regents of the University of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the University of
California, Berkeley and its contributors.
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
13. libxmlrpc ext/xmlrpc
Copyright 2000 Epinions, Inc.
Subject to the following 3 conditions, Epinions, Inc. permits you, free
of charge, to (a) use, copy, distribute, modify, perform and display this
software and associated documentation files (the "Software"), and (b)
permit others to whom the Software is furnished to do so as well.
1) The above copyright notice and this permission notice shall be included
without modification in all copies or substantial portions of the
Software.
2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF
ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY
IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE OR NONINFRINGEMENT.
3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
DAMAGES.
14. libzip ext/zip
zip.h -- exported declarations.
Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15. main/snprintf.c
Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Sponsored in part by the Defense Advanced Research Projects
Agency (DARPA) and Air Force Research Laboratory, Air Force
Materiel Command, USAF, under agreement number F39502-99-1-0512.
main/spprintf
Copyright (c) 1995-1998 The Apache Group. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
"This product includes software developed by the Apache Group
for use in the Apache HTTP server project (http://www.apache.org/)."
4. The names "Apache Server" and "Apache Group" must not be used to
endorse or promote products derived from this software without
prior written permission.
5. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes software developed by the Apache Group
for use in the Apache HTTP server project (http://www.apache.org/)."
THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================
This software consists of voluntary contributions made by many
individuals on behalf of the Apache Group and was originally based
on public domain software written at the National Center for
Supercomputing Applications, University of Illinois, Urbana-Champaign.
For more information on the Apache Group and the Apache HTTP server
project, please see <http://www.apache.org/>.
This code is based on, and used with the permission of, the
SIO stdio-replacement strx_* functions by Panos Tsirigotis
<panos@alumni.cs.colorado.edu> for xinetd.
16. main/strlcat
17. main/strlcpy
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-286
View File
@@ -1,286 +0,0 @@
=======================
PHP Release Process
=======================
General notes and tips
----------------------
1. Do not release on Fridays, Saturdays or Sundays
because the sysadmins can not upgrade stuff then.
2. Package the day before a release. So if the release is to be on Thursday,
package on Wednesday.
3. Ensure that Windows builds will work before packaging
4. Follow all steps to the letter. When unclear ask previous RM's (Derick/Ilia)
before proceeding. Ideally make sure that for the first releases one of the
previous RM's is around to answer questions. For the steps related to the
php/QA/bug websites try to have someone from the webmaster team (Bjori) on hand.
5. Verify the tags to be extra sure everything was tagged properly.
6. Moving extensions from/to PECL requires root level access to the CVS server.
Contact systems@php.net to get this taken care of.
Moving extensions from php-src to PECL
- Filesystem: cp -r php-src/ext/foo pecl/foo
- cvs rm php-src/ext/foo
If the extension is still usable or not dead, in cooperation with the extension
maintainers if any:
- create the pecl.php.net/foo package and its content, license, maintainer
- create the package.xml, commit
- release the package
Moving extensions from PECL to php-src
- Filesystem: cp -r pecl/foo php-src/ext/foo
OR depending on the wishes from the PECL extension maintainer.
- Filesystem: ln -s pecl/foo php-src/ext/foo
Rolling a non stable release (alpha/beta/RC)
--------------------------------------------
1. Check windows snapshot builder logs (http://snaps.php.net/win32/snapshot-STABLE.log f.e.)
2. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
Do not use abbreviations for alpha and beta.
3. Commit those changes
4. run the "scripts/dev/credits" script in php-src and commit the changes in the
credits files in ext/standard.
5. tag the repository with the version f.e. "``cvs tag php_4_4_1RC1``"
(of course, you need to change that to the version you're rolling an RC for).
6. Bump up the version numbers in ``main/php_version.h``, ``configure.in``
and possibly ``NEWS`` again, to the **next** version. F.e. if the release
candidate was "4.4.1RC1" then the new one should be "4.4.1RC2-dev" - regardless
if we get a new RC or not. This is to make sure ``version_compare()`` can
correctly work.
7. Commit those changes
8. Log in onto the snaps box and go into the correct tree (f.e. the PHP_4_4
branch if you're rolling 4.4.x releases).
9. You do not have to update the tree, but of course you can with "``cvs up -dP``".
10. run: ``./makedist php 4.4.1RC1``, this will export the tree, create configure
and build two tarballs (one gz and one bz2).
11. Copy those two tarballs to www.php.net, in your homedir there should be a
directory "downloads/". Copy them into there, so that the system can generate
MD5 sums. If you do not have this directory, talk to Derick.
12. Now the RC can be found on http://downloads.php.net/yourname,
f.e. http://downloads.php.net/derick/
13. Once the release has been tagged, contact the PHP Windows development team
(internals-win@lists.php.net) so that Windows binaries can be created. Once
those are made, they should be placed into the same directory as the source snapshots.
Getting the non stable release (alpha/beta/RC) announced
--------------------------------------------------------
1. Send an email (see example here: http://news.php.net/php.internals/19486)
**To** ``internals@lists.php.net`` and ``php-general@lists.php.net`` lists
pointing out "the location of the release" and "the possible release date of
either the next RC, or the final release".
2. Send an email (see example here http://news.php.net/php.pear.qa/5201) **To**
``php-qa@lists.php.net`` and ``primary-qa-tests@lists.php.net``.
This email is to notify the selected projects about a new release so that they
can make sure their projects keep working. Make sure that you have been setup
as a moderator for ``primary-qa-tests@lists.php.net`` by having someone (Wez,
Derick) run the following commands for you:
``ssh lists.php.net``
``sudo -u ezmlm ezmlm-sub ~ezmlm/primary-qa-tester/mod moderator-email-address``
3. Update the MD5 sums in ``web/qa/trunk/include/rc-md5sums.txt`` (no empty lines).
4. Update in ``web/qa/trunk/include/release-qa.php`` constants with the new RC and
commit this.
a. ``$BUILD_TEST_RELEASES`` = array("4.4.7RC1", "5.2.2RC1")
b. ``$CURRENT_QA_RELEASE_4`` = "4.4.7RC1" (``$CURRENT_QA_RELEASE_5`` for PHP5)
c. ``$RELEASE_PROCESS`` = array(4 => true, 5 => true)
1. Update in ``php-bugs/trunk/include/functions.inc`` the ``show_version_option``
function to include the new RC and commit.
2. Update ``phpweb/include/version.inc`` (x=major version number)
a. ``$PHP_x_RC`` = "5.3.0RC1"
b. ``$PHP_x_RC_DATE`` = "06 September 2007"
3. Commit those changes:
a. ``cvs commit include/version.inc include/releases.inc``
4. For the first RC, write the doc team (phpdoc@lists.php.net) about updating the
INSTALL and win32/install.txt files which are generated from the PHP manual sources.
Rolling a stable release
------------------------
1. Check windows snapshot builder logs (http://snaps.php.net/win32/snapshot-STABLE.log f.e.)
2. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
3. **Merge** all related sections in NEWS (f.e. merge the 4.4.1RC1 and 4.4.0 sections)
4. Commit those changes
5. run the "scripts/dev/credits" script in php-src and commit the changes in the
credits files in ext/standard.
6. tag the repository with the version f.e. "``cvs tag php_4_4_1``"
(of course, you need to change that to the version you're rolling an RC for).
When making 5.X release, you need to tag the Zend directory separately!!
7. Bump up the version numbers in ``main/php_version.h``, ``configure.in`` and
possibly ``NEWS`` again, to the **next** version. F.e. if the release candidate
was "4.4.1RC1" then the new one should be "4.4.1RC2-dev" - regardless if we get
a new RC or not. This is to make sure ``version_compare()`` can correctly work.
8. Commit those changes
9. Log in onto the snaps box and go into the correct tree (f.e. the PHP_4_4
branch if you're rolling 4.4.x releases).
10. You do not have to update the tree, but of course you can with "``cvs up -dP``".
11. run: ``./makedist php 4.4.1``, this will export the tree, create configure
and build two tarballs (one gz and one bz2).
12. Commit those two tarballs to CVS (phpweb/distributions)
13. Once the release has been tagged, contact the PHP Windows development team
(internals-win@lists.php.net) so that Windows binaries can be created. Once
those are made, they should be committed to CVS too.
14. Check if the pear files are updated (phar for 5.1+ or run pear/make-pear-bundle.php with 4.4)
15. When making a final release, also remind the PHP Windows development team
(internals-win@lists.php.net) to prepare the installer packages for Win32.
Getting the stable release announced
------------------------------------
1. Run the bumpRelease script for phpweb on your local checkout
a. ``php bin/bumpRelease 5`` (or ``php bin/bumpRelease 4`` for PHP4)
2. Edit ``phpweb/include/version.inc`` and change (X=major release number):
a. ``$PHP_X_VERSION`` to the correct version
b. ``$PHP_X_DATE`` to the release date
c. ``$PHP_X_MD5`` array and update all the md5 sums
d. set ``$PHP_X_RC`` to false!
e. Make sure there are no outdated "notes" or edited "date" keys in the
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
3. Update the ChangeLog file for the given major version
f.e. ``ChangeLog-4.php`` from the NEWS file
a. go over the list and put every element on one line
b. check for &, < and > and escape them if necessary
c. remove all the names at the ends of lines
d. for marking up, you can do the following (with VI):
I. ``s/^- /<li>/``
II. ``s/$/<\/li>/``
III. ``s/Fixed bug #\([0-9]\+\)/<?php bugfix(\1); ?>/``
IV. ``s/Fixed PECL bug #\([0-9]\+\)/<?php peclbugfix(\1); ?>/``
V. ``s/FR #\([0-9]\+\)/FR <?php bugl(\1); ?>/``
4. ``cp releases/4_4_0.php releases/4_4_1.php``
5. ``cvs add releases/4_4_1.php``
6. Update the ``releases/*.php`` file with relevant data. The release
announcement file should list in detail:
a. security fixes,
b. changes in behavior (whether due to a bug fix or not)
7. Add a short notice to phpweb stating that there is a new release, and
highlight the major important things (security fixes) and when it is important
to upgrade.
a. Call php bin/createNewsEntry in your local phpweb checkout
b. Add the content for the news entry
8. Commit all the changes.
9. Wait an hour or two, then send a mail to php-announce@lists.php.net,
php-general@lists.php.net and internals@lists.php.net with a text similar to
http://news.php.net/php.internals/17222.
10. Update ``php-bugs-web/include/functions.php`` to include the new version
number, and remove the RC from there.
11. Update ``qaweb/include/release-qa.php``
a. Update the $BUILD_TEST_RELEASES array with the release name
b. Update $RELEASE_PROCESS array (set to false)
I. For PHP4: Set $CURRENT_QA_RELEASE_4 to false
II. For PHP5: Set $CURRENT_QA_RELEASE_5 to false
Re-releasing the same version (or -pl)
--------------------------------------
1. Commit the new binaries to ``phpweb/distributions/``
2. Edit ``phpweb/include/version.inc`` and change (X=major release number):
a. If only releasing for one OS, make sure you edit only those variables
b. ``$PHP_X_VERSION`` to the correct version
c. ``$PHP_X_DATE`` to the release date
d. ``$PHP_X_MD5`` array and update all the md5 sums
e. Make sure there are no outdated "notes" or edited "date" keys in the
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
3. Add a short notice to phpweb stating that there is a new release, and
highlight the major important things (security fixes) and when it is important
to upgrade.
a. Call php bin/createNewsEntry in your local phpweb checkout
b. Add the content for the news entry
4. Commit all the changes (``include/version.inc``, ``archive/archive.xml``,
``archive/entries/YYYY-MM-DD-N.xml``)
5. Wait an hour or two, then send a mail to php-announce@lists.php.net,
php-general@lists.php.net and internals@lists.php.net with a text similar to
the news entry.
+33 -14
View File
@@ -4,9 +4,10 @@ $Id$
HOW TO CREATE A SELF-CONTAINED PHP EXTENSION
A self-contained extension can be distributed independently of
the PHP source. To create such an extension, two things are
the PHP source. To create such an extension, three things are
required:
- Makefile template (Makefile.in)
- Configuration file (config.m4)
- Source code for your module
@@ -73,9 +74,28 @@ DEFINING THE NEW EXTENSION
need to specify anything).
CREATING THE MAKEFILE TEMPLATE
The Makefile Template (Makefile.in) contains three lines:
------------------------------------------------------------------------------
LTLIBRARY_SHARED_NAME = foobar.la
LTLIBRARY_SOURCES = foo.c bar.c
include $(top_srcdir)/build/dynlib.mk
------------------------------------------------------------------------------
LTLIBRARY_SHARED_NAME specifies the name of the extension.
It must be of the form `ext-name.la'.
LTLIBRARY_SOURCES specifies the names of the sources files. You can
name an arbitrary number of source files here.
The final include directive includes the build rules (you usually
don't need to care about what happens there). rules.mk and other
files are installed by phpize which we will cover later.
CREATING THE M4 CONFIGURATION FILE
The m4 configuration can perform additional checks. For a
@@ -87,17 +107,13 @@ PHP_ARG_ENABLE(foobar,whether to enable foobar,
[ --enable-foobar Enable foobar])
if test "$PHP_FOOBAR" != "no"; then
PHP_NEW_EXTENSION(foobar, foo.c bar.c, $ext_shared)
PHP_EXTENSION(foobar, $ext_shared)
fi
------------------------------------------------------------------------------
PHP_ARG_ENABLE will automatically set the correct variables, so
that the extension will be enabled by PHP_NEW_EXTENSION in shared mode.
that the extension will be enabled by PHP_EXTENSION in shared mode.
The first argument of PHP_NEW_EXTENSION describes the name of the
extension. The second names the source-code files. The third passes
$ext_shared which is set by PHP_ARG_ENABLE/WITH to PHP_NEW_EXTENSION.
Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not
plan to distribute your module with PHP, these facilities allow you
to integrate your module easily into the main PHP module framework.
@@ -115,9 +131,8 @@ CREATING SOURCE FILES
CREATING THE SELF-CONTAINED EXTENSION
Put config.m4 and the source files into one directory. Then, run phpize
(this is installed during make install by PHP 4.0).
Put Makefile.in, config.m4 and the source files into one directory.
Then run phpize (this is installed during make install by PHP 4.0).
For example, if you configured PHP with --prefix=/php, you would run
$ /php/bin/phpize
@@ -142,13 +157,17 @@ ADDING SHARED MODULE SUPPORT TO A MODULE
support to an existing module called foo.
1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will
automatically be able to use --with-foo=shared[,..] or
--enable-foo=shared[,..].
automatically be able to use --with-foo=shared or
--enable-foo=shared.
2. In config.m4, use PHP_NEW_EXTENSION(foo,.., $ext_shared) to enable
2. In config.m4, use PHP_EXTENSION(foo, $ext_shared) to enable
building the extension.
3. Add the following lines to your C source file:
3. Add the following line to Makefile.in:
LTLIBRARY_SHARED_NAME = foo.la
4. Add the following lines to your C source file:
#ifdef COMPILE_DL_FOO
ZEND_GET_MODULE(foo)
+61 -197
View File
@@ -2,17 +2,16 @@ An Overview of the PHP Streams abstraction
==========================================
$Id$
WARNING: some prototypes in this file are out of date.
The information contained here is being integrated into
the PHP manual - stay tuned...
Please send comments to: Wez Furlong <wez@thebrainroom.com>
Note: this doc is preliminary and is intended to give the reader an idea of
how streams work and should be used.
Why Streams?
============
You may have noticed a shed-load of issock parameters flying around the PHP
code; we don't want them - they are ugly and cumbersome and force you to
special case sockets and files every time you need to work with a "user-level"
special case sockets and files everytime you need to work with a "user-level"
PHP file pointer.
Streams take care of that and present the PHP extension coder with an ANSI
stdio-alike API that looks much nicer and can be extended to support non file
@@ -27,9 +26,7 @@ The main functions are:
PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
count);
PHPAPI size_t php_stream_printf(php_stream * stream TSRMLS_DC,
const char * fmt, ...);
count);
PHPAPI int php_stream_eof(php_stream * stream);
PHPAPI int php_stream_getc(php_stream * stream);
PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen);
@@ -37,131 +34,22 @@ PHPAPI int php_stream_close(php_stream * stream);
PHPAPI int php_stream_flush(php_stream * stream);
PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence);
PHPAPI off_t php_stream_tell(php_stream * stream);
PHPAPI int php_stream_lock(php_stream * stream, int mode);
These (should) behave in the same way as the ANSI stdio functions with similar
names: fread, fwrite, fprintf, feof, fgetc, fgets, fclose, fflush, fseek, ftell, flock.
names: fread, fwrite, feof, fgetc, fgets, fclose, fflush, fseek, ftell.
Opening Streams
===============
In most cases, you should use this API:
Ultimately, I aim to implement an fopen_wrapper-like call to do this with
minimum fuss.
Currently, mostly for testing purposes, you can use php_stream_fopen to open a
stream on a regular file.
PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode,
int options, char **opened_path TSRMLS_DC);
PHPAPI php_stream * php_stream_fopen(const char * filename, const char *
mode);
Where:
path is the file or resource to open.
mode is the stdio compatible mode eg: "wb", "rb" etc.
options is a combination of the following values:
IGNORE_PATH (default) - don't use include path to search for the file
USE_PATH - use include path to search for the file
IGNORE_URL - do not use plugin wrappers
REPORT_ERRORS - show errors in a standard format if something
goes wrong.
STREAM_MUST_SEEK - If you really need to be able to seek the stream
and don't need to be able to write to the original
file/URL, use this option to arrange for the stream
to be copied (if needed) into a stream that can
be seek()ed.
opened_path is used to return the path of the actual file opened,
but if you used STREAM_MUST_SEEK, may not be valid. You are
responsible for efree()ing opened_path. opened_path may be (and usually
is) NULL.
If you need to open a specific stream, or convert standard resources into
streams there are a range of functions to do this defined in php_streams.h.
A brief list of the most commonly used functions:
PHPAPI php_stream *php_stream_fopen_from_file(FILE *file, const char *mode);
Convert a FILE * into a stream.
PHPAPI php_stream *php_stream_fopen_tmpfile(void);
Open a FILE * with tmpfile() and convert into a stream.
PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir,
const char *pfx, char **opened_path TSRMLS_DC);
Generate a temporary file name and open it.
There are some network enabled relatives in php_network.h:
PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent);
Convert a socket into a stream.
PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port,
int socktype, int timeout, int persistent);
Open a connection to a host and return a stream.
PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent,
struct timeval *timeout);
Open a UNIX domain socket.
Stream Utilities
================
If you need to copy some data from one stream to another, you will be please
to know that the streams API provides a standard way to do this:
PHPAPI size_t php_stream_copy_to_stream(php_stream *src,
php_stream *dest, size_t maxlen);
If you want to copy all remaining data from the src stream, pass
PHP_STREAM_COPY_ALL as the maxlen parameter, otherwise maxlen indicates the
number of bytes to copy.
This function will try to use mmap where available to make the copying more
efficient.
If you want to read the contents of a stream into an allocated memory buffer,
you should use:
PHPAPI size_t php_stream_copy_to_mem(php_stream *src, char **buf,
size_t maxlen, int persistent);
This function will set buf to the address of the buffer that it allocated,
which will be maxlen bytes in length, or will be the entire length of the
data remaining on the stream if you set maxlen to PHP_STREAM_COPY_ALL.
The buffer is allocated using pemalloc(); you need to call pefree() to
release the memory when you are done.
As with copy_to_stream, this function will try use mmap where it can.
If you have an existing stream and need to be able to seek() it, you
can use this function to copy the contents into a new stream that can
be seek()ed:
PHPAPI int php_stream_make_seekable(php_stream *origstream, php_stream **newstream);
It returns one of the following values:
#define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */
#define PHP_STREAM_RELEASED 1 /* newstream should be used; origstream is no longer valid */
#define PHP_STREAM_FAILED 2 /* an error occurred while attempting conversion */
#define PHP_STREAM_CRITICAL 3 /* an error occurred; origstream is in an unknown state; you should close origstream */
make_seekable will always set newstream to be the stream that is valid
if the function succeeds.
When you have finished, remember to close the stream.
NOTE: If you only need to seek forward, there is no need to call this
function, as the php_stream_seek can emulate forward seeking when the
whence parameter is SEEK_CUR.
NOTE: Writing to the stream may not affect the original source, so it
only makes sense to use this for read-only use.
NOTE: If the origstream is network based, this function will block
until the whole contents have been downloaded.
NOTE: Never call this function with an origstream that is referenced
as a resource! It will close the origstream on success, and this
can lead to a crash when the resource is later used/released.
NOTE: If you are opening a stream and need it to be seekable, use the
STREAM_MUST_SEEK option to php_stream_open_wrapper();
PHPAPI int php_stream_supports_lock(php_stream * stream);
This function will return either 1 (success) or 0 (failure) indicating whether or
not a lock can be set on this stream. Typically you can only set locks on stdio streams.
This call behaves just like fopen(), except it returns a stream instead of a
FILE *
Casting Streams
===============
@@ -171,14 +59,14 @@ You need to "cast" the stream into a FILE*, and this is how you do it:
FILE * fp;
php_stream * stream; /* already opened */
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&fp, REPORT_ERRORS) == FAILURE) {
RETURN_FALSE;
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, &fp, 1) == FAILURE) {
RETURN_FALSE;
}
The prototype is:
PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int
show_err);
show_err);
The show_err parameter, if non-zero, will cause the function to display an
appropriate error message of type E_WARNING if the cast fails.
@@ -195,14 +83,8 @@ if you mix ANSI stdio calls on the FILE* with php stream calls on the stream.
If your system has the fopencookie function, php streams can synthesize a
FILE* on top of any stream, which is useful for SSL sockets, memory based
streams, data base streams etc. etc.
In situations where this is not desirable, you should query the stream
to see if it naturally supports FILE *. You can use this code snippet
for this purpose:
if (php_stream_is(stream, PHP_STREAM_IS_STDIO)) {
/* can safely cast to FILE* with no adverse side effects */
}
NOTE: There might be situations where this is not desireable, and we need to
provide a flag to inform the casting routine of this.
You can use:
@@ -211,15 +93,10 @@ PHPAPI int php_stream_can_cast(php_stream * stream, int castas)
to find out if a stream can be cast, without actually performing the cast, so
to check if a stream is a socket you might use:
if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) {
/* it can be a socket */
if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) {
/* it's a socket */
}
Please note the difference between php_stream_is and php_stream_can_cast;
stream_is tells you if the stream is a particular type of stream, whereas
can_cast tells you if the stream can be forced into the form you request.
The former doesn't change anything, while the later *might* change some
state in the stream.
Stream Internals
================
@@ -232,10 +109,10 @@ underlying implementation.
The php_streams ops struct consists of pointers to methods that implement
read, write, close, flush, seek, gets and cast operations. Of these, an
implementation need only implement write, read, close and flush. The gets
method is intended to be used for streams if there is an underlying method
that can efficiently behave as fgets. The ops struct also contains a label
for the implementation that will be used when printing error messages - the
stdio implementation has a label of "STDIO" for example.
method is intended to be used for non-buffered streams if there is an
underlying method that can efficiently behave as fgets. The ops struct also
contains a label for the implementation that will be used when printing error
messages - the stdio implementation has a label of "STDIO" for example.
The idea is that a stream implementation defines a php_stream_ops struct, and
associates it with a php_stream using php_stream_alloc.
@@ -244,17 +121,17 @@ As an example, the php_stream_fopen() function looks like this:
PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode)
{
FILE * fp = fopen(filename, mode);
php_stream * ret;
if (fp) {
ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, 0, mode);
if (ret)
return ret;
FILE * fp = fopen(filename, mode);
php_stream * ret;
if (fp) {
ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, 0, mode);
if (ret)
return ret;
fclose(fp);
}
return NULL;
fclose(fp);
}
return NULL;
}
php_stream_stdio_ops is a php_stream_ops structure that can be used to handle
@@ -266,7 +143,7 @@ to be passed back to fopen_wrapper (or it's yet to be implemented successor).
The prototype for php_stream_alloc is this:
PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract,
size_t bufsize, int persistent, const char * mode)
size_t bufsize, int persistent, const char * mode)
ops is a pointer to the implementation,
abstract holds implementation specific data that is relevant to this instance
@@ -287,23 +164,10 @@ into a FILE*, so it should be compatible with the mode parameter of fopen().
Writing your own stream implementation
======================================
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
RULE #1: when writing your own streams: make sure you have configured PHP with
--enable-debug.
I've taken some great pains to hook into the Zend memory manager to help track
down allocation problems. It will also help you spot incorrect use of the
STREAMS_DC, STREAMS_CC and the semi-private STREAMS_REL_CC macros for function
definitions.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
RULE #2: Please use the stdio stream as a reference; it will help you
understand the semantics of the stream operations, and it will always
be more up to date than these docs :-)
First, you need to figure out what data you need to associate with the
php_stream. For example, you might need a pointer to some memory for memory
based streams, or if you were making a stream to read data from an RDBMS like
MySQL, you might want to store the connection and rowset handles.
mysql, you might want to store the connection and rowset handles.
The stream has a field called abstract that you can use to hold this data.
If you need to store more than a single field of data, define a structure to
@@ -312,9 +176,9 @@ appropriately), and use the abstract pointer to refer to it.
For structured state you might have this:
struct my_state {
MYSQL conn;
MYSQL_RES * result;
struct my_state {
MYSQL conn;
MYSQL_RES * result;
};
struct my_state * state = pemalloc(sizeof(struct my_state), persistent);
@@ -333,36 +197,36 @@ Once you have that part figured out, you can write your implementation and
define the your own php_stream_ops struct (we called it my_ops in the above
example).
For example, for reading from this weird MySQL stream:
For example, for reading from this wierd mysql stream:
static size_t php_mysqlop_read(php_stream * stream, char * buf, size_t count)
{
struct my_state * state = (struct my_state*)stream->abstract;
struct my_state * state = (struct my_state*)stream->abstract;
if (buf == NULL && count == 0) {
/* in this special case, php_streams is asking if we have reached the
* end of file */
if (... at end of file ...)
return EOF;
else
return 0;
}
/* pull out some data from the stream and put it in buf */
... mysql_fetch_row(state->result) ...
/* we could do something strange, like format the data as XML here,
and place that in the buf, but that brings in some complexities,
such as coping with a buffer size too small to hold the data,
so I won't even go in to how to do that here */
if (buf == NULL && count == 0) {
/* in this special case, php_streams is asking if we have reached the
* end of file */
if (... at end of file ...)
return EOF;
else
return 0;
}
/* pull out some data from the stream and put it in buf */
... mysql_fetch_row(state->result) ...
/* we could do something strange, like format the data as XML here,
and place that in the buf, but that brings in some complexities,
such as coping with a buffer size too small to hold the data,
so I won't even go in to how to do that here */
}
Implement the other operations - remember that write, read, close and flush
are all mandatory. The rest are optional. Declare your stream ops struct:
php_stream_ops my_ops = {
php_mysqlop_write, php_mysqlop_read, php_mysqlop_close,
php_mysqlop_flush, NULL, NULL, NULL,
"Strange MySQL example"
php_mysqlop_write, php_mysqlop_read, php_mysqlop_close,
php_mysqlop_flush, NULL, NULL, NULL,
"Strange mySQL example"
}
Thats it!
@@ -376,4 +240,4 @@ connection and then use pefree to dispose of the struct you allocated.
You may read the stream->persistent field to determine if your struct was
allocated in persistent mode or not.
vim:tw=78:et
vim:tw=78
-152
View File
@@ -1,152 +0,0 @@
Submitting Patches to PHP
=========================
This document describes how to submit a patch for PHP. Creating a
patch for PHP is easy!
You don't need any login accounts or special access to download,
build, debug and begin submitting PHP code, tests or documentation for
inclusion in PHP. Once you've followed this README and had several
patches accepted, PHP commit privileges are often quickly granted.
An excellent article to read first is:
http://phpadvent.org/2008/less-whining-more-coding-by-elizabeth-smith
Prework
-------
If you are fixing broken functionality then create a bug or identify
an existing bug at http://bugs.php.net/. This can be used to track
the patch progress and prevent your changes getting lost in the PHP
mail archives.
If your code change is large, then first discuss it with the extension
maintainer and/or a development mail list. Extension maintainers can
be found in the EXTENSIONS file in the PHP source. Use the
internals@lists.php.net mail list to discuss changes to the base PHP
code. Use pecl-dev@lists.php.net for changes to code that is only
available from PECL (http://pecl.php.net/). Use pear-dev@lists.php.net
for PEAR modules (http://pear.php.net/). Use phpdoc@lists.php.net for
PHP documentation questions. Mail list subscription is explained on
http://www.php.net/mailing-lists.php.
If a PHP or PECL patch affects user functionality or makes significant
internal changes then create a simple Request For Comment (RFC) page
on http://wiki.php.net/rfc before starting discussion. This RFC can be
used for initial discussion and later for documentation. Wiki accounts
can be requested on http://wiki.php.net/start?do=register
Online information on PHP internal C functions is at
http://www.php.net/internals, though this is considered
incomplete. Various external resources can be found on the web. A
standard reference is the book "Extending and Embedding PHP" by Sara
Golemon.
Information on contributing to PEAR is available at
http://pear.php.net/manual/en/guide-developers.php
Information on contributing to PHP documentation is at
http://php.net/dochowto and http://wiki.php.net/doc/howto
There are several IRC channels where PHP developers are often
available to discuss questions. They include #php.pecl and #php.doc
on the EFNet network and #php-dev-win on FreeNode.
How to create your patch
------------------------
PHP uses Subversion (SVN) for revision control. Read
http://www.php.net/svn.php for help on using SVN to get and build PHP
source code. We recommend using a Sparse Directory checkout described
in http://wiki.php.net/vcs/svnfaq. If you are new to SVN, read
http://svnbook.red-bean.com.
Generally we ask that patches work on the current stable PHP
development branch and on "trunk".
Read CODING_STANDARDS before you start working.
After modifying the source see README.TESTING and
http://qa.php.net/write-test.php for how to test. Submitting test
scripts helps us to understand what functionality has changed. It is
important for the stability and maintainability of PHP that tests are
comprehensive.
After testing is finished, create a patch file using the command:
svn diff > your_patch.txt
For ease of review and later troubleshooting, submit individual
patches for each bug or feature.
Checklist for submitting your patch
-----------------------------------
- Update SVN source just before running your final 'diff' and
before testing.
- Run "make test" to check your patch doesn't break other features.
- Rebuild PHP with --enable-debug (which will show some kinds of
memory errors) and check the PHP and web server error logs after
running the PHP tests.
- Rebuild PHP with --enable-maintainer-zts to check your patch compiles
on multi-threaded web servers.
- Create test scripts for use with "make test".
- Add in-line comments and/or have external documentation ready.
- Review the patch once more just before submitting it.
Where to send your patch
------------------------
If you are patching PHP C source then email the patch to
internals@lists.php.net
If you patching a PECL extension then send the patch to
pecl-dev@lists.php.net
If you are patching PEAR then send the patch to
pear-dev@lists.php.net
If you are patching PHP's documentation then send the patch to
phpdoc@lists.php.net
The mail can be CC'd to the extension maintainer (see EXTENSIONS).
Please make the subject prefix "[PATCH]", for example "[PATCH] Fix
return value of all array functions"
Include the patch as an attachment with a file extension of ".txt".
This is because only MIME attachments of type 'text/*' are accepted.
Explain what has been fixed/added/changed by your patch. Test scripts
should be included in the email.
Include the bug id(s) which can be closed by your patch.
Finally, update any open bugs and add a link to the source of your
patch.
What happens after you submit your patch
----------------------------------------
If your patch is easy to review and obviously has no side-effects,
it might be committed relatively quickly.
Because PHP is a volunteer-driven effort more complex patches will
require patience on your side. If you do not receive feedback in a few
days, consider resubmitting the patch. Before doing this think about
these questions:
- Did I review the mail list archives to see if these kind of
changes had been discussed before?
- Did I explain my patch clearly?
- Is my patch too hard to review? Because of which factors?
- Are there any unwanted white space changes?
What happens when your patch is applied
---------------------------------------
Your name will be included in the SVN commit log. If your patch
affects end users, a brief description and your name might be added to
the NEWS file.
Thank you for patching PHP!
-146
View File
@@ -1,146 +0,0 @@
====================
SVN Commit Rules
====================
This is the first file you should be reading after you get your SVN account.
We'll assume you're basically familiar with SVN, but feel free to post
your questions on the mailing list. Please have a look at
http://svnbook.red-bean.com/ for more detailed information on SVN.
PHP is developed through the efforts of a large number of people.
Collaboration is a Good Thing(tm), and SVN lets us do this. Thus, following
some basic rules with regards to SVN usage will::
a. Make everybody happier, especially those responsible for maintaining
the SVN itself.
b. Keep the changes consistently well documented and easily trackable.
c. Prevent some of those 'Oops' moments.
d. Increase the general level of good will on planet Earth.
Having said that, here are the organizational rules::
1. Respect other people working on the project.
2. Discuss any significant changes on the list before committing and get
confirmation from the release manager for the given branch.
3. Look at EXTENSIONS file to see who is the primary maintainer of
the code you want to contribute to.
4. If you "strongly disagree" about something another person did, don't
start fighting publicly - take it up in private email.
5. If you don't know how to do something, ask first!
6. Test your changes before committing them. We mean it. Really.
To do so use "make test".
7. For development use the --enable-maintainer-zts switch to ensure your
code handles TSRM correctly and doesn't break for thos who need that.
Currently we have the following branches in use::
trunk Will become PHP 6.0. This branch is for active development.
branches/PHP_5_3 Is used to release the PHP 5.3.x series. It still allows for
larger enhancements.
branches/PHP_5_2 Is used to release the PHP 5.2.x series. Only bugfixes are permitted
on this branch (Consult the releasemaster prior to commit).
branches/PHP_5_1 This branch is closed.
branches/PHP_4_4 This branch is closed.
The next few rules are more of a technical nature::
1. All changes should first go to trunk and then get merged from trunk
(aka MFH'ed) to all other relevant branches.
2. DO NOT TOUCH ChangeLog! It is automagically updated from the commit
messages every day. Woe be to those who attempt to mess with it.
3. All news updates intended for public viewing, such as new features,
bug fixes, improvements, etc., should go into the NEWS file of the
*first* to be released version with the given change. In other words
any NEWS file change only needs to done in one branch.
NB! Lines, starting with @ will go automagically into NEWS file, but
this is NOT recommended, though. Please, add news entries directly to
NEWS file and don't forget to keep them adjusted and sorted.
4. Do not commit multiple file and dump all messages in one commit. If you
modified several unrelated files, commit each group separately and
provide a nice commit message for each one. See example below.
5. Do write your commit message in such a way that it makes sense even
without the corresponding diff. One should be able to look at it, and
immediately know what was modified. Definitely include the function name
in the message as shown below.
6. In your commit messages, keep each line shorter than 80 characters. And
try to align your lines vertically, if they wrap. It looks bad otherwise.
7. If you modified a function that is callable from PHP, prepend PHP to
the function name as shown below.
The format of the commit messages is pretty simple.
Use a - to start a new item in your commit message.
If a line begins with #, it is taken to be a comment and will not appear
in the ChangeLog. Everything else goes into the ChangeLog.
It is important to note that if your comment or news logline spans multiple
lines, you have to put # at the beginning of **every** such line.
Example. Say you modified two files, datetime.c and string.c. In datetime.c you
added a new format option for the date() function, and in string.c you fixed a
memory leak in php_trim(). Don't commit both of these at once. Commit them
separately and try to make sure your commit messages look something like the
following.
For datetime.c::
- Added new 'K' format modifier to date() for printing out number of days
until New Year's Eve.
For string.c::
- Fixed a memory leak in php_trim() resulting from improper use of zval_dtor().
#- Man, that thing was leaking all over the place!
The # lines will be omitted from the ChangeLog automagically.
Use the [DOC] tag in your log message whenever you feel that your changes
imply a documentation modification. The php-doc team will automatically
get notified about your commit through the php-doc mailing list.
If you fix some bugs, you should note the bug ID numbers in your
commit message. Bug ID should be prefixed by "#" for easier access to
bug report when developers are browsing SVN via LXR or Bonsai.
Example::
Fixed bug #14016 (pgsql notice handler double free crash bug.)
If you don't see your messages in ChangeLog right away, don't worry!
These files are updated once a day, so your stuff will not show up until
somewhat later.
When you change the NEWS file for a bug fix, then please keep the bugs
sorted in decreasing order under the fixed version.
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
to look at PHP SVN repository in various ways.
To receive daily updates to ChangeLog and NEWS, send an empty message to
php-cvs-daily-subscribe@lists.php.net.
Happy hacking,
PHP Team
-180
View File
@@ -1,180 +0,0 @@
[IMPORTANT NOTICE]
------------------
Failed tests usualy indicate a problem with your local system setup
and not within PHP itself (at least for official PHP release versions).
You may decide to automaticaly submit a test summary to our QA workflow
at the end of a test run.
Please do *not* submit a failed test as a bug or ask for help on why
it failed on your system without providing substantial backup information
on *why* the test failed on your special setup. Thank you :-)
[Testing Basics]
----------------
The easiest way to test your PHP build is to run "make test" from the
command line after successfully compiling. This will run the complete
tests for all enabled functionalities and extensions using the PHP
CLI binary.
To execute test scripts, you must build PHP with some SAPI, then you
type "make test" to execute all or some test scripts saved under
"tests" directory under source root directory.
Usage:
make test
"make test" basically executes "run-tests.php" script
under the source root (parallel builds will not work). Therefore you
can execute the script as follows:
TEST_PHP_EXECUTABLE=sapi/cli/php \
sapi/cli/php [-c /path/to/php.ini] run-tests.php [ext/foo/tests/GLOB]
[Which "php" executable "make test" look for]
---------------------------------------------
If you are running the run-tests.php script from the command line (as above)
you must set the TEST_PHP_EXECUTABLE environment variable to explicitly
select the PHP executable that is to be tested, that is, used to run the test scripts.
If you run the tests using make test, the PHP CLI and CGI executables are
automatically set for you. "make test" executes "run-tests.php" script with the CLI binary. Some
test scripts such as session must be executed by CGI SAPI. Therefore,
you must build PHP with CGI SAPI to perform all tests.
NOTE: PHP binary executing "run-tests.php" and php binary used for
executing test scripts may differ. If you use different PHP binary for
executing "run-tests.php" script, you may get errors.
[Which php.ini is used]
-----------------------
"make test" uses the same php.ini file as it would once installed.
The tests have been written to be independent of that php.ini file,
so if you find a test that is affected by a setting, please report
this, so we can address the issue.
[Which test scripts are executed]
---------------------------------
"run-tests.php" ("make test"), without any arguments executes all
test scripts by extracting all directories named "tests"
from the source root and any subdirectories below. If there are files,
which have a "phpt" extension, "run-tests.php" looks at the sections
in these files, determines whether it should run it, by evaluating
the 'SKIP' section. If the test is eligible for execution, the 'FILE'
section is extracted into a ".php" file (with the same name besides
the extension) and gets executed.
When an argument is given or TESTS environment variable is set, the
GLOB is expanded by the shell and any file with extension "*.phpt" is
regarded as a test file.
Tester can easily execute tests selectively with as follows.
Examples:
./sapi/cli/php run-tests.php ext/mbstring/*
./sapi/cli/php run-tests.php ext/mbstring/020.phpt
[Test results]
--------------
Test results are printed to standard output. If there is a failed test,
the "run-tests.php" script saves the result, the expected result and the
code executed to the test script directory. For example, if
ext/myext/tests/myext.phpt fails to pass, the following files are created:
ext/myext/tests/myext.php - actual test file executed
ext/myext/tests/myext.log - log of test execution (L)
ext/myext/tests/myext.exp - expected output (E)
ext/myext/tests/myext.out - output from test script (O)
ext/myext/tests/myext.diff - diff of .out and .exp (D)
Failed tests are always bugs. Either the test is bugged or not considering
factors applying to the tester's environment, or there is a bug in PHP.
If this is a known bug, we strive to provide bug numbers, in either the
test name or the file name. You can check the status of such a bug, by
going to: http://bugs.php.net/12345 where 12345 is the bug number.
For clarity and automated processing, bug numbers are prefixed by a hash
sign '#' in test names and/or test cases are named bug12345.phpt.
NOTE: The files generated by tests can be selected by setting the
environment variable TEST_PHP_LOG_FORMAT. For each file you want to be
generated use the character in brackets as shown above (default is LEOD).
The php file will be generated always.
NOTE: You can set environment variable TEST_PHP_DETAILED to enable
detailed test information.
[Automated testing]
If you like to keep up to speed, with latest developments and quality
assurance, setting the environment variable NO_INTERACTION to 1, will not
prompt the tester for any user input.
Normally, the exit status of "make test" is zero, regardless of the results
of independent tests. Set the environment variable REPORT_EXIT_STATUS to 1,
and "make test" will set the exit status ("$?") to non-zero, when an
individual test has failed.
Example script to be run by cron(1):
========== qa-test.sh =============
#!/bin/sh
CO_DIR=$HOME/cvs/php5
MYMAIL=qa-test@domain.com
TMPDIR=/var/tmp
TODAY=`date +"%Y%m%d"`
# Make sure compilation enviroment is correct
CONFIGURE_OPTS='--disable-all --enable-cli --with-pcre'
export MAKE=gmake
export CC=gcc
# Set test environment
export NO_INTERACTION=1
export REPORT_EXIT_STATUS=1
cd $CO_DIR
cvs update . >>$TMPDIR/phpqatest.$TODAY
./cvsclean ; ./buildconf ; ./configure $CONFIGURE_OPTS ; $MAKE
$MAKE test >>$TMPDIR/phpqatest.$TODAY 2>&1
if test $? -gt 0
then
cat $TMPDIR/phpqatest.$TODAY | mail -s"PHP-QA Test Failed for $TODAY" $MYMAIL
fi
========== end of qa-test.sh =============
NOTE: the exit status of run-tests.php will be 1 when
REPORT_EXIT_STATUS is set. The result of "make test" may be higher
than that. At present, gmake 3.79.1 returns 2, so it is
advised to test for non-zero, rather then a specific value.
[Creating new test files]
-------------------------
Writing test file is very easy if you are used to PHP.
See the HOWTO at http://qa.php.net/write-test.php
[How to help us]
----------------
If you find bug in PHP, you can submit bug report AND test script
for us. You don't have to write complete script, just give us test
script with following format. Please test the script and make sure
you write the correct ACTUAL OUTPUT and EXPECTED OUTPUT before you
submit.
<?php
/*
Bug #12345
substr() bug. Do not return expected string.
ACTUAL OUTPUT
XYXA
EXPECTED OUTPUT
ABCD
*/
$str = "XYZABCD";
echo substr($str,3,7);
?>
-137
View File
@@ -1,137 +0,0 @@
[IMPORTANT NOTICE]
------------------
This is an addendum to README.TESTING with additional information
specific to server-tests.php.
server-tests.php is backward compatible with tests developed for
the original run-tests.php script. server-tests is *not* used by
'make test'. server-tests was developed to provide support for
testing PHP under it's primary environment, HTTP, and can run the
PHP tests under any of the SAPI modules that are direct executables,
or are accessable via HTTP.
[New features]
----------------
* Command line interface:
You can run 'php server-tests.php -h' to get all the possible options.
* Configuration file:
the -c argument will allow you to use a configuration file. This is
handy if you are testing multiple environments and need various options
depending on the environment.
see server-tests-config.php for details.
* CGI Emulation:
Will emulate a CGI environment when testing with the cgi sapi executable.
* HTTP testing:
can be configured to run test scripts through an HTTP server running
on localhost. localhost is required since either the web server must
alias a directory to the php source directory, or the test scripts
must be copied to a directory under the web server
(see config options TEST_WEB_BASE_URL, TEST_BASE_PATH, and TEST_WEB_EXT)
* New sections supported for test files (see below)
When running tests over http, tests that require ini settings different that what
the web server runs under will be skipped. Since the test harness defines a number
of ini settings by default, the web server may require special configuration to
make testing work.
[Example Usage]
----------------
Some (but not all!) examples of usage:
1. run tests from the php source directory
php server-tests.php -p /path/to/php-cli
2. run tests using cgi emulation
php server-tests.php -p /path/to/php-cgi
3. run tests over http, copying test files into document root
php server-tests.php -w -u http://localhost/test -m /path/to/htdocs/test
4. run tests over http, php sources have been aliased in web server
php server-tests.php -w -u http://localhost/test
5. run tests using configuration file
php server-tests.php -c /path/to/server-tests-config.php
6. run tests using configuration file, but overriding some settings:
(config file must be first)
php server-tests.php -c /path/to/server-tests-config.php -w -t 3 -d /path/to/testdir
NOTE: configuration as described in README.TESTING still works.
[New Test Sections]
----------------
In addition to the traditional test sections
(see http://qa.php.net/write-test.php), several new sections are available
under server-tests.
--POST--
This is not a new section, but not multipart posts are supported for testing
file uploads, or other types of POST data.
--CGI--
This section takes no value. It merely provides a simple marker for tests
that MUST be run as CGI, even if there is no --POST-- or --GET-- sections
in the test file.
--DESCRIPTION--
Not used for anything, just a section for documenting the test
--ENV--
This section get's eval()'d to help build an environment for the
execution of the test. This can be used to change environment
vars that are used for CGI emulation, or simply to set env vars
for cli testing. A full example looks like:
--ENV--
return <<<END
PATH_TRANSLATED=$filename
PATH_INFO=$scriptname
SCRIPT_NAME=$scriptname
END;
Some variables are made easily available for use in this section, they
include:
$filename full native path to file, will become PATH_TRANSLATED
$filepath =dirname($filename)
$scriptname this is what will become SCRIPT_NAME unless you override it
$docroot the equivelant of DOCUMENT_ROOT under Apache
$cwd the directory that the test is being initiated from
$this->conf all server-tests configuration vars
$this->env all environment variables that will get passed to the test
--REQUEST--
This section is also eval'd, and is similar in nature to --ENV--. However,
this section is used to build the url used in an HTTP request. Valid values
to set in this section would include:
SCRIPT_NAME The inital part of the request url
PATH_INFO The pathinfo part of a request url
FRAGMENT The fragment section of a url (after #)
QUERY_STRING The query part of a url (after ?)
--REQUEST--
return <<<END
PATH_INFO=/path/info
END;
--HEADERS--
This section is also eval'd. It is used to provide additional headers sent
in an HTTP request, such as content type for multipart posts, cookies, etc.
--HEADERS--
return <<<END
Content-Type=multipart/form-data; boundary=---------------------------240723202011929
Content-Length=100
END;
--EXPECTHEADERS--
This section can be used to define what headers are required to be
received back from a request, and is checked in addition to the
regular expect sections. For example:
--EXPECTHEADERS--
Status: 404
-644
View File
@@ -1,644 +0,0 @@
Audience
========
This README describes how PHP 6 provides native support for the Unicode
Standard. Readers of this document should be proficient with PHP and have a
basic understanding of Unicode concepts. For more technical details about
PHP 6 design principles and for guidelines about writing Unicode-ready PHP
extensions, refer to README.UNICODE-UPGRADES.
Introduction
============
As successful as PHP has proven to be over the years, its support for
multilingual and multinational environments has languished. PHP can no
longer afford to remain outside the overall movement towards the Unicode
standard. Although recent updates involving the mbstring extension have
enabled easier multibyte data processing, this does not constitute native
Unicode support.
Since the full implementation of the Unicode Standard is very involved, our
approach is to speed up implementation by using the well-tested,
full-featured, and freely available ICU (International Components for
Unicode) library.
General Remarks
===============
International Components for Unicode
------------------------------------
ICU (International Components for Unicode is a mature, widely used set of
C/C++ and Java libraries for Unicode support, software internationalization
and globalization. It provides:
- Encoding conversions
- Collations
- Unicode text processing
- and much more
When building PHP 6, Unicode support is always enabled. The only
configuration option during development should be the location of the ICU
headers and libraries.
--with-icu-dir=<dir>
where <dir> specifies the location of ICU header and library files. If you do
not specify this option, PHP attempts to find ICU under /usr and /usr/local.
NOTE: ICU is not bundled with PHP 6 yet. To download the distribution, visit
http://icu.sourceforge.net. PHP requires ICU version 3.4 or higher.
Backwards Compatibility
-----------------------
Our paramount concern for providing Unicode support is backwards compatibility.
Because PHP is used on so many sites, existing data types and functions must
work as they always have. However, although PHP's interfaces must remain
backwards-compatible, the speed of certain operations might be affected due to
internal implementation changes.
Encoding Names
--------------
All the encoding settings discussed in this document can accept any valid
encoding name supported by ICU. For a full list of encodings, refer to the ICU
online documentation.
NOTE: References to "Unicode" in this document generally mean the UTF-16
character encoding, unless explicitly stated otherwise.
Unicode Semantics Switch
========================
Because many applications do not require Unicode, PHP 6 provides a server-wide
INI setting to enable Unicode support:
unicode.semantics = On/Off
This switch is off by default. If your applications do not require native
Unicode support, you may leave this switch off, and continue to use Unicode
strings only when you need to.
However, if your application is ready to fully support Unicode, you should
turn this switch on. This activates various Unicode support mechanisms,
including:
* All string literals become Unicode
* All variables received from HTTP requests become Unicode
* PHP identifiers may use Unicode characters
More fundamentally, your PHP environment is now a Unicode environment. Strings
inside PHP are Unicode, and the system is responsible for converting non-Unicode
strings on PHP's periphery (for example, in HTTP input and output, streams, and
filesystem operations). With unicode.semantics on, you must specify binary
strings explicitly. PHP makes no assumptions about the content of a binary
string, so your application must handle all binary string appropriately.
Conversely, if unicode.semantics is off, PHP behaves as it did in the past.
String literals do not become Unicode, and files are binary strings for
backwards compatibility. You can always create Unicode strings programmatically,
and all functions and operators support Unicode strings transparently.
Fallback Encoding
=================
The fallback encoding provides a default value for all other unicode.*_encoding
INI settings. If you do not set a particular unicode.*_encoding setting, PHP
uses the fallback encoding. If you do not specify a fallback encoding, PHP uses
UTF-8.
unicode.fallback_encoding = "iso-8859-1"
Runtime Encoding
================
The runtime encoding specifies the encoding PHP uses for converting binary
strings within the PHP engine itself.
unicode.runtime_encoding = "iso-8859-1"
This setting has no effect on I/O-related operations such as writing to
standard out, reading from the filesystem, or decoding HTTP input variables.
PHP enables you to explicitly convert strings using casting:
* (binary) -- casts to binary string type
* (unicode) -- casts to Unicode string type
* (string) -- casts to Unicode string type if unicode.semantics is on,
to binary otherwise
For example, if unicode.runtime_encoding is iso-8859-1, and $uni is a unicode
string, then
$str = (binary)$uni
creates a binary string $str in the ISO-8859-1 encoding.
Implicit conversions include concatenation, comparison, and parameter passing.
For better precision, PHP attempts to convert strings to Unicode before
performing these sorts of operations. For example, if we concatenate our binary
string $str with a unicode literal, PHP converts $str to Unicode first, using
the encoding specified by unicode.runtime_encoding.
Output Encoding
===============
PHP automatically converts output for commands that write to the standard
output stream, such as 'print' and 'echo'.
unicode.output_encoding = "utf-8"
However, PHP does not convert binary strings. When writing to files or external
resources, you must rely on stream encoding features or manually encode the data
using functions provided by the unicode extension.
The existing default_charset INI setting is DEPRECATED in favor of
unicode.output_setting. Previously, default_charset only specified the charset
portion of the Content-Type MIME header. Now default_charset only takes effect
when unicode.semantics is off, and it does not affect the actual transcoding of
the output stream. Setting unicode.output_encoding causes PHP to add the
'charset' portion to the Content-Type header, overriding any value set for
default_charset.
HTTP Input Encoding
===================
The HTTP input encoding specifies the encoding of variables received via
HTTP, such as the contents of the $_GET and _$POST arrays.
This functionality is currently under development. For a discussion of the
approach that the PHP 6 team is taking, refer to:
http://marc.theaimsgroup.com/?t=116613047300005&r=1&w=2
Filesystem Encoding
===================
The filesystem encoding specifies the encoding of file and directory names
on the filesystem.
unicode.filename_encoding = "utf-8"
Filesystem-related functions such as opendir() perform this conversion when
accepting and returning file names. You should set the filename encoding to
the encoding used by your filesystem.
Script Encoding
===============
You may write PHP scripts in any encoding supported by ICU. To specify the
script encoding site-wide, use the INI setting:
unicode.script_encoding = utf-8
If you cannot change the encoding system wide, you can use a pragma to
override the INI setting in a local script:
<?php declare(encoding = 'Shift-JIS'); ?>
The pragma setting must be the first statement in the script. It only affects
the script in which it occurs, and does not propagate to any included files.
INI Files
=========
If unicode.semantics is on, INI files are presumed to contain UTF-8 encoded
keys and values. If unicode.semantics is off, the data is taken as-is,
similar to PHP 5. No validation occurs during parsing. Instead invalid UTF-8
sequences are caught during access by ini_*() functions.
Stream I/O
==========
PHP has a streams-based I/O system for generalized filesystem access,
networking, data compression, and other operations. Since the data on the
other end of the stream can be in any encoding, you need to think about
data conversion.
Okay, this needs to be clarified. By "default", streams are actually
opened in binary mode. You have to specify 't' flag or use FILE_TEXT in
order to open it in text mode, where conversions apply. And for the text
mode streams, the default stream encoding is UTF-8 indeed.
By default, PHP opens streams in binary mode. To open a file in text mode,
you must use the 't' flag (or the FILE_TEXT parameter -- see below). The
default encoding for streams in text mode is UTF-8. This means that if
'file.txt' is a UTF-8 text file, this code snippet:
$fp = fopen('file.txt', 'rt');
$str = fread($fp, 100)
returns 100 Unicode characters, while:
$fp = fopen('file.txt', 'wt');
$fwrite($fp, $uni)
writes to a UTF-8 text file.
If you mainly work with files in an encoding other than UTF-8, you can
change the default context encoding setting:
stream_default_encoding('Shift-JIS');
$data = file_get_contents('file.txt', FILE_TEXT);
// work on $data
file_put_contents('file.txt', $data, FILE_TEXT);
The file_get_contents() and file_put_contents() functions now accept an
additional parameter, FILE_TEXT. If you provide FILE_TEXT for
file_get_contents(), PHP returns a Unicode string. Without FILE_TEXT, PHP
returns a binary string (which would be appropriate for true binary data, such
as an image file). When writing a Unicode string with file_put_contents(), you
must supply the FILE_TEXT parameter, or PHP generates a warning.
If you need to work with multiple encodings, you can create custom contexts
using stream_context_create() and then pass in the custom context as an
additional parameter. For example:
$ctx = stream_context_create(NULL, array('encoding' => 'big5'));
$data = file_get_contents('file.txt', FILE_TEXT, $ctx);
// work on $data
file_put_contents('file.txt', $data, FILE_TEXT, $ctx);
Conversion Semantics and Error Handling
=======================================
PHP can convert strings explicitly (casting) and implicitly (concatenation,
comparison, and parameter passing. For example, when concatenating a Unicode
string and a binary string, PHP converts the binary string to Unicode for better
precision.
However, not all characters can be converted between Unicode and legacy
encodings. The first possibility is that a string contains corrupt data or
an illegal byte sequence. In this case, the converter simply stops with
a message that resembles:
Warning: Could not convert binary string to Unicode string
(converter UTF-8 failed on bytes (0xE9) at offset 2)
Conversely, if a similar error occurs when attempting to convert Unicode to
a legacy string, the converter generates a message that resembles:
Warning: Could not convert Unicode string to binary string
(converter ISO-8859-1 failed on character {U+DC00} at offset 2)
To customize this behavior, refer to "Creating a Custom Error Handler" below.
The second possibility is that a Unicode character simply cannot be represented
in the legacy encoding. By default, when downconverting from Unicode, the
converter substitutes any missing sequences with the appropriate substitution
sequence for that codepage, such as 0x1A (Control-Z) in ISO-8859-1. When
upconverting to Unicode, the converter replaces any byte sequence that has no
Unicode equivalent with the Unicode substitution character (U+FFFD).
You can customize the conversion error behavior to:
- stop the conversion and return an empty string
- skip any invalid characters
- substitute invalid characters with a custom substitution character
- escape the invalid character in various formats
To control the global conversion error settings, use the functions:
unicode_set_error_mode(int direction, int mode)
unicode_set_subst_char(unicode char)
where direction is either FROM_UNICODE or TO_UNICODE, and mode is one of these
constants:
U_CONV_ERROR_STOP
U_CONV_ERROR_SKIP
U_CONV_ERROR_SUBST
U_CONV_ERROR_ESCAPE_UNICODE
U_CONV_ERROR_ESCAPE_ICU
U_CONV_ERROR_ESCAPE_JAVA
U_CONV_ERROR_ESCAPE_XML_DEC
U_CONV_ERROR_ESCAPE_XML_HEX
As an example, with a runtime encoding of ISO-8859-1, the conversion:
$str = (binary)"< \u30AB >";
results in:
MODE RESULT
--------------------------------------
stop ""
skip "< >"
substitute "< ? >"
escape (Unicode) "< {U+30AB} >"
escape (ICU) "< %U30AB >"
escape (Java) "< \u30AB >"
escape (XML decimal) "< &#12459; >"
escape (XML hex) "< &#x30AB; >"
With a runtime encoding of UTF-8, the conversion of the (illegal) sequence:
$str = (unicode)b"< \xe9\xfe >";
results in:
MODE RESULT
--------------------------------------
stop ""
skip ""
substitute ""
escape (Unicode) "< %XE9%XFE >"
escape (ICU) "< %XE9%XFE >"
escape (Java) "< \xE9\xFE >"
escape (XML decimal) "< &#233;&#254; >"
escape (XML hex) "< &#xE9;&#xFE; >"
The substitution character can be set only for FROM_UNICODE direction and has to
exist in the target character set. The default substitution character is (?).
NOTE: Casting is just a shortcut for using unicode.runtime_encoding. To convert
using an alternative encoding, use the unicode_encode() and unicode_decode()
functions. For example,
$str = unicode_encode($uni, 'koi8-r', U_CONV_ERROR_SUBST);
results in a binary KOI8-R encoded string.
Creating a Custom Error Handler
-------------------------------
If an error occurs during the conversion, PHP outputs a warning describing the
problem. Instead of this default behavior, PHP can invoke a user-provided error
handler, similar to how the current user-defined error handler works. To set
the custom conversion error handler, call:
mixed unicode_set_error_handler(callback error_handler)
The function returns the previously defined custom error handler. If no error
handler was defined, or if an error occurs when returning the handler, this
function returns NULL.
When the custom handler is set, the standard error handler is bypassed. It is
the responsibility of the custom handler to output or log any messages, raise
exceptions, or die(), if necessary. However, if the custom error handler returns
FALSE, the standard handler will be invoked afterwards.
The user function specified as the error_handler must accept five parameters:
mixed error_handler($direction, $encoding, $char_or_byte, $offset,
$message)
where:
$direction - the direction of conversion, FROM_UNICODE/TO_UNICODE
$encoding - the name of the encoding to/from which the conversion
was attempted
$char_or_byte - either Unicode character or byte sequence (depending
on direction) which caused the error
$offset - the offset of the failed character/byte sequence in
the source string
$message - the error message describing the problem
NOTE: If the error mode set by unicode_set_error_mode() is substitute,
skip, or escape, the handler won't be called, since these are non-error
causing operations. To always invoke your handler, set the error mode to
U_CONV_ERROR_STOP.
Unicode String Type
===================
The Unicode string type (IS_UNICODE) is supposed to contain text data encoded in
UTF-16. This is the main string type in PHP when Unicode semantics switch is
turned on. Unicode strings can exist when the switch is off, but they have to be
produced programmatically via calls to functions that return Unicode types.
Binary String Type
==================
Binary string type (IS_STRING) serves two purposes: backwards compatibility and
representing non-Unicode strings and binary data. When Unicode semantics switch
is off, it is used for all strings in PHP, same in previous versions. When the
switch is on, this type will be used to store text in other encodings as well as
true binary data such as images, PDFs, etc.
Printing binary data to the standard output passes it through as-is, independent
of the output encoding.
For examples of specifying binary string literals, refer to the section
"Language Modfications".
Language Modifications
======================
If a Unicode switch is turned on, PHP string literals -- single-quoted,
double-quoted, and heredocs -- become Unicode strings (IS_UNICODE type). String
literals support all the same escape sequences and variable interpolations as
before, plus several new escape sequences.
PHP interprets the contents of strings as follows:
- all non-escaped characters are interpreted as a corresponding Unicode
codepoint based on the current script encoding, e.g. ASCII 'a' (0x61) =>
U+0061, Shift-JIS (0x92 0x86) => U+4E2D
- existing PHP escape sequences are also interpreted as Unicode codepoints,
including \xXX (hex) and \OOO (octal) numbers, e.g. "\x20" => U+0020
- two new escape sequences, \uXXXX and \UXXXXXX, are interpreted as a 4 or
6-hex Unicode codepoint value, e.g. \u0221 => U+0221, \U010410 =>
U+10410. (Having two sequences avoids the ambiguity of \u020608 --
is that supposed to be U+0206 followed by "08", or U+020608 ?)
- a new escape sequence allows specifying a character by its full
Unicode name, e.g. \C{THAI CHARACTER PHO SAMPHAO} => U+0E20
PHP allows variable interpolation inside the double-quoted and heredoc strings.
However, the parser separates the string into literal and variable chunks during
compilation, e.g. "abc $var def" -> "abc" . $var . "def". This means that PHP
can handle literal chunks in the normal way as far as Unicode support is
concerned.
Since all string literals become Unicode by default, PHP 6 introduces new syntax
for creating byte-oriented or binary strings. Prefixing a string literal with
the letter 'b' creates a binary string:
$var = b'abc\001';
$var = b"abc\001";
$var = b<<<EOD
abc\001
EOD;
The content of a binary string is the literal byte sequence inside the
delimiters, which depends on the script encoding (unicode.script_encoding).
Binary string literals support the same escape sequences as PHP 5 strings. If
the Unicode switch is turned off, then the binary string literals generate the
normal string (IS_STRING) type internally without any effect on the application.
The string operators now accomodate the new IS_UNICODE and IS_BINARY types:
- The concatenation operator (.) and concatenation assignment operator (.=)
automatically coerce the IS_STRING type to the more precise IS_UNICODE if
the operands are of different string types.
- The string indexing operator [] now accommodates IS_UNICODE type strings
and extracts the specified character. To support supplementary characters,
the index specifies a code point, not a byte or a code unit.
- Bitwise operators and increment/decrement operators do not work on
Unicode strings. They do work on binary strings.
- Two new casting operators are introduced, (unicode) and (binary). The
(string) operator casts to Unicode type if the Unicode semantics switch is
on, and to binary type otherwise.
- The comparison operators compare Unicode strings in binary code point
order. They also coerce strings to Unicode if the strings are of different
types.
- The arithmetic operators use the same semantics as today for converting
strings to numbers. A Unicode string is considered numeric if it
represents a long or a double number in the en_US_POSIX locale.
Unicode Support in Existing Functions
=====================================
All functions in the PHP default distribution are undergoing analysis to
determine which functions need to be upgraded for native Unicode support.
You can track progress here:
http://www.php.net/~scoates/unicode/render_func_data.php
Key extensions that are fully converted include:
* curl
* dom
* json
* mysql
* mysqli
* oci8
* pcre
* reflection
* simplexml
* soap
* sqlite
* xml
* xmlreader/xmlwriter
* xsl
* zlib
NOTE: Unsafe functions might still work, since PHP performs Unicode conversions
at runtime. However, unsafe functions might not work correctly with multibyte
binary strings, or Unicode characters that are not representable in the
specified unicode.runtime_encoding.
Identifiers
===========
Since scripts may be written in various encodings, we do not restrict
identifiers to be ASCII-only. PHP allows any valid identifier based
on the Unicode Standard Annex #31.
Numbers
=======
Unlike identifiers, numbers must consist only of ASCII digits,.and are
restricted to the en_US_POSIX or C locale. In other words, numbers have no
thousands separator, and the fractional separator is (.) "full stop". Numeric
strings adhere to the same rules, so "10,3" is not interpreted as a number even
if the current locale's fractional separator is a comma.
TextIterators
=============
Instead of using the offset operator [] to access characters in a linear
fashion, use a TextIterator instead. TextIterator is very fast and enables you
to iterate over code points, combining sequences, characters, words, lines, and
sentences, both forward and backward. For example:
$text = "nai\u308ve";
foreach (new TextIterator($text) as $u) {
var_inspect($u)
}
lists six code points, including the umlaut (U+0308) as a separate code point.
Instantiating the TextIterator to iterate over characters,
$text = "nai\u308ve";
foreach (new TextIterator($text, TextIterator::CHARACTER) as $u) {
var_inspect($u)
}
lists five characters, including an "i" with an umlaut as a single character.
Locales
=======
Unicode support in PHP relies exclusively on ICU locales, NOT the POSIX locales
installed on the system. You may access the default ICU locale using:
locale_set_default()
locale_get_default()
ICU locale IDs have a somewhat different format from POSIX locale IDs. The ICU
syntax is:
<language>[_<script>]_<country>[_<variant>][@<keywords>]
For example, sr_Latn_YU_REVISED@currency=USD is Serbian (Latin, Yugoslavia,
Revised Orthography, Currency=US Dollar).
Do not use the deprecated setlocale() function. This function interacts with the
POSIX locale. If Unicode semantics are on, using setlocale() generates
a deprecation warning.
Document TODO
==========================================
- Final review.
- Fix the HTTP Input Encoding section, that's obsolete now.
References
==========
Unicode
http://www.unicode.org
Unicode Glossary
http://www.unicode.org/glossary/
UTF-8
http://www.utf-8.com/
UTF-16
http://www.ietf.org/rfc/rfc2781.txt
ICU Homepage
http://www.ibm.com/software/globalization/icu/
ICU User Guide and API Reference
http://icu.sourceforge.net/
Unicode Annex #31
http://www.unicode.org/reports/tr31/
PHP Parameter Parsing API
http://www.php.net/manual/en/zend.arguments.retrieval.php
Authors
=======
Andrei Zmievski <andrei@gravitonic.com>
Evan Goer <goer@yahoo-inc.com>
vim: set et tw=80 :
-806
View File
@@ -1,806 +0,0 @@
This document attempts to describe portions of the API related to the new
Unicode functionality and the best practices for upgrading existing
functions to support Unicode.
Your first stop should be README.UNICODE: it covers the general Unicode
functionality and concepts without going into technical implementation
details.
Internal Encoding
=================
UTF-16 is the internal encoding used for Unicode strings. UTF-16 consumes
two bytes for any Unicode character in the Basic Multilingual Plane, which
is where most of the current world's languages are represented. While being
less memory efficient for basic ASCII text it simplifies the processing and
makes interfacing with ICU easier, since ICU uses UTF-16 for its internal
processing as well.
Zval Structure Changes
======================
For IS_UNICODE type, we add another structure to the union:
union {
....
struct {
UChar *val; /* Unicode string value */
int len; /* number of UChar's */
} ustr;
....
} value;
This cleanly separates the two types of strings and helps preserve backwards
compatibility.
To optimize access to IS_STRING and IS_UNICODE storage at runtime, we need yet
another structure:
union {
....
struct { /* Universal string type */
zstr val;
int len;
} uni;
....
} value;
Where zstr is a union of char*, UChar*, and void*.
Parameter Parsing API Modifications
===================================
There are now five new specifiers: 'u', 't', 'T', 'U', 'S', 'x' and a new '&'
modifier.
't' specifier
-------------
This specifier indicates that the caller requires the incoming parameter to be
string data (IS_STRING, IS_UNICODE). The caller has to provide the storage for
string value, length, and type.
void *str;
int len;
zend_uchar type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &str, &len, &type) == FAILURE) {
return;
}
if (type == IS_UNICODE) {
/* process Unicode string */
} else {
/* process binary string */
}
For IS_STRING type, the length represents the number of bytes, and for
IS_UNICODE the number of UChar's. When converting other types (numbers,
booleans, etc) to strings, the exact behavior depends on the Unicode semantics
switch: if on, they are converted to IS_UNICODE, otherwise to IS_STRING.
'u' specifier
-------------
This specifier indicates that the caller requires the incoming parameter
to be a Unicode encoded string. If a non-Unicode string is passed, the engine
creates a copy of the string and automatically convert it to Unicode type before
passing it to the internal function. No such conversion is necessary for Unicode
strings, obviously.
UChar *str;
int len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, &len) == FAILURE) {
return;
}
/* process Unicode string */
'T' specifier
-------------
This specifier is useful when the function takes two or more strings and
operates on them. Using 't' specifier for each one would be somewhat
problematic if the passed-in strings are of mixed types, and multiple
checks need to be performed in order to do anything. All parameters
marked by the 'T' specifier are promoted to the same type.
If at least one of the 'T' parameters is of Unicode type, then the rest of
them are converted to IS_UNICODE. Otherwise all 'T' parameters are conveted to
IS_STRING type.
void *str1, *str2;
int len1, len2;
zend_uchar type1, type2;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &str1, &len1,
&type1, &str2, &len2, &type2) == FAILURE) {
return;
}
if (type1 == IS_UNICODE) {
/* process as Unicode, str2 is guaranteed to be Unicode as well */
} else {
/* process as binary string, str2 is guaranteed to be the same */
}
'x' specifier
-------------
This specifier acts as either 'u' or 's', depending on the value of the
unicode semantics switch. If UG(unicode) is on, it behaves as 'u', and as
's' otherwise.
The existing 's' specifier has been modified as well. If a Unicode string is
passed in, it automatically copies and converts the string to the runtime
encoding, and issues a warning. If a binary type is passed-in, no conversion
is necessary. The '&' modifier can be used after 's' specifier to force
a different converter instead.
char *str;
int len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &str, &len, UG(utf8_conv)) == FAILURE) {
return;
}
/* here str is in UTF-8, if a Unicode string was passed in */
The 'U' and 'S' specifiers are similar to 'u' and 's' but they are more strict
about the type of the passed-in parameter. If 'U' is specified and the binary
string is passed in, the engine will issue a warning instead of doing automatic
conversion. The converse applies to the 'S' specifier.
Working in Unicode World
========================
Strings
-------
A lot of internal functionality is controlled by the unicode.semantics
switch. Its value is found in the Unicode globals variable, UG(unicode). It
is either on or off for the entire request.
The big thing is that there is a new string types: IS_UNICODE.
This has its own storage in the value union part of
zval (value.ustr) while non-unicode (binary) strings reuse the
IS_STRING type and the value.str element of the zval.
New macros exist (parallel to Z_STRVAL/Z_STRLEN) for accessing unicode strings.
Z_USTRVAL(), Z_USTRLEN()
- accesses the value (as a UChar*) and length (in code units) of the Unicode type string
value.ustr.val value.ustr.len
Z_UNIVAL(), Z_UNILEN()
- accesses the value (as a zstr) and length (in type-appropriate units)
value.uni.val value.uni.len
Z_USTRCPLEN()
- gives the number of codepoints (not units) in the Unicode type string
This macro examines the actual string taking into account Surrogate Pairs
and returns the number of UChar32(UTF32) codepoints which may be less than the
number of UChar(UTF16) codeunits found in the string buffer.
If this value will be used repeatedly, consider storing it in a local variable
to avoid having to reexamine the string every time.
ZVAL_* macros
-------------
The 'dup' parameter to the ZVAL_STRING()/RETVAL_STRING()/RETURN_STRING() type
macros has been extended slightly. The following defines are now encouraged instead:
#define ZSTR_DUPLICATE (1<<0)
#define ZSTR_AUTOFREE (1<<1)
ZSTR_DUPLICATE (which has a resulting value of 1) serves the same purpose as a
truth value in old-style 'dup' flags. The value of 1 was specifically chosen
to match the common practice of passing a 1 for this parameter.
Warning: If you find extension code which uses a truth value other than one for
the dup flag, its logic should be modified to explicitly pass ZSTR_DUPLICATE instead.
ZSTR_AUTOFREE is used with macros such as ZVAL_RT_STRING which may populate Unicode
zvals from non-unicode source strings. When UG(unicode) is on, the source string
will be implicitly copied (to make a UChar* version). If the original string
needed copying anyway this is fine. However if the original string was emalloc()'d
and would have ordinarily been given to the engine (i.e. RETURN_STRING(estrdup("foo"), 0))
then it will need to be freed in UG(unicode) mode to avoid leaking.
The ZSTR_AUTOFREE flag ensures that the original string is freed in UG(unicode) mode.
ZVAL_UNICODE(pzv, str, dup), ZVAL_UNICODEL(pzv, str, str_len, dup)
- Sets zval to hold a Unicode string. Takes the same parameters as
Z_STRING(), Z_STRINGL().
ZVAL_U_STRING(conv, pzv, str, dup), ZVAL_U_STRINGL(conv, pzv, str, str_len, dup)
- When UG(unicode) is off, it's equivalent to Z_STRING(), ZSTRINGL()
and the conv parameter is ignored.
When UG(unicode) is on, it sets zval to hold a Unicode representation of the
passed-in string using the UConverter* specified by conv.
Since a new string is always created in this case, passing ZSTR_DUPLICATE
for 'dup' does not matter, but ZSTR_AUTOFREE will be used will be used to
efree the original value
ZVAL_RT_STRING(pzv, str, dup), ZVAL_RT_STRINGL(pzv, str, str_len, dup)
- When UG(unicode) is off, it's equivalent to Z_STRING(), Z_STRINGL().
When UG(unicode) is on, it takes the input string, converts it to Unicode
using the runtime_encoding converter and sets zval to it.
Since a new string is always created in this case, passing ZSTR_DUPLICATE
for 'dup' does not matter, but ZSTR_AUTOFREE will be used will be used to
efree the original value
ZVAL_ASCII_STRING(pzv, str, dup), ZVAL_ASCII_STRINGL(pzv, str, str_len, dup)
- When UG(unicode) is off, it's equivalent to Z_STRING(), Z_STRINGL().
When UG(unicode) is on, it takes the input string, converts it to Unicode
using an ASCII converter and sets zval to it.
Since a new string is always created in this case, passing ZSTR_DUPLICATE
for 'dup' does not matter, but ZSTR_AUTOFREE will be used will be used to
efree the original value
ZVAL_UTF8_STRING(pzv, str, dup), ZVAL_UTF8_STRINGL(pzv, str, str_len, dup)
- When UG(unicode) is off, it's equivalent to Z_STRING(), Z_STRINGL().
When UG(unicode) is on, it takes the input string, converts it to Unicode
using a UTF8 converter and sets zval to it.
Since a new string is always created in this case, passing ZSTR_DUPLICATE
for 'dup' does not matter, but ZSTR_AUTOFREE will be used will be used to
efree the original value
ZVAL_ZSTR(pzv, type, zstr, dup), ZVAL_ZSTRL(pzv, type, zstr, zstr_len, dup)
- This macro uses 'type' to switch between calling ZVAL_STRING(pzv, zstr.s, dup)
and ZVAL_UNICODE(pzv, zstr.u, dup). No conversion happens so the
presense of absense of ZSTR_AUTOFREE is ignored.
ZVAL_TEXT(pzv, zstr, dup), ZVAL_TEXTL(pzv, zstr, zstr_len, dup)
- This macro sets the zval to hold either a Unicode or a normal string,
depending on the value of UG(unicode). No conversion happens, so be certain
that the string passed in matches the type expected by UG(unicode).
One example of its usage would be to initialize zval to hold the name
of a user function.
ZVAL_EMPTY_UNICODE(pzv) / ZVAL_EMPTY_TEXT(pzv)
- These macros work identically to ZVAL_EMPTY_STRING() with the UNICODE
version always generating an IS_UNICODE zval, and the TEXT version
generating a UG(unicode) dependent string type.
ZVAL_UCHAR32(pzv, char)
- Converts the character provided into a UChar string (which may potentially
be 1 or 2 characters long in the case of surrogate pairs) and dispatches
to ZVAL_UNICODEL().
As usual, for each ZVAL_* macro, there is a matching RETVAL_* and RETURN_* macro.
Conversion Macros
-----------------
convert_to_string_with_converter(zval *op, UConverter *conv)
- converts a zval to native string using the specified converter, if necessary.
convert_to_unicode_with_converter(zval *op, UConverter *conv)
- converts a zval to Unicode string using the specified converter, if
necessary.
convert_to_unicode(zval *op)
- converts a zval to Unicode string.
convert_to_string(zval *op)
- Behaves just as it currently does, converting to IS_STRING type
convert_to_text(zval *op)
- converts a zval to either Unicode or native string, depending on the
value of UG(unicode) switch
zend_ascii_to_unicode() function can be used to convert an ASCII char*
string to Unicode. This is useful especially for inline string literals, in
which case you can simply use USTR_MAKE() macro, e.g.:
UChar* ustr;
ustr = USTR_MAKE("main");
If you need to initialize a few such variables, it may be more efficient to
use ICU macros, which avoid the conversion, depending on the platform. See
[1] for more information.
USTR_FREE(zstr) can be used to free a UChar* string safely, since it checks for
NULL argument. USTR_LEN() takes a zstr as its argument, and
depending on the UG(unicode) value, and returns its strlen() or u_strlen().
Array Manipulation
------------------
The add_next_index_*(), add_index_*() and add_assoc_*() functions have been
significantly expanded both to allow for the unicode type as a value and to
permit various types of keys.
Values: In the following examples, {1} represents a placeholder for the keytype and
its arguments (covered later).
add_{1}_unicode(zval *arr, {1}, UChar *ustr, int dup);
add_{1}_unicodel(zval *arr, {1}, UChar *ustr, int ustr_len, int dup);
- Works like add_{1}_string() and add_{1}_stringl() but takes a UChar* value
and adds an IS_UNICODE type.
add_{1}_rt_string(zval *arr, {1}, char *str, int dup);
add_{1}_rt_stringl(zval *arr, {1}, char *str, int str_len, int dup);
- Works like add_{1}_string() and add_{1}_stringl() but converts the char*
value to Unicode using runtime encoding when UG(unicode) is on.
add_{1}_ascii_string(zval *arr, {1}, char *str, int dup);
add_{1}_ascii_stringl(zval *arr, {1}, char *str, int str_len, int dup);
- Works like add_{1}_rt_string() and add_{1}_rt_stringl() but uses
an ASCII converter rather than runtime encoding.
add_{1}_utf8_string(zval *arr, {1}, char *str, int dup);
add_{1}_utf8_stringl(zval *arr, {1}, char *str, int str_len, int dup);
- Works like add_{1}_rt_string() and add_{1}_rt_stringl() but uses
a UTF8 converter rather than runtime encoding.
add_{1}_text(zval *arr, {1}, zstr str, int dup);
add_{1}_textl(zval *arr, {1}, zstr str, int str_len, int dup);
- Wrapper which dispatches to add_{1}_string(l)() or add_{1}_unicode(l)()
depending on the setting of UG(unicode).
add_{1}_zstr(zval *arr, {1}, zend_uchar type, zstr str, int dup);
add_{1}_zstrl(zval *arr, {1}, zend_uchar type, zstr str, int str_len, int dup);
- Works like add_{1}_text() and add_{1}_textl(), but dispatches based on 'type'.
Keys: In the following example, the zval* type is used for values, however
each of the value types (including those listed above) are supported.
The existing key types work as they always have:
add_next_index_zval(zval *arr, zval *val);
add_index_zval(zval *arr, long idx, zval *val);
add_assoc_zval(zval *arr, char *key, zval *val);
add_assoc_zval_ex(zval *arr, char *key, int key_len, zval *val);
. Associative keys are considered binary (IS_STRING)
. Remember that key_len includes the terminating NULL
The following additional methods provide unicode capable keytypes:
add_u_assoc_zval(zval *arr, zend_uchar type, zstr key, zval *val);
add_u_assoc_zval_ex(zval *arr, zend_uchar type, zstr key, int key_len, zval *val);
. When type==IS_STRING, these behave identically to their
add_assoc_zval() and add_assoc_zval_ex() counterparts.
When type==IS_STRING, the key is considered to be Unicode (UChar*).
add_rt_assoc_zval(zval *arr, char *key, zval *val);
add_rt_assoc_zval_ex(zval *arr, char *key, int key_len, zval *val);
. When UG(unicode) is off, these behave identically to their
add_assoc_zval() and add_assoc_zval_ex() counterparts.
When UG(unicode) is on, key is converted to Unicode using runtime encoding.
add_ascii_assoc_zval(zval *arr, char *key, zval *val);
add_ascii_assoc_zval_ex(zval *arr, char *key, int key_len, zval *val);
. When UG(unicode) is off, these behave identically to their
add_assoc_zval() and add_assoc_zval_ex() counterparts.
When UG(unicode) is on, key is converted to Unicode using an ASCII converter.
add_utf8_assoc_zval(zval *arr, char *key, zval *val);
add_utf8_assoc_zval_ex(zval *arr, char *key, int key_len, zval *val);
. When UG(unicode) is off, these behave identically to their
add_assoc_zval() and add_assoc_zval_ex() counterparts.
When UG(unicode) is on, key is converted to Unicode using a UTF8 converter.
Keytype and Valuetype specification may be mixed in any combination, for example:
add_utf8_assoc_ascii_stringl_ex(zval *arr, char *key, int key_len, char *val, int val_len, int dup);
Miscellaneous
-------------
UBYTES() macro can be used to obtain the number of bytes necessary to store
the given number of UChar's. The typical usage is:
char *constant_name = colon + (UG(unicode)?UBYTES(2):2);
Code Points and Code Units
--------------------------
Unicode type strings are in the UTF-16 encoding where 1 Unicode character
may be represented by 1 or 2 UChar's. Each UChar is referred to as a "code
unit", and a full Unicode character as a "code point". Consequently, number
of code units and number of code points for the same Unicode string may be
different. This has many implications, the most important of which is that
you cannot simply index the UChar* string to get the desired codepoint.
The zval's value.ustr.len contains the number of code units (UChar -- UTF16).
To obtain the number of code points, one can use u_countChar32() ICU API
function or Z_USTRCPLEN() macro.
ICU provides a number of macros for working with UTF-16 strings on the
codepoint level [2]. They allow you to do things like obtain a codepoint at
random code unit offset, move forward and backward over the string, etc.
There are two versions of iterator macros, *_SAFE and *_UNSAFE. It is strong
recommended to use *_SAFE version, since they handle unpaired surrogates and
check for string boundaries. Here is an example of how to move through
UChar* string and work on codepoints.
UChar *str = ...;
int32_t str_len = ...;
UChar32 codepoint;
int32_t offset = 0;
while (offset < str_len) {
U16_NEXT(str, offset, str_len, codepoint);
/* now we have the Unicode character in codepoint */
}
There is not macro to get a codepoint at a certain code point offset, but
there is a Zend API function that does it.
inline UChar32 zend_get_codepoint_at(UChar *str, int32_t length, int32_t n);
To retrieve 3rd codepoint, you would call:
zend_get_codepoint_at(str, str_len, 3);
If you have a UChar32 codepoint and need to put it into a UChar* string,
there is another helper function, zend_codepoint_to_uchar(). It takes
a single UChar32 and converts it to a UChar sequence (1 or 2 UChar's).
UChar buf[8];
UChar32 codepoint = 0x101a2;
int8_t num_uchars;
num_uchars = zend_codepoint_to_uchar(codepoint, buf);
The return value is the number of resulting UChar's or 0, which indicates
invalid codepoint.
Memory Allocation
-----------------
For ease of use and to reduce possible bugs, there are memory allocation
functions specific to Unicode strings. Please use them at all times when
allocating UChar's.
eumalloc(size)
eurealloc(ptr, size)
eustrndup(s, length)
eustrdup(s)
peumalloc(size, persistent)
peurealloc(ptr, size, persistent)
The size parameter refers to the number of UChar's, not bytes.
zend_zstrndup(type, zstr, length)
Hashes
------
Hashes API has been upgraded to work with Unicode and binary strings. All
hash functions that worked with string keys now have their equivalent
zend_u_hash_* API. The zend_u_hash_* functions take the type of the key
string as the second argument.
When UG(unicode) switch is on, the IS_STRING keys are upconverted to
IS_UNICODE and then used in the hash lookup.
A new HASH_KEY constant has been added for differentiating key types:
. HASH_KEY_IS_UNICODE
Note that zend_hash_get_current_key_ex() does not have a zend_u_hash_*
version. It returns the key as a char* pointer, you can can cast it
appropriately based on the key type.
Identifiers and Class Entries
-----------------------------
In Unicode mode all the identifiers are Unicode strings. This means that
while various structures such as zend_class_entry, zend_function, etc store
the identifier name as a char* pointer, it will actually point to UChar*
string. Be careful when accessing the names of classes, functions, and such
-- always check UG(unicode) before using them.
Formatted Output
----------------
Since UTF-16 strings frequently contain NULL bytes, you cannot simpley use
%s format to print them out. Towards that end, output functions such as
php_printf(), spprintf(), etc now have three different formats for use with
Unicode strings:
%r
This format treats the corresponding argument as a Unicode string. The
string is automatically converted to the output encoding. If you wish to
apply a different converter to the string, use %*r and pass the
converter before the string argument.
UChar *class_name = USTR_NAME("ReflectionClass");
zend_printf("%r", class_name);
spprintf(&utf8_buffer, 0, "%*r", UG(utf8_conv), class_name);
%R
This format requires at least two arguments: the first one specifies the
type of the string to follow (IS_STRING or IS_UNICODE), and the second
one - the string itself. If the string is of Unicode type, it is
automatically converted to the output encoding. If you wish to apply
a different converter to the string, use %*R and pass the converter
before the string argument.
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Interface %R does not exist",
Z_TYPE_P(class_name), Z_UNIVAL_P(class_name));
%v
This format takes only one parameter, the string, but the expected
string type depends on the UG(unicode) value. If the string is of
Unicode type, it is automatically converted to the output encoding. If
you wish to apply a different converter to the string, use %*R and pass
the converter before the string argument.
zend_error(E_WARNING, "%v::__toString() did not return anything",
Z_OBJCE_P(object)->name);
%Z
This format prints a zval's value. You can specify the minimum length
of the string representation using "%*Z" as well as the absolute length
using "%.*Z". The following example is taken from the engine and
therefor uses zend_spprintf rather than spprintf. Further more clen is
an integer that is smaller than Z_UNILEN_P(callable).
zend_spprintf(error, 0, "class '%.*Z' not found", clen, callable);
The function allows to output any kind of zval values, as long as a
string (or unicode) conversion is available. Note that printing non
string zvals outside of request time is not possible.
Since [v]spprintf() can only output native strings there are also the new
functions [v]uspprintf() and [v]zspprintf() that create unicode strings and
return the number of characters printed. That is they return the length rather
than the byte size. The second pair of functions also takes an additional type
parameter that allows to create a string of arbitrary type. The following
example illustrates the use. Assume it fetches a unicode/native string into
path, path_len and path_type inorder to create sub_name, sub_len and sub_type.
zstr path, sub_name;
int path_len, sub_len;
zend_uchar path_type, sub_type;
/* fetch */
if (path.v) {
sub_type = path_type;
sub_len = zspprintf(path_type, &sub_name, 0, "%R%c%s",
path_type, path,
DEFAULT_SLASH,
entry.d_name);
}
Upgrading Functions
===================
Let's take a look at a couple of functions that have been upgraded to
support new string types.
substr()
--------
This functions returns part of a string based on offset and length
parameters.
zstr str;
int str_len, cp_len;
zend_uchar str_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tl|l", &str, &str_len, &str_type, &f, &l) == FAILURE) {
return;
}
The first thing we notice is that the incoming string specifier is 't',
which means that we can accept all 3 string types. The 'str' variable is
declared as zstr, because it can point to either UChar* or char*.
The actual type of the incoming string is stored in 'str_type' variable.
if (str_type == IS_UNICODE) {
cp_len = u_countChar32(str.u, str_len);
} else {
cp_len = str_len;
}
If the string is a Unicode one, we cannot rely on the str_len value to tell
us the number of characters in it. Instead, we call u_countChar32() to
obtain it.
The next several lines normalize start and length parameters to fit within the
string. Nothing new here. Then we locate the appropriate segment.
if (str_type == IS_UNICODE) {
int32_t start = 0, end = 0;
U16_FWD_N(str.u, end, str_len, f);
start = end;
U16_FWD_N(str.u, end, str_len, l);
RETURN_UNICODEL(str.u + start, end-start, ZSTR_DUPLICATE);
Since codepoint (character) #n is not necessarily at offset #n in Unicode
strings, we start at the beginning and iterate forward until we have gone
through the required number of codepoints to reach the start of the segment.
Then we save the location in 'start' and continue iterating through the number
of codepoints specified by the offset. Once that's done, we can return the
segment as a Unicode string.
} else {
RETURN_STRINGL(str.s + f, l, ZSTR_DUPLICATE);
}
For native strings, we can return the segment directly.
strrev()
--------
Let's look at strrev() which requires somewhat more complicated upgrade.
While one of the guidelines for upgrades is that combining sequences are not
really taken into account during processing -- substr() can break them up,
for example -- in this case, we actually should be concerned, because
reversing combining sequence may result in a completely different string. To
illustrate:
a (U+0061 LATIN SMALL LETTER A)
o (U+006f LATIN SMALL LETTER O)
+ ' (U+0301 COMBINING ACUTE ACCENT)
+ _ (U+0320 COMBINING MINUS SIGN BELOW)
l (U+006C LATIN SMALL LETTER L)
Reversing this would result in:
l (U+006C LATIN SMALL LETTER L)
+ _ (U+0320 COMBINING MINUS SIGN BELOW)
+ ' (U+0301 COMBINING ACUTE ACCENT)
o (U+006f LATIN SMALL LETTER O)
a (U+0061 LATIN SMALL LETTER A)
All of a sudden the combining marks are being applied to 'l' instead of 'o'.
To avoid this, we need to treat combininig sequences as a unit, by checking
the combining character class of each character with u_getCombiningClass().
strrev() obtains its single argument, a string, and unless the string is of
Unicode type, processes it exactly as before, simply swapping bytes around.
For Unicode case, the magic is like this:
int32_t i, x1, x2;
UChar32 ch;
UChar *u_s, *u_n, *u_p;
u_n = eumalloc(Z_USTRLEN_PP(str)+1);
u_p = u_n;
u_s = Z_USTRVAL_PP(str);
i = Z_USTRLEN_PP(str);
while (i > 0) {
U16_PREV(u_s, 0, i, ch);
if (u_getCombiningClass(ch) == 0) {
u_p += zend_codepoint_to_uchar(ch, u_p);
} else {
x2 = i;
do {
U16_PREV(u_s, 0, i, ch);
} while (u_getCombiningClass(ch) != 0);
x1 = i;
while (x1 <= x2) {
U16_NEXT(u_s, x1, Z_USTRLEN_PP(str), ch);
u_p += zend_codepoint_to_uchar(ch, u_p);
}
}
}
*u_p = 0;
The basic idea is to walk the string backwards from the end, using
U16_PREV() macro. If the combining class of the current character is 0,
meaning it's a base character and not a combining mark, we simply append it
to the new string. Otherwise, we save the location of the index and do a run
over the characters until we get to the next one with combining class 0. At
that point we append the sequence as is, without reversing, to the new
string. Voila.
Note that the code uses zend_codepoint_to_uchar() to convert full Unicode
characters (UChar32 type) to 1 or 2 UTF-16 code units (UChar type).
realpath()
----------
Filenames use their own converter as it's not uncommon, for example,
to need to access files on a filesystem with latin1 entries while outputting
UTF8 runtime content.
The most common approach to parsing filenames can be found in realpath():
zval **ppfilename;
char *filename;
int filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &ppfilename) == FAILURE ||
php_stream_path_param_encode(ppfilename, &filename, &filename_len, REPORT_ERRORS, FG(default_context)) == FAILURE) {
return;
}
Here, the filename is taken first as a generic zval**, then converted (separating if necessary)
and populated into local char* and int storage. The filename will be converted according to
unicode.filesystem_encoding unless the wrapper specified overrides this with its own conversion
function (The http:// wrapper, for example, enforces utf8 conversion).
rmdir()
-------
If the function accepts a context parameter, then this context should be used in place of FG(default_context)
zval **ppdir, *zcontext = NULL;
char *dir;
int dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|r", &ppdir, &zcontext) == FAILURE) {
return;
}
context = php_stream_context_from_zval(zcontext, 0);
if (php_stream_path_param_encode(ppdir, &dir, &dir_len, REPORT_ERRORS, context) == FAILURE) {
return;
}
sqlite_query()
--------------
If the function's underlying library expects a particular encoding (i.e. UTF8), then the alternate form of
the string parameter may be used with zend_parse_parameters().
char *sql;
int sql_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &sql, &sql_len, UG(utf8_conv)) == FAILURE) {
return;
}
Converters
==========
Standard Converters
-------------------
The following converters (UConverter*) are initialized by Zend and are always available (regardless of UG(unicode) mode):
UG(utf8_conv)
UG(ascii_conv)
UG(fallback_encoding_conv) - UTF8 unless overridden by INI setting unicode.fallback_encoding
Additional converters will be optionally initialized depending on INI settings:
UG(runtime_encoding_conv) - unicode.runtime_encoding
. Unicode output generated by a script will be encoding using this converter
UG(script_encoding_conv) - unicode.script_encoding
. Scripts read from disk will be decoded using this converter
UG(filesystem_encoding_conv) - unicode.filesystem_encoding
. Filenames and paths will be encoding using this converter
Since these additional converters may not be instatiated (because their INI value is not set), all uses of these converters must
be wrapped in ZEND_U_CONVERTER() for safety. If the converter hasn't been instantiated, then UG(fallback_encoding_conv) will be
used instead.
For example, RETURN_RT_STRING("foo", ZSTR_DUPLICATE); expands out to:
RETURN_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), "foo", ZSTR_DUPLICATE);
Which uses UG(runtime_encoding_conv) if it's been set, otherwise using UG(fallback_encoding_conv).
Note that the INI setting unicode.stream_encoding does not instantiate a UConverter* automatically for use by the process/thread,
it stores the value as a string for use during fopen() style calls where a UConverter* is instantiated for that particular stream.
References
==========
[1] http://icu.sourceforge.net/apiref/icu4c/ustring_8h.html#a1
[2] http://icu.sourceforge.net/apiref/icu4c/utf16_8h.html
vim: set et ai tw=76 fo=tron21:
-123
View File
@@ -1,123 +0,0 @@
PHP Build System V5 Overview
- supports Makefile.ins during transition phase
- not-really-portable Makefile includes have been eliminated
- supports separate build directories without VPATH by using
explicit rules only
- does not waste disk-space/CPU-time for building temporary libraries
=> especially noticeable on slower systems
- slow recursive make replaced with one global Makefile
- eases integration of proper dependencies
- adds PHP_DEFINE(what[, value]) which creates a single include-file
per what. This will allow more fine-grained dependencies.
- abandoning the "one library per directory" concept
- improved integration of the CLI
- several new targets
build-modules: builds and copies dynamic modules into modules/
install-cli: installs the CLI only, so that the install-sapi
target does only what its name says
- finally abandoned automake (still requires aclocal at this time)
- changed some configure-time constructs to run at buildconf-time
- upgraded shtool to 1.5.4
- removed $(moduledir) (use EXTENSION_DIR)
The Reason For a New System
It became more and more apparent that there is a severe need
for addressing the portability concerns and improving the chance
that your build is correct (how often have you been told to
"make clean"? When this is done, you won't need to anymore).
If You Build PHP on a Unix System
You, as a user of PHP, will notice no changes. Of course, the build
system will be faster, look better and work smarter.
If You Are Developing PHP
Extension developers:
Makefile.ins are abandoned. The files which are to be compiled
are specified in the config.m4 now using the following macro:
PHP_NEW_EXTENSION(foo, foo.c bar.c baz.cpp, $ext_shared)
E.g. this enables the extension foo which consists of three source-code
modules, two in C and one in C++. And, depending on the user's wishes,
the extension will even be built as a dynamic module.
The full syntax:
PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]])
Please have a look at acinclude.m4 for the gory details and meanings
of the other parameters.
And that's basically it for the extension side.
If you previously built sub-libraries for this module, add
the source-code files here as well. If you need to specify
separate include directories, do it this way:
PHP_NEW_EXTENSION(foo, foo.c mylib/bar.c mylib/gregor.c,,,-I@ext_srcdir@/lib)
E.g. this builds the three files which are located relative to the
extension source directory and compiles all three files with the
special include directive (@ext_srcdir@ is automatically replaced).
Now, you need to tell the build system that you want to build files
in a directory called $ext_builddir/lib:
PHP_ADD_BUILD_DIR($ext_builddir/lib)
Make sure to call this after PHP_NEW_EXTENSION, because $ext_builddir
is only set by the latter.
If you have a complex extension, you might to need add special
Make rules. You can do this by calling PHP_ADD_MAKEFILE_FRAGMENT
in your config.m4 after PHP_NEW_EXTENSION.
This will read a file in the source-dir of your extension called
Makefile.frag. In this file, $(builddir) and $(srcdir) will be
replaced by the values which are correct for your extension
and which are again determined by the PHP_NEW_EXTENSION macro.
Make sure to prefix *all* relative paths correctly with either
$(builddir) or $(srcdir). Because the build system does not
change the working directory anymore, we must use either
absolute paths or relative ones to the top build-directory.
Correct prefixing ensures that.
SAPI developers:
Instead of using PHP_SAPI=foo/PHP_BUILD_XYZ, you will need to type
PHP_SELECT_SAPI(name, type, sources.c)
I.e. specify the source-code files as above and also pass the
information regarding how PHP is supposed to be built (shared
module, program, etc).
For example for APXS:
PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php5.c php_apache.c)
General info
The foundation for the new system is the flexible handling of
sources and their contexts. With the help of macros you
can define special flags for each source-file, where it is
located, in which target context it can work, etc.
Have a look at the well documented macros
PHP_ADD_SOURCES(_X) in acinclude.m4.
-172
View File
@@ -1,172 +0,0 @@
Updating your script to PHP6
============================
This document attempts to describe portions of PHP that changed or
disapeared in PHP6 and the best practices for upgrading existing
applications to support PHP6.
1. Language
1.1 Functions and function aliases
1.2 Register globals
1.3 Magic quotes
1.4 Register long arrays ($HTTP_*_VARS)
1.5 ZE1 compatibility mode
1.6 dl() function
1.7 E_ALL and E_STRICT constants
1.8 References
2. Unicode (see README.UNICODE-UPGRADES)
2. Extensions
2.1 GD
1.1 Functions and function aliases
------------------------------
<TODO: List all arguments order changes, aliases droped in php6...>
1.2 Register globals
----------------
For security reasons, register_globals has been removed from php6.
ini_get('register_globals') will always return false.
You can emulate its behavior with some minimum changes in your code.
*DISCLAIMER*
people should get a short-term solution if they are willing to run
an insecure app.
Here is an example to emulate the session related functions and
a snippet to register variables:
$_register_globals_order = strrev(ini_get("variables_order"));
$_register_globals_order_len = strlen($_register_globals_order);
for($_register_globals_i=0;$_register_globals_i<$_register_globals_order_len;$_register_globals_i++) {
switch($_register_globals_order{$_register_globals_i}) {
case "E":
extract($_ENV, EXTR_REFS|EXTR_SKIP);
break;
case "G":
extract($_GET, EXTR_REFS|EXTR_SKIP);
break;
case "P":
extract($_POST, EXTR_REFS|EXTR_SKIP);
break;
case "C":
extract($_COOKIE, EXTR_REFS|EXTR_SKIP);
break;
case "S":
extract($_SERVER, EXTR_REFS|EXTR_SKIP);
break;
}
}
unset($_register_globals_order, $_register_globals_order_len, $_register_globals_i);
function session_register($mixed) {
static $started;
if(!isset($started) || session_id() === "") {
session_start();
$started = true;
}
$array = func_get_args();
foreach($array as $mixed) {
if(is_scalar($mixed)) {
$_SESSION[$mixed] =& $GLOBALS[$mixed];
}
elseif(is_array($mixed)) {
foreach($mixed as $name) {
$ok = session_register($name);
if(!$ok) {
return false;
}
}
}
else {
return false;
}
}
return true;
}
function session_is_registered($name) {
if(is_scalar($name)) {
return isset($_SESSION[$name]);
}
return false;
}
function session_unregister($name) {
if(isset($_SESSION[$name]) && is_scalar($name)) {
unset($_SESSION[$name]);
return true;
}
return false;
}
1.3 Magic quotes
------------
1.4 Register long arrays ($HTTP_*_VARS)
-----------------------------------
register_long_arrays and the long versions of super globals had been removed.
PHP will emit E_CORE_ERROR during PHP startup if it would detect
register_long_arrays setting.
You can emulate long arrays by including the following file:
<?php
if (!ini_get('register_long_arrays')) {
$HTTP_POST_VARS =& $_POST;
$HTTP_GET_VARS =& $_GET;
$HTTP_COOKIE_VARS =& $_COOKIE;
$HTTP_SERVER_VARS =& $_SERVER;
$HTTP_ENV_VARS =& $_ENV;
$HTTP_POST_FILES =& $_FILES;
}
?>
1.5 ZE1 compatibility mode
----------------------
ZE1 compatibility mode (PHP4 object model) was introduced to migrate from PHP4
to PHP5 in an easier way, but it never keeped 100% compatibility.
It is completly removed in PHP6, and there is no way to emulate it.
Applications should assume PHP5/PHP6 object model.
1.6 dl() function
-------------
Now dl() function is supported only in CLI, CGI and EMBED SAPI.
There is no way to emulte it. You can just check if dl() is supported by SAPI:
<?php
if (!function_exists("dl")) {
die("dl() function is required\n!");
}
?>
1.7 E_ALL and E_STRICT constants
----------------------------
Now E_ALL error reporting mask includes E_STRICT.
You can filter E_STRICT error messages using the following code:
<?php
error_reporting(error_reporting() & ~E_STRICT);
?>
1.8 References
----------
<TODO: Derick plans to clean the reference mess in php6>
2.1 GD
<TODO: gd2/ft2 only, functions droped>
-6
View File
@@ -1,6 +0,0 @@
The Win32 Build System.
See http://wiki.php.net/internals/windows/stepbystepbuild
vim:tw=78:sw=1:ts=1:et
+25 -11
View File
@@ -1,4 +1,4 @@
Using PHP 5 with the Zeus Web Server
Using PHP4 with the Zeus Web Server
-----------------------------------
Zeus fully supports running PHP in combination with our
@@ -21,13 +21,29 @@ If you have any problems, please check the support site for more
up-to-date information and advice.
Quick guide to installing CGI/FastCGI with Zeus
-----------------------------------------------
Quick guide to installing FastCGI with Zeus
-------------------------------------------
Step 1 - Compile PHP as FastCGI.
Step 1 - obtain and install FastCGI development kit.
Grab the package from:
http://www.fastcgi.com/dist/devkit_2.2.0.tar.gz
Extract the package and follow the instructions:
./configure
make
make export
(run the last as root)
This will install to /usr/local/lib/libfcgi.a
and /usr/local/include/*fcgi*
Step 2 - Compile PHP as FastCGI.
Compile as follows:
./configure --enable-fastcgi
./configure --with-fastcgi
make
Note that PHP has many options to the configure script -
@@ -39,7 +55,7 @@ program called 'php'. Copy this into your document root, under a
dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php)
Step 2 - configure Zeus
Step 3 - configure Zeus
Four stages:
- enable FastCGI
@@ -82,7 +98,7 @@ Click 'update' to commit these changes
Finally restart your virtual server for these changes to take effect.
Step 3 - start PHP as a FastCGI runner
Step 4 - start PHP as a FastCGI runner
When you start PHP, it will pre-fork a given number of child processes
to handle incoming PHP requests. Each process will handle a given
@@ -90,10 +106,8 @@ number of requests before exiting (and being replaced by a newly
forked process). You can control these two parameters by setting the
following environment variables BEFORE starting the FastCGI runner:
PHP_FCGI_CHILDREN - the number of child processes to pre-fork. This
variable MUST be set, if not then the PHP will not run as a FastCGI.
We recommend a value of 8 for a fairly busy site. If you have many,
long-running PHP scripts, then you may need to increase this further.
PHP_FCGI_CHILDREN - the number of child processes to pre-fork. If not
set, defaults to 8.
PHP_FCGI_MAX_REQUESTS - the number of requests each PHP child process
handles before exiting. If not set, defaults to 500.
-193
View File
@@ -1,193 +0,0 @@
Input Filter Support in PHP 5
-----------------------------
XSS (Cross Site Scripting) hacks are becoming more and more prevalent,
and can be quite difficult to prevent. Whenever you accept user data
and somehow display this data back to users, you are likely vulnerable
to XSS hacks.
The Input Filter support in PHP 5 is aimed at providing the framework
through which a company-wide or site-wide security policy can be
enforced. It is implemented as a SAPI hook and is called from the
treat_data and post handler functions. To implement your own security
policy you will need to write a standard PHP extension.
A simple implementation might look like the following. This stores the
original raw user data and adds a my_get_raw() function while the normal
$_POST, $_GET and $_COOKIE arrays are only populated with stripped
data. In this simple example all I am doing is calling strip_tags() on
the data. If register_globals is turned on, the default globals that
are created will be stripped ($foo) while a $RAW_foo is created with the
original user input.
ZEND_BEGIN_MODULE_GLOBALS(my_input_filter)
zval *post_array;
zval *get_array;
zval *cookie_array;
ZEND_END_MODULE_GLOBALS(my_input_filter)
#ifdef ZTS
#define IF_G(v) TSRMG(my_input_filter_globals_id, zend_my_input_filter_globals *, v)
#else
#define IF_G(v) (my_input_filter_globals.v)
#endif
ZEND_DECLARE_MODULE_GLOBALS(my_input_filter)
zend_function_entry my_input_filter_functions[] = {
PHP_FE(my_get_raw, NULL)
{NULL, NULL, NULL}
};
zend_module_entry my_input_filter_module_entry = {
STANDARD_MODULE_HEADER,
"my_input_filter",
my_input_filter_functions,
PHP_MINIT(my_input_filter),
PHP_MSHUTDOWN(my_input_filter),
NULL,
PHP_RSHUTDOWN(my_input_filter),
PHP_MINFO(my_input_filter),
"0.1",
STANDARD_MODULE_PROPERTIES
};
PHP_MINIT_FUNCTION(my_input_filter)
{
ZEND_INIT_MODULE_GLOBALS(my_input_filter, php_my_input_filter_init_globals, NULL);
REGISTER_LONG_CONSTANT("POST", PARSE_POST, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("GET", PARSE_GET, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
sapi_register_input_filter(my_sapi_input_filter);
return SUCCESS;
}
PHP_RSHUTDOWN_FUNCTION(my_input_filter)
{
if(IF_G(get_array)) {
zval_ptr_dtor(&IF_G(get_array));
IF_G(get_array) = NULL;
}
if(IF_G(post_array)) {
zval_ptr_dtor(&IF_G(post_array));
IF_G(post_array) = NULL;
}
if(IF_G(cookie_array)) {
zval_ptr_dtor(&IF_G(cookie_array));
IF_G(cookie_array) = NULL;
}
return SUCCESS;
}
PHP_MINFO_FUNCTION(my_input_filter)
{
php_info_print_table_start();
php_info_print_table_row( 2, "My Input Filter Support", "enabled" );
php_info_print_table_row( 2, "Revision", "$Revision$");
php_info_print_table_end();
}
/* The filter handler. If you return 1 from it, then PHP also registers the
* (modified) variable. Returning 0 prevents PHP from registering the variable;
* you can use this if your filter already registers the variable under a
* different name, or if you just don't want the variable registered at all. */
SAPI_INPUT_FILTER_FUNC(my_sapi_input_filter)
{
zval new_var;
zval *array_ptr = NULL;
char *raw_var;
int var_len;
assert(*val != NULL);
switch(arg) {
case PARSE_GET:
if(!IF_G(get_array)) {
ALLOC_ZVAL(array_ptr);
array_init(array_ptr);
INIT_PZVAL(array_ptr);
}
IF_G(get_array) = array_ptr;
break;
case PARSE_POST:
if(!IF_G(post_array)) {
ALLOC_ZVAL(array_ptr);
array_init(array_ptr);
INIT_PZVAL(array_ptr);
}
IF_G(post_array) = array_ptr;
break;
case PARSE_COOKIE:
if(!IF_G(cookie_array)) {
ALLOC_ZVAL(array_ptr);
array_init(array_ptr);
INIT_PZVAL(array_ptr);
}
IF_G(cookie_array) = array_ptr;
break;
}
Z_STRLEN(new_var) = val_len;
Z_STRVAL(new_var) = estrndup(*val, val_len);
Z_TYPE(new_var) = IS_STRING;
var_len = strlen(var);
raw_var = emalloc(var_len+5); /* RAW_ and a \0 */
strcpy(raw_var, "RAW_");
strlcat(raw_var,var,var_len+5);
php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC);
php_strip_tags(*val, val_len, NULL, NULL, 0);
*new_val_len = strlen(*val);
return 1;
}
PHP_FUNCTION(my_get_raw)
{
long arg;
char *var;
int var_len;
zval **tmp;
zval *array_ptr = NULL;
HashTable *hash_ptr;
char *raw_var;
if(zend_parse_parameters(2 TSRMLS_CC, "ls", &arg, &var, &var_len) == FAILURE) {
return;
}
switch(arg) {
case PARSE_GET:
array_ptr = IF_G(get_array);
break;
case PARSE_POST:
array_ptr = IF_G(post_array);
break;
case PARSE_COOKIE:
array_ptr = IF_G(post_array);
break;
}
if(!array_ptr) RETURN_FALSE;
/*
* I'm changing the variable name here because when running with register_globals on,
* the variable will end up in the global symbol table
*/
raw_var = emalloc(var_len+5); /* RAW_ and a \0 */
strcpy(raw_var, "RAW_");
strlcat(raw_var,var,var_len+5);
hash_ptr = HASH_OF(array_ptr);
if(zend_hash_find(hash_ptr, raw_var, var_len+5, (void **)&tmp) == SUCCESS) {
*return_value = **tmp;
zval_copy_ctor(return_value);
} else {
RETVAL_FALSE;
}
efree(raw_var);
}
-174
View File
@@ -1,174 +0,0 @@
Design
======
Main assumption of the model is that the problem that we are to solve is the
problem of the very long class names in PHP libraries. We would not attempt
to take autoloader's job or create packaging model - only make names
manageable.
Namespaces are defined the following way:
Zend/DB/Connection.php:
<?php
namespace Zend\DB;
class Connection {
}
function connect() {
}
?>
Namespace definition does the following:
All class and function names inside are automatically prefixed with
namespace name. Inside namespace, local name always takes precedence over
global name. Several files may be using the same namespace.
The namespace declaration statement must be the very first statement in
the file. The only exception is "declare" statement that can be used before.
Every class and function in a namespace can be referred to by the full name
- e.g. Zend\DB\Connection or Zend\DB\connect - at any time.
<?php
require 'Zend/Db/Connection.php';
$x = new Zend\DB\Connection;
Zend\DB\connect();
?>
Namespace or class name can be imported:
<?php
require 'Zend/Db/Connection.php';
use Zend\DB;
use Zend\DB\Connection as DbConnection;
$x = new Zend\DB\Connection();
$y = new DB\connection();
$z = new DbConnection();
DB\connect();
?>
The use statement only defines name aliasing. It may create name alias for
namespace or class. The simple form of statement "use A\B\C\D;" is
equivalent to "use A\B\C\D as D;". The use statement can be used at any
time in the global scope (not inside function/class) and takes effect from
the point of definition down to the end of file. It is recommended however to
place the use statements at the beginning of the file. The use statements have
effect only on the file where they appear.
The special "empty" namespace (\ prefix) is useful as explicit global
namespace qualification. All class and function names started from \
interpreted as global.
<?php
namespace A\B\C;
$con = \mysql_connect(...);
?>
A special constant __NAMESPACE__ contains the name of the current namespace.
It can be used to construct fully-qualified names to pass them as callbacks.
<?php
namespace A\B\C;
function foo() {
}
set_error_handler(__NAMESPACE__ . "\foo");
?>
In global namespace __NAMESPACE__ constant has the value of empty string.
Names inside namespace are resolved according to the following rules:
1) all qualified names are translated during compilation according to
current import rules. So if we have "use A\B\C" and then "C\D\e()"
it is translated to "A\B\C\D\e()".
2) unqualified class names translated during compilation according to
current import rules. So if we have "use A\B\C" and then "new C()" it
is translated to "new A\B\C()".
3) inside namespace, calls to unqualified functions that are defined in
current namespace (and are known at the time the call is parsed) are
interpreted as calls to these namespace functions.
4) inside namespace, calls to unqualified functions that are not defined
in current namespace are resolved at run-time. The call to function foo()
inside namespace (A\B) first tries to find and call function from current
namespace A\B\foo() and if it doesn't exist PHP tries to call internal
function foo(). Note that using foo() inside namespace you can call only
internal PHP functions, however using \foo() you are able to call any
function from the global namespace.
5) unqualified class names are resolved at run-time. E.q. "new Exception()"
first tries to use (and autoload) class from current namespace and in case
of failure uses internal PHP class. Note that using "new A" in namespace
you can only create class from this namespace or internal PHP class, however
using "new \A" you are able to create any class from the global namespace.
6) Calls to qualified functions are resolved at run-time. Call to
A\B\foo() first tries to call function foo() from namespace A\B, then
it tries to find class A\B (__autoload() it if necessary) and call its
static method foo()
7) qualified class names are interpreted as class from corresponding
namespace. So "new A\B\C()" refers to class C from namespace A\B.
Examples
--------
<?php
namespace A;
foo(); // first tries to call "foo" defined in namespace "A"
// then calls internal function "foo"
\foo(); // calls function "foo" defined in global scope
?>
<?php
namespace A;
new B(); // first tries to create object of class "B" defined in namespace "A"
// then creates object of internal class "B"
new \B(); // creates object of class "B" defined in global scope
?>
<?php
namespace A;
new A(); // first tries to create object of class "A" from namespace "A" (A\A)
// then creates object of internal class "A"
?>
<?php
namespace A;
B\foo(); // first tries to call function "foo" from namespace "A\B"
// then calls method "foo" of internal class "B"
\B\foo(); // first tries to call function "foo" from namespace "B"
// then calls method "foo" of class "B" from global scope
?>
The worst case if class name conflicts with namespace name
<?php
namespace A;
A\foo(); // first tries to call function "foo" from namespace "A\A"
// then tries to call method "foo" of class "A" from namespace "A"
// then tries to call function "foo" from namespace "A"
// then calls method "foo" of internal class "A"
\A\foo(); // first tries to call function "foo" from namespace "A"
// then calls method "foo" of class "A" from global scope
?>
TODO
====
* Support for namespace constants?
* performance problems
- calls to internal functions in namespaces are slower, because PHP first
looks for such function in current namespace
- calls to static methods are slower, because PHP first tries to look
for corresponding function in namespace
* Extend the Reflection API?
* Add ReflectionNamespace class
+ getName()
+ getClasses()
+ getFunctions()
+ getFiles()
* Add getNamespace() methods to ReflectionClass and ReflectionFunction
* Rename namespaces to packages?
+186
View File
@@ -0,0 +1,186 @@
Advisory on the PHP Release Cycle
Copyright & Liciencing
This Document is (c) Copyright 2000,2001 by The PHP Group
This Document is distributed under the terms of the GNU General
Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later
version.
Table of Contents
1. Introduction
2. Dealing with bugs
2.1 As a QA Team Member
2.2 As a Developer
3. Releaseing another RC
4. CVS During the Release Process
4.1 Useful CVS Commands
5 The Final Release
6 Summary
1. Introduction
This cycle should take place over roughly 10 days. When it is
decided it is time for an Release to occur Andi/Zeev (Or
Whoever) will tarball RC1, Tag & Branch CVS (see section 4)
and then announce the RC on PHP-QA and PHP-DEV. At this
point the build tracker and QA Bug System come into play.
If you successfully build PHP then report it in the build
tracker, If you then run and complete all the tests you
should report this too in the build tracker when
these features become avalible.
2. Dealing with Bugs
2.1 As a QA Team member
If you find a bug in an RC that you think is a showstopper
then, even if it is a known bug, you should report it in the
QA Bug system. This marks the bug for discussion at least,
and preferably fixing before the actual release. This system
is separate from the main bugs system so that important bugs
dont get lost in the midst if lots of feature/change request
in the approach to a release. It is imperitive where
appropraite that as a QA'er a test script, Configure options
and PHP.ini files are provided to enable the developer to
reproduce the bug, this is an important part of our job. If
you have a serious bug then you should also create a test
script to be added to the tests dir of the php source so
that at the end of the process to enable us to make sure bug
does not return. It is not difficult to create these test
scripts and a readme on it can be found in
php4/tests/README.
2.2 As a Developer
What should happen is that when a bug is reported it
is send to php-dev and php-qa as with other bugs. We should
have far stricter assignment system in this bug cycle rather
than just leaving them. Once again bugs should be able to be
marked as To Be Fixed Before release or moved to other bug
system. (This is currently the Release Masters responsibility)
Then before the actual release the qa bugs system can be
checked and if there are outstanding To Be Fixed Before
release bugs the Developers can see this easyly rather than
show stoppers being dismissed and not worried about.
When a bug is fixed the QAer who reported the bug is emailed
and asked to test again and see if the bug is fixed.
3 Releasing another RC
If it is felt necessary that a 2nd RC is needed then it
should be packaged as before and announced to both lists
again. The testing process then starts again, the RC2 is
added to the build tracker and QA'ers are asked to build and
retest the scripts as appropriate, espectially if you
reported a bug, you should test thourghly for your
bug and make sure it no longer occurs. This will normally
add anouther 3 days to the cycle, giving QA'ers time to
build test and report back, then for developers to
fix any problems.
4 CVS during the release process
At the point where the first RC is create a branch is
formed. This branch is not altered form that point onward
other than major bug fixes. Minor non important bug
fixes should not be applied to this branch but to the main
tree instead. Any major bug fixes should be applied to both
trees. The developer should test and check the RC tree then
also test and check the MAIN tree. This is their
responsibility to make sure (as far as possible) that the
bug fix works on both trees.
4.1 Useful CVS Commands
To create a Branch <Should only be done by person tarballing
the RC (The Release Master)>:
$ cvs tag -b php_4_0_<Version>RC<NUMBER>
IE:
$ cvs tag -b php_4_0_1RC1
This should be executed in the PHP directory of an up to
date checkout. Remember to also tag the Zend and TSRM repositories.
You can retrieve a branch in one of two ways: by checking it
out fresh from the repository, or by switching an existing
working copy over to the branch, I would suggest you
checkout a new copy.
To check out a new copy:
$ cvs checkout -r php_4_0_<Version>RC<NUMBER> php4
IE:
$ cvs checkout -r php_4_0_1RC1 php4
To switch a working copy (Not recomended due to possible
commiting to wrong branch)
$ cvs update -r php_4_0_<Version>RC<NUMBER> php4
IE:
$ cvs update -r php_4_0_1RC1 php4
This should be done in the PHP4 directory itself.
To revert back to normal branch you should use the
following:
$ cvs update -A
To Commit to the branch you follow exactly the same
procedure as normal
$ cvs commit file.c
MAKE SURE YOU DO NOT COMMIT TO THE WRONG BRANCH.
5 The Final Release
When it is time to make the final release the following
proceedure should be followed. The person who is tarballing
the final release should check the QA bugs system and make
sure there are no showstoppers left unfixed. If there are
then bug the person the bug is assigned to until they fix
it. If there are no more qa bugs then they should tag the
branch as php_4_0_<Version> and tarball as usual. An email
should be sent to PHP-GEN, PHP_DEV and PHP-QA about the new
release and it should be added to php.net. The windows
binaries and servelets should be built as soon as possible
and added too, as should the windows installer.
6 Summary
Here is a summary of what a release cycle might look like:
Thurs: RC is agreed on and packaged, an email is sent to
PHP_QA and PHP-DEV, the CVS is Branched and the
Release Cycle Begins.
Mon: After a weekends testing most show stoppers should
have been found (Hopefully) and the developers get to
work on fixing them.
Thurs: A second RC is released if needed with the new bug
fixes in and the QAers test again.
Sun: A review is made of all outstanding bugs and any show
stoppers should be fixed. if there are no show
stoppers then the final release is packaged and
released on the monday morning on php.net
Mon: Release is made.
James
--
James Moore
PHP QA Team
jmoore@php.net
+82 -93
View File
@@ -3,143 +3,134 @@ parenthesis means that person has taken on this project.
Zend
----
* Allow foreach ($array as $k => list($a, $b)) syntax for multi
* allow foreach ($array as $k => &$val) syntax. right now we cannot
traverse an array without copying each element.
* allow foreach ($array as $k => list($a, $b)) syntax for multi
dimensional arrays.
* Look at replacing c-lib call tolower().
* Make hash API functions work with HASH_OF() to save time.
* Native large number support (probably with GNU GMP)
* look at replacing c-lib call tolower().
* make hash API functions work with HASH_OF() to save time.
* native large number support (probably with GNU GMP)
* Const'ify APIs. Right now, many functions leave parameters untouched,
but don't declare those as const. This makes interaction with other
interfaces difficult which pass const parameters to us.
* Clean up object->string conversion behavior wherever possible (switch(),
comparison, etc)
* Port safe-allocation functions from 5.3 (zend_alloc.[ch])
interfaces difficult which pass const parameters to us.
* add try..catch/throw exception handling
global
------
* Make sure that all ZTS globals get destructed. Most ts_allocate_id()
* when used in standalone (skell-script like) mode don't urldecode
arguments passed to php. right now it's not possible to say
/usr/local/bin/php somescript.php dog+cat.txt
as "dog+cat.txt" will arrive in php as "dog cat.txt".
* make everything on the language-level independent of your locale setings.
* always build the standalone executable as well as the chosen SAPI
target.
* make sure all source files have the "right" copyright.
* the following modules still use PHP3_TLS_*() macros (and thereby don't
work in ZTS mode): ext/db/db.c, ext/gd/gd.c
* make sure that all ZTS globals get destructed. Most ts_allocate_id()
calls should have a dtor entry.
* on some platforms unimplemented function will just do nothing
(e.g. symlink) they should print a warning or not even be defined!
(DONE ?)
* activate all extensions by default that don't rely on external
dependices. (eg ftp)
* --enable-all in configure. (--enable-shared=max ...)
* make configure print out a summary when it's done (like XEmacs)
* replace standard functions which work on static data with
reentrancy-safe functions (DONE?).
* on some platforms unimplemented function will just do nothing (e.g. symlink)
they should print a warning or not even be defined!
* implement javadoc based function docs template system.
* use thread-safe resolver functions (either require BIND 8 or adns).
* provide optional IPv6 support.
* make SAPI conform to CGI/1.1. Currently, all SAPI modules
define REMOTE_ADDR etc. themselves and reach only various level
of compliance.
* see what functions might need to be changed to use HashPosition, so
that the internal array pointer is not affected.
Other
* use thread-safe resolver functions (either require BIND 8 or adns).
* implement javadoc based function docs template system.
* provide optional IPv6 support (seems to be done?).
* find a better way to implement script timeouts. SIGVTALRM is used
by some POSIX threads implementations (i.e. OpenBSD) and is not
available in ZTS mode.
* Implement flush feature suitable for nested output buffers.
Streams
-------
* Route filestat.c through the wrapper layer; isolate the statcache code
so that it is independent of php functions and can be applied to any
stream/path.
* Implement generalized connection pool for stated protocols such as
ftp and http/1.1 (using keep-alive) to avoid having to negotiate
new command/request stream for each subsequent call; Possibly store
resources in contexts (creating a default context if necessary) to
allow segmentation of connection pools.
* Add a method to take ownership of the memory buffer in memory streams so
that generating string values for zvals doesn't require an estrdup.
* bundle and use curl lib for fopen wrapper.
* add aliases to functions to conform to new naming conventions, e.g.
str_to_upper().
* see what functions might need to be changed to use HashPosition, so
that the internal array pointer is not affected.
documentation
-------------
* Add remarks in the documentation which functions are not implemented
on win32.
* Add remarks in the documentation which functions are not binary-safe.
* Update curl documentation (DONE?)
* Add developer documentation.
* Add detailed documentation for Java extension.
ext/bz2
-------
* Add an ini directive to specify the size of decompression buffer.
The default 4k is too small for large files and also requires much time
for decompression. 40k is suitable for such files, however it may be too
much under certain environments. There should be appropriate default
settings for the various SAPI modules (e.g. apache and cli).
* add remarks in the documentation which functions are not implemented on win32.
* add remarks in the documentation which functions are not binary-safe.
* improve documentation for the sablotron extension
* update curl documentation
* write documentation for the bzip2 extension
* write documentation for the zziplib extension
ext/curl
--------
* Use the cURL write handler to save data for use when returning data or outputting
data.
* Have a warning scheme for when people use unsupported features.
ext/dav
--------
* rewrite.
ext/oci8
--------
* All OCIFetch*() functions should return 0 for no more data and false on
error.
* Have a flag that trims trailing spaces from CHAR fields on retrieval.
* Make allow_call_time_pass_reference=Off working.
* For additional todo information, see oci8.c, in ext/oci8
ext/odbc
--------
For PHP 4.3.0:
* update all php_error calls to php_error_docref where valid
* integrate EXPERIMENTAL ODBC update for use in PHP 5.0, use for
testing purposes only.
For PHP 5.0.0
* Activate EXPERIMENTAL ODBC codebase update
* all OCIFetch*() functions should return 0 for no more data and false on error.
* have a flag that trims trailing spaces from CHAR fields on retrieval.
* make allow_call_time_pass_reference=Off working.
* for additional todo information, see oci8.c, in ext/oci8
ext/pcre
--------
* Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe
* add option to preg_grep() to return entries that _don't_ match
ext/pcntl
---------
* Change internal callback handler to use TICKS
* Remove all zend_extension code
* Add object callback support to pcntl_signal()
ext/pgsql
---------
For PHP 4.3.0:
* Add pg_metadata() with metadata cache feature.
* Add pg_convert() to check and convert array value for query.
* Add pg_insert/pg_update/pg_delete/pg_select for simple query.
ext/sablot
----------
* Re-write the error handling and reporting interface
* Cleanup the underlying code a bit
* Add proper support for the message handlers
ext/session
-----------
For PHP 4.3.0:
* session_abort() to abort session. ie: Do not save session data.
* Allow unset($_SESSION) or unset($HTTP_SESSION_VARS) to unset
session vars regardless of register_globals setting.
Other:
* Maybe implement finer-grained session variables that could be
* maybe implement finer-grained session variables that could be
locked individually.
* Write a network-transparent storage back-end with fallover
* write a network-transparent storage back-end with fallover
facilities
* Provide a callback facility which is executed upon encountering
an unknown class name during deserialization
* provide a callback facility which is executed upon encountering
an unknown classname during deserialization
ext/sockets
-----------
* Make the extension work on windows (Daniel Beulshausen)
* Make the extension work with Solaris and the Sun GCC
ext/standard
------------
* Add a version number to data serialized via serialize().
* Possibly modify parsing of GPC data to automatically create arrays if
* add a version number to data serialized via serialize().
* array_add(). (Andrei)
* possibly modify parsing of GPC data to automatically create arrays if
variable name is seen more than once.
* Implement regex-cache for url-functions.
* Move socket related functions to fsock.c.
* implement regex-cache for url-functions.
* stri_replace(). (Andrei)
* move socket related functions to fsock.c.
* NOT binary safe:
strtok()
basename()
dirname()
strrpos()
strrchr()
strip_tags()
* rewrite win32 SMTP code to be useable for *ix to, maybe as a (default)
module of its own (Hartmut)
ext/zziplib
------------
* more fully support the zziplib api
ext/wddx
--------
* See if we can support the remaining data types:
* See if we can support the remaining datatypes:
dateTime
binary
recordset
http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm
(Andrei)
@@ -149,5 +140,3 @@ ext/wddx
other cool stuff
----------------
* PVM extension
vim:et:sw=4:ts=4
+35
View File
@@ -0,0 +1,35 @@
* Change the odbc_fetch_into() function to require ALWAYS the first two
parameters ($conn_id and $array), and make the third (row) be optional.
* Remove --with-openlink configure option (--with-iodbc replaces it).
* Always build CGI (--disable-cgi option to disable).
* Move most extensions and PEAR packages out of the PHP CVS tree,
include them again during release packaging.
* Renaming functions, so that they all are conform to one standard form.
* Allow foreach($array as $key => &$value).
* Allow foreach($array as list($var1, $var2)).
* Clean up "$instance = &new object" syntax (default to the =& behaviour?).
* Allow to set a default value for call-by-reference-parameters. eg:
function hallo (&$pallo = NULL) {}
* Change PHP error messages, so that they point to pages or sections in the
PHP Manual.
* Fix Zend shallow copy issues with objects and arrays.
* Make all extensions thread-safe.
* Finish PHP streams abstraction, nuke all that issock stuff, implement SSL
socket support. (wez)
- ext/ftp/ -> all FILEs to streams
- ext/bz2/ -> convert to stream impl.
* Using arg_separator.input to implode args in the CGI sapi extension
and arg_separator.input to explode in php_build_argv().
-5
View File
@@ -1,5 +0,0 @@
Zend Engine
-----------
- Look at making zend_constant value member be a zval* instead of zval. (Andi)
- Implement inheritance rules for type hints. (Marcus)
- Find a keyword for the if-set-or operator (apply the patch). (Marcus, all)
-109
View File
@@ -1,109 +0,0 @@
Component: Zend Engine 2
Important stuff to finish: PPP members/PPP methods,
support of overloaded extensions, possibly differentiate
between class and namespace as discussed with Stig in
Germany.
Responsibility: Zeev, Andi, Stas
Time frame: Couple of months for first part and extensions will be
ongoing while PHP is being fixed.
Things to leave for later versions: Native aggregation
support, accessing static members via object and not class.
Component: Aggregation
Responsibility: Andi, Stig?
Time frame: ?
Component: Redesign of API Versioning
Responsibility: ?
Time frame: 1 month
Component: Thread Safety
Identify the extensions that are not thread safe by design
or due to dependant libraries and identify them as such.
If possible try to resolve thread safety issue via code
improvements (if php code or patches will be accepted by
library maintainers). For situations where thread safety
cannot easily be acheived a flag in the extension API is
set so PHP can identify non-thread safe extensions. These
extensions will not be loaded in a ZTS compiled binary
(unless it is cli/cgi).
Responsibility: ?
Time frame: ?
Component: SAPI
Environment variables defined in the CGI spec need to be
verified in each SAPI module that they conform to the CGI
spec correctly. If they do not, the SAPI module needs to
fix the variable prior to script execution. Having this
conformity will aid in having PHP scripts run correctly
under different sapi modules.
Responsibility: Shane Caraveo & each sapi module owner
Timeframe: ? (but shouldn't be much effort, most modules are probably ok)
Component: Input Filtering
- Implement a SAPI input filter hook that will get called
just before registering a variable in the
treat_data/post_handler hooks. (done)
- Make sure this is also done in mbstring (done)
- Provide access functions, or perhaps a new
$_RAW_GET/POST/Cookie set of superglobals to get at the
unfiltered data
- Provide a .ini directive which allows people to set their
input filter to one of the built-in strip_tags,
htmlspecialchars or whatever other internal function might
be useful here.
- (The main benefit of this is to make it easier for people
to solve the XSS problem once and for all without having
to go through every line of their code and adding input
validation/filtering everywhere)
Responsibility: Rasmus
Timeframe: Yesterday
Component: RPC Abstraction Layer
Porting java, com, dotnet, xmlrpc, corba, soap and python, srm
(are there more ?) to work with the new oo api and preferably
by using ext/rpc.
Responsibility: Harald
Time frame: 2 months (but i have to wait for a few engine features first)
Component: OO Extensions
Each OO extension has to be revised and rewritten to fit into
the new OO model. We should decide which extensions are a must
to have for the release and which can be ported by the maintainer
later as a separate pecl release.
A list of extensions to be extended that have to be investigated:
* browscap
* aggregate
* all *sql extensions (*_fetch_object)
* domxml (seems like christian is rewriting it anyways)
* ming
Responsibility: Harald (, extension maintainers)
Component: Abstract Data Types (ADT)
Responsibility: Sterling, Harald
Time frame: ?
Component: Test Suite
Extending the test suite with atleast a test for every
function in an extension that doesn't require external
resources. Also developing an automated test thing which
cvs ups's, compiles and tests the build on a daily base on
as much platforms/extensions as possible.
The test suite will also be extended to support threaded
testing and testing for differing sapi modules (via http
calls or other methods).
Reponsibility: Derick (, extension maintainers)
Time frame: 3 months
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 1999-2006, Andi Gutmans, Sascha Schumann, Zeev Suraski.
Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski.
All rights reserved.
Redistribution and use in source and binary forms, with or without
+48 -238
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| Thread Safe Resource Manager |
+----------------------------------------------------------------------+
| Copyright (c) 1999-2009, Andi Gutmans, Sascha Schumann, Zeev Suraski |
| Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
| This source file is subject to the TSRM license, that is bundled |
| with this package in the file LICENSE |
+----------------------------------------------------------------------+
@@ -15,6 +15,7 @@
#ifdef ZTS
#include <stdio.h>
#include <stdlib.h>
#if HAVE_STDARG_H
#include <stdarg.h>
@@ -34,7 +35,6 @@ typedef struct {
size_t size;
ts_allocate_ctor ctor;
ts_allocate_dtor dtor;
int done;
} tsrm_resource_type;
@@ -80,7 +80,7 @@ static FILE *tsrm_error_file;
} \
}
#else
#define TSRM_ERROR(args)
#define TSRM_ERROR
#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
if (offset==0) { \
return &array; \
@@ -92,30 +92,13 @@ static FILE *tsrm_error_file;
#if defined(PTHREADS)
/* Thread local storage */
static pthread_key_t tls_key;
# define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what))
# define tsrm_tls_get() pthread_getspecific(tls_key)
#elif defined(TSRM_ST)
static int tls_key;
# define tsrm_tls_set(what) st_thread_setspecific(tls_key, (void*)(what))
# define tsrm_tls_get() st_thread_getspecific(tls_key)
#elif defined(TSRM_WIN32)
static DWORD tls_key;
# define tsrm_tls_set(what) TlsSetValue(tls_key, (void*)(what))
# define tsrm_tls_get() TlsGetValue(tls_key)
#elif defined(BETHREADS)
static int32 tls_key;
# define tsrm_tls_set(what) tls_set(tls_key, (void*)(what))
# define tsrm_tls_get() (tsrm_tls_entry*)tls_get(tls_key)
#else
# define tsrm_tls_set(what)
# define tsrm_tls_get() NULL
# warning tsrm_set_interpreter_context is probably broken on this platform
#endif
/* Startup TSRM (call once for the entire process) */
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
{
@@ -128,8 +111,6 @@ TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debu
st_key_create(&tls_key, 0);
#elif defined(TSRM_WIN32)
tls_key = TlsAlloc();
#elif defined(BETHREADS)
tls_key = tls_allocate();
#endif
tsrm_error_file = stderr;
@@ -174,13 +155,8 @@ TSRM_API void tsrm_shutdown(void)
int j;
next_p = p->next;
for (j=0; j<p->count; j++) {
if (p->storage[j]) {
if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
resource_types_table[j].dtor(p->storage[j], &p->storage);
}
free(p->storage[j]);
}
for (j=0; j<id_count; j++) {
free(p->storage[j]);
}
free(p->storage);
free(p);
@@ -203,7 +179,6 @@ TSRM_API void tsrm_shutdown(void)
#if defined(GNUPTH)
pth_kill();
#elif defined(PTHREADS)
pthread_setspecific(tls_key, 0);
pthread_key_delete(tls_key);
#elif defined(TSRM_WIN32)
TlsFree(tls_key);
@@ -238,7 +213,6 @@ TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].size = size;
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].ctor = ctor;
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].dtor = dtor;
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].done = 0;
/* enlarge the arrays for the already active threads */
for (i=0; i<tsrm_tls_table_size; i++) {
@@ -278,29 +252,30 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
(*thread_resources_ptr)->thread_id = thread_id;
(*thread_resources_ptr)->next = NULL;
#if defined(PTHREADS)
/* Set thread local storage to this new thread resources structure */
tsrm_tls_set(*thread_resources_ptr);
pthread_setspecific(tls_key, (void *) *thread_resources_ptr);
#elif defined(TSRM_ST)
st_thread_setspecific(tls_key, (void *) *thread_resources_ptr);
#elif defined(TSRM_WIN32)
TlsSetValue(tls_key, (void *) *thread_resources_ptr);
#endif
if (tsrm_new_thread_begin_handler) {
tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
}
for (i=0; i<id_count; i++) {
if (resource_types_table[i].done) {
(*thread_resources_ptr)->storage[i] = NULL;
} else
{
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
if (resource_types_table[i].ctor) {
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
}
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
if (resource_types_table[i].ctor) {
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
}
}
tsrm_mutex_unlock(tsmm_mutex);
if (tsrm_new_thread_end_handler) {
tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
}
tsrm_mutex_unlock(tsmm_mutex);
}
@@ -311,23 +286,21 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
int hash_value;
tsrm_tls_entry *thread_resources;
#ifdef NETWARE
/* The below if loop is added for NetWare to fix an abend while unloading PHP
* when an Apache unload command is issued on the system console.
* While exiting from PHP, at the end for some reason, this function is called
* with tsrm_tls_table = NULL. When this happened, the server abends when
* tsrm_tls_table is accessed since it is NULL.
*/
if(tsrm_tls_table) {
#endif
if (!th_id) {
#if defined(PTHREADS)
/* Fast path for looking up the resources for the current
* thread. Its used by just about every call to
* ts_resource_ex(). This avoids the need for a mutex lock
* and our hashtable lookup.
*/
thread_resources = tsrm_tls_get();
thread_resources = pthread_getspecific(tls_key);
#elif defined(TSRM_ST)
thread_resources = st_thread_getspecific(tls_key);
#elif defined(TSRM_WIN32)
thread_resources = TlsGetValue(tls_key);
#else
thread_resources = NULL;
#endif
if (thread_resources) {
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id));
/* Read a specific resource from the thread's resources.
@@ -373,68 +346,6 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
* changes to the structure as we read it.
*/
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
#ifdef NETWARE
} /* if(tsrm_tls_table) */
#endif
}
/* frees an interpreter context. You are responsible for making sure that
* it is not linked into the TSRM hash, and not marked as the current interpreter */
void tsrm_free_interpreter_context(void *context)
{
tsrm_tls_entry *next, *thread_resources = (tsrm_tls_entry*)context;
int i;
while (thread_resources) {
next = thread_resources->next;
for (i=0; i<thread_resources->count; i++) {
if (resource_types_table[i].dtor) {
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
}
}
for (i=0; i<thread_resources->count; i++) {
free(thread_resources->storage[i]);
}
free(thread_resources->storage);
free(thread_resources);
thread_resources = next;
}
}
void *tsrm_set_interpreter_context(void *new_ctx)
{
tsrm_tls_entry *current;
current = tsrm_tls_get();
/* TODO: unlink current from the global linked list, and replace it
* it with the new context, protected by mutex where/if appropriate */
/* Set thread local storage to this new thread resources structure */
tsrm_tls_set(new_ctx);
/* return old context, so caller can restore it when they're done */
return current;
}
/* allocates a new interpreter context */
void *tsrm_new_interpreter_context(void)
{
tsrm_tls_entry *new_ctx, *current;
THREAD_T thread_id;
thread_id = tsrm_thread_id();
tsrm_mutex_lock(tsmm_mutex);
current = tsrm_tls_get();
allocate_new_resource(&new_ctx, thread_id);
/* switch back to the context that was in use prior to our creation
* of the new one */
return tsrm_set_interpreter_context(current);
}
@@ -467,7 +378,11 @@ void ts_free_thread(void)
} else {
tsrm_tls_table[hash_value] = thread_resources->next;
}
tsrm_tls_set(0);
#if defined(PTHREADS)
pthread_setspecific(tls_key, 0);
#elif defined(TSRM_WIN32)
TlsSetValue(tls_key, 0);
#endif
free(thread_resources);
break;
}
@@ -480,83 +395,9 @@ void ts_free_thread(void)
}
/* frees all resources allocated for all threads except current */
void ts_free_worker_threads(void)
{
tsrm_tls_entry *thread_resources;
int i;
THREAD_T thread_id = tsrm_thread_id();
int hash_value;
tsrm_tls_entry *last=NULL;
tsrm_mutex_lock(tsmm_mutex);
hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
thread_resources = tsrm_tls_table[hash_value];
while (thread_resources) {
if (thread_resources->thread_id != thread_id) {
for (i=0; i<thread_resources->count; i++) {
if (resource_types_table[i].dtor) {
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
}
}
for (i=0; i<thread_resources->count; i++) {
free(thread_resources->storage[i]);
}
free(thread_resources->storage);
if (last) {
last->next = thread_resources->next;
} else {
tsrm_tls_table[hash_value] = thread_resources->next;
}
free(thread_resources);
if (last) {
thread_resources = last->next;
} else {
thread_resources = tsrm_tls_table[hash_value];
}
} else {
if (thread_resources->next) {
last = thread_resources;
}
thread_resources = thread_resources->next;
}
}
tsrm_mutex_unlock(tsmm_mutex);
}
/* deallocates all occurrences of a given id */
void ts_free_id(ts_rsrc_id id)
{
int i;
int j = TSRM_UNSHUFFLE_RSRC_ID(id);
tsrm_mutex_lock(tsmm_mutex);
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Freeing resource id %d", id));
if (tsrm_tls_table) {
for (i=0; i<tsrm_tls_table_size; i++) {
tsrm_tls_entry *p = tsrm_tls_table[i];
while (p) {
if (p->count > j && p->storage[j]) {
if (resource_types_table && resource_types_table[j].dtor) {
resource_types_table[j].dtor(p->storage[j], &p->storage);
}
free(p->storage[j]);
p->storage[j] = NULL;
}
p = p->next;
}
}
}
resource_types_table[j].done = 1;
tsrm_mutex_unlock(tsmm_mutex);
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully freed resource id %d", id));
}
@@ -581,8 +422,6 @@ TSRM_API THREAD_T tsrm_thread_id(void)
return PIThread_getCurrent();
#elif defined(TSRM_ST)
return st_thread_self();
#elif defined(BETHREADS)
return find_thread(NULL);
#endif
}
@@ -590,9 +429,10 @@ TSRM_API THREAD_T tsrm_thread_id(void)
/* Allocate a mutex */
TSRM_API MUTEX_T tsrm_mutex_alloc(void)
{
MUTEX_T mutexp;
MUTEX_T mutexp;
#ifdef TSRM_WIN32
mutexp = malloc(sizeof(CRITICAL_SECTION));
mutexp = malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(mutexp);
#elif defined(GNUPTH)
mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
@@ -606,25 +446,20 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void)
mutexp = PIPlatform_allocLocalMutex();
#elif defined(TSRM_ST)
mutexp = st_mutex_new();
#elif defined(BETHREADS)
mutexp = (beos_ben*)malloc(sizeof(beos_ben));
mutexp->ben = 0;
mutexp->sem = create_sem(1, "PHP sempahore");
#endif
#ifdef THR_DEBUG
printf("Mutex created thread: %d\n",mythreadid());
printf("Mutex created thread: %d\n",mythreadid());
#endif
return( mutexp );
return( mutexp );
}
/* Free a mutex */
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
{
if (mutexp) {
if (mutexp) {
#ifdef TSRM_WIN32
DeleteCriticalSection(mutexp);
free(mutexp);
#elif defined(GNUPTH)
free(mutexp);
#elif defined(PTHREADS)
@@ -636,77 +471,52 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
PISync_delete(mutexp);
#elif defined(TSRM_ST)
st_mutex_destroy(mutexp);
#elif defined(BETHREADS)
delete_sem(mutexp->sem);
free(mutexp);
#endif
}
}
#ifdef THR_DEBUG
printf("Mutex freed thread: %d\n",mythreadid());
printf("Mutex freed thread: %d\n",mythreadid());
#endif
}
/*
Lock a mutex.
A return value of 0 indicates success
*/
/* Lock a mutex */
TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
{
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id()));
#ifdef TSRM_WIN32
EnterCriticalSection(mutexp);
return 0;
return 1;
#elif defined(GNUPTH)
if (pth_mutex_acquire(mutexp, 0, NULL)) {
return 0;
}
return -1;
return pth_mutex_acquire(mutexp, 0, NULL);
#elif defined(PTHREADS)
return pthread_mutex_lock(mutexp);
#elif defined(NSAPI)
crit_enter(mutexp);
return 0;
return crit_enter(mutexp);
#elif defined(PI3WEB)
return PISync_lock(mutexp);
#elif defined(TSRM_ST)
return st_mutex_lock(mutexp);
#elif defined(BETHREADS)
if (atomic_add(&mutexp->ben, 1) != 0)
return acquire_sem(mutexp->sem);
return 0;
#endif
}
/*
Unlock a mutex.
A return value of 0 indicates success
*/
/* Unlock a mutex */
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
{
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id()));
#ifdef TSRM_WIN32
LeaveCriticalSection(mutexp);
return 0;
return 1;
#elif defined(GNUPTH)
if (pth_mutex_release(mutexp)) {
return 0;
}
return -1;
return pth_mutex_release(mutexp);
#elif defined(PTHREADS)
return pthread_mutex_unlock(mutexp);
#elif defined(NSAPI)
crit_exit(mutexp);
return 0;
return crit_exit(mutexp);
#elif defined(PI3WEB)
return PISync_unlock(mutexp);
#elif defined(TSRM_ST)
return st_mutex_unlock(mutexp);
#elif defined(BETHREADS)
if (atomic_add(&mutexp->ben, -1) != 1)
return release_sem(mutexp->sem);
return 0;
#endif
}
+8 -44
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| Thread Safe Resource Manager |
+----------------------------------------------------------------------+
| Copyright (c) 1999-2009, Andi Gutmans, Sascha Schumann, Zeev Suraski |
| Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
| This source file is subject to the TSRM license, that is bundled |
| with this package in the file LICENSE |
+----------------------------------------------------------------------+
@@ -13,51 +13,35 @@
#ifndef TSRM_H
#define TSRM_H
#if !defined(__CYGWIN__) && defined(WIN32)
#ifdef HAVE_CONFIG_H
# include "tsrm_config.h"
#endif
#ifdef WIN32
# define TSRM_WIN32
# include "tsrm_config.w32.h"
#else
# include <tsrm_config.h>
#endif
#ifdef TSRM_WIN32
# ifdef TSRM_EXPORTS
# define TSRM_API __declspec(dllexport)
# define TSRM_API __declspec(dllexport)
# else
# define TSRM_API __declspec(dllimport)
# define TSRM_API __declspec(dllimport)
# endif
#elif defined(__GNUC__) && __GNUC__ >= 4
# define TSRM_API __attribute__ ((visibility("default")))
#else
# define TSRM_API
#endif
#ifdef _WIN64
typedef __int64 tsrm_intptr_t;
typedef unsigned __int64 tsrm_uintptr_t;
#else
typedef long tsrm_intptr_t;
typedef unsigned long tsrm_uintptr_t;
#endif
/* Only compile multi-threading functions if we're in ZTS mode */
#ifdef ZTS
#ifdef TSRM_WIN32
# ifndef TSRM_INCLUDE_FULL_WINDOWS_HEADERS
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# include <shellapi.h>
#elif defined(GNUPTH)
# include <pth.h>
#elif defined(PTHREADS)
# include <pthread.h>
#elif defined(TSRM_ST)
# include <st.h>
#elif defined(BETHREADS)
#include <kernel/OS.h>
#include <TLS.h>
#endif
typedef int ts_rsrc_id;
@@ -81,13 +65,6 @@ typedef int ts_rsrc_id;
#elif defined(TSRM_ST)
# define THREAD_T st_thread_t
# define MUTEX_T st_mutex_t
#elif defined(BETHREADS)
# define THREAD_T thread_id
typedef struct {
sem_id sem;
int32 ben;
} beos_ben;
# define MUTEX_T beos_ben *
#endif
typedef void (*ts_allocate_ctor)(void *, void ***);
@@ -113,9 +90,6 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
/* frees all resources allocated for the current thread */
TSRM_API void ts_free_thread(void);
/* frees all resources allocated for all threads except current */
void ts_free_worker_threads(void);
/* deallocates all occurrences of a given id */
TSRM_API void ts_free_id(ts_rsrc_id id);
@@ -142,18 +116,10 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp);
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler);
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
/* these 3 APIs should only be used by people that fully understand the threading model
* used by PHP/Zend and the selected SAPI. */
TSRM_API void *tsrm_new_interpreter_context(void);
TSRM_API void *tsrm_set_interpreter_context(void *new_ctx);
TSRM_API void tsrm_free_interpreter_context(void *context);
#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
#define TSRMLS_D void ***tsrm_ls
#define TSRMLS_DC , TSRMLS_D
@@ -167,8 +133,6 @@ TSRM_API void tsrm_free_interpreter_context(void *context);
#else /* non ZTS */
#define TSRMLS_FETCH()
#define TSRMLS_FETCH_FROM_CTX(ctx)
#define TSRMLS_SET_CTX(ctx)
#define TSRMLS_D void
#define TSRMLS_DC
#define TSRMLS_C
+1 -1
View File
@@ -1,5 +1,5 @@
AC_DEFUN([AM_SET_LIBTOOL_VARIABLE],[
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
])
-10
View File
@@ -1,10 +0,0 @@
// vim:ft=javascript
// $Id$
if (CHECK_HEADER_ADD_INCLUDE("NewAPIs.h", "CFLAGS_PHP", php_usual_include_suspects)) {
// Need to add the flag directly, since TSRM doesn't include the config
// header
ADD_FLAG("CFLAGS_PHP", "/DHAVE_NEWAPIS_H=1");
}
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c tsrm_win32.c");
+5 -6
View File
@@ -7,13 +7,11 @@
* on Windows 95/NT.
*/
#include <windows.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <direct.h>
/* struct dirent - same as Unix */
@@ -27,10 +25,10 @@ struct dirent {
/* typedef DIR - not the same as Unix */
typedef struct {
HANDLE handle; /* _findfirst/_findnext handle */
long handle; /* _findfirst/_findnext handle */
short offset; /* offset into directory */
short finished; /* 1 if there are not more files */
WIN32_FIND_DATA fileinfo; /* from _findfirst/_findnext */
struct _finddata_t fileinfo; /* from _findfirst/_findnext */
char *dir; /* the dir we are reading */
struct dirent dent; /* the dirent to return */
} DIR;
@@ -40,6 +38,7 @@ DIR *opendir(const char *);
struct dirent *readdir(DIR *);
int readdir_r(DIR *, struct dirent *, struct dirent **);
int closedir(DIR *);
int rewinddir(DIR *);
void rewinddir(DIR *);
#endif /* READDIR_H */
+39 -55
View File
@@ -30,28 +30,25 @@ dnl PTHREADS_FLAGS
dnl
dnl Set some magic defines to achieve POSIX threads conformance
dnl
AC_DEFUN([PTHREADS_FLAGS],[
if test -z "$host_alias" && test -n "$host"; then
host_alias=$host
fi
AC_DEFUN(PTHREADS_FLAGS,[
if test -z "$host_alias"; then
AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess)
fi
case $host_alias in
case "$host_alias" in
*solaris*)
PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
*freebsd*)
PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
*linux*)
PTHREAD_FLAGS=-D_REENTRANT;;
PTHREAD_FLAGS="-D_REENTRANT";;
*aix*)
PTHREAD_FLAGS=-D_THREAD_SAFE;;
PTHREAD_FLAGS="-D_THREAD_SAFE";;
*irix*)
PTHREAD_FLAGS=-D_POSIX_THREAD_SAFE_FUNCTIONS;;
PTHREAD_FLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS";;
*hpux*)
PTHREAD_FLAGS=-D_REENTRANT;;
PTHREAD_FLAGS="-D_REENTRANT";;
*sco*)
PTHREAD_FLAGS=-D_REENTRANT;;
PTHREAD_FLAGS="-D_REENTRANT";;
dnl Solves sigwait() problem, creates problems with u_long etc.
dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";;
esac
@@ -65,7 +62,7 @@ dnl PTHREADS_CHECK_COMPILE
dnl
dnl Check whether the current setup can use POSIX threads calls
dnl
AC_DEFUN([PTHREADS_CHECK_COMPILE], [
AC_DEFUN(PTHREADS_CHECK_COMPILE, [
AC_TRY_RUN( [
#include <pthread.h>
#include <stddef.h>
@@ -80,19 +77,11 @@ int main() {
int data = 1;
pthread_mutexattr_init(&mattr);
return pthread_create(&thd, NULL, thread_routine, &data);
} ], [
pthreads_working=yes
} ], [
pthreads_working="yes"
], [
pthreads_working=no
], [
dnl For cross compiling running this test is of no use. NetWare supports pthreads
pthreads_working=no
case $host_alias in
*netware*)
pthreads_working=yes
esac
]
) ] )dnl
pthreads_working="no"
], pthreads_working="no" ) ] )dnl
dnl
dnl PTHREADS_CHECK()
dnl
@@ -108,46 +97,41 @@ dnl -pthreads gcc (Solaris)
dnl -qthreaded AIX cc V5
dnl -threads gcc (HP-UX)
dnl
AC_DEFUN([PTHREADS_CHECK],[
AC_DEFUN(PTHREADS_CHECK,[
if test "$beos_threads" = "1"; then
pthreads_working="yes"
ac_cv_pthreads_cflags=""
else
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
PTHREADS_ASSIGN_VARS
PTHREADS_CHECK_COMPILE
LIBS=$save_LIBS
CFLAGS=$save_CFLAGS
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
PTHREADS_ASSIGN_VARS
PTHREADS_CHECK_COMPILE
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
ac_cv_pthreads_cflags=
if test "$pthreads_working" != "yes"; then
for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do
ac_save=$CFLAGS
CFLAGS="$CFLAGS $flag"
PTHREADS_CHECK_COMPILE
CFLAGS=$ac_save
if test "$pthreads_working" = "yes"; then
ac_cv_pthreads_cflags=$flag
break
fi
done
fi
AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
ac_cv_pthreads_cflags=""
if test "$pthreads_working" != "yes"; then
for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do
ac_save="$CFLAGS"
CFLAGS="$CFLAGS $flag"
PTHREADS_CHECK_COMPILE
CFLAGS="$ac_save"
if test "$pthreads_working" = "yes"; then
ac_cv_pthreads_cflags="$flag"
break
fi
done
fi
])
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
ac_cv_pthreads_lib=
ac_cv_pthreads_lib=""
if test "$pthreads_working" != "yes"; then
for lib in pthread pthreads c_r; do
ac_save=$LIBS
ac_save="$LIBS"
LIBS="$LIBS -l$lib"
PTHREADS_CHECK_COMPILE
LIBS=$ac_save
LIBS="$ac_save"
if test "$pthreads_working" = "yes"; then
ac_cv_pthreads_lib=$lib
ac_cv_pthreads_lib="$lib"
break
fi
done
@@ -155,14 +139,14 @@ fi
])
if test "$pthreads_working" = "yes"; then
threads_result="POSIX-Threads found"
threads_result="POSIX Threads found"
else
threads_result="POSIX-Threads not found"
threads_result="POSIX Threads not found"
fi
])dnl
dnl
dnl
AC_DEFUN([PTHREADS_ASSIGN_VARS],[
AC_DEFUN(PTHREADS_ASSIGN_VARS,[
if test -n "$ac_cv_pthreads_lib"; then
LIBS="$LIBS -l$ac_cv_pthreads_lib"
fi
+18 -22
View File
@@ -1,6 +1,6 @@
dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
AC_DEFUN([TSRM_CHECK_GCC_ARG],[
AC_DEFUN(TSRM_CHECK_GCC_ARG,[
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
echo 'void somefunc() { };' > conftest.c
@@ -21,7 +21,7 @@ AC_DEFUN([TSRM_CHECK_GCC_ARG],[
fi
])
AC_DEFUN([TSRM_BASIC_CHECKS],[
AC_DEFUN(TSRM_BASIC_CHECKS,[
AC_REQUIRE([AC_PROG_CC])dnl
dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
@@ -33,7 +33,7 @@ AC_CHECK_HEADERS(stdarg.h)
])
AC_DEFUN([TSRM_CHECK_PTH],[
AC_DEFUN(TSRM_CHECK_PTH,[
AC_MSG_CHECKING(for GNU Pth)
PTH_PREFIX="`$1 --prefix`"
@@ -50,7 +50,7 @@ AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
])
AC_DEFUN([TSRM_CHECK_ST],[
AC_DEFUN(TSRM_CHECK_ST,[
if test -r "$1/include/st.h"; then
CPPFLAGS="$CPPFLAGS -I$1/include"
LDFLAGS="$LDFLAGS -L$1/lib"
@@ -58,7 +58,7 @@ AC_DEFUN([TSRM_CHECK_ST],[
CPPFLAGS="$CPPFLAGS -I$1"
LDFLAGS="$LDFLAGS -L$1"
fi
AC_CHECK_HEADERS(st.h,[],[
AC_CHECK_HEADERS(st.h,[ ],[
AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
])
LIBS="$LIBS -lst"
@@ -68,41 +68,37 @@ AC_DEFUN([TSRM_CHECK_ST],[
])
sinclude(threads.m4)
sinclude(TSRM/threads.m4)
AC_DEFUN([TSRM_CHECK_PTHREADS],[
AC_DEFUN(TSRM_CHECK_PTHREADS,[
PTHREADS_CHECK
if test "$beos_threads" = "1"; then
AC_DEFINE(BETHREADS, 1, Whether to use native BeOS threads)
else
if test "$pthreads_working" != "yes"; then
AC_MSG_ERROR(Your system seems to lack POSIX threads.)
fi
AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
AC_MSG_CHECKING(for POSIX threads)
AC_MSG_RESULT(yes)
if test "$pthreads_working" != "yes"; then
AC_MSG_ERROR(Your system seems to lack POSIX threads.)
fi
AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
AC_MSG_CHECKING(for POSIX threads)
AC_MSG_RESULT(yes)
])
AC_DEFUN([TSRM_THREADS_CHECKS],[
AC_DEFUN(TSRM_THREADS_CHECKS,[
dnl For the thread implementations, we always use --with-*
dnl to maintain consistency
AC_ARG_WITH(tsrm-pth,
[ --with-tsrm-pth[=pth-config]
Use GNU Pth],[
[ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
TSRM_PTH=$withval
],[
TSRM_PTH=no
])
AC_ARG_WITH(tsrm-st,
[ --with-tsrm-st Use SGI's State Threads],[
[ --with-tsrm-st],[
TSRM_ST=$withval
],[
TSRM_ST=no
-7
View File
@@ -1,15 +1,8 @@
#ifndef TSRM_CONFIG_W32_H
#define TSRM_CONFIG_W32_H
#include <../main/config.w32.h>
#define HAVE_UTIME 1
#define HAVE_ALLOCA 1
#define HAVE_REALPATH 1
#include <malloc.h>
#include <stdlib.h>
#include <crtdbg.h>
#undef inline
#ifdef ZEND_WIN32_FORCE_INLINE
+16 -39
View File
@@ -1,36 +1,23 @@
#ifndef TSRM_CONFIG_COMMON_H
#define TSRM_CONFIG_COMMON_H
#ifndef __CYGWIN__
# if WINNT|WIN32
# define TSRM_WIN32
# endif
#if WINNT|WIN32
# define TSRM_WIN32
#endif
#ifndef TSRM_WIN32
# include "tsrm_config.h"
# include <sys/param.h>
#else
# include "tsrm_config.w32.h"
#endif
#ifdef TSRM_WIN32
# include "tsrm_config.w32.h"
#else
# include <tsrm_config.h>
# include <sys/param.h>
#include <malloc.h>
#endif
#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
# include <alloca.h>
#endif
/* AIX requires this to be the first thing in the file. */
#ifndef __GNUC__
# ifndef HAVE_ALLOCA_H
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
# ifndef NETWARE
char *alloca ();
# endif
# endif
# endif
# endif
#if HAVE_ALLOCA_H
#include <alloca.h>
#endif
#if HAVE_UNISTD_H
@@ -44,27 +31,17 @@ char *alloca ();
#ifndef MAXPATHLEN
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
# elif defined(MAX_PATH)
# define MAXPATHLEN MAX_PATH
# else
# define MAXPATHLEN 256
# endif
#endif
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
# define TSRM_ALLOCA_MAX_SIZE 4096
# define TSRM_ALLOCA_FLAG(name) \
int name;
# define tsrm_do_alloca_ex(size, limit, use_heap) \
((use_heap = ((size) > (limit))) ? malloc(size) : alloca(size))
# define tsrm_do_alloca(size, use_heap) \
tsrm_do_alloca_ex(size, TSRM_ALLOCA_MAX_SIZE, use_heap)
# define tsrm_free_alloca(p, use_heap) \
do { if (use_heap) free(p); } while (0)
# define tsrm_do_alloca(p) alloca(p)
# define tsrm_free_alloca(p)
#else
# define TSRM_ALLOCA_FLAG(name)
# define tsrm_do_alloca(p, use_heap) malloc(p)
# define tsrm_free_alloca(p, use_heap) free(p)
# define tsrm_do_alloca(p) malloc(p)
# define tsrm_free_alloca(p) free(p)
#endif
#endif /* TSRM_CONFIG_COMMON_H */
-240
View File
@@ -1,240 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 6 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Venkat Raghavan S <rvenkat@novell.com> |
| Anantha Kesari H Y <hyanantha@novell.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include "TSRM.h"
#ifdef NETWARE
#ifdef USE_MKFIFO
#include <sys/stat.h>
#elif !defined(USE_PIPE_OPEN) /* NXFifoOpen */
#include <nks/fsio.h>
#endif
#include <nks/vm.h>
#include <nks/memory.h>
#include <string.h>
#include "mktemp.h"
/* strtok() call in LibC is abending when used in a different address space
* -- hence using PHP's version itself for now
*/
#include "tsrm_strtok_r.h"
#define tsrm_strtok_r(a,b,c) strtok((a),(b))
#define WHITESPACE " \t"
#define MAX_ARGS 10
TSRM_API FILE* popen(const char *commandline, const char *type)
{
char *command = NULL, *argv[MAX_ARGS] = {'\0'}, **env = NULL;
char *tempName = "sys:/php/temp/phpXXXXXX.tmp";
char *filePath = NULL;
char *ptr = NULL;
int ptrLen = 0, argc = 0, i = 0, envCount = 0, err = 0;
FILE *stream = NULL;
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
int pipe_handle;
int mode = O_RDONLY;
#else
NXHandle_t pipe_handle;
NXMode_t mode = NX_O_RDONLY;
#endif
NXExecEnvSpec_t envSpec;
NXNameSpec_t nameSpec;
NXVmId_t newVM = 0;
/* Check for validity of input parameters */
if (!commandline || !type)
return NULL;
/* Get temporary file name */
filePath = mktemp(tempName);
if (!filePath)
return NULL;
/* Set pipe mode according to type -- for now allow only "r" or "w" */
if (strcmp(type, "r") == 0)
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
mode = O_RDONLY;
#else
mode = NX_O_RDONLY;
#endif
else if (strcmp(type, "w") == 0)
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
mode = O_WRONLY;
#else
mode = NX_O_WRONLY;
#endif
else
return NULL;
#ifdef USE_PIPE_OPEN
pipe_handle = pipe_open(filePath, mode);
if (pipe_handle == -1)
return NULL;
#elif defined(USE_MKFIFO)
pipe_handle = mkfifo(filePath, mode);
if (pipe_handle == -1)
return NULL;
#else
/* - NetWare doesn't require first parameter
* - Allowing LibC to choose the buffer size for now
*/
err = NXFifoOpen(0, filePath, mode, 0, &pipe_handle);
if (err)
return NULL;
#endif
/* Copy the environment variables in preparation for the spawn call */
envCount = NXGetEnvCount() + 1; /* add one for NULL */
env = (char **) NXMemAlloc(sizeof(char *) * envCount, 0);
if (!env)
return NULL;
err = NXCopyEnv(env, envCount);
if (err) {
NXMemFree (env);
return NULL;
}
/* Separate commandline string into words */
ptr = tsrm_strtok_r((char*)commandline, WHITESPACE, NULL);
ptrLen = strlen(ptr);
command = (char*)malloc(ptrLen + 1);
if (!command) {
NXMemFree (env);
return NULL;
}
strcpy (command, ptr);
ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
while (ptr && (argc < MAX_ARGS)) {
ptrLen = strlen(ptr);
argv[argc] = (char*)malloc(ptrLen + 1);
if (!argv[argc]) {
NXMemFree (env);
if (command)
free (command);
for (i = 0; i < argc; i++) {
if (argv[i])
free (argv[i]);
}
return NULL;
}
strcpy (argv[argc], ptr);
argc++;
ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
}
/* Setup the execution environment and spawn new process */
envSpec.esFlags = 0; /* Not used */
envSpec.esArgc = argc;
envSpec.esArgv = (void **) argv;
envSpec.esEnv = (void **) env;
/* envSpec.esStdin.ssType = */
envSpec.esStdout.ssType = NX_OBJ_FIFO;
envSpec.esStderr.ssType = NX_OBJ_FILE;
/* 'ssHandle' is not a struct/union/class member */
/*
envSpec.esStdin.ssHandle =
envSpec.esStdout.ssHandle =
envSpec.esStderr.ssHandle = -1;
*/
envSpec.esStdin.ssPathCtx = NULL;
envSpec.esStdout.ssPathCtx = NULL;
envSpec.esStderr.ssPathCtx = NULL;
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
if (mode == O_RDONLY) {
#else
if (mode == NX_O_RDONLY) {
#endif
envSpec.esStdin.ssPath = filePath;
envSpec.esStdout.ssPath = stdout;
} else { /* Write Only */
envSpec.esStdin.ssPath = stdin;
envSpec.esStdout.ssPath = filePath;
}
envSpec.esStderr.ssPath = stdout;
nameSpec.ssType = NX_OBJ_FIFO;
/* nameSpec.ssHandle = 0; */ /* 'ssHandle' is not a struct/union/class member */
nameSpec.ssPathCtx = NULL; /* Not used */
nameSpec.ssPath = argv[0];
err = NXVmSpawn(&nameSpec, &envSpec, 0, &newVM);
if (!err)
/* Get file pointer corresponding to the pipe (file) opened */
stream = fdopen(pipe_handle, type);
/* Clean-up */
if (env)
NXMemFree (env);
if (pipe_handle)
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
close(pipe_handle);
#else
NXClose(pipe_handle);
#endif
if (command)
free (command);
for (i = 0; i < argc; i++) {
if (argv[i])
free (argv[i]);
}
return stream;
}
TSRM_API int pclose(FILE* stream)
{
int err = 0;
NXHandle_t fd = 0;
/* Get the process associated with this pipe (file) handle and terminate it */
fd = fileno(stream);
NXClose (fd);
err = fclose(stream);
return err;
}
#endif /* NETWARE */
-29
View File
@@ -1,29 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 6 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Venkat Raghavan S <rvenkat@novell.com> |
| Anantha Kesari H Y <hyanantha@novell.com> |
+----------------------------------------------------------------------+
*/
#ifndef TSRM_NW_H
#define TSRM_NW_H
#include "TSRM.h"
TSRM_API FILE* popen(const char *command, const char *type);
TSRM_API int pclose(FILE* stream);
#endif
+256 -1283
View File
File diff suppressed because it is too large. Load diff
+36 -172
View File
@@ -1,13 +1,13 @@
/*
+----------------------------------------------------------------------+
| PHP Version 6 |
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -37,18 +37,8 @@
#include <stdarg.h>
#endif
#ifdef ZTS
#define VIRTUAL_DIR
#endif
#ifndef TSRM_WIN32
#include <unistd.h>
#else
#include <direct.h>
#endif
#if defined(__osf__) || defined(_AIX)
#include <errno.h>
#endif
#ifdef TSRM_WIN32
@@ -60,40 +50,11 @@ typedef unsigned short mode_t;
#define DEFAULT_SLASH '\\'
#define DEFAULT_DIR_SEPARATOR ';'
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
#define IS_SLASH_P(c) (*(c) == '/' || \
(*(c) == '\\' && !IsDBCSLeadByte(*(c-1))))
#define DEFAULT_U_SLASH ((UChar)0x5c) /*'\\'*/
#define DEFAULT_U_DIR_SEPARATOR ((UChar)0x3b) /*';'*/
#define IS_U_SLASH(c) ((UChar32)(c) == (UChar32)0x2f /*'/'*/ || (UChar32)(c) == (UChar32)0x5c /*'\\'*/)
#define IS_U_SLASH_P(c) IS_SLASH(*(c))
/* COPY_WHEN_ABSOLUTE is 2 under Win32 because by chance both regular absolute paths
in the file system and UNC paths need copying of two characters */
#define COPY_WHEN_ABSOLUTE(path) 2
#define COPY_WHEN_ABSOLUTE 2
#define IS_ABSOLUTE_PATH(path, len) \
(len >= 2 && isalpha(path[0]) && path[1] == ':')
#define IS_UNC_PATH(path, len) \
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
#define IS_ABSOLUTE_PATH(path, len) \
(len >= 2 && ((isalpha(path[0]) && path[1] == ':') || IS_UNC_PATH(path, len)))
#elif defined(NETWARE)
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#define DEFAULT_SLASH '/'
#define DEFAULT_DIR_SEPARATOR ';'
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
#define IS_SLASH_P(c) IS_SLASH(*(c))
#define DEFAULT_U_SLASH ((UChar)0x2f) /*'/'*/
#define DEFAULT_U_DIR_SEPARATOR ((UChar)0x3b) /*';'*/
#define IS_U_SLASH(c) ((UChar32)(c) == (UChar32)0x2f /*'/'*/ || (UChar32)(c) == (UChar32)0x5c /*'\\'*/)
#define IS_U_SLASH_P(c) IS_U_SLASH(*(c))
/* Colon indicates volume name, either first character should be forward slash or backward slash */
#define IS_ABSOLUTE_PATH(path, len) \
((strchr(path, ':') != NULL) || ((len >= 1) && ((path[0] == '/') || (path[0] == '\\'))))
#else
#ifdef HAVE_DIRENT_H
@@ -101,27 +62,14 @@ typedef unsigned short mode_t;
#endif
#define DEFAULT_SLASH '/'
#ifdef __riscos__
#define DEFAULT_DIR_SEPARATOR ';'
#define DEFAULT_U_DIR_SEPARATOR ((UChar)0x3b) /*';'*/
#else
#define DEFAULT_DIR_SEPARATOR ':'
#define DEFAULT_U_DIR_SEPARATOR ((UChar)0x3a) /*':'*/
#endif
#define IS_SLASH(c) ((c) == '/')
#define IS_SLASH_P(c) IS_SLASH(*(c))
#define DEFAULT_U_SLASH ((UChar)0x2f) /*'/'*/
#define IS_U_SLASH(c) ((UChar32)(c) == (UChar32)0x2f /*'/'*/)
#define IS_U_SLASH_P(c) IS_U_SLASH(*(c))
#define DEFAULT_DIR_SEPARATOR ':'
#define IS_SLASH(c) ((c) == '/')
#endif
#ifndef COPY_WHEN_ABSOLUTE
#define COPY_WHEN_ABSOLUTE(path) 0
#define COPY_WHEN_ABSOLUTE 0
#endif
#ifndef IS_ABSOLUTE_PATH
@@ -134,21 +82,13 @@ typedef unsigned short mode_t;
#endif
#ifdef TSRM_WIN32
# ifdef CWD_EXPORTS
# define CWD_API __declspec(dllexport)
# else
# define CWD_API __declspec(dllimport)
# endif
#elif defined(__GNUC__) && __GNUC__ >= 4
# define CWD_API __attribute__ ((visibility("default")))
# ifdef CWD_EXPORTS
# define CWD_API __declspec(dllexport)
# else
# define CWD_API __declspec(dllimport)
# endif
#else
# define CWD_API
#endif
#ifdef TSRM_WIN32
CWD_API int php_sys_stat(const char *path, struct stat *buf);
#else
# define php_sys_stat stat
#define CWD_API
#endif
typedef struct _cwd_state {
@@ -172,7 +112,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
#if !defined(TSRM_WIN32)
#ifndef TSRM_WIN32
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
#endif
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
@@ -180,85 +120,26 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC);
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC);
CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC);
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
#if defined(TSRM_WIN32)
/* these are not defined in win32 headers */
#ifndef W_OK
#define W_OK 0x02
#endif
#ifndef R_OK
#define R_OK 0x04
#endif
#ifndef X_OK
#define X_OK 0x01
#endif
#ifndef F_OK
#define F_OK 0x00
#endif
#endif
#if HAVE_UTIME
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
#endif
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
#if !defined(TSRM_WIN32) && !defined(NETWARE)
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC);
#ifndef TSRM_WIN32
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC);
#endif
/* One of the following constants must be used as the last argument
in virtual_file_ex() call. */
#define CWD_EXPAND 0 /* expand "." and ".." but dont resolve symlinks */
#define CWD_FILEPATH 1 /* resolve symlinks if file is exist otherwise expand */
#define CWD_REALPATH 2 /* call realpath(), resolve symlinks. File must exist */
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath);
CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC);
#define REALPATH_CACHE_TTL (2*60) /* 2 minutes */
#define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */
typedef struct _realpath_cache_bucket {
unsigned long key;
char *path;
int path_len;
char *realpath;
int realpath_len;
int is_dir;
time_t expires;
#ifdef PHP_WIN32
unsigned char is_rvalid;
unsigned char is_readable;
unsigned char is_wvalid;
unsigned char is_writable;
#endif
struct _realpath_cache_bucket *next;
} realpath_cache_bucket;
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
typedef struct _virtual_cwd_globals {
cwd_state cwd;
long realpath_cache_size;
long realpath_cache_size_limit;
long realpath_cache_ttl;
realpath_cache_bucket *realpath_cache[1024];
} virtual_cwd_globals;
#ifdef ZTS
extern ts_rsrc_id cwd_globals_id;
# define CWDG(v) TSRMG(cwd_globals_id, virtual_cwd_globals *, v)
#else
extern virtual_cwd_globals cwd_globals;
# define CWDG(v) (cwd_globals.v)
#endif
CWD_API void realpath_cache_clean(TSRMLS_D);
CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC);
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC);
CWD_API int realpath_cache_size(TSRMLS_D);
CWD_API int realpath_cache_max_buckets(TSRMLS_D);
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
/* The actual macros to be used in programs using TSRM
* If the program defines VIRTUAL_DIR it will use the
* virtual_* functions
@@ -278,24 +159,22 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC)
#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC)
#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
#if !defined(TSRM_WIN32)
# define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
#ifdef TSRM_WIN32
#define VCWD_LSTAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
#else
#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
#endif
#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC)
#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC)
#define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC)
#define VCWD_OPENDIR(pathname) virtual_opendir(pathname TSRMLS_CC)
#define VCWD_POPEN(command, type) virtual_popen(command, type TSRMLS_CC)
#define VCWD_ACCESS(pathname, mode) virtual_access(pathname, mode TSRMLS_CC)
#if HAVE_UTIME
#define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC)
#endif
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group, 0 TSRMLS_CC)
#if HAVE_LCHOWN
#define VCWD_LCHOWN(path, owner, group) virtual_chown(path, owner, group, 1 TSRMLS_CC)
#endif
#ifndef TSRM_WIN32
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC)
#endif
#else
@@ -305,45 +184,30 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
#define VCWD_OPEN(path, flags) open(path, flags)
#define VCWD_OPEN_MODE(path, flags, mode) open(path, flags, mode)
#define VCWD_CREAT(path, mode) creat(path, mode)
/* rename on windows will fail if newname already exists.
MoveFileEx has to be used */
#if defined(TSRM_WIN32)
# define VCWD_RENAME(oldname, newname) (MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED) == 0 ? -1 : 0)
#else
# define VCWD_RENAME(oldname, newname) rename(oldname, newname)
#endif
#define VCWD_RENAME(oldname, newname) rename(oldname, newname)
#define VCWD_CHDIR(path) chdir(path)
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, chdir)
#define VCWD_GETWD(buf) getwd(buf)
#define VCWD_STAT(path, buff) php_sys_stat(path, buff)
#define VCWD_STAT(path, buff) stat(path, buff)
#define VCWD_LSTAT(path, buff) lstat(path, buff)
#define VCWD_UNLINK(path) unlink(path)
#define VCWD_MKDIR(pathname, mode) mkdir(pathname, mode)
#define VCWD_RMDIR(pathname) rmdir(pathname)
#define VCWD_OPENDIR(pathname) opendir(pathname)
#define VCWD_POPEN(command, type) popen(command, type)
#if defined(TSRM_WIN32)
#define VCWD_ACCESS(pathname, mode) tsrm_win32_access(pathname, mode)
#else
#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
#endif
#define VCWD_REALPATH(path, real_path) tsrm_realpath(path, real_path TSRMLS_CC)
#ifndef TSRM_WIN32
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
#else
#define VCWD_REALPATH(path, real_path) strcpy(real_path, path)
#endif
#if HAVE_UTIME
# ifdef TSRM_WIN32
# define VCWD_UTIME(path, time) win32_utime(path, time)
# else
# define VCWD_UTIME(path, time) utime(path, time)
# endif
#define VCWD_UTIME(path, time) utime(path, time)
#endif
#define VCWD_CHMOD(path, mode) chmod(path, mode)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#ifndef TSRM_WIN32
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
#if HAVE_LCHOWN
#define VCWD_LCHOWN(path, owner, group) lchown(path, owner, group)
#endif
#endif
#endif
+31 -390
View File
@@ -1,13 +1,13 @@
/*
+----------------------------------------------------------------------+
| PHP Version 6 |
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -18,21 +18,18 @@
/* $Id$ */
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <process.h>
#include <time.h>
#include <errno.h>
#define TSRM_INCLUDE_FULL_WINDOWS_HEADERS
#include "SAPI.h"
#include "TSRM.h"
#ifdef TSRM_WIN32
#include <Sddl.h>
#include <windows.h>
#include "tsrm_win32.h"
#include "tsrm_virtual_cwd.h"
#ifdef ZTS
static ts_rsrc_id win32_globals_id;
@@ -47,16 +44,6 @@ static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
globals->process_size = 0;
globals->shm_size = 0;
globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
/* Set it to INVALID_HANDLE_VALUE
* It will be initialized correctly in tsrm_win32_access or set to
* NULL if no impersonation has been done.
* the impersonated token can't be set here as the impersonation
* will happen later, in fcgi_accept_request (or whatever is the
* SAPI being used).
*/
globals->impersonation_token = INVALID_HANDLE_VALUE;
globals->impersonation_token_sid = NULL;
}
static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC)
@@ -78,13 +65,6 @@ static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC)
}
free(globals->comspec);
if (globals->impersonation_token && globals->impersonation_token != INVALID_HANDLE_VALUE ) {
CloseHandle(globals->impersonation_token);
}
if (globals->impersonation_token_sid) {
free(globals->impersonation_token_sid);
}
}
TSRM_API void tsrm_win32_startup(void)
@@ -103,303 +83,26 @@ TSRM_API void tsrm_win32_shutdown(void)
#endif
}
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
{
PSID pSid = TWG(impersonation_token_sid);
DWORD sid_len = pSid ? GetLengthSid(pSid) : 0;
TCHAR *ptcSid = NULL;
char *bucket_key = NULL;
if (!pSid) {
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + 1);
if (!bucket_key) {
return NULL;
}
memcpy(bucket_key, pathname, strlen(pathname));
return bucket_key;
}
if (!ConvertSidToStringSid(pSid, &ptcSid)) {
return NULL;
}
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + strlen(ptcSid) + 1);
if (!bucket_key) {
LocalFree(ptcSid);
return NULL;
}
memcpy(bucket_key, ptcSid, strlen(ptcSid));
memcpy(bucket_key + strlen(ptcSid), pathname, strlen(pathname) + 1);
LocalFree(ptcSid);
return bucket_key;
}
PSID tsrm_win32_get_token_sid(HANDLE hToken)
{
BOOL bSuccess = FALSE;
DWORD dwLength = 0;
PTOKEN_USER pTokenUser = NULL;
PSID sid;
PSID *ppsid = &sid;
DWORD sid_len;
PSID pResultSid = NULL;
/* Get the actual size of the TokenUser structure */
if (!GetTokenInformation(
hToken, TokenUser, (LPVOID) pTokenUser, 0, &dwLength)) {
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
goto Finished;
}
pTokenUser = (PTOKEN_USER)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwLength);
if (pTokenUser == NULL) {
goto Finished;
}
}
/* and fetch it now */
if (!GetTokenInformation(
hToken, TokenUser, (LPVOID) pTokenUser, dwLength, &dwLength)) {
goto Finished;
}
sid_len = GetLengthSid(pTokenUser->User.Sid);
/* ConvertSidToStringSid(pTokenUser->User.Sid, &ptcSidOwner); */
pResultSid = malloc(sid_len);
if (!pResultSid) {
goto Finished;
}
if (!CopySid(sid_len, pResultSid, pTokenUser->User.Sid)) {
goto Finished;
}
HeapFree(GetProcessHeap(), 0, (LPVOID)pTokenUser);
return pResultSid;
Finished:
if (pResultSid) {
free(pResultSid);
}
/* Free the buffer for the token groups. */
if (pTokenUser != NULL) {
HeapFree(GetProcessHeap(), 0, (LPVOID)pTokenUser);
}
return NULL;
}
TSRM_API int tsrm_win32_access(const char *pathname, int mode)
{
time_t t;
HANDLE thread_token;
PSID token_sid;
SECURITY_INFORMATION sec_info = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
GENERIC_MAPPING gen_map = { FILE_GENERIC_READ, FILE_GENERIC_WRITE, FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS };
DWORD priv_set_length = sizeof(PRIVILEGE_SET);
PRIVILEGE_SET privilege_set = {0};
DWORD sec_desc_length = 0, desired_access = 0, granted_access = 0;
BYTE * psec_desc = NULL;
BOOL fAccess = FALSE;
BOOL bucket_key_alloc = FALSE;
realpath_cache_bucket * bucket = NULL;
char * real_path = NULL;
TSRMLS_FETCH();
if (mode == 1 /*X_OK*/) {
DWORD type;
return GetBinaryType(pathname, &type) ? 0 : -1;
} else {
if(!IS_ABSOLUTE_PATH(pathname, strlen(pathname)+1)) {
real_path = (char *)malloc(MAX_PATH);
if(tsrm_realpath(pathname, real_path TSRMLS_CC) == NULL) {
goto Finished;
}
pathname = real_path;
}
if(access(pathname, mode)) {
free(real_path);
return errno;
}
/* If only existence check is made, return now */
if (mode == 0) {
free(real_path);
return 0;
}
/* Only in NTS when impersonate==1 (aka FastCGI) */
/*
AccessCheck() requires an impersonation token. We first get a primary
token and then create a duplicate impersonation token. The
impersonation token is not actually assigned to the thread, but is
used in the call to AccessCheck. Thus, this function itself never
impersonates, but does use the identity of the thread. If the thread
was impersonating already, this function uses that impersonation context.
*/
if(!OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE, &thread_token)) {
DWORD err = GetLastError();
if (GetLastError() == ERROR_NO_TOKEN) {
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &thread_token)) {
TWG(impersonation_token) = NULL;
goto Finished;
}
}
}
/* token_sid will be freed in tsrmwin32_dtor */
token_sid = tsrm_win32_get_token_sid(thread_token);
if (!token_sid) {
if (TWG(impersonation_token_sid)) {
free(TWG(impersonation_token_sid));
}
TWG(impersonation_token_sid) = NULL;
goto Finished;
}
/* Different identity, we need a new impersontated token as well */
if (!TWG(impersonation_token_sid) || !EqualSid(token_sid, TWG(impersonation_token_sid))) {
if (TWG(impersonation_token_sid)) {
free(TWG(impersonation_token_sid));
}
TWG(impersonation_token_sid) = token_sid;
/* Duplicate the token as impersonated token */
if (!DuplicateToken(thread_token, SecurityImpersonation, &TWG(impersonation_token))) {
goto Finished;
}
} else {
/* we already have it, free it then */
free(token_sid);
}
if (CWDG(realpath_cache_size_limit)) {
t = time(0);
bucket = realpath_cache_lookup(pathname, strlen(pathname), t TSRMLS_CC);
if(bucket == NULL && real_path == NULL) {
/* We used the pathname directly. Call tsrm_realpath */
/* so that entry is created in realpath cache */
real_path = (char *)malloc(MAX_PATH);
if(tsrm_realpath(pathname, real_path TSRMLS_CC) != NULL) {
pathname = real_path;
bucket = realpath_cache_lookup(pathname, strlen(pathname), t TSRMLS_CC);
}
}
}
/* Do a full access check because access() will only check read-only attribute */
if(mode == 0 || mode > 6) {
if(bucket != NULL && bucket->is_rvalid) {
fAccess = bucket->is_readable;
goto Finished;
}
desired_access = FILE_GENERIC_READ;
} else if(mode <= 2) {
if(bucket != NULL && bucket->is_wvalid) {
fAccess = bucket->is_writable;
goto Finished;
}
desired_access = FILE_GENERIC_WRITE;
} else if(mode <= 4) {
if(bucket != NULL && bucket->is_rvalid) {
fAccess = bucket->is_readable;
goto Finished;
}
desired_access = FILE_GENERIC_READ|FILE_FLAG_BACKUP_SEMANTICS;
} else { // if(mode <= 6)
if(bucket != NULL && bucket->is_rvalid && bucket->is_wvalid) {
fAccess = bucket->is_readable & bucket->is_writable;
goto Finished;
}
desired_access = FILE_GENERIC_READ | FILE_GENERIC_WRITE;
}
if(TWG(impersonation_token) == NULL) {
goto Finished;
}
/* Get size of security buffer. Call is expected to fail */
if(GetFileSecurity(pathname, sec_info, NULL, 0, &sec_desc_length)) {
goto Finished;
}
psec_desc = (BYTE *)malloc(sec_desc_length);
if(psec_desc == NULL ||
!GetFileSecurity(pathname, sec_info, (PSECURITY_DESCRIPTOR)psec_desc, sec_desc_length, &sec_desc_length)) {
goto Finished;
}
MapGenericMask(&desired_access, &gen_map);
if(!AccessCheck((PSECURITY_DESCRIPTOR)psec_desc, TWG(impersonation_token), desired_access, &gen_map, &privilege_set, &priv_set_length, &granted_access, &fAccess)) {
goto Finished_Impersonate;
}
/* Keep the result in realpath_cache */
if(bucket != NULL) {
if(desired_access == (FILE_GENERIC_READ|FILE_FLAG_BACKUP_SEMANTICS)) {
bucket->is_rvalid = 1;
bucket->is_readable = fAccess;
}
else if(desired_access == FILE_GENERIC_WRITE) {
bucket->is_wvalid = 1;
bucket->is_writable = fAccess;
} else if (desired_access == (FILE_GENERIC_READ | FILE_GENERIC_WRITE)) {
bucket->is_rvalid = 1;
bucket->is_readable = fAccess;
bucket->is_wvalid = 1;
bucket->is_writable = fAccess;
}
}
Finished_Impersonate:
if(psec_desc != NULL) {
free(psec_desc);
psec_desc = NULL;
}
Finished:
if(real_path != NULL) {
free(real_path);
real_path = NULL;
}
if(fAccess == FALSE) {
errno = EACCES;
return errno;
} else {
return 0;
}
}
}
static process_pair *process_get(FILE *stream TSRMLS_DC)
{
process_pair *ptr;
process_pair *newptr;
for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
if (ptr->stream == stream) {
break;
}
}
if (ptr < (TWG(process) + TWG(process_size))) {
return ptr;
}
newptr = (process_pair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(process_pair));
if (newptr == NULL) {
return NULL;
}
TWG(process) = newptr;
ptr = newptr + TWG(process_size);
TWG(process_size)++;
@@ -411,7 +114,7 @@ static shm_pair *shm_get(int key, void *addr)
shm_pair *ptr;
shm_pair *newptr;
TSRMLS_FETCH();
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
if (!ptr->descriptor) {
continue;
@@ -426,12 +129,12 @@ static shm_pair *shm_get(int key, void *addr)
if (ptr < (TWG(shm) + TWG(shm_size))) {
return ptr;
}
newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair));
if (newptr == NULL) {
return NULL;
}
TWG(shm) = newptr;
ptr = newptr + TWG(shm_size);
TWG(shm_size)++;
@@ -447,55 +150,25 @@ static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
}
TSRM_API FILE *popen(const char *command, const char *type)
{
return popen_ex(command, type, NULL, NULL);
}
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env)
{
FILE *stream = NULL;
int fno, type_len = strlen(type), read, mode;
int fno, str_len = strlen(type), read, mode;
STARTUPINFO startup;
PROCESS_INFORMATION process;
SECURITY_ATTRIBUTES security;
HANDLE in, out;
DWORD dwCreateFlags = 0;
BOOL res;
process_pair *proc;
char *cmd;
int i;
char *ptype = (char *)type;
HANDLE thread_token = NULL;
HANDLE token_user = NULL;
BOOL asuser = TRUE;
process_pair *proc;
TSRMLS_FETCH();
if (!type) {
return NULL;
}
/*The following two checks can be removed once we drop XP support */
type_len = strlen(type);
if (type_len <1 || type_len > 2) {
return NULL;
}
for (i=0; i < type_len; i++) {
if (!(*ptype == 'r' || *ptype == 'w' || *ptype == 'b' || *ptype == 't')) {
return NULL;
}
ptype++;
}
security.nLength = sizeof(SECURITY_ATTRIBUTES);
security.bInheritHandle = TRUE;
security.lpSecurityDescriptor = NULL;
if (!type_len || !CreatePipe(&in, &out, &security, 2048L)) {
if (!str_len || !CreatePipe(&in, &out, &security, 2048L)) {
return NULL;
}
memset(&startup, 0, sizeof(STARTUPINFO));
memset(&process, 0, sizeof(PROCESS_INFORMATION));
@@ -504,7 +177,8 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
read = (type[0] == 'r') ? TRUE : FALSE;
mode = ((type_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT;
mode = ((str_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT;
if (read) {
in = dupHandle(in, FALSE);
@@ -516,43 +190,21 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
}
dwCreateFlags = NORMAL_PRIORITY_CLASS;
if (strcmp(sapi_module.name, "cli") != 0) {
dwCreateFlags |= CREATE_NO_WINDOW;
}
/* Get a token with the impersonated user. */
if(OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE, &thread_token)) {
DuplicateTokenEx(thread_token, MAXIMUM_ALLOWED, &security, SecurityImpersonation, TokenPrimary, &token_user);
} else {
DWORD err = GetLastError();
if (err == ERROR_NO_TOKEN) {
asuser = FALSE;
}
}
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
if (asuser) {
res = CreateProcessAsUser(token_user, NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);
CloseHandle(token_user);
} else {
res = CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);
}
free(cmd);
if (!res) {
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c "));
sprintf(cmd, "%s /c %s", TWG(comspec), command);
if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, NULL, NULL, &startup, &process)) {
return NULL;
}
free(cmd);
CloseHandle(process.hThread);
proc = process_get(NULL TSRMLS_CC);
if (read) {
fno = _open_osfhandle((tsrm_intptr_t)in, _O_RDONLY | mode);
fno = _open_osfhandle((long)in, _O_RDONLY | mode);
CloseHandle(out);
} else {
fno = _open_osfhandle((tsrm_intptr_t)out, _O_WRONLY | mode);
fno = _open_osfhandle((long)out, _O_WRONLY | mode);
CloseHandle(in);
}
@@ -573,7 +225,7 @@ TSRM_API int pclose(FILE *stream)
}
fflush(process->stream);
fclose(process->stream);
fclose(process->stream);
WaitForSingleObject(process->prochnd, INFINITE);
GetExitCodeProcess(process->prochnd, &termstat);
@@ -601,6 +253,9 @@ TSRM_API int shmget(int key, int size, int flags)
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
if ((!shm_handle && !info_handle)) {
if (flags & IPC_EXCL) {
return -1;
}
if (flags & IPC_CREAT) {
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, shm_segment);
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
@@ -609,10 +264,6 @@ TSRM_API int shmget(int key, int size, int flags)
if ((!shm_handle || !info_handle)) {
return -1;
}
} else {
if (flags & IPC_EXCL) {
return -1;
}
}
shm = shm_get(key, NULL);
@@ -705,14 +356,4 @@ TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
return -1;
}
}
TSRM_API char *realpath(char *orig_path, char *buffer)
{
int ret = GetFullPathName(orig_path, _MAX_PATH, buffer, NULL);
if(!ret || ret > _MAX_PATH) {
return NULL;
}
return buffer;
}
#endif
#endif
+10 -13
View File
@@ -1,13 +1,13 @@
/*
+----------------------------------------------------------------------+
| PHP Version 6 |
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -22,6 +22,8 @@
#define TSRM_WIN32_H
#include "TSRM.h"
#ifdef TSRM_WIN32
#include <windows.h>
struct ipc_perm {
@@ -63,8 +65,6 @@ typedef struct {
int process_size;
int shm_size;
char *comspec;
HANDLE impersonation_token;
PSID impersonation_token_sid;
} tsrm_win32_globals;
#ifdef ZTS
@@ -73,6 +73,8 @@ typedef struct {
# define TWG(v) (win32_globals.v)
#endif
#endif
#define IPC_PRIVATE 0
#define IPC_CREAT 00001000
#define IPC_EXCL 00002000
@@ -90,21 +92,16 @@ typedef struct {
#define SHM_RND FILE_MAP_WRITE
#define SHM_REMAP FILE_MAP_COPY
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC);
TSRM_API void tsrm_win32_startup(void);
TSRM_API void tsrm_win32_shutdown(void);
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env);
TSRM_API FILE *popen(const char *command, const char *type);
TSRM_API int pclose(FILE *stream);
TSRM_API int tsrm_win32_access(const char *pathname, int mode);
TSRM_API int win32_utime(const char *filename, struct utimbuf *buf);
TSRM_API int shmget(int key, int size, int flags);
TSRM_API void *shmat(int key, const void *shmaddr, int flags);
TSRM_API int shmdt(const void *shmaddr);
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
TSRM_API char *realpath(char *orig_path, char *buffer);
#endif
#endif
-41998
View File
File diff suppressed because it is too large. Load diff
-56
View File
@@ -1,56 +0,0 @@
--------------------------------------------------------------------
The Zend Engine License, Version 2.00
Copyright (c) 1999-2006 Zend Technologies Ltd. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. The names "Zend" and "Zend Engine" must not be used to endorse
or promote products derived from this software without prior
permission from Zend Technologies Ltd. For written permission,
please contact license@zend.com.
4. Zend Technologies Ltd. may publish revised and/or new versions
of the license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the
terms of that version. You may also choose to use such covered
code under the terms of any subsequent version of the license
published by Zend Technologies Ltd. No one other than Zend
Technologies Ltd. has the right to modify the terms applicable
to covered code created under this License.
5. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes the Zend Engine, freely available at
http://www.zend.com"
6. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
"The Zend Engine is freely available at http://www.zend.com"
THIS SOFTWARE IS PROVIDED BY ZEND TECHNOLOGIES LTD. ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZEND
TECHNOLOGIES LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
--------------------------------------------------------------------
-54
View File
@@ -1,54 +0,0 @@
## Process this file with automake to produce Makefile.in -*- makefile -*-
#CLEANFILES = zend_language_parser.c zend_language_parser.h zend_language_scanner.c zend_language_parser.output zend_ini_parser.c zend_ini_parser.h zend_ini_scanner.c zend_ini_parser.output
AUTOMAKE_OPTIONS=foreign
noinst_LTLIBRARIES=libZend.la
libZend_la_SOURCES=\
zend_language_parser.y zend_language_scanner.l \
zend_ini_parser.y zend_ini_scanner.l \
zend_alloc.c zend_compile.c zend_constants.c \
zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \
zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
zend_ini.c zend_qsort.c zend_objects.c zend_object_handlers.c \
zend_objects_API.c zend_ts_hash.c zend_stream.c \
zend_default_classes.c \
zend_iterators.c zend_interfaces.c zend_exceptions.c \
zend_strtod.c zend_strtod.c zend_strtol.c zend_closures.c zend_float.c
libZend_la_LDFLAGS =
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
# automake isn't too clever about "non-standard" use of lex and yacc
$(libZend_la_OBJECTS): zend_language_parser.h
zend_ini_scanner.lo: zend_ini_parser.h
# Language parser/scanner rules
zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
$(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_language_scanner_defs.h -o$@ $(srcdir)/zend_language_scanner.l
zend_language_parser.h: zend_language_parser.c
zend_language_parser.c: $(srcdir)/zend_language_parser.y
$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o zend_language_parser.c
# INI parser/scanner rules
zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c
zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
$(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_ini_scanner_defs.h -o$@ $(srcdir)/zend_ini_scanner.l
zend_ini_parser.h: zend_ini_parser.c
depend:
zend_execute.lo: $(srcdir)/zend_execute.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(INLINE_CFLAGS) -c $(srcdir)/zend_execute.c
-1
View File
@@ -1 +0,0 @@
Zend/zend_execute.lo: $(srcdir)/zend_vm_execute.h $(srcdir)/zend_vm_opcodes.h
-195
View File
@@ -1,195 +0,0 @@
Creating an object
------------------
Object can be created in the following ways:
1. As a result of a function call. E.g.:
$foo = create_new_foo("parameter");
$foo->run();
The function should create a new zval, create new object and get the
handle for it, set handle and handler table as needed. Note that the
handle is the only ID of the object, so it should be enough to
identify it.
2. Overriding create_object handler for class. E.g.:
$foo = new Java("some.Class.here", "parameter");
$foo->run();
The create_object handler function should create a new zval, create
new object and get the handle for it, set handle and handler table as
needed, and also provide constructor method that would handle
constructor call. The get_constructor handler table entry should be
used for that. Do not rely class entry's constructor, unless you refer
to it from get_constructor handler.
Object maintenance
------------------
The handlers add_ref and del_ref are called when a new zval referring
to the object is created. This does not create a new object - both
zvals still refer to the same object.
clone_obj handler should create a new object, identical to an old one,
but being a separate entity.
delete_obj should destroy an object, all references to it become
invalid.
Object access - read
--------------------
read_property is used to read object's property. This value is not
meant to be changed. The handler returns zval * with the value.
Object access - write
---------------------
write_property is used to directly write object's property by
name. This handler is used to assign property variables or to change them
in operations like += or ++ (unless get_property_zval_ptr is also set).
get_property_zval_ptr is used to obtain pointer to modifiable zval for
operations like += or ++. This should be used only if your object model
stores properties as real zval's that can be modified from outside.
Otherwise this handler should be NULL and the engine will use
read_property and write_property instead.
get_property_ptr is used to obtain zval ** for future writing to
it. If your object properties are stored as zval*, return real place
where the property is stored. If the aren't, the best way is to create
proxy object and handle it via get and set methods (see below).
This method is meant to be used for send-by-reference and assign-by-reference
use of object properties. If you don;t want to implement property
referencing for your objects, you can set this handler to NULL.
get and set handlers are used when engine needs to access the object
as a value. E.g., in the following situation:
$foo =& $obj->bar;
$foo = 1;
if $foo is an object (e.g., proxy object from get_property_ptr) it
would be accessed using write handler.
Object access - method call
---------------------------
get_method handler is used to find method description by name. It
should set right type, function name and parameter mask for the
method. If the type is ZEND_OVERLOADED_FUNCTION, the method would be
called via call_method handler, otherwise it would be called with
standard Zend means.
get_constructor performs the same function as get_method, but for the
object constructor.
call_method handler is used to perform method call. Parameters are
passed like to any other Zend internal function.
Object - comparison
-------------------
Objects can be compared via compare_objects handler. This is used with
== operation, === compares objects by handles, i.e., return true if
and only if it's really the same object. Note that objects from
different object types (i.e., having different handlers) can not be
compared.
Objects - reflection
--------------------
get_class_name is used to retrieve class name of the object.
get_class_entry returns class entry (zend_class_entry) for the object,
in case there exists PHP class for it.
No other reflection functions are currently implemented.
Objects - data structures and handlers
---------------------------------------
The object is represented by the following structure:
struct _zend_object_value {
zend_object_handle handle;
zend_object_handlers *handlers;
};
handle is an ID of the object among the objects of the same type (not
class!). The type of the object and how it behaves is determined by
the handler table.
typedef struct _zend_object_handlers {
zend_object_add_ref_t add_ref;
zend_object_del_ref_t del_ref;
zend_object_delete_obj_t delete_obj;
zend_object_clone_obj_t clone_obj;
zend_object_read_property_t read_property;
zend_object_write_property_t write_property;
zend_object_get_property_ptr_t get_property_ptr;
zend_object_get_property_zval_ptr_t get_property_zval_ptr;
zend_object_get_t get;
zend_object_set_t set;
zend_object_has_property_t has_property;
zend_object_unset_property_t unset_property;
zend_object_get_properties_t get_properties;
zend_object_get_method_t get_method;
zend_object_call_method_t call_method;
zend_object_get_constructor_t get_constructor;
zend_object_get_class_entry_t get_class_entry;
zend_object_get_class_name_t get_class_name;
zend_object_compare_t compare_objects;
} zend_object_handlers;
See zend_object_handlers.h for prototypes. All objects are passed as zval's.
Handlers explained:
add_ref - called when a copy of the object handle is created.
del_ref - called when a copy of the object handle is destroyed.
delete_obj - called when an object needs to be destroyed.
clone_obj - called when a new object identical to an old one should be
created (unlike Zend Engine 1, this never happens unless explicitly
asked for).
read_property - returns zval *, containing the value of the
property. Is used when value of the property should be retrieved for
reading.
write_property - assigns value to certain property of the object.
get_property_zval_ptr - retrieves zval** for being directly modified by
the engine. If your properties are not zval's, don't define it.
get_property_ptr - retrieves zval** for the property of the value, to
be used for read and write. If object properties are not zval's
natively, this method should create and return proxy object for use
with get and set methods.
get - retrieves zval* for object contents. To be used mainly with
proxy objects from get_property_ptr, but also may be used for
convert_to_* functions.
set - sets value for object contents. To be used mainly with
proxy objects from get_property_ptr.
has_property - checks if the object has certain property set.
unset_property - removes value for the property of the object
get_method - retrieves description of the method
call_method - calls the method (parameters should be put on stack like
for any other PHP internal function).
get_constructor - get description for the object constructor method
get_class_entry - should return the class entry for the object
get_class_name - get the name of the class the object belongs to
compare_objects - compares if two objects are equal
-34
View File
@@ -1,34 +0,0 @@
Zend Memory Manager
===================
General:
--------
The goal of the new memory manager (available since PHP 5.2) is to reduce memory
allocation overhead and speedup memory management.
The new manager's "configure" has no "--disable-zend-memory-manager" option,
but it has "--enable-malloc-mm" instead. It is enabled by default in DEBUG
build and disabled by default in RELEASE build. when enabled it allows selecting
between malloc and emalloc at runtime so you can use internal and external memory
debuggers without recompilation.
Debugging:
----------
Normal:
$ sapi/cli/php -r 'leak();'
Zend MM disabled:
$ USE_ZEND_ALLOC=0 valgrind --leak-check=full sapi/cli/php -r 'leak();'
Tweaking:
---------
The Zend MM can be tweaked using ZEND_MM_MEM_TYPE and ZEND_MM_SEG_SIZE environment
variables. Default values are "malloc" and "256K". Dependent on target system you
can also use "mmap_anon", "mmap_zero" and "win32" storage managers.
$ ZEND_MM_MEM_TYPE=mmap_anon ZEND_MM_SEG_SIZE=1M sapi/cli/php ..etc.
-108
View File
@@ -1,108 +0,0 @@
ZEND_VM
=======
ZEND_VM architecture allows specializing opcode handlers according to op_type
fields and using different execution methods (call threading, switch threading
and direct threading). As a result ZE2 got more than 20% speedup on raw PHP
code execution (with specialized executor and direct threading execution
method). As in most PHP applications raw execution speed isn't the limiting
factor but system calls and database callls are, your mileage with this patch
will vary.
Most parts of the old zend_execute.c go into zend_vm_def.h. Here you can
find opcode handlers and helpers. The typical opcode handler template looks
like this:
ZEND_VM_HANDLER(<OPCODE-NUMBER>, <OPCODE>, <OP1_TYPES>, <OP2_TYPES>)
{
<HANDLER'S CODE>
}
<OPCODE-NUMBER> is a opcode number (0, 1, ...)
<OPCODE> is an opcode name (ZEN_NOP, ZEND_ADD, :)
<OP1_TYPES> & <OP2_TYPES> are masks for allowed operand op_types. Specializer
will generate code only for defined combination of types. You can use any
combination of the following op_types UNUSED, CONST, VAR, TMP and CV also
you can use ANY mask to disable specialization according operand's op_type.
<HANDLER'S CODE> is a handler's code itself. For most handlers it stills the
same as in old zend_execute.c, but now it uses macros to access opcode operands
and some internal executor data.
You can see the conformity of new macros to old code in the following list:
EXECUTE_DATA
execute_data
ZEND_VM_DISPATCH_TO_HANDLER(<OP>)
return <OP>_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)
ZEND_VM_DISPATCH_TO_HELPER(<NAME>)
return <NAME>(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)
ZEND_VM_DISPATCH_TO_HELPER_EX(<NAME>,<PARAM>,<VAL>)
return <NAME>(<VAL>, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)
ZEND_VM_CONTINUE()
return 0
ZEND_VM_NEXT_OPCODE()
NEXT_OPCODE()
ZEND_VM_SET_OPCODE(<TARGET>
SET_OPCODE(<TARGET>
ZEND_VM_INC_OPCODE()
INC_OPCOD()
ZEND_VM_RETURN_FROM_EXECUTE_LOOP()
RETURN_FROM_EXECUTE_LOOP()
ZEND_VM_C_LABEL(<LABEL>):
<LABEL>:
ZEND_VM_C_GOTO(<LABEL>)
goto <LABEL>
OP<X>_TYPE
opline->op<X>.op_type
GET_OP<X>_ZVAL_PTR(<TYPE>)
get_zval_ptr(&opline->op<X>, EX(Ts), &free_op<X>, <TYPE>)
GET_OP<X>_ZVAL_PTR_PTR(<TYPE>)
get_zval_ptr_ptr(&opline->op<X>, EX(Ts), &free_op<X>, <TYPE>)
GET_OP<X>_OBJ_ZVAL_PTR(<TYPE>)
get_obj_zval_ptr(&opline->op<X>, EX(Ts), &free_op<X>, <TYPE>)
GET_OP<X>_OBJ_ZVAL_PTR_PTR(<TYPE>)
get_obj_zval_ptr_ptr(&opline->op<X>, EX(Ts), &free_op<X>, <TYPE>)
IS_OP<X>_TMP_FREE()
IS_TMP_FREE(free_op<X>)
FREE_OP<X>()
FREE_OP(free_op<X>)
FREE_OP<X>_IF_VAR()
FREE_VAR(free_op<X>)
FREE_OP<X>_VAR_PTR()
FREE_VAR_PTR(free_op<X>)
Executor's helpers can be defined without parameters or with one parameter.
This is done with the following constructs:
ZEND_VM_HELPER(<HELPER-NAME>, <OP1_TYPES>, <OP2_TYPES>)
{
<HELPER'S CODE>
}
ZEND_VM_HELPER_EX(<HELPER-NAME>, <OP1_TYPES>, <OP2_TYPES>, <PARAM_SPEC>)
{
<HELPER'S CODE>
}
Executor's code is generated by PHP script zend_vm_gen.php it uses zend_vm_def.h
and zend_vm_execute.skl as input and produces zend_vm_opcodes.h and
zend_vm_execute.h. The first file is a list of opcode definitions. It is
included from zend_compile.h. The second one is an executor code itself. It is
included from zend_execute.c.
zend_vm_gen.php can produce different kind of executors. You can select
different opcode threading model using --with-vm-kind=CALL|SWITCH|GOTO. You can
disable opcode specialization using --without-specializer. You can include or
exclude old executor together with specialized one using --without-old-executor.
At last you can debug executor using original zend_vm_def.h or generated file
zend_vm_execute.h. Debugging with original file requires --with-lines
option. By default ZE2 uses the following command to generate executor:
$ php zend_vm_gen.php --with-vm-kind=CALL
Zend Engine II currently includes two executors during the build process, one
is the specialized version and the other is the old one non-specialized with
function handlers. By default Zend Engine II uses the specialized one but you
can switch to the old executor at runtime by calling zend_vm_use_old_executor().
-136
View File
@@ -1,136 +0,0 @@
Revamped object model using object handles
===========================================
Background
----------
In the Zend Engine 1.0 (and its predecessor the PHP 3 scripting
engine) the object model's design is that instantiated objects are
language values. This means that when programmers are performing
operations, such variable assignment and passing parameters to
functions, objects are handled very similarly to the way other
primitive types are handled such as integers and strings.
Semantically this means that the whole object is being copied. The
approach Java takes is different where one refers to objects by handle
and not by value (one can think of a handle as an objects' ID).
Need
----
Unfortunately, the approach taken up to now has severely limited the
Zend Engine's object oriented model, both feature and simplicity
wise. One of the main problems with the former approach is that object
instantiation and duplication is very hard to control, a problem which
can not only lead to inefficient development but also often to strange
run-time behavior. Changing the object model to a handle oriented
model will allow the addressing of many needs such as destructors,
de-referencing method return values, tight control of object
duplication and more.
Overview
--------
The proposed object model is very much influenced by the Java
model. In general, when you create a new object you will be getting a
handle to the object instead of the object itself. When this handle is
sent to functions, assigned and copied it is only the handle which is
copied/sent/assigned. The object itself is never copied nor
duplicated. This results in all handles of this object to always point
at the same object making it a very consistent solution and saving
unnecessary duplication and confusing behavior.
Functionality
-------------
After this change the basic use of objects will be almost identical to
previous versions of the scripting engine. However, you won't bump
into awkward and confusing copying & destructing of objects. In order
to create and use a new object instance you will do the following:
$object = new MyClass(); $object->method();
The previous code will assign $object the handle of a new instance of
the class MyClass and call one of its methods.
Consider the following code:
1 class MyClass
2 {
3 function setMember($value)
4 {
5 $this->member = $value;
6 }
7
8 function getMember()
9 {
10 return $this->member;
11 }
12 }
13
14 function foo($obj)
15 {
16 $obj->setMember("foo");
17 }
18
19 $object = new MyClass();
20 $object->setMember("bar");
21 foo($object);
22 print $object->getMember();
Without the new Java-like handles, at line 20 the objects' data member
member is set to the string value of "bar". Because of the internal
representation of objects in the Zend Engine 1.0, the object is marked
as a reference, and when it is sent by value to the function foo, it
is duplicated (!). Therefore, the call to foo() on line 21 will
result in the $obj->setMember("foo") call being called on a duplicate
of $object. Line 22 will then result in "bar" being printed.
This is how the scripting engine has worked until today. Most
developers are probably unaware of the fact that they aren't always
talking to the same object but often duplicates; others may have
realized this can usually be solved by always passing objects by
reference (unless a replica is actually desired, which is uncommon).
The new object model will allow for a much more intuitive
implementation of the code. On line 21, the object's handle (ID) is
passed to foo() by value. Inside foo(), the object is fetched
according to this handle and, therefore, the setMember() method is
called on the originally instantiated object and not a copy. Line 22
will therefore result in "foo" being printed. This approach gives
developers tighter control of when objects are created and duplicated.
An additional not-as-important benefit is that the object handle will
be passed to foo() by value, which most probably will also save
unnecessary duplication of the value containing the ID itself and thus
additionally improving run-time performance.
This was just a simple description of why the new object model solves
awkward behavior and makes object handling much easier, intuitive and
efficient. The importance of this change goes far beyond what is
mentioned in this section as you will see in further sections which
describe new features with a majority of them being based on this
change.
Compatibility Notes
--------------------
Many PHP programmers aren't even aware of the copying quirks of the
current object model and, therefore, there is a relatively good chance
that the amount of PHP applications that will work out of the box or
after a very small amount of modifications would be high.
To simplify migration, version 2.0 will support an optional
'auto-clone' feature, which will perform a cloning of the object
whenever it would have been copied in version 1.0. Optionally, it
will also be possible to request that the engine will emit an E_NOTICE
message whenever such an automatic clone occurs, in order to allow
developers to gradually migrate to the version 2.0-style behavior
(without automatic clones).
Dependencies
------------
The new object model is not dependent on other features. Many of the
other Zend Engine 2.0 features, such as the $foo->bar()->barbara()
syntax, destructors and others completely rely on this new object
model.
-169
View File
@@ -1,169 +0,0 @@
Title: Zend 2.0 Namespaces
Version: $Revision$
Status: declined
Maintainer: Stig S. Bakken <ssb@php.net>
Created: 2001-09-08
Modified: 2001-09-08
1. Background/Need
==================
PHP and Zend 1.0 have come to a point where a lot of reusable code is
being written; from simple functions and classes to entire application
frameworks. It is becoming increasingly difficult to avoid symbol
name collisions with the current scoping methods.
The symbol scopes available in Zend 1.0 are the global scope, the
class scope and the function scope. All scopes but classes may
contain variables, only the class and global scopes may contain
functions, while only the global scope may contain constants and
classes. This means that all of Zend 1.0's scoping methods are
inherently limited for solving symbol name collision problems.
2. Overview
===========
Namespaces in Zend 2.0 provide a way to manage the symbol collision
problem by making it possible to define multiple symbol tables able to
contain all types of symbols. Zend will get the notion of a current
namespace, defaulting to the current global one. The current name
space may be changed on a file-by-file basis. Symbols in other name
spaces than the current one may be referenced using a new namespace
operator. It will be possible to "import" symbols from one namespace
into another.
3. Functionality
================
3.1. Namespace Syntax
=====================
The namespace operator ":" is used to refer to symbols in other
namespaces than the current one:
Class: Namespace:class
Function: Namespace:function
Static method: Namespace:class::method
Variable: $Namespace:variable
Constant: Namespace:CONSTANT
Class variable: $Namespace:class::variable
To refer to symbols in the global namespace, symbols are prefixed with
only the namespace operator:
Class: :class
Function: :function
Static method: :class::method
Variable: $:variable
Constant: :CONSTANT
Class variable: $:class::variable
Note: $:variable will effectively be just another syntax for
$GLOBALS['variable'].
A namespace may have a name containing a ":", it is always the last
":" character in the symbol qualifier that is the actual namespace
operator:
Class: Name:Space:class
Function: Name:Space:function
Static method: Name:Space:class::method
Variable: $Name:Space:variable
Constant: Name:Space:CONSTANT
Class variable: $Name:Space:class::variable
(Here, the ":" between "Name" and "Space" is part of the name, it is
the one after "Space" that is the namespace operator.)
3.2. Defining Namespaces
========================
Individual files may define a namespace that will apply to the entire
file. If no "namespace" operator occurs in the file, it will be in
the global namespace:
1 namespace HTML;
2
3 class Form {
4 function Form() {
5 // constructor
6 }
7 // ...
8 }
Or with the "nested" name syntax:
1 namespace HTML:Form;
2
3 class Image {
4 var $src;
5 function Image($src) {
6 $this->src = $src;
7 }
8 // ...
9 }
Code executed within the "HTML" namespace may refer to the Form class
as just "Form". Code executed from within other namespaces has to
refer to it as "HTML:Form". The "namespace" statement must occur
before any other statements in the file.
# [ssb 2001-09-08]:
# Should it be possible to "add" symbols to a namespace by including a
# second file with the same namespace statement?
3.3. Importing Symbols
======================
It is possible to import symbols from another namespace into the
current one with the "import" statement:
import * from HTML; // all symbols
import Form from HTML; // single symbols
import Form,Table from HTML; // multiple symbols
There is a potential for name clashes between symols of different
types that have the same qualifier syntax. These are resolved in this
order: class, function, constant.
Optionally, the symbol type may be explicitly given to import (as
"class", "function", "variable" or "constant"):
import class Form from HTML;
And finally, you may import all symbols of a given type:
import constant * from HTML:Table;
The namespace with its symbols must already be defined before using
"import".
4. Compatibility Notes
======================
Old code that does not take advantage of namespaces will run without
modifications.
5. Dependencies
===============
The class variable syntax depends on this class variables being
implemented in the new ZE2 object model.
6. Acknowledgements
===================
Andi Gutmans <andi@zend.com> and Zeev Suraski <zeev@zend.com> for
initial ZE2 namespaces proposal
Dean Hall <php@apt7.com> for the initial symbol qualification syntax
-72
View File
@@ -1,72 +0,0 @@
Title: Loose type requirements for functions
Version: $Revision$
Status: draft
Maintainer: Brian Moon <brianm@dealnews.com>
Created: 2001-09-17
Modified: 2001-09-17
1. Background/Need
==================
Many internal function of PHP will reject parameters because of their
type (the array and variable function come to mind). For userland
this is not an easy task as there is no uniform way to do it. An
addition to the engine for requiring loose types would allow
delevopers to know that the data passed to their functions is of the
correct type and reduce the need for duplicating the same code in
every function to check for the type of data.
2. Overview
===========
Loose typing mostly means evaluating the contents of the variable and
not the type of the variable itself. The requirements for this would
and should work much like several of the is_* functions do now.
The typing of parameters would be optional and those not typed would
simply continue to be treated as they are now.
3. Functionality
================
3.1. Allowed Types
==================
Only loose types should be needed to ensure the data is usable by the
function. Duplicating the functionallity of is_scalar, is_resource,
is_array and is_object should give developers all the information they
need to use a variable correctly.
3.2. Syntax
===========
The current function syntax should be expanded to allow typing of
variables inline in a C style.
function foo ($var){
}
could be changed to require an array such as:
function foo (array $var){
}
3.3. Errors
===========
Mis-matches in type should be reported as fatal errors and should halt
the execution of a script as that function can not be run and code
following could not reliably run.
4. Compatibility Notes
======================
Old code that does not take advantage of this will run without
modifications.
-1166
View File
File diff suppressed because it is too large. Load diff
-602
View File
@@ -1,602 +0,0 @@
# Microsoft Developer Studio Project File - Name="Zend" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=Zend - Win32 Release_inline
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Zend.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Zend.mak" CFG="Zend - Win32 Release_inline"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Zend - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "Zend - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "Zend - Win32 Release_inline" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Zend - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40d /d "NDebug"
# ADD RSC /l 0x40d /d "NDebug"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x40d /d "_Debug"
# ADD RSC /l 0x40d /d "_Debug"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
# PROP BASE Use_MFC 0
# PROP BASE Output_Dir "Zend___Win32_Release_inline"
# PROP BASE Intermediate_Dir "Zend___Win32_Release_inline"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Output_Dir "Release_inline"
# PROP Intermediate_Dir "Release_inline"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /FR /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40d /d "NDebug"
# ADD RSC /l 0x40d /d "NDebug"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "Zend - Win32 Release"
# Name "Zend - Win32 Debug"
# Name "Zend - Win32 Release_inline"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\zend.c
# End Source File
# Begin Source File
SOURCE=.\zend_alloc.c
# End Source File
# Begin Source File
SOURCE=.\zend_API.c
# End Source File
# Begin Source File
SOURCE=.\zend_builtin_functions.c
# End Source File
# Begin Source File
SOURCE=.\zend_closures.c
# End Source File
# Begin Source File
SOURCE=.\zend_compile.c
# End Source File
# Begin Source File
SOURCE=.\zend_constants.c
# End Source File
# Begin Source File
SOURCE=.\zend_default_classes.c
# End Source File
# Begin Source File
SOURCE=.\zend_execute.c
# End Source File
# Begin Source File
SOURCE=.\zend_execute_API.c
# End Source File
# Begin Source File
SOURCE=.\zend_extensions.c
# End Source File
# Begin Source File
SOURCE=.\zend_float.c
# End Source File
# Begin Source File
SOURCE=.\zend_hash.c
# End Source File
# Begin Source File
SOURCE=.\zend_highlight.c
# End Source File
# Begin Source File
SOURCE=.\zend_indent.c
# End Source File
# Begin Source File
SOURCE=.\zend_ini.c
# End Source File
# Begin Source File
SOURCE=.\zend_ini_parser.c
# End Source File
# Begin Source File
SOURCE=.\zend_ini_scanner.c
# End Source File
# Begin Source File
SOURCE=.\zend_interfaces.c
# End Source File
# Begin Source File
SOURCE=".\zend_language_parser.c"
# End Source File
# Begin Source File
SOURCE=".\zend_language_scanner.c"
# End Source File
# Begin Source File
SOURCE=.\zend_list.c
# End Source File
# Begin Source File
SOURCE=.\zend_llist.c
# End Source File
# Begin Source File
SOURCE=.\zend_object_handlers.c
# End Source File
# Begin Source File
SOURCE=.\zend_objects.c
# End Source File
# Begin Source File
SOURCE=.\zend_objects_API.c
# End Source File
# Begin Source File
SOURCE=.\zend_opcode.c
# End Source File
# Begin Source File
SOURCE=.\zend_operators.c
# End Source File
# Begin Source File
SOURCE=.\zend_ptr_stack.c
# End Source File
# Begin Source File
SOURCE=.\zend_qsort.c
# End Source File
# Begin Source File
SOURCE=.\zend_reflection_api.c
# End Source File
# Begin Source File
SOURCE=.\zend_sprintf.c
# End Source File
# Begin Source File
SOURCE=.\zend_stack.c
# End Source File
# Begin Source File
SOURCE=.\zend_stream.c
# End Source File
# Begin Source File
SOURCE=.\zend_strtod.c
# End Source File
# Begin Source File
SOURCE=.\zend_ts_hash.c
# End Source File
# Begin Source File
SOURCE=.\zend_variables.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\FlexLexer.h
# End Source File
# Begin Source File
SOURCE=.\zend.h
# End Source File
# Begin Source File
SOURCE=.\zend_alloc.h
# End Source File
# Begin Source File
SOURCE=.\zend_API.h
# End Source File
# Begin Source File
SOURCE=.\zend_builtin_functions.h
# End Source File
# Begin Source File
SOURCE=.\zend_compile.h
# End Source File
# Begin Source File
SOURCE=.\zend_config.w32.h
# End Source File
# Begin Source File
SOURCE=.\zend_constants.h
# End Source File
# Begin Source File
SOURCE=.\zend_default_classes.h
# End Source File
# Begin Source File
SOURCE=.\zend_errors.h
# End Source File
# Begin Source File
SOURCE=.\zend_execute.h
# End Source File
# Begin Source File
SOURCE=.\zend_execute_locks.h
# End Source File
# Begin Source File
SOURCE=.\zend_extensions.h
# End Source File
# Begin Source File
SOURCE=.\zend_fast_cache.h
# End Source File
# Begin Source File
SOURCE=.\zend_globals.h
# End Source File
# Begin Source File
SOURCE=.\zend_globals_macros.h
# End Source File
# Begin Source File
SOURCE=.\zend_hash.h
# End Source File
# Begin Source File
SOURCE=.\zend_highlight.h
# End Source File
# Begin Source File
SOURCE=.\zend_indent.h
# End Source File
# Begin Source File
SOURCE=.\zend_ini.h
# End Source File
# Begin Source File
SOURCE=.\zend_ini_parser.h
# End Source File
# Begin Source File
SOURCE=.\zend_ini_scanner.h
# End Source File
# Begin Source File
SOURCE=.\zend_interfaces.h
# End Source File
# Begin Source File
SOURCE=.\zend_istdiostream.h
# End Source File
# Begin Source File
SOURCE=".\zend_language_parser.h"
# End Source File
# Begin Source File
SOURCE=".\zend_language_scanner.h"
# End Source File
# Begin Source File
SOURCE=.\zend_list.h
# End Source File
# Begin Source File
SOURCE=.\zend_llist.h
# End Source File
# Begin Source File
SOURCE=.\zend_modules.h
# End Source File
# Begin Source File
SOURCE=.\zend_object_handlers.h
# End Source File
# Begin Source File
SOURCE=.\zend_objects.h
# End Source File
# Begin Source File
SOURCE=.\zend_objects_API.h
# End Source File
# Begin Source File
SOURCE=.\zend_operators.h
# End Source File
# Begin Source File
SOURCE=.\zend_ptr_stack.h
# End Source File
# Begin Source File
SOURCE=.\zend_qsort.h
# End Source File
# Begin Source File
SOURCE=.\zend_reflection_api.h
# End Source File
# Begin Source File
SOURCE=.\zend_stack.h
# End Source File
# Begin Source File
SOURCE=.\zend_stream.h
# End Source File
# Begin Source File
SOURCE=.\zend_strtod.h
# End Source File
# Begin Source File
SOURCE=.\zend_ts_hash.h
# End Source File
# Begin Source File
SOURCE=.\zend_variables.h
# End Source File
# End Group
# Begin Group "Parsers"
# PROP Default_Filter "y"
# Begin Source File
SOURCE=.\zend_ini_parser.y
!IF "$(CFG)" == "Zend - Win32 Release"
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
# Begin Custom Build
InputDir=.
InputPath=.\zend_ini_parser.y
BuildCmds= \
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
!ENDIF
# End Source File
# Begin Source File
SOURCE=".\zend_language_parser.y"
!IF "$(CFG)" == "Zend - Win32 Release"
# Begin Custom Build
InputDir=.
InputPath=".\zend_language_parser.y"
BuildCmds= \
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
# Begin Custom Build
InputDir=.
InputPath=".\zend_language_parser.y"
BuildCmds= \
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
# Begin Custom Build
InputDir=.
InputPath=".\zend_language_parser.y"
BuildCmds= \
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# End Group
# Begin Group "Scanners"
# PROP Default_Filter "l"
# Begin Source File
SOURCE=.\flex.skl
# End Source File
# Begin Source File
SOURCE=.\zend_ini_scanner.l
!IF "$(CFG)" == "Zend - Win32 Release"
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
# Begin Custom Build
InputPath=.\zend_ini_scanner.l
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
!ENDIF
# End Source File
# Begin Source File
SOURCE=".\zend_language_scanner.l"
!IF "$(CFG)" == "Zend - Win32 Release"
# Begin Custom Build
InputPath=".\zend_language_scanner.l"
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
# Begin Custom Build
InputPath=".\zend_language_scanner.l"
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
# Begin Custom Build
InputPath=".\zend_language_scanner.l"
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
# End Custom Build
!ENDIF
# End Source File
# End Group
# Begin Group "Text Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\ZEND_BUGS
# End Source File
# Begin Source File
SOURCE=.\ZEND_CHANGES
# End Source File
# Begin Source File
SOURCE=.\ZEND_TODO
# End Source File
# End Group
# Begin Group "Resources"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\zend.ico
# End Source File
# End Group
# End Target
# End Project
-419
View File
@@ -1,419 +0,0 @@
dnl
dnl $Id$
dnl
dnl This file contains Zend specific autoconf functions.
dnl
AC_DEFUN([LIBZEND_CHECK_INT_TYPE],[
AC_MSG_CHECKING(for $1)
AC_TRY_COMPILE([
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_INTTYPES_H
#include <inttypes.h>
#elif HAVE_STDINT_H
#include <stdint.h>
#endif],
[if (($1 *) 0)
return 0;
if (sizeof ($1))
return 0;
],[
AC_DEFINE_UNQUOTED([HAVE_]translit($1,a-z_-,A-Z__), 1,[Define if $1 type is present. ])
AC_MSG_RESULT(yes)
], AC_MSG_RESULT(no)
)dnl
])
AC_DEFUN([LIBZEND_BASIC_CHECKS],[
AC_REQUIRE([AC_PROG_YACC])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_CC_C_O])
AC_REQUIRE([AC_HEADER_STDC])
LIBZEND_BISON_CHECK
dnl Ugly hack to get around a problem with gcc on AIX.
if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
"`uname -sv`" = "AIX 4"; then
CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
fi
dnl Hack to work around a Mac OS X cpp problem
dnl Known versions needing this workaround are 5.3 and 5.4
if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
CPPFLAGS="$CPPFLAGS -traditional-cpp"
fi
AC_CHECK_HEADERS(
inttypes.h \
stdint.h \
limits.h \
malloc.h \
string.h \
unistd.h \
stdarg.h \
sys/types.h \
sys/time.h \
signal.h \
unix.h \
stdlib.h \
dlfcn.h)
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_DEFUN([LIBZEND_LIBDL_CHECKS],[
AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"])
AC_CHECK_FUNC(dlopen,[AC_DEFINE(HAVE_LIBDL, 1,[ ])])
])
AC_DEFUN([LIBZEND_DLSYM_CHECK],[
dnl
dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name.
dnl
AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names])
_LT_AC_TRY_DLOPEN_SELF([
AC_MSG_RESULT(no)
], [
AC_MSG_RESULT(yes)
AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ])
], [
AC_MSG_RESULT(no)
], [])
])
dnl This is required for QNX and may be some BSD derived systems
AC_CHECK_TYPE( uint, unsigned int )
AC_CHECK_TYPE( ulong, unsigned long )
dnl Check if int32_t and uint32_t are defined
LIBZEND_CHECK_INT_TYPE(int32_t)
LIBZEND_CHECK_INT_TYPE(uint32_t)
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_FUNC_MEMCMP
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass sigsetjmp)
AC_ZEND_BROKEN_SPRINTF
AC_CHECK_FUNCS(finite isfinite isinf isnan)
ZEND_FP_EXCEPT
ZEND_CHECK_FLOAT_PRECISION
dnl test whether double cast to long preserves least significant bits
AC_MSG_CHECKING(whether double cast to long preserves least significant bits)
AC_TRY_RUN([
#include <limits.h>
int main()
{
if (sizeof(long) == 4) {
double d = (double) LONG_MIN * LONG_MIN + 2e9;
if ((long) d == 2e9 && (long) -d == -2e9) {
exit(0);
}
} else if (sizeof(long) == 8) {
double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */
if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */
exit(0);
}
}
exit(1);
}
], [
AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
], [
AC_MSG_RESULT(no)
])
])
AC_DEFUN([LIBZEND_ENABLE_DEBUG],[
AC_ARG_ENABLE(debug,
[ --enable-debug Compile with debugging symbols],[
ZEND_DEBUG=$enableval
],[
ZEND_DEBUG=no
])
])
AC_DEFUN([LIBZEND_OTHER_CHECKS],[
AC_ARG_WITH(zend-vm,
[ --with-zend-vm=TYPE Set virtual machine dispatch method. Type is
one of "CALL", "SWITCH" or "GOTO" [TYPE=CALL]],[
PHP_ZEND_VM=$withval
],[
PHP_ZEND_VM=CALL
])
AC_ARG_ENABLE(maintainer-zts,
[ --enable-maintainer-zts Enable thread safety - for code maintainers only!!],[
ZEND_MAINTAINER_ZTS=$enableval
],[
ZEND_MAINTAINER_ZTS=no
])
AC_ARG_ENABLE(inline-optimization,
[ --disable-inline-optimization
If building zend_execute.lo fails, try this switch],[
ZEND_INLINE_OPTIMIZATION=$enableval
],[
ZEND_INLINE_OPTIMIZATION=yes
])
AC_MSG_CHECKING([virtual machine dispatch method])
AC_MSG_RESULT($PHP_ZEND_VM)
AC_MSG_CHECKING(whether to enable thread-safety)
AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
AC_MSG_CHECKING(whether to enable inline optimization for GCC)
AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
AC_MSG_CHECKING(whether to enable Zend debugging)
AC_MSG_RESULT($ZEND_DEBUG)
case $PHP_ZEND_VM in
SWITCH)
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_SWITCH,[virtual machine dispatch method])
;;
GOTO)
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_GOTO,[virtual machine dispatch method])
;;
*)
PHP_ZEND_VM=CALL
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_CALL,[virtual machine dispatch method])
;;
esac
if test "$ZEND_DEBUG" = "yes"; then
AC_DEFINE(ZEND_DEBUG,1,[ ])
echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g"
if test "$CFLAGS" = "-g -O2"; then
CFLAGS=-g
fi
changequote({,})
if test -n "$GCC"; then
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
"$CC" --help=warnings|grep -q -- '-Wpointer-arith[ \t]' && \
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wpointer-arith"
"$CC" --help=warnings|grep -q -- '-Wdeclaration-after-statement[ \t]' && \
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wdeclaration-after-statement"
test "$USE_MAINTAINER_MODE" = "yes" && \
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
fi
changequote([,])
else
AC_DEFINE(ZEND_DEBUG,0,[ ])
fi
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
AC_DEFINE(ZTS,1,[ ])
CFLAGS="$CFLAGS -DZTS"
LIBZEND_CPLUSPLUS_CHECKS
fi
changequote({,})
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
else
INLINE_CFLAGS="$CFLAGS"
fi
changequote([,])
AC_C_INLINE
AC_SUBST(INLINE_CFLAGS)
AC_MSG_CHECKING(target system is Darwin)
if echo "$target" | grep "darwin" > /dev/null; then
AC_DEFINE([DARWIN], 1, [Define if the target system is darwin])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl test and set the alignment define for ZEND_MM
dnl this also does the logarithmic test for ZEND_MM.
AC_MSG_CHECKING(for MM alignment and log values)
AC_TRY_RUN([
#include <stdio.h>
typedef union _mm_align_test {
void *ptr;
double dbl;
long lng;
} mm_align_test;
#if (defined (__GNUC__) && __GNUC__ >= 2)
#define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test))
#else
#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
#endif
int main()
{
int i = ZEND_MM_ALIGNMENT;
int zeros = 0;
FILE *fp;
while (i & ~0x1) {
zeros++;
i = i >> 1;
}
fp = fopen("conftest.zend", "w");
fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
fclose(fp);
exit(0);
}
], [
LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
LIBZEND_MM_ALIGN_LOG2=`cat conftest.zend | cut -d ' ' -f 2`
AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT, $LIBZEND_MM_ALIGN, [ ])
AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT_LOG2, $LIBZEND_MM_ALIGN_LOG2, [ ])
], [], [
dnl cross-compile needs something here
LIBZEND_MM_ALIGN=8
])
AC_MSG_RESULT(done)
dnl test for memory allocation using mmap(MAP_ANON)
AC_MSG_CHECKING(for memory allocation using mmap(MAP_ANON))
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef MAP_ANON
# ifdef MAP_ANONYMOUS
# define MAP_ANON MAP_ANONYMOUS
# endif
#endif
#ifndef MREMAP_MAYMOVE
# define MREMAP_MAYMOVE 0
#endif
#ifndef MAP_FAILED
# define MAP_FAILED ((void*)-1)
#endif
#define SEG_SIZE (256*1024)
int main()
{
void *seg = mmap(NULL, SEG_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
if (seg == MAP_FAILED) {
return 1;
}
if (munmap(seg, SEG_SIZE) != 0) {
return 2;
}
return 0;
}
], [
AC_DEFINE([HAVE_MEM_MMAP_ANON], 1, [Define if the target system has support for memory allocation using mmap(MAP_ANON)])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
], [
dnl cross-compile needs something here
AC_MSG_RESULT(no)
])
dnl test for memory allocation using mmap("/dev/zero")
AC_MSG_CHECKING(for memory allocation using mmap("/dev/zero"))
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef MAP_ANON
# ifdef MAP_ANONYMOUS
# define MAP_ANON MAP_ANONYMOUS
# endif
#endif
#ifndef MREMAP_MAYMOVE
# define MREMAP_MAYMOVE 0
#endif
#ifndef MAP_FAILED
# define MAP_FAILED ((void*)-1)
#endif
#define SEG_SIZE (256*1024)
int main()
{
int fd;
void *seg;
fd = open("/dev/zero", O_RDWR, S_IRUSR | S_IWUSR);
if (fd < 0) {
return 1;
}
seg = mmap(NULL, SEG_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (seg == MAP_FAILED) {
return 2;
}
if (munmap(seg, SEG_SIZE) != 0) {
return 3;
}
if (close(fd) != 0) {
return 4;
}
return 0;
}
], [
AC_DEFINE([HAVE_MEM_MMAP_ZERO], 1, [Define if the target system has support for memory allocation using mmap("/dev/zero")])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
], [
dnl cross-compile needs something here
AC_MSG_RESULT(no)
])
AC_CHECK_FUNCS(mremap)
])
AC_DEFUN([LIBZEND_CPLUSPLUS_CHECKS],[
])
AC_MSG_CHECKING(whether /dev/urandom exists)
if test -r "/dev/urandom" && test -c "/dev/urandom"; then
AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define if the target system has /dev/urandom device])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
-258
View File
@@ -1,258 +0,0 @@
# Microsoft Developer Studio Generated Dependency File, included by ZendCore.mak
.\zend_alloc.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_compile.h"\
".\zend_config.w32.h"\
".\zend_execute.h"\
".\zend_llist.h"\
".\zend_ptr_stack.h"\
".\zend_stack.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_globals.h"\
".\zend_hash.h"\
.\alloca.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_config.w32.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_hash.h"\
.\zend_compile.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_compile.h"\
".\zend_config.w32.h"\
".\zend_execute.h"\
".\zend_llist.h"\
".\zend_modules.h"\
".\zend_operators.h"\
".\zend_ptr_stack.h"\
".\zend_stack.h"\
".\zend_variables.h"\
".\zend.h"\
".\zend_API.h"\
".\zend_errors.h"\
".\zend_globals.h"\
".\zend_hash.h"\
".\zend_ini.h"\
.\zend_constants.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_config.w32.h"\
".\zend_constants.h"\
".\zend_operators.h"\
".\zend_variables.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_hash.h"\
.\zend_execute.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_compile.h"\
".\zend_config.w32.h"\
".\zend_constants.h"\
".\zend_execute.h"\
".\zend_llist.h"\
".\zend_modules.h"\
".\zend_operators.h"\
".\zend_ptr_stack.h"\
".\zend_stack.h"\
".\zend_variables.h"\
".\zend.h"\
".\zend_API.h"\
".\zend_errors.h"\
".\zend_globals.h"\
".\zend_hash.h"\
".\zend_ini.h"\
.\zend_highlight.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_compile.h"\
".\zend_config.w32.h"\
".\zend_execute.h"\
".\zend_highlight.h"\
".\zend_llist.h"\
".\zend_ptr_stack.h"\
".\zend_stack.h"\
".\zend_language_parser.tab.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_globals.h"\
".\zend_hash.h"\
.\zend_llist.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_config.w32.h"\
".\zend_llist.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_hash.h"\
.\zend_opcode.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_compile.h"\
".\zend_config.w32.h"\
".\zend_execute.h"\
".\zend_llist.h"\
".\zend_modules.h"\
".\zend_operators.h"\
".\zend_ptr_stack.h"\
".\zend_stack.h"\
".\zend_variables.h"\
".\zend.h"\
".\zend_API.h"\
".\zend_errors.h"\
".\zend_globals.h"\
".\zend_hash.h"\
".\zend_ini.h"\
.\zend_operators.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_compile.h"\
".\zend_config.w32.h"\
".\zend_execute.h"\
".\zend_llist.h"\
".\zend_operators.h"\
".\zend_ptr_stack.h"\
".\zend_stack.h"\
".\zend_variables.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_globals.h"\
".\zend_hash.h"\
.\zend_ptr_stack.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_config.w32.h"\
".\zend_ptr_stack.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_hash.h"\
.\zend_stack.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_config.w32.h"\
".\zend_stack.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_hash.h"\
.\zend_variables.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_compile.h"\
".\zend_config.w32.h"\
".\zend_constants.h"\
".\zend_execute.h"\
".\zend_llist.h"\
".\zend_modules.h"\
".\zend_ptr_stack.h"\
".\zend_stack.h"\
".\zend_variables.h"\
".\zend.h"\
".\zend_API.h"\
".\zend_errors.h"\
".\zend_globals.h"\
".\zend_hash.h"\
".\zend_ini.h"\
".\zend_list.h"\
.\zend.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_config.w32.h"\
".\zend_operators.h"\
".\zend_variables.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_hash.h"\
.\zend_API.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_compile.h"\
".\zend_config.w32.h"\
".\zend_constants.h"\
".\zend_execute.h"\
".\zend_llist.h"\
".\zend_modules.h"\
".\zend_operators.h"\
".\zend_ptr_stack.h"\
".\zend_stack.h"\
".\zend_variables.h"\
".\zend.h"\
".\zend_API.h"\
".\zend_errors.h"\
".\zend_globals.h"\
".\zend_hash.h"\
".\zend_ini.h"\
".\zend_list.h"\
.\zend_hash.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_config.w32.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_hash.h"\
.\zend_ini.c : \
"..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
".\zend_alloc.h"\
".\zend_config.w32.h"\
".\zend.h"\
".\zend_errors.h"\
".\zend_hash.h"\
".\zend_ini.h"\
!IF "$(CFG)" == "ZendCore - Win32 Release"
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
!ENDIF
!IF "$(CFG)" == "ZendCore - Win32 Release"
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
!ENDIF
!IF "$(CFG)" == "ZendCore - Win32 Release"
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
!ENDIF
!IF "$(CFG)" == "ZendCore - Win32 Release"
!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug"
!ENDIF
-735
View File
@@ -1,735 +0,0 @@
# Microsoft Developer Studio Project File - Name="ZendTS" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=ZendTS - Win32 Release_TSDbg
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ZendTS.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ZendTS.mak" CFG="ZendTS - Win32 Release_TSDbg"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ZendTS - Win32 Release_TS" (based on "Win32 (x86) Static Library")
!MESSAGE "ZendTS - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
!MESSAGE "ZendTS - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
!MESSAGE "ZendTS - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Output_Dir "Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug_TS" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40d /d "NDebug_TS"
# ADD RSC /l 0x40d /d "NDebug_TS"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x40d /d "_Debug_TS"
# ADD RSC /l 0x40d /d "_Debug_TS"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
# PROP BASE Use_MFC 0
# PROP BASE Output_Dir "ZendTS___Win32_Release_TS_inline"
# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TS_inline"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Output_Dir "Release_TS_inline"
# PROP Intermediate_Dir "Release_TS_inline"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40d /d "NDebug_TS"
# ADD RSC /l 0x40d /d "NDebug_TS"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
# PROP BASE Use_MFC 0
# PROP BASE Output_Dir "ZendTS___Win32_Release_TSDbg"
# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TSDbg"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Output_Dir "Release_TSDbg"
# PROP Intermediate_Dir "Release_TSDbg"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40d /d "NDebug_TS"
# ADD RSC /l 0x40d /d "NDebug_TS"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "ZendTS - Win32 Release_TS"
# Name "ZendTS - Win32 Debug_TS"
# Name "ZendTS - Win32 Release_TS_inline"
# Name "ZendTS - Win32 Release_TSDbg"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\zend.c
# End Source File
# Begin Source File
SOURCE=.\zend_alloc.c
# End Source File
# Begin Source File
SOURCE=.\zend_API.c
# End Source File
# Begin Source File
SOURCE=.\zend_builtin_functions.c
# End Source File
# Begin Source File
SOURCE=.\zend_closures.c
# End Source File
# Begin Source File
SOURCE=.\zend_compile.c
# End Source File
# Begin Source File
SOURCE=.\zend_constants.c
# End Source File
# Begin Source File
SOURCE=.\zend_default_classes.c
# End Source File
# Begin Source File
SOURCE=.\zend_exceptions.c
# End Source File
# Begin Source File
SOURCE=.\zend_execute.c
# End Source File
# Begin Source File
SOURCE=.\zend_execute_API.c
# End Source File
# Begin Source File
SOURCE=.\zend_extensions.c
# End Source File
# Begin Source File
SOURCE=.\zend_float.c
# End Source File
# Begin Source File
SOURCE=.\zend_hash.c
# End Source File
# Begin Source File
SOURCE=.\zend_highlight.c
# End Source File
# Begin Source File
SOURCE=.\zend_indent.c
# End Source File
# Begin Source File
SOURCE=.\zend_ini.c
# End Source File
# Begin Source File
SOURCE=.\zend_ini_parser.c
# End Source File
# Begin Source File
SOURCE=.\zend_ini_scanner.c
# End Source File
# Begin Source File
SOURCE=.\zend_interfaces.c
# End Source File
# Begin Source File
SOURCE=.\zend_iterators.c
# End Source File
# Begin Source File
SOURCE=".\zend_language_parser.c"
# End Source File
# Begin Source File
SOURCE=".\zend_language_scanner.c"
# End Source File
# Begin Source File
SOURCE=.\zend_list.c
# End Source File
# Begin Source File
SOURCE=.\zend_llist.c
# End Source File
# Begin Source File
SOURCE=.\zend_object_handlers.c
# End Source File
# Begin Source File
SOURCE=.\zend_objects.c
# End Source File
# Begin Source File
SOURCE=.\zend_objects_API.c
# End Source File
# Begin Source File
SOURCE=.\zend_opcode.c
# End Source File
# Begin Source File
SOURCE=.\zend_operators.c
# End Source File
# Begin Source File
SOURCE=.\zend_ptr_stack.c
# End Source File
# Begin Source File
SOURCE=.\zend_qsort.c
# End Source File
# Begin Source File
SOURCE=.\zend_reflection_api.c
# End Source File
# Begin Source File
SOURCE=.\zend_sprintf.c
# End Source File
# Begin Source File
SOURCE=.\zend_stack.c
# End Source File
# Begin Source File
SOURCE=.\zend_stream.c
# End Source File
# Begin Source File
SOURCE=.\zend_strtod.c
# End Source File
# Begin Source File
SOURCE=.\zend_ts_hash.c
# End Source File
# Begin Source File
SOURCE=.\zend_variables.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\FlexLexer.h
# End Source File
# Begin Source File
SOURCE=.\zend.h
# End Source File
# Begin Source File
SOURCE=.\zend_alloc.h
# End Source File
# Begin Source File
SOURCE=.\zend_API.h
# End Source File
# Begin Source File
SOURCE=.\zend_builtin_functions.h
# End Source File
# Begin Source File
SOURCE=.\zend_compile.h
# End Source File
# Begin Source File
SOURCE=.\zend_config.w32.h
# End Source File
# Begin Source File
SOURCE=.\zend_constants.h
# End Source File
# Begin Source File
SOURCE=.\zend_default_classes.h
# End Source File
# Begin Source File
SOURCE=.\zend_errors.h
# End Source File
# Begin Source File
SOURCE=.\zend_exceptions.h
# End Source File
# Begin Source File
SOURCE=.\zend_execute.h
# End Source File
# Begin Source File
SOURCE=.\zend_extensions.h
# End Source File
# Begin Source File
SOURCE=.\zend_fast_cache.h
# End Source File
# Begin Source File
SOURCE=.\zend_globals.h
# End Source File
# Begin Source File
SOURCE=.\zend_globals_macros.h
# End Source File
# Begin Source File
SOURCE=.\zend_hash.h
# End Source File
# Begin Source File
SOURCE=.\zend_highlight.h
# End Source File
# Begin Source File
SOURCE=.\zend_indent.h
# End Source File
# Begin Source File
SOURCE=.\zend_ini.h
# End Source File
# Begin Source File
SOURCE=.\zend_ini_parser.h
# End Source File
# Begin Source File
SOURCE=.\zend_ini_scanner.h
# End Source File
# Begin Source File
SOURCE=.\zend_interfaces.h
# End Source File
# Begin Source File
SOURCE=.\zend_istdiostream.h
# End Source File
# Begin Source File
SOURCE=.\zend_iterators.h
# End Source File
# Begin Source File
SOURCE=".\zend_language_parser.h"
# End Source File
# Begin Source File
SOURCE=".\zend_language_scanner.h"
# End Source File
# Begin Source File
SOURCE=.\zend_list.h
# End Source File
# Begin Source File
SOURCE=.\zend_llist.h
# End Source File
# Begin Source File
SOURCE=.\zend_modules.h
# End Source File
# Begin Source File
SOURCE=.\zend_object_handlers.h
# End Source File
# Begin Source File
SOURCE=.\zend_objects.h
# End Source File
# Begin Source File
SOURCE=.\zend_objects_API.h
# End Source File
# Begin Source File
SOURCE=.\zend_operators.h
# End Source File
# Begin Source File
SOURCE=.\zend_ptr_stack.h
# End Source File
# Begin Source File
SOURCE=.\zend_qsort.h
# End Source File
# Begin Source File
SOURCE=.\zend_reflection_api.h
# End Source File
# Begin Source File
SOURCE=.\zend_stack.h
# End Source File
# Begin Source File
SOURCE=.\zend_stream.h
# End Source File
# Begin Source File
SOURCE=.\zend_strtod.h
# End Source File
# Begin Source File
SOURCE=.\zend_ts_hash.h
# End Source File
# Begin Source File
SOURCE=.\zend_variables.h
# End Source File
# End Group
# Begin Group "Parsers"
# PROP Default_Filter "y"
# Begin Source File
SOURCE=.\zend_ini_parser.y
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
# Begin Custom Build
InputDir=.
InputPath=.\zend_ini_parser.y
BuildCmds= \
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
# Begin Custom Build
InputDir=.
InputPath=.\zend_ini_parser.y
BuildCmds= \
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
# Begin Custom Build
InputDir=.
InputPath=.\zend_ini_parser.y
BuildCmds= \
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
# Begin Custom Build
InputDir=.
InputPath=.\zend_ini_parser.y
BuildCmds= \
bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=".\zend_language_parser.y"
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
# Begin Custom Build
InputDir=.
InputPath=".\zend_language_parser.y"
BuildCmds= \
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
# Begin Custom Build
InputDir=.
InputPath=".\zend_language_parser.y"
BuildCmds= \
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
# Begin Custom Build
InputDir=.
InputPath=".\zend_language_parser.y"
BuildCmds= \
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
# Begin Custom Build
InputDir=.
InputPath=".\zend_language_parser.y"
BuildCmds= \
bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# End Group
# Begin Group "Scanners"
# PROP Default_Filter "l"
# Begin Source File
SOURCE=.\flex.skl
# End Source File
# Begin Source File
SOURCE=.\zend_ini_scanner.l
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
# Begin Custom Build
InputPath=.\zend_ini_scanner.l
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
# Begin Custom Build
InputPath=.\zend_ini_scanner.l
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
# Begin Custom Build
InputPath=.\zend_ini_scanner.l
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
# Begin Custom Build
InputPath=.\zend_ini_scanner.l
"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=".\zend_language_scanner.l"
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
# Begin Custom Build
InputPath=".\zend_language_scanner.l"
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
# Begin Custom Build
InputPath=".\zend_language_scanner.l"
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
# Begin Custom Build
InputPath=".\zend_language_scanner.l"
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
# End Custom Build
!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
# Begin Custom Build
InputPath=".\zend_language_scanner.l"
"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
# End Custom Build
!ENDIF
# End Source File
# End Group
# Begin Group "Text Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\LICENSE
# End Source File
# Begin Source File
SOURCE=.\ZEND_BUGS
# End Source File
# Begin Source File
SOURCE=.\ZEND_CHANGES
# End Source File
# End Group
# Begin Group "Resources"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\zend.ico
# End Source File
# End Group
# End Target
# End Project
-127
View File
@@ -1,127 +0,0 @@
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) 1998-2010 Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#if defined(__GNUC__) && __GNUC__ >= 4
# define ZEND_API __attribute__ ((visibility("default")))
# define ZEND_DLEXPORT __attribute__ ((visibility("default")))
#else
# define ZEND_API
# define ZEND_DLEXPORT
#endif
#define ZEND_DLIMPORT
@TOP@
#undef uint
#undef ulong
/* Define if you want to enable memory limit support */
#define MEMORY_LIMIT 0
@BOTTOM@
#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_IEEEFP_H
# include <ieeefp.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#if ZEND_BROKEN_SPRINTF
int zend_sprintf(char *buffer, const char *format, ...);
#else
# define zend_sprintf sprintf
#endif
#include <math.h>
/* To enable the is_nan, is_infinite and is_finite PHP functions */
#ifdef NETWARE
#define HAVE_ISNAN 1
#define HAVE_ISINF 1
#define HAVE_ISFINITE 1
#endif
#ifndef zend_isnan
#ifdef HAVE_ISNAN
#define zend_isnan(a) isnan(a)
#elif defined(HAVE_FPCLASS)
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
#else
#define zend_isnan(a) 0
#endif
#endif
#ifdef HAVE_ISINF
#define zend_isinf(a) isinf(a)
#elif defined(INFINITY)
/* Might not work, but is required by ISO C99 */
#define zend_isinf(a) (((a)==INFINITY)?1:0)
#elif defined(HAVE_FPCLASS)
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
#else
#define zend_isinf(a) 0
#endif
#ifdef HAVE_FINITE
#define zend_finite(a) finite(a)
#elif defined(HAVE_ISFINITE) || defined(isfinite)
#define zend_finite(a) isfinite(a)
#elif defined(fpclassify)
#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
#else
#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
#endif
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
#ifdef NETWARE
#ifdef USE_WINSOCK
#/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T
#/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H
#endif
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/
-221
View File
@@ -1,221 +0,0 @@
dnl $Id$
dnl
dnl This file contains local autoconf functions.
AC_DEFUN([LIBZEND_BISON_CHECK],[
# we only support certain bison versions
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1"
# for standalone build of Zend Engine
test -z "$SED" && SED=sed
bison_version=none
if test "$YACC"; then
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
php_cv_bison_version=invalid
if test -n "$bison_version_vars"; then
set $bison_version_vars
bison_version="${1}.${2}"
for bison_check_version in $bison_version_list; do
if test "$bison_version" = "$bison_check_version"; then
php_cv_bison_version="$bison_check_version (ok)"
break
fi
done
fi
])
fi
case $php_cv_bison_version in
""|invalid[)]
bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)."
AC_MSG_WARN([$bison_msg])
YACC="exit 0;"
;;
esac
])
AC_DEFUN([ZEND_FP_EXCEPT],[
AC_CACHE_CHECK(whether fp_except is defined, ac_cv_type_fp_except,[
AC_TRY_COMPILE([
#include <floatingpoint.h>
],[
fp_except x = (fp_except) 0;
],[
ac_cv_type_fp_except=yes
],[
ac_cv_type_fp_except=no
],[
ac_cv_type_fp_except=no
])])
if test "$ac_cv_type_fp_except" = "yes"; then
AC_DEFINE(HAVE_FP_EXCEPT, 1, [whether floatingpoint.h defines fp_except])
fi
])
dnl
dnl Check for broken sprintf()
dnl
AC_DEFUN([AC_ZEND_BROKEN_SPRINTF],[
AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
ac_cv_broken_sprintf=no
],[
ac_cv_broken_sprintf=yes
],[
ac_cv_broken_sprintf=no
])
])
if test "$ac_cv_broken_sprintf" = "yes"; then
ac_result=1
else
ac_result=0
fi
AC_DEFINE_UNQUOTED(ZEND_BROKEN_SPRINTF, $ac_result, [Whether sprintf is broken])
])
dnl
dnl AC_ZEND_C_BIGENDIAN
dnl Replacement macro for AC_C_BIGENDIAN
dnl
AC_DEFUN([AC_ZEND_C_BIGENDIAN],
[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
[
ac_cv_c_bigendian_php=unknown
AC_TRY_RUN(
[
int main(void)
{
short one = 1;
char *cp = (char *)&one;
if (*cp == 0) {
return(0);
} else {
return(1);
}
}
], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
])
if test $ac_cv_c_bigendian_php = yes; then
AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
fi
])
AC_DEFUN([AM_SET_LIBTOOL_VARIABLE],[
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
])
dnl x87 floating point internal precision control checks
dnl See: http://wiki.php.net/rfc/rounding
AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
AC_MSG_CHECKING([for usable _FPU_SETCW])
AC_TRY_LINK([
#include <fpu_control.h>
],[
fpu_control_t fpu_oldcw, fpu_cw;
volatile double result;
double a = 2877.0;
volatile double b = 1000000.0;
_FPU_GETCW(fpu_oldcw);
fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_SINGLE) | _FPU_DOUBLE;
_FPU_SETCW(fpu_cw);
result = a / b;
_FPU_SETCW(fpu_oldcw);
], [ac_cfp_have__fpu_setcw=yes], [ac_cfp_have__fpu_setcw=no])
if test "$ac_cfp_have__fpu_setcw" = "yes" ; then
AC_DEFINE(HAVE__FPU_SETCW, 1, [whether _FPU_SETCW is present and usable])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for usable fpsetprec])
AC_TRY_LINK([
#include <machine/ieeefp.h>
],[
fp_prec_t fpu_oldprec;
volatile double result;
double a = 2877.0;
volatile double b = 1000000.0;
fpu_oldprec = fpgetprec();
fpsetprec(FP_PD);
result = a / b;
fpsetprec(fpu_oldprec);
], [ac_cfp_have_fpsetprec=yes], [ac_cfp_have_fpsetprec=no])
if test "$ac_cfp_have_fpsetprec" = "yes" ; then
AC_DEFINE(HAVE_FPSETPREC, 1, [whether fpsetprec is present and usable])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for usable _controlfp])
AC_TRY_LINK([
#include <float.h>
],[
unsigned int fpu_oldcw;
volatile double result;
double a = 2877.0;
volatile double b = 1000000.0;
fpu_oldcw = _controlfp(0, 0);
_controlfp(_PC_53, _MCW_PC);
result = a / b;
_controlfp(fpu_oldcw, _MCW_PC);
], [ac_cfp_have__controlfp=yes], [ac_cfp_have__controlfp=no])
if test "$ac_cfp_have__controlfp" = "yes" ; then
AC_DEFINE(HAVE__CONTROLFP, 1, [whether _controlfp is present usable])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for usable _controlfp_s])
AC_TRY_LINK([
#include <float.h>
],[
unsigned int fpu_oldcw, fpu_cw;
volatile double result;
double a = 2877.0;
volatile double b = 1000000.0;
_controlfp_s(&fpu_cw, 0, 0);
fpu_oldcw = fpu_cw;
_controlfp_s(&fpu_cw, _PC_53, _MCW_PC);
result = a / b;
_controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
], [ac_cfp_have__controlfp_s=yes], [ac_cfp_have__controlfp_s=no])
if test "$ac_cfp_have__controlfp_s" = "yes" ; then
AC_DEFINE(HAVE__CONTROLFP_S, 1, [whether _controlfp_s is present and usable])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([whether FPU control word can be manipulated by inline assembler])
AC_TRY_LINK([
/* nothing */
],[
unsigned int oldcw, cw;
volatile double result;
double a = 2877.0;
volatile double b = 1000000.0;
__asm__ __volatile__ ("fnstcw %0" : "=m" (*&oldcw));
cw = (oldcw & ~0x0 & ~0x300) | 0x200;
__asm__ __volatile__ ("fldcw %0" : : "m" (*&cw));
result = a / b;
__asm__ __volatile__ ("fldcw %0" : : "m" (*&oldcw));
], [ac_cfp_have_fpu_inline_asm_x86=yes], [ac_cfp_have_fpu_inline_asm_x86=no])
if test "$ac_cfp_have_fpu_inline_asm_x86" = "yes" ; then
AC_DEFINE(HAVE_FPU_INLINE_ASM_X86, 1, [whether FPU control word can be manipulated by inline assembler])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
-420
View File
@@ -1,420 +0,0 @@
<?php
date_default_timezone_set('UTC');
function simple() {
$a = 0;
for ($i = 0; $i < 1000000; $i++)
$a++;
$thisisanotherlongname = 0;
for ($thisisalongname = 0; $thisisalongname < 1000000; $thisisalongname++)
$thisisanotherlongname++;
}
/****/
function simplecall() {
for ($i = 0; $i < 1000000; $i++)
strlen("hallo");
}
/****/
function hallo($a) {
}
function simpleucall() {
for ($i = 0; $i < 1000000; $i++)
hallo("hallo");
}
/****/
function simpleudcall() {
for ($i = 0; $i < 1000000; $i++)
hallo2("hallo");
}
function hallo2($a) {
}
/****/
function mandel() {
$w1=50;
$h1=150;
$recen=-.45;
$imcen=0.0;
$r=0.7;
$s=0; $rec=0; $imc=0; $re=0; $im=0; $re2=0; $im2=0;
$x=0; $y=0; $w2=0; $h2=0; $color=0;
$s=2*$r/$w1;
$w2=40;
$h2=12;
for ($y=0 ; $y<=$w1; $y=$y+1) {
$imc=$s*($y-$h2)+$imcen;
for ($x=0 ; $x<=$h1; $x=$x+1) {
$rec=$s*($x-$w2)+$recen;
$re=$rec;
$im=$imc;
$color=1000;
$re2=$re*$re;
$im2=$im*$im;
while( ((($re2+$im2)<1000000) && $color>0)) {
$im=$re*$im*2+$imc;
$re=$re2-$im2+$rec;
$re2=$re*$re;
$im2=$im*$im;
$color=$color-1;
}
if ( $color==0 ) {
print "_";
} else {
print "#";
}
}
print "<br>";
flush();
}
}
/****/
function mandel2() {
$b = " .:,;!/>)|&IH%*#";
//float r, i, z, Z, t, c, C;
for ($y=30; printf("\n"), $C = $y*0.1 - 1.5, $y--;){
for ($x=0; $c = $x*0.04 - 2, $z=0, $Z=0, $x++ < 75;){
for ($r=$c, $i=$C, $k=0; $t = $z*$z - $Z*$Z + $r, $Z = 2*$z*$Z + $i, $z=$t, $k<5000; $k++)
if ($z*$z + $Z*$Z > 500000) break;
echo $b[$k%16];
}
}
}
/****/
function Ack($m, $n){
if($m == 0) return $n+1;
if($n == 0) return Ack($m-1, 1);
return Ack($m - 1, Ack($m, ($n - 1)));
}
function ackermann($n) {
$r = Ack(3,$n);
print "Ack(3,$n): $r\n";
}
/****/
function ary($n) {
for ($i=0; $i<$n; $i++) {
$X[$i] = $i;
}
for ($i=$n-1; $i>=0; $i--) {
$Y[$i] = $X[$i];
}
$last = $n-1;
print "$Y[$last]\n";
}
/****/
function ary2($n) {
for ($i=0; $i<$n;) {
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
$X[$i] = $i; ++$i;
}
for ($i=$n-1; $i>=0;) {
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
$Y[$i] = $X[$i]; --$i;
}
$last = $n-1;
print "$Y[$last]\n";
}
/****/
function ary3($n) {
for ($i=0; $i<$n; $i++) {
$X[$i] = $i + 1;
$Y[$i] = 0;
}
for ($k=0; $k<1000; $k++) {
for ($i=$n-1; $i>=0; $i--) {
$Y[$i] += $X[$i];
}
}
$last = $n-1;
print "$Y[0] $Y[$last]\n";
}
/****/
function fibo_r($n){
return(($n < 2) ? 1 : fibo_r($n - 2) + fibo_r($n - 1));
}
function fibo($n) {
$r = fibo_r($n);
print "$r\n";
}
/****/
function hash1($n) {
for ($i = 1; $i <= $n; $i++) {
$X[dechex($i)] = $i;
}
$c = 0;
for ($i = $n; $i > 0; $i--) {
if ($X[dechex($i)]) { $c++; }
}
print "$c\n";
}
/****/
function hash2($n) {
for ($i = 0; $i < $n; $i++) {
$hash1["foo_$i"] = $i;
$hash2["foo_$i"] = 0;
}
for ($i = $n; $i > 0; $i--) {
foreach($hash1 as $key => $value) $hash2[$key] += $value;
}
$first = "foo_0";
$last = "foo_".($n-1);
print "$hash1[$first] $hash1[$last] $hash2[$first] $hash2[$last]\n";
}
/****/
function gen_random ($n) {
global $LAST;
return( ($n * ($LAST = ($LAST * IA + IC) % IM)) / IM );
}
function heapsort_r($n, &$ra) {
$l = ($n >> 1) + 1;
$ir = $n;
while (1) {
if ($l > 1) {
$rra = $ra[--$l];
} else {
$rra = $ra[$ir];
$ra[$ir] = $ra[1];
if (--$ir == 1) {
$ra[1] = $rra;
return;
}
}
$i = $l;
$j = $l << 1;
while ($j <= $ir) {
if (($j < $ir) && ($ra[$j] < $ra[$j+1])) {
$j++;
}
if ($rra < $ra[$j]) {
$ra[$i] = $ra[$j];
$j += ($i = $j);
} else {
$j = $ir + 1;
}
}
$ra[$i] = $rra;
}
}
function heapsort($N) {
global $LAST;
define("IM", 139968);
define("IA", 3877);
define("IC", 29573);
$LAST = 42;
for ($i=1; $i<=$N; $i++) {
$ary[$i] = gen_random(1);
}
heapsort_r($N, $ary);
printf("%.10f\n", $ary[$N]);
}
/****/
function mkmatrix ($rows, $cols) {
$count = 1;
$mx = array();
for ($i=0; $i<$rows; $i++) {
for ($j=0; $j<$cols; $j++) {
$mx[$i][$j] = $count++;
}
}
return($mx);
}
function mmult ($rows, $cols, $m1, $m2) {
$m3 = array();
for ($i=0; $i<$rows; $i++) {
for ($j=0; $j<$cols; $j++) {
$x = 0;
for ($k=0; $k<$cols; $k++) {
$x += $m1[$i][$k] * $m2[$k][$j];
}
$m3[$i][$j] = $x;
}
}
return($m3);
}
function matrix($n) {
$SIZE = 30;
$m1 = mkmatrix($SIZE, $SIZE);
$m2 = mkmatrix($SIZE, $SIZE);
while ($n--) {
$mm = mmult($SIZE, $SIZE, $m1, $m2);
}
print "{$mm[0][0]} {$mm[2][3]} {$mm[3][2]} {$mm[4][4]}\n";
}
/****/
function nestedloop($n) {
$x = 0;
for ($a=0; $a<$n; $a++)
for ($b=0; $b<$n; $b++)
for ($c=0; $c<$n; $c++)
for ($d=0; $d<$n; $d++)
for ($e=0; $e<$n; $e++)
for ($f=0; $f<$n; $f++)
$x++;
print "$x\n";
}
/****/
function sieve($n) {
$count = 0;
while ($n-- > 0) {
$count = 0;
$flags = range (0,8192);
for ($i=2; $i<8193; $i++) {
if ($flags[$i] > 0) {
for ($k=$i+$i; $k <= 8192; $k+=$i) {
$flags[$k] = 0;
}
$count++;
}
}
}
print "Count: $count\n";
}
/****/
function strcat($n) {
$str = "";
while ($n-- > 0) {
$str .= "hello\n";
}
$len = strlen($str);
print "$len\n";
}
/*****/
function getmicrotime()
{
$t = gettimeofday();
return ($t['sec'] + $t['usec'] / 1000000);
}
function start_test()
{
ob_start();
return getmicrotime();
}
function end_test($start, $name)
{
global $total;
$end = getmicrotime();
ob_end_clean();
$total += $end-$start;
$num = number_format($end-$start,3);
$pad = str_repeat(" ", 24-strlen($name)-strlen($num));
echo $name.$pad.$num."\n";
ob_start();
return getmicrotime();
}
function total()
{
global $total;
$pad = str_repeat("-", 24);
echo $pad."\n";
$num = number_format($total,3);
$pad = str_repeat(" ", 24-strlen("Total")-strlen($num));
echo "Total".$pad.$num."\n";
}
$t0 = $t = start_test();
simple();
$t = end_test($t, "simple");
simplecall();
$t = end_test($t, "simplecall");
simpleucall();
$t = end_test($t, "simpleucall");
simpleudcall();
$t = end_test($t, "simpleudcall");
mandel();
$t = end_test($t, "mandel");
mandel2();
$t = end_test($t, "mandel2");
ackermann(7);
$t = end_test($t, "ackermann(7)");
ary(50000);
$t = end_test($t, "ary(50000)");
ary2(50000);
$t = end_test($t, "ary2(50000)");
ary3(2000);
$t = end_test($t, "ary3(2000)");
fibo(30);
$t = end_test($t, "fibo(30)");
hash1(50000);
$t = end_test($t, "hash1(50000)");
hash2(500);
$t = end_test($t, "hash2(500)");
heapsort(20000);
$t = end_test($t, "heapsort(20000)");
matrix(20);
$t = end_test($t, "matrix(20)");
nestedloop(12);
$t = end_test($t, "nestedloop(12)");
sieve(30);
$t = end_test($t, "sieve(30)");
strcat(200000);
$t = end_test($t, "strcat(200000)");
total($t0, "Total");
?>
-43
View File
@@ -1,43 +0,0 @@
# Makefile to generate build tools
#
# Standard usage:
# make -f build.mk
#
# Written by Sascha Schumann
#
# $Id$
LT_TARGETS = ltmain.sh ltconfig
config_h_in = zend_config.h.in
makefile_am_files = Makefile.am
makefile_in_files = $(makefile_am_files:.am=.in)
makefile_files = $(makefile_am_files:e.am=e)
targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
all: $(targets)
clean:
rm -f $(targets)
$(LT_TARGETS):
rm -f $(LT_TARGETS)
libtoolize --automake $(AMFLAGS) -f
$(makefile_in_files): $(makefile_am_files)
automake -a -i $(AMFLAGS) $(makefile_files)
aclocal.m4: configure.in acinclude.m4
aclocal
$(config_h_in): configure.in acconfig.h
# explicitly remove target since autoheader does not seem to work
# correctly otherwise (timestamps are not updated)
@rm -f $@
autoheader
configure: aclocal.m4 configure.in
autoconf
-33
View File
@@ -1,33 +0,0 @@
#!/bin/sh
case "$1" in
--copy)
automake_flags=--copy
shift
;;
esac
libtoolize --force --automake $automake_flags
mv aclocal.m4 aclocal.m4.old 2>/dev/null
aclocal
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
echo "buildconf: keeping ${1}aclocal.m4"
mv aclocal.m4.old aclocal.m4
else
echo "buildconf: created or modified ${1}aclocal.m4"
fi
autoheader
automake --add-missing --include-deps $automake_flags
mv configure configure.old 2>/dev/null
autoconf
if cmp configure.old configure > /dev/null 2>&1; then
echo "buildconf: keeping ${1}configure"
mv configure.old configure
else
echo "buildconf: created or modified ${1}configure"
fi
-50
View File
@@ -1,50 +0,0 @@
dnl $Id$
dnl Process this file with autoconf to produce a configure script.
AC_INIT(zend.c)
AM_INIT_AUTOMAKE(zend, 0.80A, nodefine)
AM_CONFIG_HEADER(zend_config.h)
AM_SANITY_CHECK
AM_MAINTAINER_MODE
AC_PROG_CC
AM_PROG_CC_STDC
ZEND_VERSION=$VERSION
AC_ZEND_C_BIGENDIAN
dnl We want this one before the checks, so the checks can modify CFLAGS.
test -z "$CFLAGS" && auto_cflags=1
AC_CHECK_SIZEOF(long, 8)
AC_CHECK_SIZEOF(int, 4)
sinclude(Zend.m4)
LIBZEND_BASIC_CHECKS
LIBZEND_LIBDL_CHECKS
LIBZEND_DLSYM_CHECK
AM_PROG_LIBTOOL
if test "$enable_debug" != "yes"; then
AM_SET_LIBTOOL_VARIABLE([--silent])
fi
dnl
dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
dnl and source packages. This should be harmless on other OSs.
dnl
if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
CFLAGS="$CFLAGS -I/usr/pkg/include"
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
fi
LIBZEND_ENABLE_DEBUG
LIBZEND_OTHER_CHECKS
ZEND_EXTRA_LIBS="$LIBS"
LIBS=""
AC_SUBST(ZEND_EXTRA_LIBS)
AC_OUTPUT(Makefile)
# Local Variables:
# tab-width: 4
# End:
-19
View File
@@ -1,19 +0,0 @@
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) 1998-2010 Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: |
+----------------------------------------------------------------------+
*/
/* $Id$ */
-54
View File
@@ -1,54 +0,0 @@
--TEST--
func_num_args() tests
--FILE--
<?php
function test1() {
var_dump(func_num_args());
}
function test2($a) {
var_dump(func_num_args());
}
function test3($a, $b) {
var_dump(func_num_args());
}
test1();
test2(1);
test2();
test3(1,2);
call_user_func("test1");
call_user_func("test3", 1);
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_num_args());
}
}
test::test1(1);
var_dump(func_num_args());
echo "Done\n";
?>
--EXPECTF--
int(0)
int(1)
Warning: Missing argument 1 for test2(), called in %s on line %d
int(0)
int(2)
int(0)
Warning: Missing argument 2 for test3() in %s on line %d
int(1)
int(2)
int(1)
Warning: func_num_args(): Called from the global scope - no function context in %s on line %d
int(-1)
Done
-108
View File
@@ -1,108 +0,0 @@
--TEST--
func_get_arg() tests
--FILE--
<?php
function test1() {
var_dump(func_get_arg(-10));
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
function test2($a) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
function test3($a, $b) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
var_dump(func_get_arg(2));
}
test1();
test1(10);
test2(1);
test2();
test3(1,2);
call_user_func("test1");
call_user_func("test3", 1);
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
}
test::test1(1);
var_dump(func_get_arg(1));
echo "Done\n";
?>
--EXPECTF--
Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
bool(false)
Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
bool(false)
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
bool(false)
int(10)
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
int(1)
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Warning: Missing argument 1 for test2(), called in %s on line %d and defined in %s on line %d
Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
bool(false)
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
int(1)
int(2)
Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
bool(false)
Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
bool(false)
Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
bool(false)
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Warning: Missing argument 2 for test3() in %s on line %d
int(1)
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
bool(false)
int(1)
int(2)
Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
bool(false)
int(1)
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
bool(false)
Done
-81
View File
@@ -1,81 +0,0 @@
--TEST--
func_get_args() tests
--FILE--
<?php
function test1() {
var_dump(func_get_args());
}
function test2($a) {
var_dump(func_get_args());
}
function test3($a, $b) {
var_dump(func_get_args());
}
test1();
test1(10);
test2(1);
test2();
test3(1,2);
call_user_func("test1");
call_user_func("test3", 1);
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_get_args());
}
}
test::test1(1);
var_dump(func_get_args());
echo "Done\n";
?>
--EXPECTF--
array(0) {
}
array(1) {
[0]=>
int(10)
}
array(1) {
[0]=>
int(1)
}
Warning: Missing argument 1 for test2(), called in %s on line %d and defined in %s on line %d
array(0) {
}
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(0) {
}
Warning: Missing argument 2 for test3() in %s on line %d
array(1) {
[0]=>
int(1)
}
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(1) {
[0]=>
int(1)
}
Warning: func_get_args(): Called from the global scope - no function context in %s on line %d
bool(false)
Done
-25
View File
@@ -1,25 +0,0 @@
--TEST--
strncmp() tests
--FILE--
<?php
var_dump(strncmp("", ""));
var_dump(strncmp("", "", 100));
var_dump(strncmp("aef", "dfsgbdf", -1));
var_dump(strncmp("fghjkl", "qwer", 0));
var_dump(strncmp("qwerty", "qwerty123", 6));
var_dump(strncmp("qwerty", "qwerty123", 7));
echo "Done\n";
?>
--EXPECTF--
Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d
NULL
int(0)
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
int(0)
int(0)
int(-1)
Done
-27
View File
@@ -1,27 +0,0 @@
--TEST--
strcasecmp() tests
--FILE--
<?php
var_dump(strcasecmp(""));
var_dump(strcasecmp("", ""));
var_dump(strcasecmp("aef", "dfsgbdf"));
var_dump(strcasecmp("qwe", "qwer"));
var_dump(strcasecmp("qwerty", "QweRty"));
var_dump(strcasecmp("qwErtY", "qwerty"));
var_dump(strcasecmp("q123", "Q123"));
var_dump(strcasecmp("01", "01"));
echo "Done\n";
?>
--EXPECTF--
Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
NULL
int(0)
int(-1)
int(-1)
int(0)
int(0)
int(0)
int(0)
Done
-31
View File
@@ -1,31 +0,0 @@
--TEST--
strncasecmp() tests
--FILE--
<?php
var_dump(strncasecmp(""));
var_dump(strncasecmp("", "", -1));
var_dump(strncasecmp("aef", "dfsgbdf", 0));
var_dump(strncasecmp("aef", "dfsgbdf", 10));
var_dump(strncasecmp("qwe", "qwer", 3));
var_dump(strncasecmp("qwerty", "QweRty", 6));
var_dump(strncasecmp("qwErtY", "qwer", 7));
var_dump(strncasecmp("q123", "Q123", 3));
var_dump(strncasecmp("01", "01", 1000));
echo "Done\n";
?>
--EXPECTF--
Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d
NULL
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
int(0)
int(-1)
int(0)
int(0)
int(1)
int(0)
int(0)
Done
-63
View File
@@ -1,63 +0,0 @@
--TEST--
each() tests
--FILE--
<?php
var_dump(each());
$var = 1;
var_dump(each($var));
$var = "string";
var_dump(each($var));
$var = array(1,2,3);
var_dump(each($var));
$var = array("a"=>1,"b"=>2,"c"=>3);
var_dump(each($var));
$a = array(1);
$a [] =&$a[0];
var_dump(each($a));
echo "Done\n";
?>
--EXPECTF--
Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: Variable passed to each() is not an array or object in %s on line %d
NULL
Warning: Variable passed to each() is not an array or object in %s on line %d
NULL
array(4) {
[1]=>
int(1)
[u"value"]=>
int(1)
[0]=>
int(0)
[u"key"]=>
int(0)
}
array(4) {
[1]=>
int(1)
[u"value"]=>
int(1)
[0]=>
unicode(1) "a"
[u"key"]=>
unicode(1) "a"
}
array(4) {
[1]=>
int(1)
[u"value"]=>
int(1)
[0]=>
int(0)
[u"key"]=>
int(0)
}
Done
-53
View File
@@ -1,53 +0,0 @@
--TEST--
define() tests
--FILE--
<?php
var_dump(define());
var_dump(define("TRUE"));
var_dump(define("TRUE", 1));
var_dump(define("TRUE", 1, array(1)));
var_dump(define(array(1,2,3,4,5), 1));
var_dump(define(" ", 1));
var_dump(define("[[[", 2));
var_dump(define("test const", 3));
var_dump(define("test const", 3));
var_dump(define("test", array(1)));
var_dump(define("test1", new stdclass));
var_dump(constant(" "));
var_dump(constant("[[["));
var_dump(constant("test const"));
echo "Done\n";
?>
--EXPECTF--
Warning: define() expects at least 2 parameters, 0 given in %s on line %d
NULL
Warning: define() expects at least 2 parameters, 1 given in %s on line %d
NULL
bool(true)
Warning: define() expects parameter 3 to be boolean, array given in %s on line %d
NULL
Warning: define() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d
NULL
bool(true)
bool(true)
bool(true)
Notice: Constant test const already defined in %s on line %d
bool(false)
Warning: Constants may only evaluate to scalar values in %s on line %d
bool(false)
Warning: Constants may only evaluate to scalar values in %s on line %d
bool(false)
int(1)
int(2)
int(3)
Done
-48
View File
@@ -1,48 +0,0 @@
--TEST--
get_class() tests
--FILE--
<?php
class foo {
function bar () {
var_dump(get_class());
}
}
class foo2 extends foo {
}
foo::bar();
foo2::bar();
$f1 = new foo;
$f2 = new foo2;
$f1->bar();
$f2->bar();
var_dump(get_class());
var_dump(get_class("qwerty"));
var_dump(get_class($f1));
var_dump(get_class($f2));
echo "Done\n";
?>
--EXPECTF--
Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d
unicode(3) "foo"
Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d
unicode(3) "foo"
unicode(3) "foo"
unicode(3) "foo"
Warning: get_class() called without object from outside a class in %s on line %d
bool(false)
Warning: get_class() expects parameter 1 to be object, Unicode string given in %s on line %d
bool(false)
unicode(3) "foo"
unicode(4) "foo2"
Done
-59
View File
@@ -1,59 +0,0 @@
--TEST--
get_parent_class() tests
--FILE--
<?php
interface i {
function test();
}
class foo implements i {
function test() {
var_dump(get_parent_class());
}
}
class bar extends foo {
function test_bar() {
var_dump(get_parent_class());
}
}
$bar = new bar;
$foo = new foo;
$foo->test();
$bar->test();
$bar->test_bar();
var_dump(get_parent_class($bar));
var_dump(get_parent_class($foo));
var_dump(get_parent_class("bar"));
var_dump(get_parent_class("foo"));
var_dump(get_parent_class("i"));
var_dump(get_parent_class(""));
var_dump(get_parent_class("[[[["));
var_dump(get_parent_class(" "));
var_dump(get_parent_class(new stdclass));
var_dump(get_parent_class(array()));
var_dump(get_parent_class(1));
echo "Done\n";
?>
--EXPECT--
bool(false)
bool(false)
unicode(3) "foo"
unicode(3) "foo"
bool(false)
unicode(3) "foo"
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Done
-89
View File
@@ -1,89 +0,0 @@
--TEST--
property_exists() tests
--FILE--
<?php
class foo {
public $pp1 = 1;
private $pp2 = 2;
protected $pp3 = 3;
function bar() {
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
}
}
class bar extends foo {
function test() {
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
}
}
var_dump(property_exists());
var_dump(property_exists(""));
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
var_dump(property_exists("foo","nonexistent"));
var_dump(property_exists("fo","nonexistent"));
var_dump(property_exists("foo",""));
var_dump(property_exists("","test"));
var_dump(property_exists("",""));
$foo = new foo;
var_dump(property_exists($foo,"pp1"));
var_dump(property_exists($foo,"pp2"));
var_dump(property_exists($foo,"pp3"));
var_dump(property_exists($foo,"nonexistent"));
var_dump(property_exists($foo,""));
var_dump(property_exists(array(),"test"));
var_dump(property_exists(1,"test"));
var_dump(property_exists(true,"test"));
$foo->bar();
$bar = new bar;
$bar->test();
echo "Done\n";
?>
--EXPECTF--
Warning: property_exists() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Warning: property_exists() expects exactly 2 parameters, 1 given in %s on line %d
NULL
bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
Warning: First parameter must either be an object or the name of an existing class in %s on line %d
NULL
Warning: First parameter must either be an object or the name of an existing class in %s on line %d
NULL
Warning: First parameter must either be an object or the name of an existing class in %s on line %d
NULL
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
Done
-34
View File
@@ -1,34 +0,0 @@
--TEST--
class_exists() tests
--FILE--
<?php
class foo {
}
var_dump(class_exists());
var_dump(class_exists("qwerty"));
var_dump(class_exists(""));
var_dump(class_exists(array()));
var_dump(class_exists("test", false));
var_dump(class_exists("foo", false));
var_dump(class_exists("foo"));
var_dump(class_exists("stdClass", false));
var_dump(class_exists("stdClass"));
echo "Done\n";
?>
--EXPECTF--
Warning: class_exists() expects at least 1 parameter, 0 given in %s on line %d
NULL
bool(false)
bool(false)
Warning: class_exists() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d
NULL
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
Done
-34
View File
@@ -1,34 +0,0 @@
--TEST--
interface_exists() tests
--FILE--
<?php
interface foo {
}
var_dump(interface_exists());
var_dump(interface_exists("qwerty"));
var_dump(interface_exists(""));
var_dump(interface_exists(array()));
var_dump(interface_exists("test", false));
var_dump(interface_exists("foo", false));
var_dump(interface_exists("foo"));
var_dump(interface_exists("stdClass", false));
var_dump(interface_exists("stdClass"));
echo "Done\n";
?>
--EXPECTF--
Warning: interface_exists() expects at least 1 parameter, 0 given in %s on line %d
NULL
bool(false)
bool(false)
Warning: interface_exists() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d
NULL
bool(false)
bool(true)
bool(true)
bool(false)
bool(false)
Done
-3
View File
@@ -1,3 +0,0 @@
<?php
/* dummy file for 014.phpt */
?>
-52
View File
@@ -1,52 +0,0 @@
--TEST--
get_included_files() tests
--FILE--
<?php
var_dump(get_included_files());
include(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
var_dump(get_included_files(1,1));
include_once(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
var_dump(get_included_files(1));
include(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
echo "Done\n";
?>
--EXPECTF--
array(1) {
[0]=>
unicode(%d) "%s"
}
array(2) {
[0]=>
unicode(%d) "%s"
[1]=>
unicode(%d) "%s"
}
Warning: get_included_files() expects exactly 0 parameters, 2 given in %s on line %d
NULL
array(2) {
[0]=>
unicode(%d) "%s"
[1]=>
unicode(%d) "%s"
}
Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
NULL
array(2) {
[0]=>
unicode(%d) "%s"
[1]=>
unicode(%d) "%s"
}
Done
-37
View File
@@ -1,37 +0,0 @@
--TEST--
trigger_error() tests
--FILE--
<?php
var_dump(trigger_error());
var_dump(trigger_error("error"));
var_dump(trigger_error(array()));
var_dump(trigger_error("error", -1));
var_dump(trigger_error("error", 0));
var_dump(trigger_error("error", E_USER_WARNING));
var_dump(trigger_error("error", E_USER_DEPRECATED));
echo "Done\n";
?>
--EXPECTF--
Warning: trigger_error() expects at least 1 parameter, 0 given in %s on line %d
NULL
Notice: error in %s on line %d
bool(true)
Warning: trigger_error() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d
NULL
Warning: Invalid error type specified in %s on line %d
bool(false)
Warning: Invalid error type specified in %s on line %d
bool(false)
Warning: error in %s on line %d
bool(true)
Deprecated: error in %s on line %d
bool(true)
Done
-12
View File
@@ -1,12 +0,0 @@
--TEST--
isset() with object properties when operating on non-object
--FILE--
<?php
$foo = NULL;
isset($foo->bar->bar);
echo "Done\n";
?>
--EXPECT--
Done
Loaded 100 of 15162 files, more files were not shown because too many files have changed in this diff. Show more