Compare commits

...
Author SHA1 Message Date
SVN Migration 3642203fa0 This commit was manufactured by cvs2svn to create tag 'php_5_1_0RC4'. 2005-10-28 15:00:50 +00:00
Ilia Alshanetsky 721fec251b 5.1.0RC4 2005-10-28 15:00:49 +00:00
Dmitry Stogov b05b949a47 Fixed bug #34879 (str_replace, array_map corrupt negative array indexes on 64-bit platforms) 2005-10-28 14:46:30 +00:00
Antony Dovgal e9de9f3aeb fix TSRM build 2005-10-28 12:00:10 +00:00
Dmitry Stogov a3cb94abff Fixed bug #34982 (array_walk_recursive() modifies elements outside function scope) 2005-10-28 10:06:43 +00:00
Dmitry Stogov fa406902d5 Fixed bug #34982 (array_walk_recursive() modifies elements outside function scope) 2005-10-28 09:57:35 +00:00
Dmitry Stogov 36a14076a8 Fixed bug #34725 (CLI segmentation faults during cleanup in ZTS if ext/pcre is DSO) 2005-10-28 08:30:41 +00:00
Anantha Kesari H Y 3815b367d5 NetWare LibC sdk has stdarg.h
--Kamesh
2005-10-28 07:52:58 +00:00
Dmitry Stogov 844cb82c45 $id:$ tatgs are removed from generated files to avoid committing of Zend/zend_vm_opcodes.h without real changes. 2005-10-28 06:05:57 +00:00
Rob Richards 2e8f773eee MFH: fix crash setting attr from foreign doc (throws exception)
add test
2005-10-27 23:51:22 +00:00
Antony Dovgal a9cac89541 MFH: commit forgotten part 2005-10-27 19:39:38 +00:00
Dmitry Stogov 8212034254 Fixed SIGSEGV 2005-10-27 19:25:52 +00:00
Antony Dovgal 9ffefbc74e MFH: add MySQL options and corresponding constants 2005-10-27 17:34:24 +00:00
Antony Dovgal 7c01510b95 MFH: free && set to NULL S->stmt 2005-10-27 17:26:19 +00:00
Ilia Alshanetsky 3a9cdbfd41 Fixed memory leak on error 2005-10-27 14:07:30 +00:00
Ilia Alshanetsky bac9ab777e One check is enough. 2005-10-27 14:06:39 +00:00
Rathna N ced39e3168 Tests for calendar extension 2005-10-27 11:05:50 +00:00
Wez Furlong dcd7879556 fixes PECL Bug #5589 2005-10-27 03:51:23 +00:00
Dan Scott 97ec02ce81 Test PDO::ATTR_CASE attribute. 2005-10-26 23:09:06 +00:00
Antony Dovgal 4c98758328 MFH: make compilers happy 2005-10-26 22:47:23 +00:00
Antony Dovgal 5b502880b6 MFH: fix #34996 (ImageTrueColorToPalette() crashes when ncolors is zero) 2005-10-26 21:38:20 +00:00
Ilia Alshanetsky 51d8950b53 Additional tweaks to the patch for bug #34249. 2005-10-26 15:08:23 +00:00
Antony Dovgal b122cd4b08 MFH: fix #34977 (Compile failure on MacOSX due to use of varargs.h) 2005-10-26 13:50:39 +00:00
foobar 143d1c8011 MFH 2005-10-26 11:33:25 +00:00
Dan Scott f987de46b4 Correct non-standard SQL. Standard SQL would define "DEFAULT NULL" -- but
that is the default value if the DEFAULT clause is omitted anyways.
2005-10-26 06:23:12 +00:00
Marcus Boerger 936b1e56c3 - MFH zend_is_callable_ex() has been changed 2005-10-25 23:20:29 +00:00
Marcus Boerger 2486b846cc - MFH zend_is_callable_ex() returns zend_class_entry* if available 2005-10-25 23:19:59 +00:00
Pierre Joye af888a4807 - fix #34980, divisor and offset never passed correctly (s/float/double/) 2005-10-25 23:00:19 +00:00
Michael Wallner a329ecd8c4 fix bug #34965 tidy is not binary safe 2005-10-25 18:04:59 +00:00
Antony Dovgal 2af3190a3d use correct enum type for the arg 2005-10-25 16:02:33 +00:00
Ilia Alshanetsky e13d51cea3 MFH: Fixed bug #34968 (bz2 extension fails on to build on some win32 setups). 2005-10-25 15:53:06 +00:00
Michael Wallner 2c5c8c161c - fix the fix 2005-10-25 15:35:39 +00:00
Michael Wallner 3bbd4b17a9 - MFH: fix bug #34821 zlib encoders fail on widely varying binary data on windows 2005-10-25 15:16:20 +00:00
Antony Dovgal e415260868 MFH: apply workaround for the leak only when GLIBC is used 2005-10-25 14:57:14 +00:00
Antony Dovgal 4d3c8240d5 fix the order 2005-10-25 14:37:28 +00:00
Michael Wallner 60efdff75f - MFH: thread safe SSL crypto locks, fixes bug #33760 2005-10-25 14:32:33 +00:00
Ilia Alshanetsky 9490f1c847 Do not run tests if iconv extension is unavailable. 2005-10-25 14:22:56 +00:00
Antony Dovgal a0c8d5d80a MFH: fix problem with garbage appearing in hostnames 2005-10-25 08:19:33 +00:00
Ilia Alshanetsky 6b46a441cd Fixed compiler warning 2005-10-25 03:53:25 +00:00
foobar dda1f722e2 MFH 2005-10-24 22:46:26 +00:00
Antony Dovgal 57b520541b MFH: fix #34970 (ldap configuration issues) 2005-10-24 20:24:35 +00:00
Marcus Boerger 5460d2dad6 - Fix issue with entities in attributes 2005-10-24 08:29:36 +00:00
Dmitry Stogov a0dd931d85 Fixed bug #34950 (Unable to get WSDL through proxy) 2005-10-24 07:44:17 +00:00
Dmitry Stogov f9fb94ff00 Reverted patch for bug #34934. Bug is marked as bogus. 2005-10-24 06:58:42 +00:00
Antony Dovgal 0a7b720094 MFH: fix #34938 (dns_get_record() doesn't resolve long hostnames and leaks) 2005-10-23 18:34:26 +00:00
Ilia Alshanetsky 76ad7425ad Fixed memory leak on error. 2005-10-23 15:29:09 +00:00
Wez Furlong ea544cf38f Closes PECL Bug #5750; uri: dsn is not handled correctly.
Patch from curt@php.net
2005-10-23 04:10:20 +00:00
foobar ecca329c14 keep the order! :) 2005-10-22 17:38:35 +00:00
Wez Furlong 890f7f46b4 Fix #34957; file access checks should use VCWD_ACCESS() 2005-10-22 17:02:10 +00:00
Antony Dovgal 23d3ddea25 fix ws 2005-10-21 15:53:22 +00:00
Dmitry Stogov 75a548a7e9 Fixed bug #34934 (offsetExists is not called from array_key_exists) 2005-10-21 15:19:40 +00:00
Antony Dovgal b260064bbf MFH: fix possible crash in dns_get_record()
cleanup code a bit
(partly fixes #34938)
2005-10-21 13:49:01 +00:00
Dmitry Stogov 187b6cc583 Fixed bug #31341 (escape on curly inconsistent) 2005-10-21 13:22:05 +00:00
Dmitry Stogov af0adbed39 Fixed fgetcsv() and fputcsv() inconsistency. 2005-10-21 12:13:39 +00:00
Dmitry Stogov 7c3bdf444d Fixed bug #34782 (token_get_all() gives wrong result) 2005-10-21 09:32:40 +00:00
Dmitry Stogov 863bf8a574 Fixed bug #29268 (__autoload() not called with Reflection->getClass()) 2005-10-21 08:03:28 +00:00
Ilia Alshanetsky d4696abdb9 Fixed tests to work with ZTS builds 2005-10-20 19:22:09 +00:00
Antony Dovgal e7925c9767 MFH: use proper constants 2005-10-20 16:54:48 +00:00
Antony Dovgal 159bae3d99 MFH: use constants instead of their values 2005-10-20 16:51:03 +00:00
Antony Dovgal 5fdeb391f3 MFH: fix copy/paste typo 2005-10-20 16:47:18 +00:00
Ilia Alshanetsky b0c0b79136 MFH: Fixed test for cygwin installs 2005-10-20 14:43:00 +00:00
Dmitry Stogov ad1f706fda Removed unnecesary local variable 2005-10-20 11:31:41 +00:00
Dmitry Stogov a8c338aa65 Fixed bug #34893 (PHP5.1 overloading, Cannot access private property) 2005-10-20 09:47:12 +00:00
Dmitry Stogov c326593c1a Fixed bug #34712 (zend.ze1_compatibility_mode = on segfault) 2005-10-20 08:55:10 +00:00
Dmitry Stogov 03cb8e959b Fixed bug #34767 (Zend Engine 1 Compatibility not copying objects correctly) 2005-10-20 08:14:59 +00:00
Dmitry Stogov d32c6512e1 Fixed bug #31177 (menory leaks and corruption because of incorrect refcounting). 2005-10-20 07:30:42 +00:00
Dmitry Stogov c095e20ca8 Fixed bug #31177 (menory leaks and corruption because of incorrect refcounting) 2005-10-20 07:23:26 +00:00
Dmitry Stogov 9269f58477 Added forgotten tests 2005-10-20 07:04:25 +00:00
Greg Beaver 3446a75a36 remove unused obsolete files from pear CVS
# to run PEAR tests, grab pear-core/tests and use "pear run-tests -rq"
2005-10-20 01:49:42 +00:00
Ilia Alshanetsky 5bb29235dc MFH: Fixed -m memory leak 2005-10-19 21:57:45 +00:00
Derick Rethans 719e78c78f - Fixed bug #34874 and #33546 (Problems with lone daynames). 2005-10-19 21:08:35 +00:00
Ilia Alshanetsky 382bc9d0e4 MFH: Fixed bug #29983 (PHP does not explicitly set mime type & charset). 2005-10-19 20:33:33 +00:00
Ilia Alshanetsky 4d0439e487 MFH: Fixed bug #34623 (Crash in pdo_mysql on longtext fields). 2005-10-19 14:11:56 +00:00
Ilia Alshanetsky 5916b8dd04 MFH: Change E_ERROR to E_WARNING when more_entropy flag is off on Cygwin. 2005-10-19 13:41:44 +00:00
Dmitry Stogov 5fd4035194 Fixed test 2005-10-19 12:48:24 +00:00
foobar e264b8a4d3 MFH: Fixed error messages and tests 2005-10-19 11:18:51 +00:00
Antony Dovgal 5ec19bb68c fix news entry 2005-10-19 11:18:14 +00:00
Dmitry Stogov 4a6faadcce Fixed memory leak in ZTS mode 2005-10-19 07:54:53 +00:00
Derick Rethans 6aed41421e - MFH: Improved error messages a bit. 2005-10-19 07:22:20 +00:00
Antony Dovgal e5928942ac MFH: initialize SG(request_info).auth_digest 2005-10-18 23:51:54 +00:00
Ilia Alshanetsky 24046edbbb MFH: Fixed bug #34905 (Digest authentication does not work with Apache 1). 2005-10-18 23:15:28 +00:00
Ilia Alshanetsky cbb928b8eb MFH: Do not set authorizer unless safe_mode or open_basedir are being used. 2005-10-18 22:51:10 +00:00
Derick Rethans 3e46adb183 - MFH: Fixed bug #33829 (mime_content_type() returns text/plain for gzip and
bzip files).
2005-10-18 15:04:07 +00:00
Antony Dovgal fb57a8363e unused var 2005-10-18 14:50:48 +00:00
Ilia Alshanetsky 12ff2532c9 Fixed bug #34899 (Fixed sqlite extension compile failure). 2005-10-18 14:33:19 +00:00
Antony Dovgal 62ca4594f8 MFH: use php_error_docref() instead of php_error() everywhere 2005-10-18 13:51:50 +00:00
Antony Dovgal bddc4e6c1d MFH: fix mime_magic problems with ZTS 2005-10-18 12:41:29 +00:00
Antony Dovgal d8e5ee075f MFH: fix bug #34902 (mysqli::character_set_name() - undefined method) 2005-10-18 10:02:36 +00:00
Dan Scott e89500cdfb Apply patch for #34900, sight unseen. 2005-10-18 01:05:22 +00:00
Ilia Alshanetsky 5a7596591f ZTS fixes 2005-10-18 00:20:52 +00:00
Ilia Alshanetsky 8b91c8f32e ZTS test fix 2005-10-18 00:17:27 +00:00
Ilia Alshanetsky 03418c1d36 Fixed test for ZTS builds 2005-10-18 00:15:02 +00:00
Ilia Alshanetsky 5a29be9b7d Fixed tests for ZTS builds 2005-10-18 00:12:30 +00:00
Ilia Alshanetsky d467331307 Fixed test for ZTS builds 2005-10-18 00:06:20 +00:00
Ilia Alshanetsky cdbf1938f2 Back to dev 2005-10-17 22:24:42 +00:00
Ilia Alshanetsky f133b09907 5.1.0RC3 2005-10-17 20:26:13 +00:00
Rob Richards fbda9ce9f4 MFH: only need context set once 2005-10-17 19:50:20 +00:00
Ilia Alshanetsky 197142b3e0 MFH: Properly fixed bug #34456 (original patch completely reverted). 2005-10-17 15:31:10 +00:00
Derick Rethans 8f4112bfdd - Fixed bug #29361 (var_export() producing invalid code). (Derick) 2005-10-17 14:38:12 +00:00
Ilia Alshanetsky b0f1719ee5 MFH: Fixed bug #34884 (Possible crash in ext/sqlite when sqlite.assoc_case
is being used).
2005-10-17 14:30:35 +00:00
Dmitry Stogov cc50a96139 Fixed bug #34873 (Segmentation Fault on foreach in object) 2005-10-17 07:57:00 +00:00
Ilia Alshanetsky 8d476ded8e MFH: Further URL validations in safe_mode/open_basedir configs. 2005-10-17 02:43:20 +00:00
foobar e7bd6769df MFH 2005-10-16 20:41:26 +00:00
foobar 8ac5b549e0 NEWS file is about changes between releases. (RCs are not releases..) 2005-10-16 17:54:31 +00:00
Derick Rethans 0893e10ac3 - Updated timezone database to version 2005.14. 2005-10-15 18:13:19 +00:00
Derick Rethans 33921efc44 - Fixed timezone guessing on Windows. (Derick, Nuno) 2005-10-15 18:12:29 +00:00
Georg Richter b343aa9945 fixed an error in mysqli_fetch_fields (function returns NULL instead of array
when row_number > num_fields).
Thanks to Marc Deslisle and phpMyAdmin team for the report.
2005-10-15 06:32:26 +00:00
Antony Dovgal 3c042299e6 MFH: add test for bug #34873 2005-10-14 21:52:18 +00:00
Ilia Alshanetsky eb28594aa5 Pear installer fix 2005-10-14 15:35:56 +00:00
Ilia Alshanetsky a218299d6a ZTS fix 2005-10-14 15:30:39 +00:00
Ilia Alshanetsky e6566d9477 Back to dev 2005-10-14 15:30:26 +00:00
Derick Rethans 1017c44f4a - Use the non-zlib version of the PHAR. 2005-10-14 13:41:47 +00:00
Ilia Alshanetsky a03039bade Prepare for 5.1RC2 2005-10-14 13:36:35 +00:00
Ilia Alshanetsky d18cdaf6dd MFH: fix test failures 2005-10-13 21:26:45 +00:00
Rob Richards 709f73aea7 MFH: move constants to class 2005-10-13 21:20:12 +00:00
Rob Richards 646500bfe9 MFH: insure stream usage 2005-10-13 20:34:37 +00:00
Rob Richards 1e0494a714 MFH: bump libxml min version to 2.6.11 2005-10-13 20:33:40 +00:00
Marcus Boerger 001f506533 - MFH SPL example was changed, so change PDO test accordingly 2005-10-13 19:49:59 +00:00
Marcus Boerger 4c8afd895a - MFH Add ability to bypass key() surrounding and make that default 2005-10-13 19:49:27 +00:00
foobar 7e2bccf776 MFH 2005-10-13 19:28:58 +00:00
Marcus Boerger 491674bea6 - Do not try to autoload the class, use internal only 2005-10-13 18:37:19 +00:00
Antony Dovgal c47fb30b5b MFH: fix #34856 (configure fails to detect libiconv's type) 2005-10-13 15:23:11 +00:00
Antony Dovgal 81b8096ea8 MFH: fix #34855 (ibase_service_attach() segfault on AMD64) 2005-10-13 12:58:48 +00:00
foobar 3fbee80f35 - Fixed bug #34850 (--program-suffix and --program-prefix not included in man page names) 2005-10-13 10:02:59 +00:00
foobar 428006f54d reorder 2005-10-13 10:01:59 +00:00
Antony Dovgal d67821cd02 ws fix 2005-10-13 09:48:38 +00:00
Antony Dovgal f4371b9cc6 fix bug #34581 (crash with mod_rewrite) 2005-10-12 21:24:09 +00:00
foobar 4acffedc6b missing entry 2005-10-12 20:52:25 +00:00
Derick Rethans cd90395cb6 - MFH: Apperently you can't store NULL pointer values into Zend hashes - god
know why not - so we won't store those in the cache anymore.
2005-10-12 19:49:59 +00:00
Ilia Alshanetsky 49678f0908 MFH: Fixed bug #34758 (PDO_DBLIB did not implement rowCount()). 2005-10-12 15:03:03 +00:00
Antony Dovgal 25a82d8a5c fix compile warnings (again) 2005-10-12 14:43:30 +00:00
Antony Dovgal 67f27b0aef make GCC happy and improve CS a bit 2005-10-12 14:29:26 +00:00
Antony Dovgal 305e946358 MFH: nuke unused vars 2005-10-12 14:04:02 +00:00
Rob Richards 2580744813 MFH: use spprintf where appropriate 2005-10-12 13:58:10 +00:00
Antony Dovgal 2bc716c131 fix TS build 2005-10-12 13:31:46 +00:00
Rob Richards 0615bf6cb4 BFN 2005-10-12 03:21:36 +00:00
Rob Richards 855f7dfd95 MFH: Fixed Bug #27908 (xml default_handlers not being called)
Fix memleak when entitydecls are parsed
remove old ifdefs
2005-10-12 03:21:05 +00:00
foobar 28a0aef13e MFH: removed confusing dot. 2005-10-11 18:58:59 +00:00
foobar c0ec353655 fix test 2005-10-11 18:11:13 +00:00
Ilia Alshanetsky ea4734926e MFH: Fixed bug #33167 (Possible crash inside pg_fetch_array()). 2005-10-11 16:19:14 +00:00
Ilia Alshanetsky cc034dcb38 MFH: Fixed bug #34742 (ftp wrapper failures caused from segmented command
transfer).
2005-10-11 14:33:51 +00:00
Antony Dovgal ad73bdcbe0 fix #34757 (iconv_substr() gives "Unknown error" when offset > string length) 2005-10-11 13:50:52 +00:00
Dmitry Stogov bb8e5de181 Fixed bug #32455 (wrong setting property to unset value) 2005-10-11 10:15:40 +00:00
Dmitry Stogov 631da59b50 Fixed bug #34790 (preg_match_all(), named capturing groups, variable assignment/return => crash) 2005-10-11 06:47:48 +00:00
Antony Dovgal 062626d03e use proper macros and vars instead of strlen() 2005-10-10 20:06:35 +00:00
Antony Dovgal a5cea052e8 fix #34818 (new mysqli_stmt() and several others crash if the first parameter is not a valid mysqli_link) 2005-10-10 20:03:00 +00:00
Derick Rethans 44205dc58a - MFH: Make sure the tzcache' dtor doesn't cleanup cached misses in the lookup
tables.
2005-10-10 16:42:32 +00:00
George Schlossnagle 9d79a201f1 Test seems potentially bogus. 2005-10-10 16:01:28 +00:00
Dmitry Stogov c61c3dd422 Fixed XML Schema error 2005-10-10 15:40:53 +00:00
Ilia Alshanetsky a5fe9808aa MFH: Fixed bug #34809 (FETCH_INTO in PDO crashes without a destination object). 2005-10-10 14:44:16 +00:00
Ilia Alshanetsky df71093dd8 bug fixing news 2005-10-10 14:31:21 +00:00
Ilia Alshanetsky 58a0906bf9 MFH: Fixed bug #34802 (Fixed crash on object instantiation failure). 2005-10-10 14:31:12 +00:00
Antony Dovgal 8152c64c02 BFN 2005-10-10 12:58:10 +00:00
Antony Dovgal 410e106aae fix #34810 (mysqli::init() and others use wrong $this pointer without checks) 2005-10-10 12:57:55 +00:00
Dmitry Stogov 3019a1c6a3 Fixed bug #34786 (2 @ results in change to error_reporting() to random value) 2005-10-10 10:53:52 +00:00
Dmitry Stogov b94970a3bd MFH 2005-10-10 10:50:16 +00:00
Antony Dovgal eef799a6ec BFN 2005-10-10 10:46:34 +00:00
Antony Dovgal c797466259 MF44: fix #33383 (crash when retrieving empty LOBs) 2005-10-10 10:44:39 +00:00
foobar ad28ef81c0 MFH: copypastetypofix 2005-10-10 10:28:53 +00:00
foobar d41c6dc6d6 MFH 2005-10-10 09:50:35 +00:00
Dmitry Stogov 45794ee259 Fixed bug #34467 (foreach + __get + __set incosistency) 2005-10-10 09:50:05 +00:00
Marcus Boerger 656f02fada - MFH Fix Logic 2005-10-10 06:09:25 +00:00
foobar 036f28f115 MFH: fix test 2005-10-10 05:57:21 +00:00
foobar 60d70459f3 extra spaces removed 2005-10-10 05:55:44 +00:00
Rob Richards b551a55bca MFH: PHP_CONFIG_FILE_PATH needs to use strlen() due to Win build 2005-10-10 02:26:56 +00:00
foobar b1d0f9bb43 typofix 2005-10-09 20:44:02 +00:00
foobar 0fefec1a35 BFN 2005-10-09 20:40:46 +00:00
foobar e403b15ebb MFH: - Fixed bug #34796 (missing SSL linking in ext/ftp when configured as shared). 2005-10-09 20:39:42 +00:00
Ilia Alshanetsky 412a28d124 MFH: Fixed bug #34777 (Crash in dblib when fetching non-existent error info). 2005-10-09 19:00:34 +00:00
Andrey Hristov 24af08eb80 add charsetnr and length to the object returned. this is kind of bug
because fetch_fields() and fetch_field() return that info and
fetch_field_direct() does not
2005-10-09 17:03:01 +00:00
Marcus Boerger 91682f88e4 - MFH Make test check for PlPgSQL before using it 2005-10-09 15:58:13 +00:00
Marcus Boerger a8c5828ce0 - MFH Add new test 2005-10-09 15:14:22 +00:00
Marcus Boerger de03dd6387 - MFH Fix potential SEGV with overloaded objects 2005-10-09 14:42:08 +00:00
Marcus Boerger bc81f55541 - MFH Bugfix #34704 (Infinite recursion due to corrupt JPEG) 2005-10-09 14:40:01 +00:00
Dmitry Stogov 303a642a0d Fixed bug #34788 (SOAP Client not applying correct namespace to generated values) 2005-10-09 12:41:44 +00:00
Pierre Joye 5dd9ad8f53 -fix build as shared or separate from main build (bfrance) 2005-10-09 12:06:27 +00:00
Dmitry Stogov 5ef3e0c57b Fixed bug #34787 (SOAP Client not handling boolean types correctly) 2005-10-09 11:05:46 +00:00
Georg Richter 94238838cf added Bugfix for #34785 2005-10-09 06:03:13 +00:00
Marcus Boerger 11f0ff9c1a - Update docu
- Synch class consts with HEAD
- Synch example RecursiveTreeIterator (as far as possible)
2005-10-08 19:09:58 +00:00
Georg Richter 7357ac0b96 fix for bug 34785:
added support for parent::__construct (mysqli_statement and mysqli_resultset)
  fixed failed testcases when sql_mode is in effect
2005-10-08 15:08:07 +00:00
Derick Rethans e3c8bd51de - MFH: Fixed bug #34676: missing support for strtotime("midnight") and
strtotime("noon").
2005-10-08 14:31:17 +00:00
Marcus Boerger 470da4e960 - MFH Add new test 2005-10-07 23:23:44 +00:00
Derick Rethans 5e46f636a5 - MFH: Make the Windows guessing routines actually return the guessed timezone. 2005-10-07 20:32:17 +00:00
Marcus Boerger faf80a4035 - BFN 2005-10-07 18:57:10 +00:00
George Schlossnagle 1f7c9e197c Test simple derivation from restriction. 2005-10-07 15:05:06 +00:00
Derick Rethans 6df3e40977 - MFH: Change parameter name because NetWare expands "tzname" as a macro to
something else.
2005-10-07 13:33:31 +00:00
Dmitry Stogov 2cbe63513c Fixed bug #34766 (possible crash on HTTP redirection) 2005-10-07 11:56:19 +00:00
Dmitry Stogov e011229598 Reverted last George patches 2005-10-07 08:23:35 +00:00
Derick Rethans 969f05a709 - MFH: Fixed bug #34771 (strtotime() fails with 1-12am/pm). 2005-10-07 08:09:01 +00:00
Derick Rethans 595ee08653 - MFH: New timezonemap data. 2005-10-07 08:06:40 +00:00
Marcus Boerger 6b0de601be - MFH C vs. C++ fix 2005-10-07 07:38:59 +00:00
foobar d8bb2766a8 maybe this month.. 2005-10-07 06:43:22 +00:00
George Schlossnagle fa3394eccb Permit correct usage of inherited encoders (from restriction/extension
"base" directives) for xml response decoding.
2005-10-07 05:14:52 +00:00
Marcus Boerger dec65f584b - MFH ReflectionClass::isInstantiable and abstract classes 2005-10-06 22:46:33 +00:00
George Schlossnagle abe0e61801 MFH: support complex types in restrictions and extensions 2005-10-06 22:30:24 +00:00
Marcus Boerger 35c82a75eb - MFH Fix issue (endless loop) with temp/memory streams 2005-10-06 21:31:25 +00:00
foobar e58513c4d0 BFN 2005-10-06 21:00:54 +00:00
Ilia Alshanetsky 71bd44ac02 MFH: Added missing safe_mode checks. 2005-10-06 20:47:41 +00:00
Johannes Schlüter d3dc0a39bc - MFH: Fix #34557 php -m exits with "error" 1 2005-10-06 20:29:41 +00:00
Rob Richards e1791bedd5 MFH: use sizeof instead of define 2005-10-06 18:48:19 +00:00
Marcus Boerger 6eaf1671b5 - Add new test 2005-10-06 18:34:16 +00:00
Derick Rethans f42742f796 - MFH: Fixed Windows build (patch by Mike) 2005-10-06 13:03:43 +00:00
Marcus Boerger cb83e27b02 - MFH (faillog, streams, counting, .......) 2005-10-06 09:42:17 +00:00
Rob Richards 93ffc14028 MFH: fix buffer lengths passed to snprintf 2005-10-05 22:36:10 +00:00
Antony Dovgal b33c2d9b17 nuke unused variable 2005-10-05 22:17:38 +00:00
Antony Dovgal 8a929e054e use the right constant name in error messages 2005-10-05 22:14:52 +00:00
Marcus Boerger b29b16af2e - Synch RecursiveIteratorIterator, fixes a few memory corruptions/memleaks 2005-10-05 21:59:13 +00:00
Marcus Boerger 3ced246dfc - MFH Update examples 2005-10-05 19:11:51 +00:00
Rob Richards 3282497f82 MFH: fix ZTS build 2005-10-05 16:40:21 +00:00
Ilia Alshanetsky bcf354a97a MFH: Missing safe_mode/open_basedir checks for file uploads. 2005-10-05 14:35:30 +00:00
Derick Rethans 3abc925a8a - Committing some changes that make PDO+SPL not crash anymore. These are done
by Marcus. and I'm committing them in order to actually use PHP 5.1 without
segfaulting when apache starts. This is not necessary the best solution.
2005-10-05 13:51:46 +00:00
Derick Rethans e1661efced - Implement correct Windows timezone guessing. 2005-10-05 11:06:56 +00:00
Antony Dovgal 1f6debba12 MFH: fix test 2005-10-05 09:00:36 +00:00
Derick Rethans 33a91ad309 - Fixed typo. 2005-10-05 08:23:39 +00:00
Derick Rethans c3678550a3 - Implemented tzcache
- Attempt at Windows detection code
2005-10-05 08:20:44 +00:00
Dmitry Stogov 6cbe6d7d52 Fixed throwing exceptions derived from SoapFault 2005-10-05 07:02:30 +00:00
Ilia Alshanetsky f2ed06347b MFH: Fixed possible INI setting leak via virtual() in Apache 2 sapi. 2005-10-05 00:43:38 +00:00
Antony Dovgal 1b8ecbcf54 MFH: fix #34723 (array_count_values() strips leading zeroes) 2005-10-04 20:48:17 +00:00
Antony Dovgal e0e9b5ac39 fix #34731, patch by novicky at aarongroup dot cz 2005-10-04 18:15:18 +00:00
Antony Dovgal 3d8dc4d3b1 fix #32179 (xmlrpc_encode() segfaults with recursive references) 2005-10-04 11:18:02 +00:00
Marcus Boerger 0a50368580 - Add optional dep for SPL under windows too 2005-10-04 07:47:11 +00:00
Marcus Boerger 4d631ec31b - Add optional dependency to SPL 2005-10-04 07:44:56 +00:00
Antony Dovgal 6df490d0ca MFH: nuke warning 2005-10-03 23:48:21 +00:00
Antony Dovgal 262cbbe8d0 include php_version_compare() declaration and eliminate warning 2005-10-03 23:37:10 +00:00
Antony Dovgal ffe605f2ed free cls_methods correctly and fix segfault on shutdown
(no bug entry and MFB, though..)
2005-10-03 23:27:26 +00:00
foobar 1c667a88e7 MFH 2005-10-03 20:21:02 +00:00
Marcus Boerger 061ff97f69 - MFH Throw an exception if an illegal string value is being used in
ArrayObject::offsetSet()
2005-10-03 17:59:56 +00:00
Marcus Boerger 308a64bc08 - MFH Really allow SXE being shared by not using anything from it directly in SPL 2005-10-03 16:05:08 +00:00
Marcus Boerger 42728f947c - Synch (to decrease number of diffs) 2005-10-03 15:43:40 +00:00
Marcus Boerger 0a2e6f723e - MFH change require to require_once 2005-10-03 15:06:27 +00:00
Ilia Alshanetsky 8a5bd01a44 MFH: GLOBALS protection for extract() function. 2005-10-03 14:04:16 +00:00
Marcus Boerger 31f8d7dc20 - MFH Update example 2005-10-03 13:36:18 +00:00
Marcus Boerger 48d9adc3f0 - MFH Allow uncached global functions 2005-10-03 12:36:36 +00:00
Derick Rethans e117d540d1 - MFH: Only use external database when it is newer than the builtin one. 2005-10-03 11:34:51 +00:00
Derick Rethans afccca77dd - MFH: Allow an external Timezone Database to be used. 2005-10-03 11:17:28 +00:00
Dmitry Stogov d09fbaa495 MFH (Bug #34643 wsdl default value) 2005-10-03 09:53:13 +00:00
Marcus Boerger 184309c2e9 - MFH Fix issue with RecursiveArrayIterator::getChildren() 2005-10-03 09:14:30 +00:00
Dmitry Stogov 594fd87ca7 Fixed bug #34678 (__call(), is_callable() and static methods) 2005-10-03 09:12:19 +00:00
Dmitry Stogov 728acc3785 Fixed bug #34358 (Fatal error: Cannot re-assign $this) 2005-10-03 08:21:51 +00:00
Ilia Alshanetsky 9a0bed9863 MFH: Fixed memory leak. 2005-10-03 03:54:06 +00:00
Wez Furlong 612dab64ee fix type 2005-10-03 00:55:23 +00:00
Marcus Boerger b76dcd68ee - MFH add new example 2005-10-02 23:12:35 +00:00
Wez Furlong a750f195cd Fix Bug #34687; error information from query() not passed back 2005-10-02 22:11:19 +00:00
Marcus Boerger 991a29cfd6 - MFH PDOException base 2005-10-02 20:38:18 +00:00
Marcus Boerger ca9dd7d826 - Add PDO::setAttribute(PDO::ATTR_STATEMENT_CLASS) 2005-10-02 20:07:11 +00:00
Marcus Boerger 0ea0e1615f - MFH Add new example 2005-10-02 17:33:05 +00:00
Derick Rethans 224e1f50ae - timelib_config.h should stay too. 2005-10-02 16:30:42 +00:00
Derick Rethans 6333f71ea3 - parse_date.c should not be here, as "make clean" removes it then. 2005-10-02 16:01:11 +00:00
Wez Furlong c19322869b use the right macro for these 2005-10-01 19:19:36 +00:00
Greg Beaver ba3862b369 set error_reporting to E_ALL in Makefile.frag 2005-10-01 16:05:44 +00:00
Marcus Boerger 13dc73940d - SPL may extend SimpleXML (if present) 2005-10-01 15:46:31 +00:00
Marcus Boerger 69722777a0 - Allow xpl/simplexml integration with simplexml being built shared 2005-10-01 15:41:37 +00:00
Derick Rethans 08b5c498ce - Implemented better timezone guessing algorithm. 2005-10-01 15:04:07 +00:00
Wez Furlong 932346c00f Allow compilation with PHP 5.0.x
Closes PECL #5514
2005-10-01 02:48:11 +00:00
foobar 56f006a998 fix bfn 2005-10-01 02:01:23 +00:00
Pierre Joye 4c4b955dce - entry for #33125 2005-09-30 21:01:38 +00:00
Pierre Joye 655743c4e7 - #33125, imagecopymergegray produces mosaic rainbow effect
at some point the alpha emulation formula has been broken
  restored.
2005-09-30 20:48:05 +00:00
Marcus Boerger 91e31d0243 - Try to fetch the necessary file via wget 2005-09-30 17:03:22 +00:00
foobar dfc8044098 reorder,reword,merge 2005-09-30 10:26:18 +00:00
Wez Furlong 69f0675a35 Fix for PECL #5433 (rowCount() not set) 2005-09-30 04:19:24 +00:00
Marcus Boerger b47525e508 - TSRM fix 2005-09-29 19:57:13 +00:00
Ilia Alshanetsky 941ac55d2f Removed unnecessary component that accidentally snuck-in 2005-09-29 16:39:37 +00:00
Ilia Alshanetsky 09540ee965 MFH:
Fixed possible crash and/or memory corruption in import_request_variables()
Fixed potential GLOBALS overwrite via import_request_variables().
2005-09-29 16:30:51 +00:00
Dmitry Stogov e2599c3dbf Fixed wrong array autodetection 2005-09-29 10:02:11 +00:00
Ilia Alshanetsky 1a04335ec2 MFH: Fixed possible GLOBALS variable override when register_globals are ON.
MFH: Fixed possible register_globals toggle via parse_str().
MFH: Fixed negative offset handling in substr_compare() function.
2005-09-28 22:39:52 +00:00
Dmitry Stogov ba5f66777e Fixed bug #34453 (parsing http://www.w3.org/2001/xml.xsd exception) 2005-09-28 11:24:18 +00:00
Dmitry Stogov 386a3b9305 Fixed bug #34617 (zend_deactivate: objects_store used after zend_objects_store_destroy is called) 2005-09-27 18:07:41 +00:00
Dmitry Stogov 4329db25a1 Fixed bug #34643 (wsdl default value has no effect) 2005-09-27 15:25:10 +00:00
Ilia Alshanetsky 72857b6dbb MFH: Fixed bug #32937 (open_basedir looses trailing / in the limiter). 2005-09-27 15:07:49 +00:00
Marcus Boerger c0cb5a83bf - BFN 2005-09-27 08:23:20 +00:00
Wez Furlong 006922ba18 ensure that this size is initialized correctly 2005-09-26 21:37:33 +00:00
Ilia Alshanetsky ef04eea493 Touch generated file 2005-09-26 19:34:09 +00:00
Ilia Alshanetsky 846b0826ab MFH: upgraded bundled libsqlite3 to version 3.2.7 2005-09-26 19:33:26 +00:00
Marcus Boerger 15c9f414a6 - MFH: Reset global pointer to NULL after mem free (required for apache 1.3) 2005-09-26 17:56:26 +00:00
Ilia Alshanetsky c508b5e66a Bug fixing news 2005-09-26 15:14:49 +00:00
Ilia Alshanetsky 9daaedc125 Fixed bug #34645 (ctype corrupts memory when validating large numbers). 2005-09-26 15:14:19 +00:00
Marcus Boerger 049882f29c - Try to fix bugs #34216 (Segfault with autoload) and #34584 (Segfault with
SPL autoload handler)
2005-09-25 18:04:35 +00:00
Ilia Alshanetsky f4a15e4fb8 Bug fixing news 2005-09-25 13:27:20 +00:00
Ilia Alshanetsky d696f11814 MFH: Fixed bug #34321 (Possible crash in filter code). 2005-09-25 13:26:30 +00:00
Wez Furlong 57641c166f reinstate this fix for building against PHP 5.0.x.
This works fine against PHP 5.1 too; if you revert this, you'd better have an
awesome technical reason, or I'll remove your karma.
2005-09-25 02:28:42 +00:00
Wez Furlong fdd42afa6c Fixup LOB handling for inserts (refs #34630).
Also tripped over the return of PECL #5200; looks like mysql doesn't return an
accurate length for the columns.  The PDO driver will sanity check the real
length against the buffer size it allocated (based on the info provided by
mysql), so that we won't overrun the buffer.  In addition, if a varchar field
is reported as having a length of less than 128, we'll allocate 128 just in
case.

If the data is truncated, report it via the appropriate sqlstate code.

There must be a better way to do this stuff.
2005-09-25 02:05:03 +00:00
Wez Furlong fab0baa274 refs #34630.
Real lob support for oracle will appear after the PHP 5.1 release.
2005-09-25 00:47:00 +00:00
Marcus Boerger 06550ce8e0 - MFH: Rename here too 2005-09-24 23:48:58 +00:00
foobar 2352850c52 Revert the "fix". It works fine when you use PHP_5_1 2005-09-24 23:33:58 +00:00
foobar 1536082186 fix typo 2005-09-24 23:23:25 +00:00
Marcus Boerger a349428685 - MFH: Serializeable was renamed to Serializable long ago 2005-09-24 23:19:24 +00:00
Wez Furlong 4fb5b322ee 99% certain that this fixes PECL #5366 and PECL #5391. 2005-09-24 19:15:23 +00:00
Wez Furlong 3905ce46d9 Refs #34630 2005-09-24 18:55:56 +00:00
Wez Furlong 4f7d14f8d9 a test for bug #34630 2005-09-24 18:54:50 +00:00
Wez Furlong 6cc5e191d0 Refs #34630 2005-09-24 18:47:50 +00:00
foobar 0d9bc3a679 Documentation belongs elsewhere 2005-09-24 18:18:58 +00:00
Edin Kadribasic ba8a8d9f25 Allow php extensions to use php_escape_shell_cmd() and php_escape_shell_arg(), needed for mbstring 2005-09-24 15:22:32 +00:00
Edin Kadribasic 4566f48777 Build PDO and SQLite as shared 2005-09-24 15:13:13 +00:00
Pierre Joye c81c189198 - MFH #33220, infinite loop while loading invalid GIF (nlopees) 2005-09-24 14:39:16 +00:00
Edin Kadribasic a952406eb3 sqlite3.h is a generated file 2005-09-24 14:21:29 +00:00
Edin Kadribasic 35b7ad00a6 Declare functions used by driver as PDO_API in php_pdo_driver.h 2005-09-24 14:18:01 +00:00
Antony Dovgal 6cf5be04d6 MFH: fix test 2005-09-23 10:34:20 +00:00
Anantha Kesari H Y a3a2fe37af NetWare LibC don't have socketpair function. So enabling socket_create_pair functionality only if socketpair is available in the host LibC.
--Kamesh
2005-09-23 09:54:31 +00:00
foobar 09f0161160 ws fix 2005-09-23 09:40:24 +00:00
Antony Dovgal e3a1bf1e62 MFH 2005-09-23 09:40:16 +00:00
Antony Dovgal 5ece2f6369 add new tests 2005-09-23 09:39:00 +00:00
Antony Dovgal d38a901189 - store current value of error_reporting only if it's not stored yet
- reset old_error_reporting to NULL only it points to the tmp_var at current opline
2005-09-23 09:36:43 +00:00
Anantha Kesari H Y 5337c02684 In NetWare two binaries with the same name can not be loaded in kernel address space(This is the default behaviour for NetWare apache webserver and hence PHP extensions also get loaded in kernel address space) simultaneoulsy. As the current autoconf built mysql extension is built as mysql.nlm this forbids the loading of mysql client binary. To work around this NetWare idiosyncrasy prefixing all the extensions with "php" except php5lib(phpts.dll eqivalent of Windows). I could have named this extensions prefixed with "php_" but "_" is eaten from the exported symbol prefix by the GCC cross compiler for NetWare so sticking to "php".
This fixes the issue of not needing "PHP_SUBST(EXTENSIONNAME_SHARED_LIBADD)" in all the extensions especially when they need to be built shared.

--Kamesh
2005-09-23 09:25:18 +00:00
foobar b5017bd725 MFH: Improved the fix for #21306 a bit 2005-09-23 08:14:13 +00:00
Dmitry Stogov d6c7d9630b MFH 2005-09-23 07:12:07 +00:00
Antony Dovgal 0dce979bfc MFH: fix #32081 (mysqli_real_connect(): mysqli.default_socket in php.ini has no effect) for real 2005-09-22 20:14:34 +00:00
Antony Dovgal eef28dacec bump API number 2005-09-22 19:13:32 +00:00
Antony Dovgal 8524b33feb BFN 2005-09-22 19:03:34 +00:00
Antony Dovgal f8e8c5534b MFH: fix #33771 (error_reporting falls to 0 when @ was used inside try/catch block) 2005-09-22 19:03:18 +00:00
Ilia Alshanetsky 0823526afe Fixed test 2005-09-22 16:24:51 +00:00
Edin Kadribasic f0c27e68b2 Fix building of extensions that inlcude extname/header.h 2005-09-22 13:16:30 +00:00
foobar cd63787e9a - Fixed bug #34583 ("make install" prematurely fails because of PEAR) 2005-09-22 13:04:12 +00:00
Marcus Boerger 8bba75f0f8 - BFN 2005-09-21 23:00:29 +00:00
Marcus Boerger f3c44f6065 - MFH Fixed Bug #34590 User defined PDOStatement class can't implement
methods
- Reimplement Traversable interface
# If there is a problem with this i need a backtrace. As far as i can
# tell by gdb/valgrind/logic there is no error here. But missuse leads to
# the same error report casing the exclusion of interface Traversable.
2005-09-21 22:58:39 +00:00
Marcus Boerger a72a517e2f - Add ability to execute .php generated from .phpt on failure without the
need to manually set the environment.
2005-09-21 18:40:56 +00:00
Dmitry Stogov 0988162649 Fixed memory corruption 2005-09-21 15:55:07 +00:00
Dmitry Stogov 3d41ebf595 Allow fopen() make HTTPS requests throug HTTP proxies 2005-09-21 15:04:26 +00:00
Ilia Alshanetsky 20c3266588 fixed compiler warnings 2005-09-21 13:23:00 +00:00
Ilia Alshanetsky 999a7acd71 MFH: Fixed bug #34565 (mb_send_mail does not fetch mail.force_extra_parameters) 2005-09-21 13:16:03 +00:00
Marcus Boerger 967413c58c - MFH Fix Bug #34243 ReflectionClass::getDocComment() returns no result 2005-09-21 09:56:51 +00:00
Derick Rethans 5e33a09f20 - MFH: Fixed definition in correct file. (Patch by Nuno) 2005-09-21 08:41:16 +00:00
Derick Rethans a51fc50b6e - MFH: Moved the FREE_OP to after the execution of the included file, or eval
statement so that it is safe to access this information in the overridden
  zend_execute() function, which is what Xdebug does.
2005-09-21 08:13:43 +00:00
Johannes Schlüter ddf3f9b068 - MFH: Remove HTML fragments from phpcredits() in CLI mode 2005-09-20 22:19:01 +00:00
foobar 529263d680 BFN 2005-09-20 20:59:00 +00:00
foobar de6b4c0091 MFH: - Fixed bug #21306 (catch bailouts of write handler during RSHUTDOWN) 2005-09-20 20:56:54 +00:00
Ilia Alshanetsky 4dff36f6b4 MFH: Allow overloading of PDO constructor. 2005-09-20 19:52:24 +00:00
Stanislav Malyshev bcb70109d2 fix crash on restarting static PHP having session modules loaded 2005-09-20 14:03:29 +00:00
foobar 462940cbb0 no irrelevant news here (pdo was never in PHP before, no point) 2005-09-20 07:18:54 +00:00
Wez Furlong 08a6122f54 MFH: use PDO:: class constants 2005-09-20 00:46:02 +00:00
Ilia Alshanetsky fe9db9ab0a Remove pointless PDO_ prefix 2005-09-20 00:44:51 +00:00
Ilia Alshanetsky bfe844e41e MFH: Make PDO use class constants 2005-09-20 00:35:21 +00:00
Marcus Boerger 9986219353 - MFH Fix filename 2005-09-19 19:03:53 +00:00
Antony Dovgal 33d913d9da MF5.0: add new test 2005-09-19 18:58:59 +00:00
Dmitry Stogov 5eb6b78c90 Fixed access to uninitialized value 2005-09-19 18:47:56 +00:00
Marcus Boerger e26ae04d5f - MFH Add deprecated/compatibility class for BC 2005-09-19 18:28:52 +00:00
Dmitry Stogov 9d3ac92729 MFH (removed unnecesary call to zval_ptr_dtor) 2005-09-19 17:50:24 +00:00
Dmitry Stogov 0ce7487110 Fixed access to memory that is already freed (in case of __call() method) 2005-09-19 16:28:54 +00:00
Dmitry Stogov 46488c8bb4 Fixed parameter passing incompatibilities.
Now it is possible to call array_pop(explode("&","1&2&3")) again.
2005-09-19 16:02:21 +00:00
foobar 116584297a cleanup, typos, etc 2005-09-18 20:34:43 +00:00
Antony Dovgal 9a1c6c55b8 fix build (declare extern HashTable pdo_driver_hash) 2005-09-18 18:05:59 +00:00
Marcus Boerger c3a79b5990 - MFH: Synch dosu 2005-09-18 17:52:09 +00:00
Marcus Boerger 8acd34d6d8 - MFH: Add missing docu/Synch 2005-09-18 17:39:54 +00:00
Marcus Boerger d1ee4b407c - Commite manually if not conatined in bunch commit 2005-09-18 17:16:17 +00:00
Marcus Boerger 7d918fae4c - Synch naming/move changes with HEAD
- Update tests/docu
# New functionality in CachingIterator/RecursiveIteratorIterator not MFHed
2005-09-18 17:15:04 +00:00
Wez Furlong 7e762989e7 move pdo_drivers -> PDO::getAvailableDrivers as part of namespacing sweep. 2005-09-18 14:13:08 +00:00
Edin Kadribasic 87071cf1d6 Added --add-modules-dir option to buidconf.js:
If this option is not specified buildconf.js will search for PECL
in the usual places (pecl, ../pecl).
Now it is possible to specify in which dirs additional modules reside
with say:
cscript /nologo win32/build/buildconf.js --add-modules-dir=../pecl_5_1 \
  --add-modules-dir=../php-gtk2
2005-09-17 20:00:01 +00:00
Antony Dovgal 3eb6167902 BFN 2005-09-16 23:56:12 +00:00
Antony Dovgal 21e809b7be MFH: check class_entry of this_ptr in Reflection API 2005-09-16 20:21:46 +00:00
Antony Dovgal 3fd2e85458 BFN 2005-09-16 17:12:12 +00:00
Antony Dovgal 4b9b5505f0 fix #34505 (possible memory corruption when unmangling properties with empty names)
2nd part
2005-09-16 17:11:02 +00:00
Antony Dovgal f43767b249 fix #34505 (possible memory corruption when unmangling properties with empty names)
1st part
2005-09-16 17:05:09 +00:00
Dmitry Stogov 27763b3666 Fixed bug #34478 (Incorrect parsing of url's fragment (#...)) 2005-09-16 15:48:30 +00:00
Dmitry Stogov e4a4ab60c7 Fixed bug #34518 (Unset doesn't separate container in CV) 2005-09-16 14:42:46 +00:00
Dmitry Stogov 8cf678c306 MFH (overriding of protected static property) 2005-09-16 13:42:49 +00:00
foobar 1bf64add7b correct flag 2005-09-16 12:09:17 +00:00
foobar 595e93be27 Fixed bug #34525 2005-09-16 12:06:41 +00:00
foobar 69edc17192 fix test 2005-09-16 07:41:08 +00:00
foobar ae281c372a - Fix tests due to changes in the error messages.
# Also nuked some CRLF's
2005-09-15 19:49:58 +00:00
Derick Rethans 7199bc5f86 - MFH: Fixed bug #34052 (date('U') returns %ld not unix timestamp). 2005-09-15 19:11:15 +00:00
Marcus Boerger c0ffebcee6 - Rename file class again by popular demmand: calling it SplFileObject now 2005-09-15 14:08:16 +00:00
foobar eb7e9b6bfc - Fixed error message grammar 2005-09-15 13:10:31 +00:00
Marcus Boerger 5ca5efcdda - Update docu 2005-09-15 03:54:42 +00:00
Marcus Boerger ca8596ab83 - Update with latest SPLchanges 2005-09-15 03:42:41 +00:00
Marcus Boerger 3fab7a3ed6 - No longer needed (moved into c) 2005-09-15 03:39:17 +00:00
Marcus Boerger a29501195f - MFH: Add new files 2005-09-15 03:38:03 +00:00
Marcus Boerger b4dd030782 MFH:
- Add SplObjectStorage
- Add RecursiveFilterIterator
- Rename Observer to SplObserver
- Rename Subject to SplSubject
- Move SPL constants to class constants
- Update docu
2005-09-15 03:33:04 +00:00
Derick Rethans a5f0cbed44 - Fixed shutdown order before RC2. 2005-09-14 20:08:31 +00:00
Marcus Boerger 650b76e542 - MFH: Improve error message 2005-09-14 18:23:48 +00:00
foobar d5809b85f9 MFH 2005-09-14 17:57:32 +00:00
foobar dc929d011c MFH 2005-09-14 15:53:02 +00:00
Ilia Alshanetsky 766e4b3c15 MFH: Fix error detection for queries such as OPTIMIZE 2005-09-14 15:34:58 +00:00
foobar bab59278d7 MFH 2005-09-13 21:40:46 +00:00
Ilia Alshanetsky c221e148d7 MFH: MFH: Make key() and current() take argument by value. 2005-09-13 13:24:38 +00:00
Antony Dovgal d3f03cc468 bfn 2005-09-13 09:20:36 +00:00
Antony Dovgal bd7a277d48 fix #34450 (Segfault when calling mysqli_close() in destructor) 2005-09-13 09:20:18 +00:00
Sara Golemon 196e54fc43 MFH(r-1.719) Plug leak of 1/2 bytes when converting from string/unicode 2005-09-12 17:44:21 +00:00
foobar 09f89c8cb0 MFH: Fixed build with phpize 2005-09-12 17:14:35 +00:00
Ilia Alshanetsky 2a7bd2b823 MFH: Fixed bug #34456 (Possible crash inside pspell extension). 2005-09-12 15:39:14 +00:00
Dmitry Stogov 9d1f2f30d3 Fixed bug #34199 (if($obj)/if(!$obj) inconsistency) 2005-09-12 11:48:57 +00:00
Dmitry Stogov 9a74c68a4c Additinal fix for bug #34277 (array_filter() crashes with references and objects) 2005-09-12 09:58:50 +00:00
Dmitry Stogov 21698c12fe Fixed huge memory leak in ZTS mode (backport from HEAD) 2005-09-12 09:06:15 +00:00
Dmitry Stogov 90236679e9 Fixed bug #34449 (ext/soap: XSD_ANYXML functionality not exposed) 2005-09-12 08:24:01 +00:00
Dmitry Stogov 5682438549 Better fix for exceptions in __sleep() 2005-09-12 07:13:54 +00:00
Wez Furlong 8dc3e7b147 When populating bound columns, override the returned type with the type
specified by the user in their bind.
2005-09-11 20:32:28 +00:00
Wez Furlong 9e9f413aeb Fix PECL Bug #5010 2005-09-11 19:44:26 +00:00
Greg Beaver af01525d1e prepare for using go-pear.phar 2005-09-11 17:39:15 +00:00
Ilia Alshanetsky be945f9fe2 Make use of 5.0+ features 2005-09-11 17:33:15 +00:00
Wez Furlong 81151a5dbf remove traversable interface; apparently it's not enough, and this stuff is too
magical to figure out wtf should be added.
2005-09-11 14:27:10 +00:00
Wez Furlong 497c7714e6 update manifest 2005-09-11 05:46:13 +00:00
Wez Furlong 77d3a41f8a update package.xml files and version numbers, in anticipation of a big bunch of releases. 2005-09-11 05:27:30 +00:00
Wez Furlong 1e37cc7b82 set version numbers to 1.0 2005-09-11 05:06:30 +00:00
Wez Furlong a55c4799aa MFH: reset the statement when closeCursor() is called. 2005-09-11 05:00:12 +00:00
Wez Furlong e53f6428ac merge George's fixes back from HEAD 2005-09-11 01:42:41 +00:00
Wez Furlong f4007c8f6b closes #33707: error information was not passed up to PDO::query(). 2005-09-10 21:38:07 +00:00
Wez Furlong edc39221c0 if a php bolean makes it as far as the parameter callback, it must really need
to be boolean; express is as native pgsql 't' or 'f'.

Add a test case for Bug #33876, which is a partially bogus bug.
2005-09-10 21:00:52 +00:00
Wez Furlong 5f47b4178e and touch the generated file 2005-09-10 20:58:57 +00:00
Wez Furlong e9c81e4983 actually register PDO_PARAM_BOOL as a constant (doh!).
When emulating bound parameters, pass booleans via the driver's quoter
method, so that is has an opportunity to tweak it.
Refs #33876: PDO misquotes/miscasts bool(false)
2005-09-10 20:58:19 +00:00
Wez Furlong 9c252b4b07 closes PECL #5027; PDO_FETCH_NAMED not handled via setFetchMode(). 2005-09-10 19:32:15 +00:00
Wez Furlong 2d16ed7706 Add test for this bug report; can't repeat the problem. 2005-09-10 19:27:29 +00:00
Wez Furlong efe24c0205 add __sleep and __wakeup functions to prevent serialize/deserialize from being used on PDO objects. Refs PECL #5217 2005-09-10 17:48:45 +00:00
Wez Furlong 6b0d0f7ceb allow exceptions thrown in __sleep to interrupt the serialization process. refs PECL #5217 2005-09-10 17:47:20 +00:00
Derick Rethans 7262ccfac9 - Fix version numbers as discussed to help version_compare for the PEAR folks. 2005-09-10 15:44:17 +00:00
Wez Furlong 0730fa2af9 Add PDOStatement::bindValue(), which is similar to bindParam(), except that
it binds the value of the zval at the time it is called, rather than keeping
a reference to the zval and taking the value at execute() time.
2005-09-10 15:32:04 +00:00
Dmitry Stogov 9305339d94 Changed "instanceof" and "catch" operators, is_a() and is_subclass_of() functions to not call __autoload(). 2005-09-09 06:48:49 +00:00
Ilia Alshanetsky 26bf79a15e MFH: Allow retrieval of query parse errors from SQLite. 2005-09-08 21:07:40 +00:00
Ilia Alshanetsky b5e2cc5197 MFH: Fixed bug #34420 (Possible crash inside curl_multi_remove_handle()). 2005-09-08 14:50:23 +00:00
Rob Richards 06e3607102 MFH: add save options parameter 2005-09-08 10:39:30 +00:00
Rob Richards 6818826bbd MFH: add additional constants
remove un-needed ifdefs
2005-09-08 10:37:57 +00:00
Rasmus Lerdorf 25c6fbe515 That line made no sense 2005-09-08 09:11:10 +00:00
Dmitry Stogov 42fb30298c Fixed crash on AIX 2005-09-08 06:19:07 +00:00
Greg Beaver 46783871e3 install-pear.phar removed -> moved to http://pear.php.net/install-pear.phar 2005-09-07 16:05:59 +00:00
Greg Beaver 6ed7a799af attempt to make new instructions clearer 2005-09-07 16:03:06 +00:00
Greg Beaver 38a52c5b0d change makefile to use phar and not source, if present 2005-09-07 15:59:53 +00:00
Dmitry Stogov 8a39d704c4 Fixed memory allocation bug 2005-09-07 15:36:31 +00:00
Ilia Alshanetsky 7f293b91b4 MFH: Upgraded SQLite 2 library in ext/sqlite to 2.8.16 2005-09-07 15:11:33 +00:00
Ilia Alshanetsky caa9702a5a Updated TODO 2005-09-07 02:33:12 +00:00
Ilia Alshanetsky a022e10c2d Simplify code by making use 5.1+ functions 2005-09-06 00:42:20 +00:00
Greg Beaver a3c168239d test version of install-pear.phar
can be removed if there is any issue
without changes to Makefile.frag, it is not actually used
2005-09-05 20:18:00 +00:00
foobar 27df981727 touch 2005-09-05 16:22:58 +00:00
foobar 020f1ba949 MFH: - Fixed bug #34311 (unserialize() crashes with characters above 191 dec) 2005-09-05 16:22:19 +00:00
foobar 1ee421ff66 BFN 2005-09-05 13:05:24 +00:00
Frank M. Kromann 635d65ab4e MFB: Fix for #34369
Add extra parameter to mssql_connect to force a new connection
2005-09-05 05:04:31 +00:00
Ilia Alshanetsky 084ab84411 Fixed compiler warning 2005-09-05 01:20:52 +00:00
Marcus Boerger 222900c4b0 - MFH 2005-09-04 18:55:03 +00:00
Wez Furlong d1be6c8152 assign a version number 2005-09-04 17:10:56 +00:00
Wez Furlong b6be0f9817 Allow ext/mysql to build against PHP 4 again; update package.xml ready for
release via PECL.
2005-09-04 04:51:23 +00:00
Edin Kadribasic 60b1f64cc7 touch 2005-09-04 00:48:59 +00:00
Edin Kadribasic 4e1b287b82 Fix for #34233 2005-09-04 00:47:59 +00:00
Edin Kadribasic 38317bb3bd Don't crash on invalid parameter #34203 (Wez) 2005-09-03 23:50:25 +00:00
foobar 6bc126681c reorder 2005-09-02 21:13:20 +00:00
foobar bd30309d65 BFN 2005-09-02 21:13:00 +00:00
Andrei Zmievski 0eabbc9f89 Fix bug #34307. We were not calling on_modify handler to set the default
value in case setting the one from .ini file failed.
2005-09-02 20:51:15 +00:00
Marcus Boerger a8355965bb - MFH Update docu 2005-09-02 19:11:10 +00:00
Ilia Alshanetsky 2b32ff53cd MFH: Resolved bug #34240. 2005-09-02 17:25:16 +00:00
Derick Rethans abcfcd3f2e - MFH: Added date_time_set, date_date_set and date_isodate_set() functions, and
setTime, setDate and setISODate() methods.
2005-09-02 14:58:01 +00:00
foobar 1890173d8c Revert 2005-09-02 14:05:46 +00:00
foobar 8c4d1f6657 MFH 2005-09-02 13:51:47 +00:00
Derick Rethans bb35f045df - MFH: Update timezone database to version "2005m". 2005-09-02 12:32:15 +00:00
Derick Rethans 00566c3949 - MFH: New layout for tz database file. 2005-09-02 11:40:27 +00:00
Derick Rethans 321732227f - Fixed bug #34304 (date() doesn't have a modifier for ISO Week Day). 2005-09-02 09:33:08 +00:00
foobar 170ef60d6f - Moved exts to PECL 2005-09-02 09:14:10 +00:00
foobar 96873fecef it is good idea to return something always 2005-09-02 08:24:14 +00:00
Dmitry Stogov 6319efa013 Fixed bug #34260 (Segfault with callbacks (array_map) + overloading) 2005-09-02 07:47:28 +00:00
Rob Richards 44840ace8e MFH: Fix key length so params passed by array can be retrieved by getParameter() 2005-09-02 06:38:02 +00:00
foobar a4673bd7b7 Fix test (week numbers below 10 are zero-prefixed now) 2005-09-02 05:17:42 +00:00
Ilia Alshanetsky 5f8809907a MFH: Fixed bug #34331 (php crashes when variables_order is empty). 2005-09-01 19:15:19 +00:00
foobar 64cfbf539f MFH: - Fixed bug #34307 (OnUpdateStringUnempty INI options can be set empty) 2005-09-01 14:44:15 +00:00
George Schlossnagle 248c30dad7 MFH. Protect against underflow - refs http://pecl.php.net/bugs/bug.php?id=5193 2005-09-01 14:44:11 +00:00
foobar 1978e9109f MFH 2005-09-01 14:33:47 +00:00
Wez Furlong 41901d127c portability fix (for solaris) 2005-09-01 13:59:03 +00:00
Dmitry Stogov 4f161fe289 Fixed bug #34137 (assigning array element by reference causes binary mess) 2005-09-01 13:21:37 +00:00
Dmitry Stogov 7fda1750f1 MFH 2005-09-01 13:03:00 +00:00
Derick Rethans 9057102e6e - MFH: Fixed bug #33414 (Comprehensive list of incorrect days returned after
strtotime() / date() tests).
2005-09-01 12:42:39 +00:00
Dmitry Stogov e615889d6b Fixed bug #34277 (array_filter() crashes with references and objects) 2005-09-01 12:00:37 +00:00
foobar 5253ea11de NSF 2005-09-01 11:59:47 +00:00
Dmitry Stogov 40f971b5b6 Fixed bug #34310 (foreach($arr as $c->d => $x) crashes) 2005-09-01 10:54:38 +00:00
Dmitry Stogov 248345d920 Support for class constants and static members for internal classes 2005-09-01 10:05:32 +00:00
foobar 655cb3aaf7 MFH 2005-09-01 08:25:52 +00:00
Ilia Alshanetsky 156a899e4a MFH: Fixed bug #34001 (pdo_mysql truncates numberic fields at 4 chars) 2005-09-01 01:57:01 +00:00
foobar 28796e9aa6 Fixed bug #34323 2005-08-31 22:28:55 +00:00
Rob Richards ab78a63357 MFH: make sxe_properties_get respect namespace scope 2005-08-31 17:00:46 +00:00
foobar 2ec2739c19 Update credits 2005-08-31 14:59:20 +00:00
foobar b08c3d880e - Moved ext/oracle to PECL 2005-08-31 14:58:27 +00:00
foobar 307ec8ece4 MFH:- Fixed bug #34306 (wddx_serialize_value() crashes with long array keys) 2005-08-31 14:31:44 +00:00
Derick Rethans 9230473cd3 - Fixed bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number). 2005-08-31 14:29:23 +00:00
foobar d1a4819c09 Added test for bug #34310 2005-08-31 09:16:24 +00:00
Marcus Boerger 7c37c2c37e - MFH run-tests-config.php was never used and now renamed 2005-08-31 07:00:22 +00:00
George Schlossnagle b247dc3418 MFH, fix 34072 2005-08-31 04:06:10 +00:00
Ilia Alshanetsky 43f63e4753 MFH: Fixed bug #32589 (possible crash inside imap_mail_compose() function). 2005-08-30 22:03:29 +00:00
Marcus Boerger 99baa01aac - MFH (missing run-tests2.php rename part) 2005-08-30 18:44:07 +00:00
Derick Rethans 0e2491f553 - Fixed bug #34302 (date('W') do not return leading zeros for week 1 to 9). 2005-08-30 09:17:09 +00:00
Marcus Boerger cf39bec447 - BFN 2005-08-30 07:34:57 +00:00
Dmitry Stogov 7230be4951 Fixed possible memory leak 2005-08-30 07:22:23 +00:00
Ilia Alshanetsky ba38b8a9c9 Mark pspell as working 2005-08-29 23:32:59 +00:00
Sara Golemon 5fc9d15692 MFH: allocate_new_resource() handles the malloc() for us. Don't leak by mallocing twice. 2005-08-29 22:05:25 +00:00
foobar 805ca9c51f MFH 2005-08-29 14:46:17 +00:00
Ilia Alshanetsky f02aa075cb Upgraded bundled SQLite library for PDO:SQLite to 3.2.5 2005-08-28 16:54:26 +00:00
Ilia Alshanetsky c6aae12cc1 Upgraded bundled SQLite library for PDO:SQLite to 3.2.5 (step 1) 2005-08-28 16:53:27 +00:00
Rob Richards 3a21310f37 BFN 2005-08-28 16:23:48 +00:00
Rob Richards 1b02f3ec31 MFH: Fixed bug #34276 (setAttributeNS doesn't work with default namespace)
Add test
2005-08-28 16:23:25 +00:00
foobar 2b53e96832 Nuke misinformation 2005-08-28 01:10:17 +00:00
foobar 11eeb0c3ac This is no longer required 2005-08-28 01:10:00 +00:00
foobar 0c4867144a - Fixed bug #34284 (CLI phpinfo showing html on _SERVER["argv"]) 2005-08-28 01:03:41 +00:00
foobar 5dd6467bd0 MFH 2005-08-28 00:46:36 +00:00
Marcus Boerger a596d53131 - MFH 2005-08-26 15:35:47 +00:00
Derick Rethans b842d8e3d8 - MFH: Fixed a bug where stream_get_meta_data() did not return the "uri"
element for files opened with tmpname().
2005-08-26 12:56:07 +00:00
Ilia Alshanetsky 980b9be4b4 Fixed bug #34214 (base64_decode() does not properly ignore whitespace) 2005-08-26 03:32:31 +00:00
Rob Richards 293beeb74a MFH: Fix URI escaping 2005-08-26 02:29:56 +00:00
Marcus Boerger 2e4c7dbb03 _ MFH 2005-08-25 22:06:52 +00:00
Marcus Boerger ce6abe492c - MFH Fixed bug #34257 (lib64 not handled correctly in ming extension). 2005-08-25 22:02:29 +00:00
foobar 4f89b2e0cb Fix crash with e.g. stream_get_meta_data() 2005-08-25 12:25:10 +00:00
Derick Rethans d3326d5b26 - MFH: Fixed bug #34087 for real.
- MFH: Windows compile fixes.
2005-08-25 09:47:28 +00:00
Ilia Alshanetsky 30b14ee8e9 MFH: Remainder of the 34191 bug fix. 2005-08-24 16:19:57 +00:00
foobar e96c51a175 PCRE lib is 6.2 2005-08-24 14:48:57 +00:00
Derick Rethans 164b4ad4dd MFH:
- Fixed bug #34087 (strtotime() does not work with date format "Y/m/d").
- Make use of YYMAXFILL.
- Added support for using a . as hour/minute/second separator.
2005-08-24 13:39:34 +00:00
Dmitry Stogov da4096c210 Fixed boolean encoding (from 0/1 to false/true) to support some buggy soap SDKs.
Fixed support for missing nillable elements of sequnces.
2005-08-24 11:46:11 +00:00
Dmitry Stogov 19dc0411f7 Fixed return-by-reference from internal functions 2005-08-24 10:41:06 +00:00
Johannes Schlüter 9e0ed1cb67 - MFH: Fix alphabetic order and add missing class 2005-08-24 10:17:43 +00:00
foobar 82d8cfb681 MFH 2005-08-23 21:40:26 +00:00
Ilia Alshanetsky 31dcd92f46 removed unused vars 2005-08-23 15:16:02 +00:00
Greg Beaver ae8a3a0f9e sync with PEAR 1.3.6 2005-08-22 22:09:54 +00:00
Greg Beaver de247c88cd add XML_RPC 1.4.0 2005-08-22 22:06:27 +00:00
Greg Beaver e5c570997e move Archive_Tar 1.3.2 => 1.3.1
1.3.2 does not exist
2005-08-22 21:51:15 +00:00
Ilia Alshanetsky b8cc3a9c32 MFH: Make dba extension support BerkleyDB 4.3. 2005-08-22 19:59:28 +00:00
Stanislav Malyshev 33df597531 fix crash if throw attempted outside of executable code 2005-08-22 13:26:33 +00:00
Ilia Alshanetsky daa209297d MFH: Fixed bug #34191 (ob_gzhandler does not enforce trailing \0). 2005-08-21 16:03:21 +00:00
Greg Beaver f4eb5095a6 add checks for extensions that must be loaded 2005-08-20 18:31:29 +00:00
Pierre Joye f7ef84c32d - fix bad revert and make the xmlrpc ext detections fallback
forgot that 5.1 still has pear in its branche
2005-08-18 21:29:28 +00:00
Wez Furlong b31ff96be9 Add ext to the include path. 2005-08-18 20:17:50 +00:00
Ilia Alshanetsky 3b329a9926 MFH: Fixed bug #34156 (memory usage remains elevated after memory limit is
reached);
2005-08-18 15:14:12 +00:00
Antony Dovgal 4e798f6e02 MFH: fix memleak 2005-08-18 15:13:45 +00:00
foobar 9477097564 MFH: Nuked EOLs from error messages 2005-08-18 13:34:41 +00:00
foobar 75d362225c MFH 2005-08-18 12:54:44 +00:00
foobar 286d53397a MFH 2005-08-18 12:40:41 +00:00
foobar a23aec662c MFH: nuked eol from error message 2005-08-18 12:34:22 +00:00
Ilia Alshanetsky e134382a71 MFH: Fixed bug #33987 (php script as ErrorDocument causes crash in Apache 2). 2005-08-18 01:14:42 +00:00
Greg Beaver 94c7fd0603 add return by ref from PEAR::raiseError 2005-08-17 21:48:46 +00:00
Greg Beaver 1dd48ca039 re-enable XML_RPC 1.4.0 2005-08-17 21:30:46 +00:00
foobar f286018dd0 MFH 2005-08-17 17:03:52 +00:00
foobar 617716b171 BFN 2005-08-17 16:56:20 +00:00
Ilia Alshanetsky 690f2ab5ed Added test for bug #34087 2005-08-17 15:31:57 +00:00
Dmitry Stogov 976edd47e2 Fixed bug #32981 (ReflectionMethod::getStaticVariables() causes apache2.0.54 seg fault) 2005-08-17 11:54:34 +00:00
foobar 5516735c88 MFH 2005-08-17 07:54:07 +00:00
Zeev Suraski cf1b4cf673 Introduce SoapClient::__setSoapHeaders() 2005-08-17 07:04:16 +00:00
Marcus Boerger e8b05734be - Prevent E_STRICT from ending up as exception 2005-08-16 18:10:34 +00:00
Ilia Alshanetsky 5610ad29e3 MFH: Fixed bug #34148 (+,- and . not supported as parts of scheme). 2005-08-16 14:20:41 +00:00
Zeev Suraski 23d4f9882f Go back to dev 2005-08-16 12:01:42 +00:00
Edin Kadribasic ca24e21972 Rebundle XML_RPC in the correct version for the Windows distro. 2005-08-16 11:35:45 +00:00
Zeev Suraski 2c6d0f8c48 Roll RC1 2005-08-16 10:59:56 +00:00
Dmitry Stogov 496bc9fce3 Fixed memory leak 2005-08-16 10:49:25 +00:00
Edin Kadribasic d327027ea9 Use free() instead of PQfreemem() to maintain compabitibility with older
PostgreSQL client libraries (bug #33813).
2005-08-16 09:55:44 +00:00
Ilia Alshanetsky 81b6d3e725 MFH: Input validation part 2. 2005-08-16 00:25:39 +00:00
Ilia Alshanetsky 9711fbace9 Chunk the output 2005-08-15 23:23:40 +00:00
Rob Richards a47eec0754 BFN 2005-08-15 17:14:35 +00:00
Rob Richards 8bdc4285aa MFH: Fixed bug #34103 (line numbering not maintained in dom document) 2005-08-15 17:13:57 +00:00
Ilia Alshanetsky bbd37d99e1 MFH: input validation. 2005-08-15 16:01:53 +00:00
Johannes Schlüter 0d993d2172 - Fix tab-completion for constants. 2005-08-14 13:07:15 +00:00
Wez Furlong 812c1e0475 MFH, compiler detection 2005-08-12 20:08:14 +00:00
foobar e46cd60d89 - Fixed bug #33326 (Cannot build extensions with phpize on Macosx). 2005-08-12 15:15:17 +00:00
Dmitry Stogov a0d479994f Fixed typo (ZVAL_LONG() -> ZVAL_DOUBLE()) 2005-08-12 14:56:59 +00:00
foobar b31f168184 - Fixed bug #34097 (configure failed to initize RE2C="exit 0;" when re2c is not found) 2005-08-12 13:53:27 +00:00
foobar 54df2c9d36 no DOS EOLs! 2005-08-11 23:53:59 +00:00
foobar 4ddaf76efc - Fixed test 2005-08-11 23:51:35 +00:00
foobar 417f113940 MFH 2005-08-11 23:45:22 +00:00
foobar 0941045fcc MFH 2005-08-11 23:05:34 +00:00
foobar e274f52bbf - Regenerated. 2005-08-11 22:36:47 +00:00
foobar 2f594ec2b3 BFNS 2005-08-11 22:34:10 +00:00
Marcus Boerger 6c87db9e99 - And this is version 5.1 2005-08-11 21:41:30 +00:00
Antony Dovgal 974adb419a BFN 2005-08-11 21:21:31 +00:00
Antony Dovgal 565c7708ca fix #34078 (Reflection API problems in methods with boolean or null default values) 2005-08-11 21:16:20 +00:00
Marcus Boerger 256e6e3350 - MFH creadits to Johannes 2005-08-11 20:45:58 +00:00
Rasmus Lerdorf c792839d8f Remove pear/XML_RPC dependency for the pear installer
PEAR guys, please doublecheck this.
2005-08-11 16:43:26 +00:00
Frank M. Kromann 9aa81a786b Revert the last patch so we can release PHP 5.1 2005-08-11 03:54:06 +00:00
Rasmus Lerdorf ba8cfb4a93 Minor consistency cleanup 2005-08-10 23:33:10 +00:00
Ilia Alshanetsky 2a37a0c495 MFH: Fixed bug #34068 (Numeric string as array key not cast to integer in
wddx_deserialize()).
2005-08-10 22:45:31 +00:00
Dmitry Stogov daba35fead Fixed bug #34062 (Crash in catch block when many arguments are used) 2005-08-10 13:11:05 +00:00
Dmitry Stogov ebd4ab4d78 Fixed bug #25359 (array_multisort() doesn't work in a function if array is global or reference) 2005-08-10 12:02:52 +00:00
Dmitry Stogov 779e6d203e Fixed bug #34064 (arr[] as param to function in class gives invalid opcode) 2005-08-10 10:39:55 +00:00
Marcus Boerger 3bc9bc5de8 - MFH estrdup/strndup change (as hinted by Andi) 2005-08-10 08:36:46 +00:00
Dmitry Stogov 54931f5259 Fixed bug #33940 (array_map() fails to pass by reference when called recursively) 2005-08-10 08:22:01 +00:00
Dmitry Stogov 96d755978c Fixed bug #29253 (array_diff with $GLOBALS argument fails) 2005-08-10 07:43:07 +00:00
Dmitry Stogov f0f1557998 Fixed bug #34045 (Buffer overflow with serialized object) 2005-08-10 06:37:19 +00:00
Dmitry Stogov 1a29376c07 Fixed test file (.inc.php -> .php) 2005-08-10 06:10:04 +00:00
Andi Gutmans 995c3002aa - This didn't end up being included 2005-08-09 22:23:01 +00:00
Marcus Boerger 1c7eb15eea - MFH: PEAR uses .php not .inc.php (as discussed with Andi) 2005-08-09 21:13:04 +00:00
Derick Rethans d55f456497 - MFH:
- Fixed TSRM issue.
	- Added guessed timezone to phpinfo() output.
	- Initialize is_dst in some cases.
	- Corrected some test cases.
2005-08-09 21:10:22 +00:00
Sebastian Bergmann 96dfe589fe Sync with config.m4. 2005-08-09 06:25:24 +00:00
Andi Gutmans eeecc8a015 - No release today. Found a critical bug... 2005-08-09 05:40:56 +00:00
Andi Gutmans 01d8e59d3b - RC1 2005-08-09 05:08:59 +00:00
SVN Migration 4571221d8e This commit was manufactured by cvs2svn to create branch 'PHP_5_1'. 2005-08-08 23:59:05 +00:00
831 changed files with 44199 additions and 80505 deletions

No files matched your search

+1 -1
View File
@@ -452,7 +452,7 @@ STATUS: Working
EXTENSION: pspell
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
MAINTENANCE: Unknown
STATUS: Unknown
STATUS: Working
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: readline
+4 -4
View File
@@ -7,17 +7,17 @@ $(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h
$(builddir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
@$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
$(builddir)/zend_language_parser.h: $(builddir)/zend_language_parser.c
$(builddir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
@$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
$(builddir)/zend_ini_parser.h: $(builddir)/zend_ini_parser.c
$(builddir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
@$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
$(builddir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
@$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(builddir)/zend_language_parser.h
+2 -2
View File
@@ -48,12 +48,12 @@ install-modules: build-modules
install-su: install-pear
test: all
-@if test ! -z $(PHP_EXECUTABLE) && test -x $(PHP_EXECUTABLE); then \
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(PHP_EXECUTABLE) -d 'open_basedir=' -d 'safe_mode=0' -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 \
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
+211 -3
View File
@@ -1,26 +1,215 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2005, PHP 5.1
- Updated bundled libraries in Windows distribution. (Edin)
?? Nov 2005, PHP 5.1
28 Oct 2005, PHP 5.1 Release Candidate 4
- Fixed fgetcsv() and fputcsv() inconsistency. (Dmitry)
- Fixed bug #34996 (ImageTrueColorToPalette() crashes when ncolors is
zero). (Tony)
- Fixed bug #34982 (array_walk_recursive() modifies elements outside function
scope). (Dmitry)
- Fixed bug #34977 (Compile failure on MacOSX due to use of varargs.h). (Tony)
- Fixed bug #34968 (bz2 extension fails on to build on some win32 setups).
(Ilia)
- Fixed bug #34965 (tidy is not binary safe). (Mike)
- Fixed bug #34957 (PHP doesn't respect ACLs for access checks). (Wez)
- Fixed bug #34950 (Unable to get WSDL through proxy). (Dmitry)
- Fixed bug #34938 (dns_get_record() doesn't resolve long hostnames and
leaks). (Tony)
- Fixed bug #34905 (Digest authentication does not work with Apache 1). (Ilia)
- Fixed bug #34902 (mysqli::character_set_name() - undefined method). (Tony)
- Fixed bug #34893 (PHP5.1 overloading, Cannot access private property).
(Dmitry)
- Fixed bug #34899 (Fixed sqlite extension compile failure). (Ilia)
- Fixed bug #34879 (str_replace, array_map corrupt negative array indexes on
64-bit platforms). (Dmitry)
- Fixed bug #34821 (zlib encoders fail on widely varying binary data on windows)
(Mike, Ilia)
- Fixed bug #34782 (token_get_all() gives wrong result). (Dmitry)
- Fixed bug #34767 (Zend Engine 1 Compatibility not copying objects correctly).
(Dmitry)
- Fixed bug #34725 (CLI segmentation faults during cleanup). (Dmitry)
- Fixed bug #34712 (zend.ze1_compatibility_mode = on segfault). (Dmitry)
- Fixed bug #34623 (Crash in pdo_mysql on longtext fields). (Ilia)
- Fixed bug #33829 (mime_content_type() returns text/plain for gzip and bzip
files). (Derick)
- Fixed bug #33760 (cURL needs to implement CRYPTO_callback functions to prevent
locking). (Mike, Ilia)
- Fixed bug #31341 (escape on curly inconsistent). (Dmitry)
- Fixed bug #31177 (menory leaks and corruption because of incorrect
refcounting). (Dmitry)
- Fixed bug #29983 (PHP does not explicitly set mime type & charset). (Ilia)
- Fixed bug #29268 (__autoload() not called with Reflection->getClass()).
(Dmitry)
17 Oct 2005, PHP 5.1 Release Candidate 3
- Fixed bug #34884 (Possible crash in ext/sqlite when sqlite.assoc_case is
being used). (Tony, Ilia)
- Fixed bug #34873 (Segmentation Fault on foreach in object). (Dmitry)
- Fixed bug #29361 (var_export() producing invalid code). (Derick)
14 Oct 2005, PHP 5.1 Release Candidate 2
- Changed SQLite extension to be a shared module in Windows distribution.
(Edin)
- Changed "instanceof" and "catch" operators, is_a() and is_subclass_of()
functions to not call __autoload(). (Dmitry)
- Improved SPL extension. (Marcus)
. Moved RecursiveArrayIterator from examples into extension
. Moved RecursiveFilterIterator from examples into extension
. Added SplObjectStorage
. Made all SPL constants class constants
. Renamed CachingRecursiveIterator to RecursiveCachingIterator to follow
Recursive<*>Iterator naming scheme.
- Upgraded bundled libraries:
. PCRE library to version 6.2. (Andrei)
. SQLite 3 library in ext/pdo_sqlite to 3.2.7. (Ilia)
. SQLite 2 library in ext/sqlite to 2.8.16. (Ilia)
- Upgraded bundled libraries in Windows distribution. (Edin)
. zlib 1.2.3
. curl 7.14.0
. openssl 0.9.8
. ming 0.3b
. libpq (PostgreSQL) 8.0.1
- Moved extensions to PECL:
. ext/mcve (Jani, Derick, Pierre)
. ext/oracle (Jani, Derick)
. ext/ovrimos (Jani, Derick, Pierre)
. ext/pfpro (Jani, Derick, Pierre)
- Added support for class constants and static members for internal classes.
(Dmitry, Michael Wallner)
- Added "new_link" parameter to mssql_connect() (Bug #34369). (Frank)
- Added missing safe_mode checks for image* functions and cURL. (Ilia)
- Added missing safe_mode/open_basedir checks for file uploads. (Ilia)
- Fixed an error in mysqli_fetch_fields (returned NULL instead of an
array when row number > field_count). (Georg)
- Fixed possible INI setting leak via virtual() in Apache 2 sapi. (Ilia)
- Fixed potential GLOBALS overwrite via import_request_variables() and
possible crash and/or memory corruption. (Ilia)
- Fixed possible GLOBALS variable override when register_globals are ON.
(Ilia, Stefan)
- Fixed possible register_globals toggle via parse_str(). (Ilia, Stefan)
- Fixed a bug where stream_get_meta_data() did not return the "uri" element for
files opened with tmpname(). (Derick)
- Fixed "make test" to work for phpized extensions. (Hartmut, Jani)
- Fixed failing queries (FALSE returned) with mysqli_query() on 64 bit systems.
(Andrey)
- Fixed bug #34856 (configure fails to detect libiconv's type). (Tony)
- Fixed bug #34855 (ibase_service_attach() segfault on AMD64).
(irie at gmx dot de, Tony)
- Fixed bug #34850 (--program-suffix and --program-prefix not included in
man page names). (Jani)
- Fixed bug #34818 (several functions crash when invalid mysqli_link object
is passed). (Tony)
- Fixed bug #34810 (mysqli::init() and others use wrong $this pointer
without checks). (Tony)
- Fixed bug #34809 (FETCH_INTO in PDO crashes without a destination object).
(Ilia)
- Fixed bug #34802 (Fixed crash on object instantiation failure). (Ilia)
- Fixed bug #34796 (missing SSL linking in ext/ftp when configured as shared).
(Jani)
- Fixed bug #34790 (preg_match_all(), named capturing groups, variable
assignment/return => crash). (Dmitry)
- Fixed bug #34788 (SOAP Client not applying correct namespace to generated
values). (Dmitry)
- Fixed bug #34787 (SOAP Client not handling boolean types correctly). (Dmitry)
- Fixed bug #34786 (2 @ results in change to error_reporting() to random value)
(Dmitry, Tony)
- Fixed bug #34785 (subclassing of mysqli_stmt does not work). (Georg)
- Fixed bug #34777 (Crash in dblib when fetching non-existent error info). (Ilia)
- Fixed bug #34771 (strtotime() fails with 1-12am/pm). (Derick)
- Fixed bug #34758 (PDO_DBLIB did not implement rowCount()). (Ilia)
- Fixed bug #34757 (iconv_substr() gives "Unknown error" when offset > string
length). (Tony)
- Fixed bug #34742 (ftp wrapper failures caused from segmented command
transfer). (Ilia)
- Fixed bug #34723 (array_count_values() strips leading zeroes). (Tony)
- Fixed bug #34704 (Infinite recursion due to corrupt JPEG). (Marcus)
- Fixed bug #34678 (__call(), is_callable() and static methods). (Dmitry)
- Fixed bug #34676: missing support for strtotime("midnight") and
strtotime("noon"). (Derick)
- Fixed bug #34645 (ctype corrupts memory when validating large numbers). (Ilia)
- Fixed bug #34643 (wsdl default value has no effect). (Dmitry)
- Fixed bug #34617 (zend_deactivate: objects_store used after
zend_objects_store_destroy is called). (Dmitry)
- Fixed bug #34590 (User defined PDOStatement class can't implement methods).
(Marcus)
- Fixed bug #34584 (Segfault with SPL autoload handler). (Marcus)
- Fixed bug #34581 (crash with mod_rewrite). (Tony, Ilia)
- Fixed bug #34565 (mb_send_mail does not fetch mail.force_extra_parameters).
(Marco, Ilia)
- Fixed bug #34557 (php -m exits with "error" 1). (Johannes)
- Fixed bug #34518 (Unset doesn't separate container in CV). (Dmitry)
- Fixed bug #34505 (Possible memory corruption when unmangling properties
with empty names). (Tony)
- Fixed bug #34478 (Incorrect parsing of url's fragment (#...)). (Dmitry)
- Fixed bug #34467 (foreach + __get + __set incosistency). (Dmitry)
- Fixed bug #34456 (Possible crash inside pspell extension). (Ilia)
- Fixed bug #34453 (parsing http://www.w3.org/2001/xml.xsd exception). (Dmitry)
- Fixed bug #34450 (Segfault when calling mysqli_close() in destructor). (Tony)
- Fixed bug #34449 (ext/soap: XSD_ANYXML functionality not exposed). (Dmitry)
- Fixed bug #34420 (Possible crash inside curl_multi_remove_handle()). (Ilia)
- Fixed bug #34358 (Fatal error: Cannot re-assign $this). (Dmitry)
- Fixed bug #34331 (php crashes when variables_order is empty). (Ilia)
- Fixed bug #34321 (Possible crash in filter code). (Ilia)
- Fixed bug #34311 (unserialize() crashes with chars above 191 dec). (Nuno)
- Fixed bug #34310 (foreach($arr as $c->d => $x) crashes). (Dmitry)
- Fixed bug #34307 (on_modify handler not called to set the default value if
setting from php.ini was invalid). (Andrei)
- Fixed bug #34306 (wddx_serialize_value() crashes with long array keys). (Jani)
- Fixed bug #34304 (date() doesn't have a modifier for ISO Week Day). (Derick)
- Fixed bug #34302 (date('W') do not return leading zeros for week 1 to 9).
(Derick)
- Fixed bug #34299 (ReflectionClass::isInstantiable() returns true for abstract
classes). (Marcus)
- Fixed bug #34284 (CLI phpinfo showing html on _SERVER["argv"]). (Jani)
- Fixed bug #34277 (array_filter() crashes with references and objects).
(Dmitry)
- Fixed bug #34276 (setAttributeNS doesn't work with default namespace). (Rob)
- Fixed bug #34260 (Segfault with callbacks (array_map) + overloading).
(Dmitry)
- Fixed bug #34257 (lib64 not handled correctly in ming extension). (Marcus)
- Fixed bug #34221 (Compiling xmlrpc as shared fails other parts). (Jani)
- Fixed bug #34216 (Segfault with autoload). (Marcus)
- Fixed bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler).
(Dmitry, Alex)
- Fixed bug #34191 (ob_gzhandler does not enforce trailing \0). (Ilia)
- Fixed bug #33167 (Possible crash inside pg_fetch_array()). (Ilia)
- Fixed bug #34156 (memory usage remains elevated after memory limit is
reached). (Ilia)
- Fixed bug #34148 (+,- and . not supported as parts of scheme). (Ilia)
- Fixed bug #34137 (assigning array element by reference causes binary mess).
(Dmitry)
- Fixed bug #34103 (line numbering not maintained in dom document). (Rob)
- Fixed bug #34078 (Reflection API problems in methods with boolean or
null default values). (Tony)
- Fixed bug #34068 (Numeric string as array key not cast to integer in
wddx_deserialize()). (Ilia)
- Fixed bug #34064 (arr[] as param to function in class gives invalid opcode).
(Dmitry)
- Fixed bug #34062 (Crash in catch block when many arguments are used).
(Dmitry)
- Fixed bug #34052 (date('U') returns %ld not unix timestamp). (Nuno)
- Fixed bug #34045 (Buffer overflow with serialized object). (Dmitry)
- Fixed bug #34001 (pdo_mysql truncates numberic fields at 4 chars). (Ilia)
- Fixed bug #33999 (object remains object when cast to int). (Dmitry)
- Fixed bug #33996 (No information given for fatal error on passing invalid
value to typed argument). (Dmitry)
- Fixed bug #33989 (extract($GLOBALS,EXTR_REFS) crashes PHP). (Dmitry)
- Fixed bug #33987 (php script as ErrorDocument causes crash in Apache 2).
(Ilia)
- Fixed bug #33967 (misuse of Exception constructor doesn't display errorfile).
(Jani)
- Fixed bug #33966 (Wrong use of reflectionproperty causes a segfault). (Tony)
- Fixed bug #33958 (duplicate cookies and magic_quotes=off may cause a crash).
(Ilia)
- Fixed bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number).
(Derick)
- Fixed bug #33940 (array_map() fails to pass by reference when called
recursively). (Dmitry)
- Fixed bug #33917 (number_format() output with > 1 char separators). (Jani)
- Fixed bug #33904 (input array keys being escaped when magic quotes is off).
(Ilia)
- Fixed bug #33903 (spl_autoload_register class method). (Marcus)
- Fixed bug #33899 (CLI: setting extension_dir=some/path extension=foobar.so
does not work). (Jani)
- Fixed bug #33882 (CLI was looking for php.ini in wrong path). (Hartmut)
@@ -29,15 +218,35 @@ PHP NEWS
on execution of prepared statments). (Ilia)
- Fixed bug #33837 (Informix ESQL version numbering schema changed). (Jani)
- Fixed bug #33802 (throw Exception in error handler causes crash). (Dmitry)
- Fixed bug #33771 (error_reporting falls to 0 when @ was used inside
try/catch block). (Tony)
- Fixed bug #33723 (php_value overrides php_admin_value). (Dmitry)
- Fixed bug #33710 (ArrayAccess objects doen't initialize $this). (Dmitry)
- Fixed bug #33690 (Crash setting some ini directives in httpd.conf). (Rasmus)
- Fixed bug #33578 (strtotime() problem with "Oct17" format). (Derick)
- Fixed bug #33558 (warning with nested calls to functions returning by
reference). (Dmitry)
- Fixed bug #33414 (Comprehensive list of incorrect days returned after
strtotime() / date() tests). (Derick)
- Fixed bug #33383 (crash when retrieving empty LOBs). (Tony)
- Fixed bug #33326 (Cannot build extensions with phpize on Macosx). (Jani)
- Fixed bug #33125 (imagecopymergegray() produces mosaic rainbow effect).
(Pierre)
- Fixed bug #32981 (ReflectionMethod::getStaticVariables() causes apache2.0.54
seg fault). (Dmitry)
- Fixed bug #32937 (open_basedir looses trailing / in the limiter). (Adam Conrad)
- Fixed bug #32589 (possible crash inside imap_mail_compose() function). (Ilia)
- Fixed bug #32455 (wrong setting property to unset value). (Dmitry)
- Fixed bug #32179 (xmlrpc_encode() segfaults with recursive references). (Tony)
- Fixed bug #32139 (SOAP client does not auto-handle base64 encoding). (Ilia)
- Fixed bug #32010 (Memory leak in mssql_fetch_batch). (fmk)
- Fixed bug #29334 (win32 mail() provides incorrect Date: header). (Jani)
- Fixed bug #29253 (array_diff with $GLOBALS argument fails). (Dmitry)
- Fixed bug #27908 (xml default_handlers not being called). (Rob)
- Fixed bug #25359 (array_multisort() doesn't work in a function if array is
global or reference). (Dmitry)
- Fixed bug #21306 (ext/sesssion: catch bailouts of write handler during
RSHUTDOWN). (Jani, Xuefer at 21cn dot com)
14 Jul 2005, PHP 5.1 Beta 3
- Upgraded bundled SQLite library for PDO:SQLite to 3.2.2 (Ilia)
@@ -261,7 +470,6 @@ PHP NEWS
- Added MDTM support to ftp_url_stat. (Sara)
- Added zlib stream filter support. (Sara)
- Added bz2 stream filter support. (Sara)
- Added HTTP/1.1 and chunked encoding support to http:// wrapper. (Sara)
- Added max_redirects context option that specifies how many HTTP
redirects to follow. (Ilia)
- Added support of parameter=>value arrays to xsl_xsltprocessor_set_parameter().
-8
View File
@@ -64,14 +64,6 @@ documentation
* 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).
ext/curl
--------
* Have a warning scheme for when people use unsupported features.
-1
View File
@@ -430,7 +430,6 @@ void *tsrm_new_interpreter_context(void)
current = tsrm_tls_get();
new_ctx = malloc(sizeof(*new_ctx));
allocate_new_resource(&new_ctx, thread_id);
/* switch back to the context that was in use prior to our creation
+13 -10
View File
@@ -9,23 +9,26 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
# 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, [
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /'|tr -d a-z`
bison_version="${1}.${2}"
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
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)"
fi
done
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
])
else
bison_version=none
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)."
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;"
;;
+1 -1
View File
@@ -12,4 +12,4 @@ foo(123);
--EXPECTF--
3
Fatal error: Argument 1 must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
Fatal error: Argument 1 passed to foo() must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
+1 -1
View File
@@ -39,5 +39,5 @@ echo "Done\n";
2
3
Done
test::__destruct
test::destructor
test::__destruct
-3
View File
@@ -34,6 +34,3 @@ $c->viewMom();
--EXPECT--
protected method
protected property
--EXPECT--
protected method
protected property
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #31177 (menory corruption because of incorrect refcounting)
--FILE--
<?php
class foo {
function foo($n=0) {
if($n) throw new Exception("new");
}
}
$x = new foo();
try {
$y=$x->foo(1);
} catch (Exception $e) {
var_dump($x);
}
--EXPECT--
object(foo)#1 (0) {
}
+29
View File
@@ -0,0 +1,29 @@
--TEST--
Bug #31341 (escape on curly inconsistent)
--FILE--
<?php
$a = array(
"$ \{ ",
" \{ $",
" \{$ ",
" $\{ ",
" \$\{ ",
" \{\$ ",
"\$ \{ ",
" \{ \$",
"% \{ ");
foreach ($a as $v) {
echo("'$v'\n");
}
?>
--EXPECT--
'$ \{ '
' \{ $'
' {$ '
' $\{ '
' $\{ '
' \{$ '
'$ \{ '
' \{ $'
'% \{ '
+9 -1
View File
@@ -1,5 +1,7 @@
--TEST--
Bug #33257 array_splice() inconsistent when passed function instead of variable
--INI--
error_reporting=4095
--FILE--
<?php
class X {
@@ -14,4 +16,10 @@ array_splice(X::getArr(), 1, 1);
print_r(X::getArr());
?>
--EXPECTF--
Fatal error: Only variables can be passed by reference in %sbug33257.php on line 10
Strict Standards: Only variables should be passed by reference in %sbug33257.php on line 10
Array
(
[0] => a
[1] => b
[2] => c
)
+66
View File
@@ -0,0 +1,66 @@
--TEST--
Bug #33512 (unset() overloaded properties doesn't work)
--FILE--
<?php
class TheObj {
public $RealVar1, $RealVar2, $RealVar3, $RealVar4;
public $Var = array();
function __set($var, $val) {
$this->Var[$var] = $val;
}
function __get($var) {
if(isset($this->Var[$var])) return $this->Var[$var];
else return -1;
}
function __unset($var) {
unset($this->Var[$var]);
}
}
$SomeObj = new TheObj;
// this will fine
$SomeObj->RealVar1 = 'somevalue';
$SomeObj->{'RealVar2'} = 'othervalue';
$SomeObj->{'RealVar'.(3)} = 'othervaluetoo';
$SomeObj->{'RealVar'.'4'} = 'anothervalue';
// this will fine too
$SomeObj->Virtual1 = 'somevalue';
$SomeObj->{'Virtual2'} = 'othervalue';
// it's can't be used since this will encounter error
$SomeObj->{'Virtual'.(3)} = 'othervaluetoo';
$SomeObj->{'Virtual'.'4'} = 'anothervalue';
// but this will fine, ofcourse
$SomeObj->Var['Virtual'.(3)] = 'othervaluetoo';
$SomeObj->Var['Virtual'.'4'] = 'anothervalue';
var_dump($SomeObj->RealVar1);
print $SomeObj->{'RealVar'.(3)}."\n";
unset($SomeObj->RealVar1);
unset($SomeObj->{'RealVar'.(3)});
//the lines below will catch by '__get' magic method since these variables are unavailable anymore
var_dump($SomeObj->RealVar1);
print $SomeObj->{'RealVar'.(3)}."\n";
// now we will try to unset these variables
unset($SomeObj->Virtual1);
unset($SomeObj->{'Virtual'.(3)});
//but, these variables are still available??? eventhough they're "unset"-ed
print $SomeObj->Virtual1."\n";
print $SomeObj->{'Virtual'.(3)}."\n";
?>
--EXPECT--
string(9) "somevalue"
othervaluetoo
int(-1)
-1
-1
-1
+40
View File
@@ -0,0 +1,40 @@
--TEST--
bug #33771 (error_reporting falls to 0 when @ was used inside try/catch block)
--FILE--
<?php
error_reporting(E_ALL | E_STRICT);
var_dump(error_reporting());
function make_exception()
{
throw new Exception();
}
function make_exception_and_change_err_reporting()
{
error_reporting(E_ALL);
throw new Exception();
}
try {
@make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
try {
@make_exception_and_change_err_reporting();
} catch (Exception $e) {}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
int(4095)
int(4095)
int(2047)
Done
+1 -1
View File
@@ -26,4 +26,4 @@ FooTest(new Foo());
--EXPECTF--
Warning: Missing argument 1 for NormalTest(), called in %sbug33996.php on line 17 and defined in %sbug33996.php on line 12
Hi!
Fatal error: Argument 1 must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
Fatal error: Argument 1 passed to FooTest() must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
+28
View File
@@ -0,0 +1,28 @@
--TEST--
Bug #34045 (Buffer overflow with serialized object)
--FILE--
<?php
class BasicSingleton
{
private static $instance;
public function __wakeup() {
self::$instance = $this;
}
public static function singleton() {
if (!(self::$instance instanceof BasicSingleton)) {
$c = __CLASS__;
self::$instance = new $c;
}
return self::$instance;
}
}
$db = BasicSingleton::singleton();
$db_str = serialize($db);
$db2 = unserialize($db_str);
echo "ok\n";
?>
--EXPECT--
ok
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #34062 (Crash in catch block when many arguments are used)
--FILE--
<?php
function f1() { throw new Exception; }
function f2() { echo "here\n"; }
try {
// Currently it's the minimum required number of zeros
// If you remove one, it won't crash
max(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, f1());
} catch (Exception $e) {
echo "(((\n";
f2(0, 0, 0); // Won't crash if less than 3 zeros here
echo ")))\n";
}
?>
--EXPECT--
(((
here
)))
+35
View File
@@ -0,0 +1,35 @@
--TEST--
Bug #34064 (arr[] as param to function in class gives invalid opcode)
--FILE--
<?php
class XmlTest {
function test_ref(&$test)
{
$test = "ok";
}
function test($test)
{
}
function run()
{
$ar = array();
$this->test_ref($ar[]);
var_dump($ar);
$this->test($ar[]);
}
}
$o = new XmlTest();
$o->run();
?>
--EXPECTF--
array(1) {
[0]=>
string(2) "ok"
}
Fatal error: Cannot use [] for reading in %sbug34064.php on line 18
+10
View File
@@ -0,0 +1,10 @@
--TEST--
Bug #34137 (assigning array element by reference causes binary mess)
--FILE--
<?php
$arr1 = array('a1' => array('alfa' => 'ok'));
$arr1 =& $arr1['a1'];
echo '-'.$arr1['alfa']."-\n";
?>
--EXPECT--
-ok-
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml = "<root></root>";
$xml = simplexml_load_string($xml);
$kids = $xml->children();
var_dump((bool)$kids);
if($kids) echo "bug\n"; else echo "ok\n";
if(!$kids) echo "ok\n"; else echo "bug\n";
?>
--EXPECT--
bool(false)
ok
ok
+36
View File
@@ -0,0 +1,36 @@
--TEST--
Bug #34260 (Segfault with callbacks (array_map) + overloading)
--FILE--
<?php
class Faulty
{
function __call($Method,$Args)
{
switch($Method)
{
case 'seg':
echo "I hate me\n";
break;
}
}
function NormalMethod($Args)
{
echo "I heart me\n";
}
}
$Faulty = new Faulty();
$Array = array('Some junk','Some other junk');
// This causes a seg fault.
$Failure = array_map(array($Faulty,'seg'),$Array);
// This does not.
$Failure = array_map(array($Faulty,'NormalMethod'),$Array);
?>
--EXPECT--
I hate me
I hate me
I heart me
I heart me
+34
View File
@@ -0,0 +1,34 @@
--TEST--
Bug #34310 (foreach($arr as $c->d => $x) crashes)
--FILE--
<?php
class C
{
public $d;
}
$c = new C();
$arr = array (1 => 'a', 2 => 'b', 3 => 'c');
// Works fine:
foreach($arr as $x => $c->d)
{
echo "{$x} => {$c->d}\n";
}
// Crashes:
foreach($arr as $c->d => $x)
{
echo "{$c->d} => {$x}\n";
}
?>
--EXPECT--
1 => a
2 => b
3 => c
1 => a
2 => b
3 => c
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #34358 (Fatal error: Cannot re-assign $this(again))
--FILE--
<?php
class foo {
function bar() {
$ref = &$this;
}
}
$x = new foo();
$x->bar();
echo "ok\n";
?>
--EXPECT--
ok
+27
View File
@@ -0,0 +1,27 @@
--TEST--
Bug #34467 (foreach + __get + __set incosistency)
--FILE--
<?php
class abc {
private $arr;
function __set ($key, $value) {
$this->arr[$key] = $value;
}
function __get ($key) {
return $this->arr[$key];
}
}
$abc = new abc();
foreach (array (1,2,3) as $abc->k => $abc->v) {
var_dump($abc->k,$abc->v);
}
?>
--EXPECT--
int(0)
int(1)
int(1)
int(2)
int(2)
int(3)
+38
View File
@@ -0,0 +1,38 @@
--TEST--
Bug #34518 (Unset doesn't separate container in CV)
--FILE--
<?php
$arr = array(1,2,3);
$arr["foo"] = array(4,5,6);
$copy = $arr;
unset($copy["foo"][0]);
print_r($arr);
print_r($copy);
?>
--EXPECT--
Array
(
[0] => 1
[1] => 2
[2] => 3
[foo] => Array
(
[0] => 4
[1] => 5
[2] => 6
)
)
Array
(
[0] => 1
[1] => 2
[2] => 3
[foo] => Array
(
[1] => 5
[2] => 6
)
)
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #34617 (zend_deactivate: objects_store used after zend_objects_store_destroy is called)
--SKIPIF--
<?php if (!extension_loaded("xml")) print "skip"; ?>
--FILE--
<?php
class Thing {}
function boom()
{
$reader = xml_parser_create();
xml_set_object($reader, new Thing());
die("ok\n");
xml_parser_free($reader);
}
boom();
?>
--EXPECT--
ok
+25
View File
@@ -0,0 +1,25 @@
--TEST--
Bug #34678 (__call(), is_callable() and static methods)
--FILE--
<?php
class A {
public function __call($m, $a) {
echo "__call\n";
}
}
class B extends A {
public static function foo() {
echo "foo\n";
}
}
if (is_callable(array('B', 'foo'))) {
call_user_func(array('B', 'foo'));
}
if (is_callable(array('A', 'foo'))) {
call_user_func(array('A', 'foo'));
}
?>
--EXPECT--
foo
+28
View File
@@ -0,0 +1,28 @@
--TEST--
Bug #34712 zend.ze1_compatibility_mode = on segfault
--INI--
zend.ze1_compatibility_mode=1
error_reporting=4095
--FILE--
<?php
class foo {
function foo(&$obj_ref) {
$this->bar = &$obj_ref;
}
}
class bar {
function bar() {
$this->foo = new foo($this);
}
}
$test = new bar;
echo "ok\n";
?>
--EXPECTF--
Strict Standards: Implicit cloning object of class 'foo' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 11
Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 15
ok
+33
View File
@@ -0,0 +1,33 @@
--TEST--
Bug #34767 (Zend Engine 1 Compatibility not copying objects correctly)
--INI--
zend.ze1_compatibility_mode=1
error_reporting=4095
--FILE--
<?php
$a->y = &new stdClass();
print_r($a);
$b = $a;
$a->y->z = 1;
print_r($b);
?>
--EXPECTF--
Strict Standards: Assigning the return value of new by reference is deprecated in %sbug34767.php on line 2
stdClass Object
(
[y] => stdClass Object
(
)
)
Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug34767.php on line 4
stdClass Object
(
[y] => stdClass Object
(
[z] => 1
)
)
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #34786 (2 @ results in change to error_reporting() to random value)
--FILE--
<?php
function foo($a,$b,$c) {
echo "foo: ".error_reporting()."\n";
}
function bar() {
echo "bar: ".error_reporting()."\n";
}
error_reporting(1);
echo "before: ".error_reporting()."\n";
@foo(1,@bar(),3);
echo "after: ".error_reporting()."\n";
?>
--EXPECT--
before: 1
bar: 0
foo: 0
after: 1
+27
View File
@@ -0,0 +1,27 @@
--TEST--
bug #34873 (Segmentation Fault on foreach in object)
--FILE--
<?php
class pwa {
public $var;
function __construct(){
$this->var = array();
}
function test (){
$cont = array();
$cont["mykey"] = "myvalue";
foreach ($cont as $this->var['key'] => $this->var['value'])
var_dump($this->var['value']);
}
}
$myPwa = new Pwa();
$myPwa->test();
echo "Done\n";
?>
--EXPECT--
string(7) "myvalue"
Done
+11
View File
@@ -0,0 +1,11 @@
--TEST--
Bug #34879 (str_replace, array_map corrupt negative array indexes on 64-bit platforms)
--FILE--
<?php
print_r(str_replace('a', 'b', array(-1 =>-1)));
?>
--EXPECT--
Array
(
[-1] => -1
)
+33
View File
@@ -0,0 +1,33 @@
--TEST--
Bug #34893 (PHP5.1 overloading, Cannot access private property)
--FILE--
<?php
class A {
private $p;
function __get($name){
return $this->$name;
}
function __set($name, $value) {
$this->$name = $value;
}
}
class B {
private $t;
function __get($name){
return $this->$name;
}
function __set($name, $value) {
$this->$name = $value;
}
}
$a = new A;
$b = new B;
$a->p = $b;
$b->t = "foo";
echo $a->p->t;
$a->p->t = "bar";
echo $a->p->t;
?>
--EXPECT--
foobar
+23
View File
@@ -0,0 +1,23 @@
--TEST--
catch shouldn't call __autoload
--FILE--
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
eval("class $name {}");
}
try {
} catch (A $e) {
}
try {
throw new Exception();
} catch (B $e) {
} catch (Exception $e) {
echo "ok\n";
}
?>
--EXPECT--
ok
+26
View File
@@ -0,0 +1,26 @@
--TEST--
testing @ and error_reporting - 1
--FILE--
<?php
error_reporting(E_ALL);
function foo($arg) {
}
function bar() {
throw new Exception("test");
}
try {
@foo(@bar());
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECT--
int(2047)
Done
+27
View File
@@ -0,0 +1,27 @@
--TEST--
testing @ and error_reporting - 2
--FILE--
<?php
error_reporting(E_ALL);
function foo($arg) {
}
function bar() {
error_reporting(E_ALL|E_STRICT);
throw new Exception("test");
}
try {
@foo(@bar());
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECT--
int(4095)
Done
+35
View File
@@ -0,0 +1,35 @@
--TEST--
testing @ and error_reporting - 3
--FILE--
<?php
error_reporting(E_ALL);
function foo($arg) {
echo @$nonex_foo;
}
function bar() {
echo @$nonex_bar;
throw new Exception("test");
}
function foo1() {
echo $undef1;
error_reporting(E_ALL|E_STRICT);
echo $undef2;
}
try {
@foo(@bar(@foo1()));
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: undef2 in %s on line %d
int(4095)
Done
+23
View File
@@ -0,0 +1,23 @@
--TEST--
testing @ and error_reporting - 4
--FILE--
<?php
error_reporting(E_ALL);
function foo() {
echo $undef;
error_reporting(E_ALL|E_STRICT);
}
foo(@$var);
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: undef in %s on line %d
int(4095)
Done
+34
View File
@@ -0,0 +1,34 @@
--TEST--
testing @ and error_reporting - 5
--FILE--
<?php
error_reporting(E_ALL);
class test {
function __get($name) {
return $undef_name;
}
function __set($name, $value) {
return $undef_value;
}
}
$test = new test;
$test->abc = 123;
echo $test->bcd;
@$test->qwe = 123;
echo @$test->wer;
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: undef_value in %s on line %d
Notice: Undefined variable: undef_name in %s on line %d
int(2047)
Done
+30
View File
@@ -0,0 +1,30 @@
--TEST--
testing @ and error_reporting - 6
--FILE--
<?php
error_reporting(E_ALL);
function foo1($arg) {
}
function foo2($arg) {
}
function foo3($arg) {
echo $undef3;
throw new Exception("test");
}
try {
@foo1(@foo2(@foo3()));
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
int(2047)
Done
+30
View File
@@ -0,0 +1,30 @@
--TEST--
testing @ and error_reporting - 7
--FILE--
<?php
error_reporting(E_ALL);
function foo1($arg) {
}
function foo2($arg) {
}
function foo3($arg) {
echo $undef3;
throw new Exception("test");
}
try {
@error_reporting(@foo1(@foo2(@foo3())));
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
int(2047)
Done
+32
View File
@@ -0,0 +1,32 @@
--TEST--
testing @ and error_reporting - 8
--FILE--
<?php
error_reporting(E_ALL);
function foo1($arg) {
}
function foo2($arg) {
}
function foo3($arg) {
error_reporting(E_ALL|E_STRICT);
echo $undef3;
throw new Exception("test");
}
try {
@foo1(@foo2(@foo3()));
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: undef3 in %s on line %d
int(4095)
Done
+31
View File
@@ -0,0 +1,31 @@
--TEST--
testing @ and error_reporting - 9
--FILE--
<?php
error_reporting(E_ALL);
function bar() {
echo @$blah;
echo $undef2;
}
function foo() {
echo @$undef;
error_reporting(E_ALL|E_STRICT);
echo $blah;
return bar();
}
@foo();
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: blah in %s on line %d
Notice: Undefined variable: undef2 in %s on line %d
int(4095)
Done
+35
View File
@@ -0,0 +1,35 @@
--TEST--
testing @ and error_reporting - 10
--FILE--
<?php
error_reporting(E_ALL);
function make_exception()
{
@$blah;
str_replace();
error_reporting(0);
throw new Exception();
}
try {
@make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
error_reporting(E_ALL&~E_NOTICE);
try {
@make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
int(2047)
int(2039)
Done
+18
View File
@@ -0,0 +1,18 @@
--TEST--
instanceof shouldn't call __autoload
--FILE--
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
eval("class $name {}");
}
class A {
}
$a = new A;
var_dump($a instanceof B);
var_dump($a instanceof A);
?>
--EXPECT--
bool(false)
bool(true)
+51
View File
@@ -0,0 +1,51 @@
--TEST--
is_a() and is_subclass_of() shouldn't call __autoload
--INI--
error_reporting=4095
--FILE--
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
eval("class $name {}");
}
class BASE {
}
interface INT {
}
class A extends BASE implements INT {
}
$a = new A;
var_dump(is_a($a, "B1"));
var_dump(is_a($a, "A"));
var_dump(is_a($a, "BASE"));
var_dump(is_a($a, "INT"));
var_dump(is_subclass_of($a, "B2"));
var_dump(is_subclass_of($a, "A"));
var_dump(is_subclass_of($a, "BASE"));
var_dump(is_subclass_of($a, "INT"));
var_dump(is_subclass_of("X1", "X2"));
?>
--EXPECTF--
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 17
bool(false)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 18
bool(true)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 19
bool(true)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 20
bool(true)
bool(false)
bool(false)
bool(true)
bool(false)
AUTOLOAD 'X1'
AUTOLOAD 'X2'
bool(false)
+11
View File
@@ -0,0 +1,11 @@
--TEST--
unset() CV 12 (unset() in indirect called function)
--FILE--
<?php
$x = 1;
function foo() {unset($GLOBALS["x"]);}
call_user_func("foo");
echo "ok\n";
?>
--EXPECT--
ok
+16 -7
View File
@@ -38,6 +38,7 @@
# define GLOBAL_FUNCTION_TABLE CG(function_table)
# define GLOBAL_CLASS_TABLE CG(class_table)
# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
# define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
#endif
#if defined(ZEND_WIN32) && ZEND_DEBUG
@@ -88,6 +89,7 @@ HashTable *global_function_table;
HashTable *global_class_table;
HashTable *global_constants_table;
HashTable *global_auto_globals_table;
static HashTable *global_persistent_list = NULL;
#endif
ZEND_API zend_utility_values zend_uv;
@@ -127,7 +129,7 @@ static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC)
if (is_object) {
char *prop_name, *class_name;
zend_unmangle_property_name(string_key, &class_name, &prop_name);
zend_unmangle_property_name_ex(string_key, str_len, &class_name, &prop_name);
ZEND_PUTS(prop_name);
if (class_name) {
if (class_name[0]=='*') {
@@ -486,6 +488,13 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
{
zend_ini_shutdown(TSRMLS_C);
if (&executor_globals->persistent_list != global_persistent_list) {
zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC);
}
if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
zend_hash_destroy(executor_globals->zend_constants);
free(executor_globals->zend_constants);
}
}
@@ -682,6 +691,7 @@ void zend_post_startup(TSRMLS_D)
compiler_globals_ctor(compiler_globals, tsrm_ls);
free(EG(zend_constants));
executor_globals_ctor(executor_globals, tsrm_ls);
global_persistent_list = &EG(persistent_list);
zend_new_thread_end_handler(tsrm_thread_id() TSRMLS_CC);
}
#endif
@@ -691,9 +701,6 @@ void zend_shutdown(TSRMLS_D)
{
#ifdef ZEND_WIN32
zend_shutdown_timeout_thread();
#endif
#ifndef ZTS
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
#endif
zend_hash_graceful_reverse_destroy(&module_registry);
@@ -706,16 +713,18 @@ void zend_shutdown(TSRMLS_D)
zend_shutdown_extensions(TSRMLS_C);
free(zend_version_info);
zend_shutdown_constants(TSRMLS_C);
free(GLOBAL_FUNCTION_TABLE);
free(GLOBAL_CLASS_TABLE);
#ifdef ZTS
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
free(GLOBAL_CONSTANTS_TABLE);
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
#ifdef ZTS
GLOBAL_FUNCTION_TABLE = NULL;
GLOBAL_CLASS_TABLE = NULL;
GLOBAL_AUTO_GLOBALS_TABLE = NULL;
GLOBAL_CONSTANTS_TABLE = NULL;
#endif
zend_destroy_rsrc_list_dtors();
}
+1
View File
@@ -331,6 +331,7 @@ struct _zend_class_entry {
HashTable function_table;
HashTable default_properties;
HashTable properties_info;
HashTable default_static_members;
HashTable *static_members;
HashTable constants_table;
struct _zend_function_entry *builtin_functions;
+256 -23
View File
@@ -753,13 +753,53 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC)
{
if (!class_type->constants_updated) {
if (!class_type->constants_updated || !class_type->static_members) {
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
zend_class_entry *old_scope = *scope;
*scope = class_type;
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
if (!class_type->static_members) {
HashPosition pos;
zval **p;
if (class_type->parent) {
zend_update_class_constants(class_type->parent TSRMLS_CC);
}
ALLOC_HASHTABLE(class_type->static_members);
zend_hash_init(class_type->static_members, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_internal_pointer_reset_ex(&class_type->default_static_members, &pos);
while (zend_hash_get_current_data_ex(&class_type->default_static_members, (void**)&p, &pos) == SUCCESS) {
char *str_index;
uint str_length;
ulong num_index;
zval **q;
zend_hash_get_current_key_ex(&class_type->default_static_members, &str_index, &str_length, &num_index, 0, &pos);
if ((*p)->is_ref &&
class_type->parent &&
zend_hash_find(&class_type->parent->default_static_members, str_index, str_length, (void**)&q) == SUCCESS &&
*p == *q &&
zend_hash_find(class_type->parent->static_members, str_index, str_length, (void**)&q) == SUCCESS) {
(*q)->refcount++;
(*q)->is_ref = 1;
zend_hash_add(class_type->static_members, str_index, str_length, (void**)q, sizeof(zval*), NULL);
} else {
zval *q;
ALLOC_ZVAL(q);
*q = **p;
INIT_PZVAL(q)
zval_copy_ctor(q);
zend_hash_add(class_type->static_members, str_index, str_length, (void**)&q, sizeof(zval*), NULL);
}
zend_hash_move_forward_ex(&class_type->default_static_members, &pos);
}
}
zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
*scope = old_scope;
class_type->constants_updated = 1;
}
@@ -895,7 +935,7 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value)
}
ZEND_API int add_index_long(zval *arg, uint index, long n)
ZEND_API int add_index_long(zval *arg, ulong index, long n)
{
zval *tmp;
@@ -906,7 +946,7 @@ ZEND_API int add_index_long(zval *arg, uint index, long n)
}
ZEND_API int add_index_null(zval *arg, uint index)
ZEND_API int add_index_null(zval *arg, ulong index)
{
zval *tmp;
@@ -916,7 +956,7 @@ ZEND_API int add_index_null(zval *arg, uint index)
return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
}
ZEND_API int add_index_bool(zval *arg, uint index, int b)
ZEND_API int add_index_bool(zval *arg, ulong index, int b)
{
zval *tmp;
@@ -927,7 +967,7 @@ ZEND_API int add_index_bool(zval *arg, uint index, int b)
}
ZEND_API int add_index_resource(zval *arg, uint index, int r)
ZEND_API int add_index_resource(zval *arg, ulong index, int r)
{
zval *tmp;
@@ -938,7 +978,7 @@ ZEND_API int add_index_resource(zval *arg, uint index, int r)
}
ZEND_API int add_index_double(zval *arg, uint index, double d)
ZEND_API int add_index_double(zval *arg, ulong index, double d)
{
zval *tmp;
@@ -949,7 +989,7 @@ ZEND_API int add_index_double(zval *arg, uint index, double d)
}
ZEND_API int add_index_string(zval *arg, uint index, char *str, int duplicate)
ZEND_API int add_index_string(zval *arg, ulong index, char *str, int duplicate)
{
zval *tmp;
@@ -960,7 +1000,7 @@ ZEND_API int add_index_string(zval *arg, uint index, char *str, int duplicate)
}
ZEND_API int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate)
ZEND_API int add_index_stringl(zval *arg, ulong index, char *str, uint length, int duplicate)
{
zval *tmp;
@@ -971,7 +1011,7 @@ ZEND_API int add_index_stringl(zval *arg, uint index, char *str, uint length, in
}
ZEND_API int add_index_zval(zval *arg, uint index, zval *value)
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value)
{
return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &value, sizeof(zval *), NULL);
}
@@ -1082,7 +1122,7 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *
}
ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest)
ZEND_API int add_get_index_long(zval *arg, ulong index, long l, void **dest)
{
zval *tmp;
@@ -1093,7 +1133,7 @@ ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest)
}
ZEND_API int add_get_index_double(zval *arg, uint index, double d, void **dest)
ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest)
{
zval *tmp;
@@ -1104,7 +1144,7 @@ ZEND_API int add_get_index_double(zval *arg, uint index, double d, void **dest)
}
ZEND_API int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate)
ZEND_API int add_get_index_string(zval *arg, ulong index, char *str, void **dest, int duplicate)
{
zval *tmp;
@@ -1115,7 +1155,7 @@ ZEND_API int add_get_index_string(zval *arg, uint index, char *str, void **dest,
}
ZEND_API int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate)
ZEND_API int add_get_index_stringl(zval *arg, ulong index, char *str, uint length, void **dest, int duplicate)
{
zval *tmp;
@@ -1494,10 +1534,14 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
}
} else {
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
efree(lc_class_name);
zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname);
return FAILURE;
}
if (!internal_function->handler) {
if (scope) {
efree(lc_class_name);
}
zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
return FAILURE;
@@ -1905,23 +1949,28 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
return 1;
}
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
{
char *lcname;
zend_bool retval = 0;
int callable_name_len_local;
zend_class_entry *ce_local;
zend_function *fptr_local;
zval **zobj_ptr_local;
if (callable_name_len == NULL) {
callable_name_len = &callable_name_len_local;
}
if (ce_ptr == NULL) {
ce_ptr = &ce_local;
}
if (fptr_ptr == NULL) {
fptr_ptr = &fptr_local;
}
if (zobj_ptr_ptr == NULL) {
zobj_ptr_ptr = &zobj_ptr_local;
}
*ce_ptr = NULL;
*fptr_ptr = NULL;
*zobj_ptr_ptr = NULL;
@@ -1944,9 +1993,9 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
case IS_ARRAY:
{
zend_class_entry *ce = NULL, **pce;
zval **method;
zval **obj;
zend_class_entry *ce = NULL, **pce;
if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2 &&
zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj) == SUCCESS &&
@@ -1965,10 +2014,12 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
memcpy(ptr, "::", sizeof("::") - 1);
ptr += sizeof("::") - 1;
memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
}
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
*ce_ptr = ce;
return 1;
}
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
@@ -1998,8 +2049,10 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
*ce_ptr = ce;
return 1;
}
}
if (ce) {
@@ -2028,7 +2081,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
}
}
/* check for __call too */
if (retval == 0 && ce->__call != 0) {
if (retval == 0 && *zobj_ptr_ptr && ce->__call != 0) {
retval = 1;
}
efree(lcname);
@@ -2037,6 +2090,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
*callable_name = estrndup("Array", sizeof("Array")-1);
*callable_name_len = sizeof("Array") - 1;
}
*ce_ptr = ce;
}
break;
@@ -2061,7 +2115,7 @@ ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **cal
{
TSRMLS_FETCH();
return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL TSRMLS_CC);
return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL, NULL TSRMLS_CC);
}
@@ -2072,7 +2126,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRML
zend_class_entry **pce;
int class_name_len;
if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL, NULL TSRMLS_CC)) {
if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL, NULL, NULL TSRMLS_CC)) {
return 1;
}
switch (Z_TYPE_P(callable)) {
@@ -2126,7 +2180,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name
access_type |= ZEND_ACC_PUBLIC;
}
if (access_type & ZEND_ACC_STATIC) {
target_symbol_table = ce->static_members;
target_symbol_table = &ce->default_static_members;
} else {
target_symbol_table = &ce->default_properties;
}
@@ -2274,6 +2328,73 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC)
{
return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL);
}
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
} else {
ALLOC_ZVAL(constant);
}
ZVAL_LONG(constant, value);
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
} else {
ALLOC_ZVAL(constant);
}
ZVAL_BOOL(constant, value);
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
} else {
ALLOC_ZVAL(constant);
}
ZVAL_DOUBLE(constant, value);
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
ZVAL_STRINGL(constant, zend_strndup(value, value_length), value_length, 0);
} else {
ALLOC_ZVAL(constant);
ZVAL_STRINGL(constant, value, value_length, 1);
}
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC)
{
return zend_declare_class_constant_stringl(ce, name, name_length, value, strlen(value) TSRMLS_CC);
}
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC)
{
zval property;
@@ -2335,7 +2456,7 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object,
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_LONG(tmp, value);
ZVAL_DOUBLE(tmp, value);
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
@@ -2361,6 +2482,106 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC)
{
zval **property;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
property = zend_std_get_static_property(scope, name, name_length, 0 TSRMLS_CC);
EG(scope) = old_scope;
if (!property) {
return FAILURE;
} else {
if (*property != value) {
if (PZVAL_IS_REF(*property)) {
zval_dtor(*property);
(*property)->type = value->type;
(*property)->value = value->value;
if (value->refcount > 0) {
zval_copy_ctor(*property);
}
} else {
zval *garbage = *property;
value->refcount++;
if (PZVAL_IS_REF(value)) {
SEPARATE_ZVAL(&value);
}
*property = value;
zval_ptr_dtor(&garbage);
}
}
return SUCCESS;
}
}
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_NULL(tmp);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_BOOL(tmp, value);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_LONG(tmp, value);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_DOUBLE(tmp, value);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_STRING(tmp, value, 1);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_len TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_STRINGL(tmp, value, value_len, 1);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC)
{
zval property, *value;
@@ -2382,6 +2603,18 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n
return value;
}
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC)
{
zval **property;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
property = zend_std_get_static_property(scope, name, name_length, silent TSRMLS_CC);
EG(scope) = old_scope;
return property?*property:NULL;
}
/*
* Local variables:
* tab-width: 4
+30 -13
View File
@@ -198,7 +198,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
#define IS_CALLABLE_CHECK_IS_STATIC (1<<2)
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
ZEND_API char *zend_get_module_version(char *module_name);
@@ -212,6 +212,13 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC);
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC);
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC);
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
@@ -221,8 +228,18 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object,
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC);
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC);
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC);
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC);
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_length TSRMLS_DC);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC);
ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC);
@@ -277,14 +294,14 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
#define add_next_index_unset(__arg) add_next_index_null(__arg)
#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
ZEND_API int add_index_long(zval *arg, uint idx, long n);
ZEND_API int add_index_null(zval *arg, uint idx);
ZEND_API int add_index_bool(zval *arg, uint idx, int b);
ZEND_API int add_index_resource(zval *arg, uint idx, int r);
ZEND_API int add_index_double(zval *arg, uint idx, double d);
ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate);
ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
ZEND_API int add_index_long(zval *arg, ulong idx, long n);
ZEND_API int add_index_null(zval *arg, ulong idx);
ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
ZEND_API int add_index_resource(zval *arg, ulong idx, int r);
ZEND_API int add_index_double(zval *arg, ulong idx, double d);
ZEND_API int add_index_string(zval *arg, ulong idx, char *str, int duplicate);
ZEND_API int add_index_stringl(zval *arg, ulong idx, char *str, uint length, int duplicate);
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
ZEND_API int add_next_index_long(zval *arg, long n);
ZEND_API int add_next_index_null(zval *arg);
@@ -301,10 +318,10 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *
#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest);
ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest);
ZEND_API int add_get_index_string(zval *arg, ulong idx, char *str, void **dest, int duplicate);
ZEND_API int add_get_index_stringl(zval *arg, ulong idx, char *str, uint length, void **dest, int duplicate);
ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC);
ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC);
+2 -1
View File
@@ -75,7 +75,8 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
if (AG(memory_limit)<AG(allocated_memory)) {\
int php_mem_limit = AG(memory_limit); \
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
AG(allocated_memory) -= rs; \
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory)) { \
AG(memory_limit) = AG(allocated_memory) + 1048576; \
if (file) { \
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \
+7 -5
View File
@@ -229,6 +229,7 @@ ZEND_FUNCTION(func_get_arg)
arg = *(p-(arg_count-requested_offset));
*return_value = *arg;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
/* }}} */
@@ -624,7 +625,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
convert_to_string_ex(class_name);
if (zend_lookup_class(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == FAILURE) {
if (zend_lookup_class_ex(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), (instance_ce != NULL), &ce TSRMLS_CC) == FAILURE) {
retval = 0;
} else {
if (only_subclass) {
@@ -689,7 +690,7 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re
zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos);
zend_hash_move_forward_ex(properties, &pos);
zend_unmangle_property_name(key, &class_name, &prop_name);
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
if (class_name) {
if (class_name[0] != '*' && strcmp(class_name, ce->name)) {
/* filter privates from base classes */
@@ -736,6 +737,7 @@ ZEND_FUNCTION(get_class_vars)
} else {
array_init(return_value);
add_class_vars(*pce, &(*pce)->default_properties, return_value TSRMLS_CC);
zend_update_class_constants(*pce TSRMLS_CC);
add_class_vars(*pce, (*pce)->static_members, return_value TSRMLS_CC);
}
}
@@ -780,7 +782,7 @@ ZEND_FUNCTION(get_object_vars)
(*value)->refcount++;
add_assoc_zval_ex(return_value, key, key_len, *value);
} else if (instanceof) {
zend_unmangle_property_name(key, &class_name, &prop_name);
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
if (!memcmp(class_name, "*", 2) || (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) && !strcmp(Z_OBJCE_P(EG(This))->name, class_name))) {
/* Not separating references */
(*value)->refcount++;
@@ -929,7 +931,7 @@ ZEND_FUNCTION(property_exists)
if (property_info->flags & ZEND_ACC_PUBLIC) {
RETURN_TRUE;
}
zend_unmangle_property_name(property_info->name, &class_name, &prop_name);
zend_unmangle_property_name_ex(property_info->name, property_info->name_length, &class_name, &prop_name);
if (!strncmp(class_name, "*", 1)) {
if (instanceof_function(EG(scope), ce TSRMLS_CC)) {
RETURN_TRUE;
@@ -1846,7 +1848,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
ptr = EG(current_execute_data);
/* skip "new Exception()" */
if ((skip_last == 0) && ptr->opline && (ptr->opline->opcode == ZEND_NEW)) {
if (ptr && (skip_last == 0) && ptr->opline && (ptr->opline->opcode == ZEND_NEW)) {
ptr = ptr->prev_execute_data;
}
+106 -41
View File
@@ -540,30 +540,50 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC)
int last_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
if (last_op_number > 0) {
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
if (variable->op_type == IS_VAR) {
int n = 0;
if (last_op->opcode == ZEND_FETCH_OBJ_W) {
last_op->opcode = ZEND_ASSIGN_OBJ;
while (last_op_number - n > 0) {
zend_op *last_op;
last_op = &CG(active_op_array)->opcodes[last_op_number-(n+1)];
zend_do_op_data(opline, value TSRMLS_CC);
SET_UNUSED(opline->result);
*result = last_op->result;
return;
} else if (last_op->opcode == ZEND_FETCH_DIM_W) {
last_op->opcode = ZEND_ASSIGN_DIM;
zend_do_op_data(opline, value TSRMLS_CC);
opline->op2.u.var = get_temporary_variable(CG(active_op_array));
opline->op2.u.EA.type = 0;
opline->op2.op_type = IS_VAR;
SET_UNUSED(opline->result);
*result = last_op->result;
return;
} else {
if (opline_is_fetch_this(last_op TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
if (last_op->result.op_type == IS_VAR &&
last_op->result.u.var == variable->u.var) {
if (last_op->opcode == ZEND_FETCH_OBJ_W) {
if (n > 0) {
*opline = *last_op;
MAKE_NOP(last_op);
last_op = opline;
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
}
last_op->opcode = ZEND_ASSIGN_OBJ;
zend_do_op_data(opline, value TSRMLS_CC);
SET_UNUSED(opline->result);
*result = last_op->result;
return;
} else if (last_op->opcode == ZEND_FETCH_DIM_W) {
if (n > 0) {
*opline = *last_op;
MAKE_NOP(last_op);
last_op = opline;
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
}
last_op->opcode = ZEND_ASSIGN_DIM;
zend_do_op_data(opline, value TSRMLS_CC);
opline->op2.u.var = get_temporary_variable(CG(active_op_array));
opline->op2.u.EA.type = 0;
opline->op2.op_type = IS_VAR;
SET_UNUSED(opline->result);
*result = last_op->result;
return;
} else if (opline_is_fetch_this(last_op TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
} else {
break;
}
}
n++;
}
}
@@ -591,7 +611,8 @@ void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC)
if (last_op_number > 0) {
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
if (opline_is_fetch_this(last_op TSRMLS_CC)) {
if (lvar->op_type == IS_VAR &&
opline_is_fetch_this(last_op TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
}
}
@@ -1499,7 +1520,12 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
}
if (function_ptr) {
send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset) ? ZEND_ARG_SEND_BY_REF : 0;
if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
op = (param->op_type & (IS_VAR|IS_CV))?ZEND_SEND_REF:ZEND_SEND_VAL;
send_by_reference = 0;
} else {
send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset) ? ZEND_ARG_SEND_BY_REF : 0;
}
} else {
send_by_reference = 0;
}
@@ -1701,6 +1727,13 @@ void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var,
long catch_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline;
if (catch_op_number > 0) {
opline = &CG(active_op_array)->opcodes[catch_op_number-1];
if (opline->opcode == ZEND_FETCH_CLASS) {
opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
}
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_CATCH;
opline->op1 = *catch_class;
@@ -2034,20 +2067,28 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS);
if (child_info->flags & ZEND_ACC_STATIC) {
zval **prop;
if (zend_hash_find(parent_ce->static_members, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) {
HashTable *ht;
if (parent_ce->type != ce->type) {
/* User class extends internal class */
ht = parent_ce->static_members;
} else {
ht = &parent_ce->default_static_members;
}
if (zend_hash_find(ht, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) {
zval **new_prop;
if (zend_hash_find(ce->static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) {
if (zend_hash_find(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) {
if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) {
char *prop_name, *tmp;
zend_unmangle_property_name(child_info->name, &tmp, &prop_name);
zend_unmangle_property_name_ex(child_info->name, child_info->name_length, &tmp, &prop_name);
zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %s::$%s in class %s",
parent_ce->name, prop_name, ce->name);
}
}
(*prop)->refcount++;
zend_hash_update(ce->static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL);
zend_hash_del(ce->static_members, prot_name, prot_name_length+1);
zend_hash_update(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL);
zend_hash_del(&ce->default_static_members, prot_name, prot_name_length+1);
}
} else {
zend_hash_del(&ce->default_properties, prot_name, prot_name_length+1);
@@ -2133,7 +2174,13 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
/* Inherit properties */
zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
if (parent_ce->type != ce->type) {
/* User class extends internal class */
zend_update_class_constants(parent_ce TSRMLS_CC);
zend_hash_merge(&ce->default_static_members, parent_ce->static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
} else {
zend_hash_merge(&ce->default_static_members, &parent_ce->default_static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
}
zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce);
zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
@@ -2263,7 +2310,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *c
zend_hash_destroy(&ce->function_table);
zend_hash_destroy(&ce->default_properties);
zend_hash_destroy(&ce->properties_info);
zend_hash_destroy(ce->static_members);
zend_hash_destroy(&ce->default_static_members);
zend_hash_destroy(&ce->constants_table);
return NULL;
}
@@ -2782,6 +2829,18 @@ ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src
}
ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **class_name, char **prop_name)
{
*prop_name = *class_name = NULL;
if (mangled_property_len < 2) { /* do not try to unmangle empty strings */
*prop_name = mangled_property;
return;
}
zend_unmangle_property_name(mangled_property, class_name, prop_name);
}
ZEND_API void zend_unmangle_property_name(char *mangled_property, char **class_name, char **prop_name)
{
*prop_name = *class_name = NULL;
@@ -3443,8 +3502,17 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC
void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC)
{
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
int last_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline;
if (last_op_number > 0) {
opline = &CG(active_op_array)->opcodes[last_op_number-1];
if (opline->opcode == ZEND_FETCH_CLASS) {
opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
}
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_INSTANCEOF;
opline->result.op_type = IS_TMP_VAR;
opline->result.u.var = get_temporary_variable(CG(active_op_array));
@@ -3568,7 +3636,8 @@ void zend_do_foreach_cont(znode *foreach_token, znode *as_token, znode *value, z
}
value_node = opline->result;
if (assign_by_ref) {
zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
if (assign_by_ref) {
/* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */
zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC);
} else {
@@ -3579,7 +3648,8 @@ void zend_do_foreach_cont(znode *foreach_token, znode *as_token, znode *value, z
if (key->op_type != IS_UNUSED) {
znode key_node;
opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1];
zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1];
opline->result.op_type = IS_TMP_VAR;
opline->result.u.EA.type = 0;
opline->result.u.opline_num = get_temporary_variable(CG(active_op_array));
@@ -3927,17 +3997,12 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
zend_hash_init_ex(&ce->default_properties, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
zend_hash_init_ex(&ce->properties_info, 0, NULL, (dtor_func_t) (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, 0);
if (persistent_hashes) {
ce->static_members = (HashTable *) malloc(sizeof(HashTable));
} else {
ALLOC_HASHTABLE(ce->static_members);
}
zend_hash_init_ex(ce->static_members, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
zend_hash_init_ex(&ce->default_static_members, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
zend_hash_init_ex(&ce->constants_table, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
zend_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
ce->static_members = (ce->type == ZEND_INTERNAL_CLASS) ? NULL : &ce->default_static_members;
if (nullify_handlers) {
ce->constructor = NULL;
ce->destructor = NULL;
+25 -4
View File
@@ -291,9 +291,9 @@ struct _zend_execute_data {
union _temp_variable *Ts;
zval ***CVs;
zend_bool original_in_execution;
zend_class_entry *calling_scope;
HashTable *symbol_table;
struct _zend_execute_data *prev_execute_data;
zval *old_error_reporting;
};
#define EX(element) execute_data.element
@@ -522,6 +522,7 @@ void zend_class_add_ref(zend_class_entry **ce);
ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal);
ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name);
ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **prop_name, char **class_name);
#define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
@@ -583,7 +584,7 @@ int zendlex(znode *zendlval TSRMLS_DC);
#define ZEND_FETCH_CLASS_GLOBAL 4
#define ZEND_FETCH_CLASS_AUTO 5
#define ZEND_FETCH_CLASS_INTERFACE 6
#define ZEND_FETCH_CLASS_NO_AUTOLOAD 0x80
/* variable parsing type (compile-time) */
#define ZEND_PARSED_MEMBER (1<<0)
@@ -648,6 +649,10 @@ int zendlex(znode *zendlval TSRMLS_DC);
#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
#define ZEND_ARG_SEND_FUNCTION (1<<2)
#define ZEND_SEND_BY_VAL 0
#define ZEND_SEND_BY_REF 1
#define ZEND_SEND_PREFER_REF 2
/* Lost In Stupid Parentheses */
#define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \
( \
@@ -657,15 +662,31 @@ int zendlex(znode *zendlval TSRMLS_DC);
( \
( \
arg_num<=((zend_function *) zf)->common.num_args \
&& ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference \
&& ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_SEND_BY_REF \
) \
|| ( \
arg_num>((zend_function *) zf)->common.num_args \
&& ((zend_function *) zf)->common.pass_rest_by_reference \
&& ((zend_function *) zf)->common.pass_rest_by_reference == ZEND_SEND_BY_REF \
) \
) \
)
#define ARG_MAY_BE_SENT_BY_REF(zf, arg_num) \
( \
zf \
&& ((zend_function *) zf)->common.arg_info \
&& \
( \
( \
arg_num<=((zend_function *) zf)->common.num_args \
&& ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_SEND_PREFER_REF \
) \
|| ( \
arg_num>((zend_function *) zf)->common.num_args \
&& ((zend_function *) zf)->common.pass_rest_by_reference == ZEND_SEND_PREFER_REF \
) \
) \
)
#define ZEND_RETURN_VAL 0
#define ZEND_RETURN_REF 1
+1
View File
@@ -196,6 +196,7 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len,
*return_value = *value;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
+32 -27
View File
@@ -392,12 +392,6 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
variable_ptr_ptr = &EG(uninitialized_zval_ptr);
} else if (variable_ptr != value_ptr) {
variable_ptr->refcount--;
if (variable_ptr->refcount==0) {
zendi_zval_dtor(*variable_ptr);
FREE_ZVAL(variable_ptr);
}
if (!PZVAL_IS_REF(value_ptr)) {
/* break it away */
value_ptr->refcount--;
@@ -413,6 +407,12 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
*variable_ptr_ptr = value_ptr;
value_ptr->refcount++;
variable_ptr->refcount--;
if (variable_ptr->refcount==0) {
zendi_zval_dtor(*variable_ptr);
FREE_ZVAL(variable_ptr);
}
} else if (!variable_ptr->is_ref) {
if (variable_ptr_ptr == value_ptr_ptr) {
SEPARATE_ZVAL(variable_ptr_ptr);
@@ -448,6 +448,7 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
{
zend_arg_info *cur_arg_info;
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
char *fclass, *fsep, *fname;
if (!zf->common.arg_info
|| arg_num>zf->common.num_args) {
@@ -455,22 +456,25 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
}
cur_arg_info = &zf->common.arg_info[arg_num-1];
fname = zf->common.function_name;
fsep = zf->common.scope ? "::" : "";
fclass = zf->common.scope ? zf->common.scope->name : "";
if (cur_arg_info->class_name) {
if (!arg) {
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s, called in %s on line %d and defined", arg_num, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s", arg_num, cur_arg_info->class_name);
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
}
}
switch (Z_TYPE_P(arg)) {
case IS_NULL:
if (!cur_arg_info->allow_null) {
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must not be null, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d must not be null", arg_num);
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
}
}
break;
@@ -484,47 +488,47 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
} else {
error_msg = "be an instance of";
}
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must %s %s, called in %s on line %d and defined", arg_num, error_msg, ce->name, ptr->op_array->filename, ptr->opline->lineno);
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must %s %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, error_msg, ce->name, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d must %s %s", arg_num, error_msg, ce->name);
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must %s %s", arg_num, fclass, fsep, fname, error_msg, ce->name);
}
}
}
break;
default:
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s, called in %s on line %d and defined", arg_num, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s", arg_num, cur_arg_info->class_name);
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
}
break;
}
} else if (cur_arg_info->array_type_hint) {
} else if (cur_arg_info->array_type_hint) {
if (!arg) {
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must be an array, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d must be an array", arg_num);
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
}
}
switch (Z_TYPE_P(arg)) {
case IS_NULL:
if (!cur_arg_info->allow_null) {
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must not be null, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d must not be null", arg_num);
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
}
}
break;
case IS_ARRAY:
break;
default:
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must be an array, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d must be an array", arg_num);
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
}
break;
}
@@ -1057,6 +1061,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
SEPARATE_ZVAL(container_ptr);
container = *container_ptr;
}
zval_dtor(container);
array_init(container);
break;
}
+19
View File
@@ -65,6 +65,7 @@ static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LI
}
}
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
@@ -98,6 +99,24 @@ static inline int i_zend_is_true(zval *op)
case IS_OBJECT:
if(IS_ZEND_STD_OBJECT(*op)) {
TSRMLS_FETCH();
if (Z_OBJ_HT_P(op)->cast_object) {
zval tmp;
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL, 0 TSRMLS_CC) == SUCCESS) {
result = Z_LVAL(tmp);
break;
}
} else if (Z_OBJ_HT_P(op)->get) {
zval *tmp = Z_OBJ_HT_P(op)->get(op TSRMLS_CC);
if(Z_TYPE_P(tmp) != IS_OBJECT) {
/* for safety - avoid loop */
convert_to_boolean(tmp);
result = Z_LVAL_P(tmp);
zval_ptr_dtor(&tmp);
break;
}
}
if(EG(ze1_compatibility_mode)) {
result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
} else {
+29 -10
View File
@@ -386,6 +386,13 @@ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
zval_dtor(*zval_ptr);
safe_free_zval_ptr_rel(*zval_ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC);
} else if ((*zval_ptr)->refcount == 1) {
if ((*zval_ptr)->type == IS_OBJECT) {
TSRMLS_FETCH();
if (EG(ze1_compatibility_mode)) {
return;
}
}
(*zval_ptr)->is_ref = 0;
}
}
@@ -750,7 +757,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
return FAILURE;
}
}
if (fci_cache) {
if (fci_cache &&
(EX(function_state).function->type != ZEND_INTERNAL_FUNCTION ||
((zend_internal_function*)EX(function_state).function)->handler != zend_std_call_user_call)) {
fci_cache->function_handler = EX(function_state).function;
fci_cache->object_pp = fci->object_pp;
fci_cache->calling_scope = calling_scope;
@@ -906,7 +915,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC)
{
zval **args[1];
zval autoload_function;
@@ -934,7 +943,7 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
* (doesn't impact fuctionality of __autoload()
*/
if (zend_is_compiling(TSRMLS_C)) {
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
free_alloca(lc_name);
return FAILURE;
}
@@ -1002,6 +1011,11 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
return retval;
}
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
{
return zend_lookup_class_ex(name, name_length, 1, ce TSRMLS_CC);
}
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
{
zval pv;
@@ -1327,7 +1341,9 @@ void zend_unset_timeout(TSRMLS_D)
zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC)
{
zend_class_entry **pce;
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
fetch_type = fetch_type & ~ZEND_FETCH_CLASS_NO_AUTOLOAD;
check_fetch_type:
switch (fetch_type) {
case ZEND_FETCH_CLASS_SELF:
@@ -1352,12 +1368,15 @@ check_fetch_type:
break;
}
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC)==FAILURE) {
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
zend_error(E_ERROR, "Interface '%s' not found", class_name);
} else {
zend_error(E_ERROR, "Class '%s' not found", class_name);
if (zend_lookup_class_ex(class_name, class_name_len, use_autoload, &pce TSRMLS_CC)==FAILURE) {
if (use_autoload) {
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
zend_error(E_ERROR, "Interface '%s' not found", class_name);
} else {
zend_error(E_ERROR, "Class '%s' not found", class_name);
}
}
return NULL;
}
return *pce;
}
@@ -1417,7 +1436,7 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC)
int i;
for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) {
if (ex->symbol_table == symbol_table) {
if (ex->op_array && ex->symbol_table == symbol_table) {
for (i = 0; i < ex->op_array->last_var; i++) {
ex->CVs[i] = NULL;
}
@@ -1432,7 +1451,7 @@ ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC)
if (zend_hash_quick_exists(&EG(symbol_table), name, name_len+1, hash_value)) {
for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) {
if (ex->symbol_table == &EG(symbol_table)) {
if (ex->op_array && ex->symbol_table == &EG(symbol_table)) {
int i;
for (i = 0; i < ex->op_array->last_var; i++) {
if (ex->op_array->vars[i].hash_value == hash_value &&
+1 -1
View File
@@ -27,7 +27,7 @@
/* The first number is the engine version and the rest is the date.
* This way engine 2 API no. is always greater than engine 1 API no..
*/
#define ZEND_EXTENSION_API_NO 220050617
#define ZEND_EXTENSION_API_NO 220051025
typedef struct _zend_extension_version_info {
int zend_extension_api_no;
+7 -4
View File
@@ -154,6 +154,7 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
zend_ini_entry *hashed_ini_entry;
zval default_value;
HashTable *directives = registered_zend_ini_directives;
zend_bool config_directive_success = 0;
#ifdef ZTS
/* if we are called during the request, eg: from dl(),
@@ -171,6 +172,7 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
while (p->name) {
p->module_number = module_number;
config_directive_success = 0;
if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
zend_unregister_ini_entries(module_number TSRMLS_CC);
return FAILURE;
@@ -180,11 +182,12 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
|| hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) {
hashed_ini_entry->value = default_value.value.str.val;
hashed_ini_entry->value_length = default_value.value.str.len;
config_directive_success = 1;
}
} else {
if (hashed_ini_entry->on_modify) {
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
}
}
if (!config_directive_success && hashed_ini_entry->on_modify) {
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
}
p++;
}
+1
View File
@@ -58,6 +58,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
/* no interest in caching and no information already present that is
* needed later inside zend_call_function. */
ZVAL_STRINGL(&z_fname, function_name, function_name_len, 0);
fci.function_table = !object_pp ? EG(function_table) : NULL;
result = zend_call_function(&fci, NULL TSRMLS_CC);
} else {
zend_fcall_info_cache fcic;
+4 -4
View File
@@ -181,7 +181,7 @@ inner_statement:
statement:
unticked_statement { zend_do_ticks(TSRMLS_C); RESET_DOC_COMMENT(); }
unticked_statement { zend_do_ticks(TSRMLS_C); }
;
unticked_statement:
@@ -220,7 +220,7 @@ unticked_statement:
foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); }
| T_FOREACH '(' expr_without_variable { zend_do_foreach_begin(&$1, &$2, &$3, 0 TSRMLS_CC); } T_AS
{ zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); }
w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); }
variable foreach_optional_arg ')' { zend_check_writable_variable(&$7); zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); }
foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); }
| T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
| ';' /* empty statement */
@@ -338,8 +338,8 @@ foreach_optional_arg:
foreach_variable:
w_variable { $$ = $1; }
| '&' w_variable { $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
variable { zend_check_writable_variable(&$1); $$ = $1; }
| '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
;
for_statement:
+8 -3
View File
@@ -615,6 +615,7 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_
if (zend_prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) {
return FAILURE;
}
BEGIN(INITIAL);
zend_highlight(syntax_highlighter_ini TSRMLS_CC);
#ifdef ZEND_MULTIBYTE
if (SCNG(script_org)) {
@@ -1833,6 +1834,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\{$" {
zendlval->value.str.val = estrndup("{$", sizeof("{$")-1);
zendlval->value.str.len = sizeof("{$")-1;
zendlval->type = IS_STRING;
return T_STRING;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"{ANY_CHAR} {
switch (yytext[1]) {
case 'n':
@@ -1850,9 +1858,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
case '$':
zendlval->value.lval = (long) yytext[1];
break;
case '{':
zendlval->value.lval = (long) yytext[1];
break;
default:
zendlval->value.str.val = estrndup(yytext, yyleng);
zendlval->value.str.len = yyleng;
+1 -1
View File
@@ -38,7 +38,7 @@ extern struct _zend_arg_info third_arg_force_ref[4];
extern struct _zend_arg_info fourth_arg_force_ref[5];
extern struct _zend_arg_info all_args_by_ref[1];
#define ZEND_MODULE_API_NO 20050617
#define ZEND_MODULE_API_NO 20050922
#ifdef ZTS
#define USING_ZTS 1
#else
+7 -4
View File
@@ -482,8 +482,10 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC
zval tmp_member;
zval **retval;
zend_property_info *property_info;
zend_bool use_get;
zobj = Z_OBJ_P(object);
use_get = (zobj->ce->__get && !zobj->in_get);
if (member->type != IS_STRING) {
tmp_member = *member;
@@ -496,12 +498,12 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
#endif
property_info = zend_get_property_info(zobj->ce, member, 0 TSRMLS_CC);
property_info = zend_get_property_info(zobj->ce, member, use_get TSRMLS_CC);
if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
if (!property_info || zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
zval *new_zval;
if (!zobj->ce->__get && !zobj->ce->__set) {
if (!use_get) {
/* we don't have access controls - will just add it */
new_zval = &EG(uninitialized_zval);
@@ -820,6 +822,8 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
return NULL;
}
zend_update_class_constants(tmp_ce TSRMLS_CC);
zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval);
if (!retval) {
@@ -830,7 +834,6 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
}
}
zval_update_constant(retval, (void *) 1 TSRMLS_CC);
return retval;
}
+12 -4
View File
@@ -38,6 +38,7 @@ ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint ini
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
{
efree(objects->object_buckets);
objects->object_buckets = NULL;
}
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC)
@@ -50,7 +51,7 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
if (!objects->object_buckets[i].destructor_called) {
objects->object_buckets[i].destructor_called = 1;
if (obj->dtor) {
if (obj->dtor && obj->object) {
obj->dtor(obj->object, i TSRMLS_CC);
}
}
@@ -138,9 +139,16 @@ ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC)
ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
{
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj;
zend_object_handle handle;
struct _store_object *obj;
if (!EG(objects_store).object_buckets) {
return;
}
handle = Z_OBJ_HANDLE_P(zobject);
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
/* Make sure we hold a reference count during the destructor call
otherwise, when the destructor ends the storage might be freed
when the refcount reaches 0 a second time
+9 -5
View File
@@ -138,11 +138,17 @@ ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
{
if ((*pce)->static_members) {
if ((*pce)->static_members != &(*pce)->default_static_members) {
zend_hash_destroy((*pce)->static_members);
FREE_HASHTABLE((*pce)->static_members);
}
(*pce)->static_members = NULL;
}
if ((*pce)->type == ZEND_USER_CLASS) {
/* Clean all parts that can contain run-time data */
/* Note that only run-time accessed data need to be cleaned up, pre-defined data can
not contain objects and thus are not probelmatic */
zend_hash_clean((*pce)->static_members);
zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
}
return 0;
@@ -159,10 +165,9 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
case ZEND_USER_CLASS:
zend_hash_destroy(&ce->default_properties);
zend_hash_destroy(&ce->properties_info);
zend_hash_destroy(ce->static_members);
zend_hash_destroy(&ce->default_static_members);
efree(ce->name);
zend_hash_destroy(&ce->function_table);
FREE_HASHTABLE(ce->static_members);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0 && ce->interfaces) {
efree(ce->interfaces);
@@ -175,10 +180,9 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
case ZEND_INTERNAL_CLASS:
zend_hash_destroy(&ce->default_properties);
zend_hash_destroy(&ce->properties_info);
zend_hash_destroy(ce->static_members);
zend_hash_destroy(&ce->default_static_members);
free(ce->name);
zend_hash_destroy(&ce->function_table);
free(ce->static_members);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0) {
free(ce->interfaces);
+1 -1
View File
@@ -482,7 +482,7 @@ ZEND_API void convert_to_boolean(zval *op)
zend_bool retval = 1;
TSRMLS_FETCH();
convert_object_to_type(op, IS_BOOL, convert_to_double);
convert_object_to_type(op, IS_BOOL, convert_to_boolean);
if (op->type == IS_BOOL) {
return;
+8 -1
View File
@@ -84,7 +84,14 @@ static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void **
*a = *(--stack->top_element);
*b = *(--stack->top_element);
*c = *(--stack->top_element);
stack->top -= 3;;
stack->top -= 3;
}
static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, void **a, void **b)
{
*a = *(--stack->top_element);
*b = *(--stack->top_element);
stack->top -= 2;
}
static inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr)
+95 -95
View File
@@ -41,13 +41,13 @@ zend_class_entry *reflection_property_ptr;
zend_class_entry *reflection_extension_ptr;
/* Method macros */
#define METHOD_NOTSTATIC \
if (!this_ptr) { \
#define METHOD_NOTSTATIC(ce) \
if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) { \
zend_error(E_ERROR, "%s() cannot be called statically", get_active_function_name(TSRMLS_C)); \
return; \
} \
#define METHOD_NOTSTATIC_NUMPARAMS(c) METHOD_NOTSTATIC \
#define METHOD_NOTSTATIC_NUMPARAMS(ce, c) METHOD_NOTSTATIC(ce) \
if (ZEND_NUM_ARGS() > c) { \
ZEND_WRONG_PARAM_COUNT(); \
} \
@@ -720,7 +720,7 @@ static void _property_string(string *str, zend_property_info *prop, char *prop_n
string_printf(str, "static ");
}
zend_unmangle_property_name(prop->name, &class_name, &prop_name);
zend_unmangle_property_name_ex(prop->name, prop->name_length, &class_name, &prop_name);
string_printf(str, "$%s", prop_name);
}
@@ -753,7 +753,7 @@ static int _extension_ini_string(zend_ini_entry *ini_entry, int num_args, va_lis
}
}
string_printf(str, "> ]\n", indent, ini_entry->name);
string_printf(str, "> ]\n");
string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value : "");
if (ini_entry->modified) {
string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value : "");
@@ -852,7 +852,7 @@ static void _function_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_BOOL(mptr->common.fn_flags & mask);
}
@@ -978,7 +978,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
property_reference *reference;
char *class_name, *prop_name;
zend_unmangle_property_name(prop->name, &class_name, &prop_name);
zend_unmangle_property_name_ex(prop->name, prop->name_length, &class_name, &prop_name);
if (!(prop->flags & ZEND_ACC_PRIVATE)) {
/* we have to seach the class hierarchy for this (implicit) public or protected property */
@@ -1252,7 +1252,7 @@ ZEND_METHOD(reflection_function, __toString)
zend_function *fptr;
string str;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
GET_REFLECTION_OBJECT_PTR(fptr);
string_init(&str);
_function_string(&str, fptr, "" TSRMLS_CC);
@@ -1264,7 +1264,7 @@ ZEND_METHOD(reflection_function, __toString)
Returns this function's name */
ZEND_METHOD(reflection, function_getName)
{
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -1276,7 +1276,7 @@ ZEND_METHOD(reflection, function_isInternal)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION);
}
@@ -1289,7 +1289,7 @@ ZEND_METHOD(reflection_function, isUserDefined)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->type == ZEND_USER_FUNCTION);
}
@@ -1302,7 +1302,7 @@ ZEND_METHOD(reflection_function, getFileName)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_STRING(fptr->op_array.filename, 1);
@@ -1318,7 +1318,7 @@ ZEND_METHOD(reflection_function, getStartLine)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_LONG(fptr->op_array.line_start);
@@ -1334,7 +1334,7 @@ ZEND_METHOD(reflection_function, getEndLine)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_LONG(fptr->op_array.line_end);
@@ -1350,7 +1350,7 @@ ZEND_METHOD(reflection_function, getDocComment)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1);
@@ -1367,12 +1367,13 @@ ZEND_METHOD(reflection_function, getStaticVariables)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
GET_REFLECTION_OBJECT_PTR(fptr);
/* Return an empty array in case no static variables exist */
array_init(return_value);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) {
zend_hash_apply_with_argument(fptr->op_array.static_variables, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
}
}
@@ -1391,7 +1392,7 @@ ZEND_METHOD(reflection_function, invoke)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_function_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
params = safe_emalloc(sizeof(zval **), argc, 0);
@@ -1451,7 +1452,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
zend_function *fptr;
zval *param_array;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_function_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &param_array) == FAILURE) {
@@ -1502,7 +1503,7 @@ ZEND_METHOD(reflection_function, returnsReference)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_function_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->op_array.return_reference);
@@ -1516,7 +1517,7 @@ ZEND_METHOD(reflection_function, getNumberOfParameters)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_function_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_LONG(fptr->common.num_args);
@@ -1530,7 +1531,7 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_function_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_LONG(fptr->common.required_num_args);
@@ -1546,7 +1547,7 @@ ZEND_METHOD(reflection_function, getParameters)
zend_uint i;
struct _zend_arg_info *arg_info;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_function_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
arg_info= fptr->common.arg_info;
@@ -1708,7 +1709,7 @@ ZEND_METHOD(reflection_parameter, __toString)
parameter_reference *param;
string str;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
string_init(&str);
_parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "" TSRMLS_CC);
@@ -1720,7 +1721,7 @@ ZEND_METHOD(reflection_parameter, __toString)
Returns this parameters's name */
ZEND_METHOD(reflection_parameter, getName)
{
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -1732,22 +1733,19 @@ ZEND_METHOD(reflection_parameter, getClass)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
if (!param->arg_info->class_name) {
RETURN_NULL();
} else {
zend_class_entry **pce;
char *lcname = do_alloca(param->arg_info->class_name_len + 1);
zend_str_tolower_copy(lcname, param->arg_info->class_name, param->arg_info->class_name_len);
if (zend_hash_find(EG(class_table), lcname, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE) {
free_alloca(lcname);
if (zend_lookup_class_ex(param->arg_info->class_name, param->arg_info->class_name_len, 1, &pce TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %s does not exist", param->arg_info->class_name);
return;
}
free_alloca(lcname);
zend_reflection_class_factory(*pce, return_value TSRMLS_CC);
}
}
@@ -1760,7 +1758,7 @@ ZEND_METHOD(reflection_parameter, isArray)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
RETVAL_BOOL(param->arg_info->array_type_hint);
@@ -1774,7 +1772,7 @@ ZEND_METHOD(reflection_parameter, allowsNull)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
RETVAL_BOOL(param->arg_info->allow_null);
@@ -1788,7 +1786,7 @@ ZEND_METHOD(reflection_parameter, isPassedByReference)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
RETVAL_BOOL(param->arg_info->pass_by_reference);
@@ -1802,7 +1800,7 @@ ZEND_METHOD(reflection_parameter, isOptional)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
RETVAL_BOOL(param->offset >= param->required);
@@ -1817,7 +1815,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable)
parameter_reference *param;
zend_op *precv;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
if (param->fptr->type != ZEND_USER_FUNCTION)
@@ -1844,7 +1842,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
zend_op *precv;
zval *zv, zv_copy;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
if (param->fptr->type != ZEND_USER_FUNCTION)
@@ -1864,7 +1862,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
zv_copy = precv->op2.u.constant;
zv = &zv_copy;
zval_update_constant(&zv, (void*)1 TSRMLS_CC);
zval_update_constant(&zv, (void*)0 TSRMLS_CC);
RETURN_ZVAL(zv, 1, 1);
}
/* }}} */
@@ -1953,7 +1951,7 @@ ZEND_METHOD(reflection_method, __toString)
zend_function *mptr;
string str;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
GET_REFLECTION_OBJECT_PTR(mptr);
string_init(&str);
_function_string(&str, mptr, "" TSRMLS_CC);
@@ -1976,7 +1974,7 @@ ZEND_METHOD(reflection_method, invoke)
zend_fcall_info_cache fcc;
zend_class_entry *obj_ce;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_method_ptr);
if (argc < 1) {
zend_error(E_WARNING, "Invoke() expects at least one parameter, none given");
@@ -2080,7 +2078,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
zend_class_entry *obj_ce;
zval *param_array;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_method_ptr);
GET_REFLECTION_OBJECT_PTR(mptr);
@@ -2223,7 +2221,7 @@ ZEND_METHOD(reflection_method, isConstructor)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
GET_REFLECTION_OBJECT_PTR(mptr);
/* we need to check if the ctor is the ctor of the class level we we
* looking at since we might be looking at an inherited old style ctor
@@ -2239,7 +2237,7 @@ ZEND_METHOD(reflection_method, isDestructor)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_DTOR);
}
@@ -2252,7 +2250,7 @@ ZEND_METHOD(reflection_method, getModifiers)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_LONG(mptr->common.fn_flags);
@@ -2266,7 +2264,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_method_ptr);
GET_REFLECTION_OBJECT_PTR(mptr);
zend_reflection_class_factory(mptr->common.scope, return_value TSRMLS_CC);
@@ -2350,7 +2348,7 @@ ZEND_METHOD(reflection_class, getStaticProperties)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
@@ -2436,7 +2434,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
zend_class_entry *ce;
int count;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
@@ -2456,7 +2454,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos);
zend_hash_move_forward_ex(&ce->default_properties, &pos);
zend_unmangle_property_name(key, &class_name, &prop_name);
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) {
/* filter privates from base classes */
continue;
@@ -2482,7 +2480,7 @@ ZEND_METHOD(reflection_class, __toString)
zend_class_entry *ce;
string str;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
string_init(&str);
_class_string(&str, ce, intern->obj, "" TSRMLS_CC);
@@ -2494,7 +2492,7 @@ ZEND_METHOD(reflection_class, __toString)
Returns the class' name */
ZEND_METHOD(reflection_class, getName)
{
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -2506,7 +2504,7 @@ ZEND_METHOD(reflection_class, isInternal)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->type == ZEND_INTERNAL_CLASS);
}
@@ -2519,7 +2517,7 @@ ZEND_METHOD(reflection_class, isUserDefined)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->type == ZEND_USER_CLASS);
}
@@ -2532,7 +2530,7 @@ ZEND_METHOD(reflection_class, getFileName)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
RETURN_STRING(ce->filename, 1);
@@ -2548,7 +2546,7 @@ ZEND_METHOD(reflection_class, getStartLine)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_FUNCTION) {
RETURN_LONG(ce->line_start);
@@ -2564,7 +2562,7 @@ ZEND_METHOD(reflection_class, getEndLine)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
RETURN_LONG(ce->line_end);
@@ -2580,7 +2578,7 @@ ZEND_METHOD(reflection_class, getDocComment)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
RETURN_STRINGL(ce->doc_comment, ce->doc_comment_len, 1);
@@ -2596,7 +2594,7 @@ ZEND_METHOD(reflection_class, getConstructor)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->constructor) {
@@ -2616,7 +2614,7 @@ ZEND_METHOD(reflection_class, hasMethod)
char *name, *lc_name;
int name_len;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2643,7 +2641,7 @@ ZEND_METHOD(reflection_class, getMethod)
char *name, *lc_name;
int name_len;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2689,7 +2687,7 @@ ZEND_METHOD(reflection_class, getMethods)
long filter = 0;
int argc = ZEND_NUM_ARGS();
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (argc) {
if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
return;
@@ -2716,7 +2714,7 @@ ZEND_METHOD(reflection_class, hasProperty)
int name_len;
zval *property;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2750,7 +2748,7 @@ ZEND_METHOD(reflection_class, getProperty)
char *name;
int name_len;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2797,7 +2795,7 @@ ZEND_METHOD(reflection_class, getProperties)
long filter = 0;
int argc = ZEND_NUM_ARGS();
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (argc) {
if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
return;
@@ -2823,7 +2821,7 @@ ZEND_METHOD(reflection_class, hasConstant)
char *name;
int name_len;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2845,7 +2843,7 @@ ZEND_METHOD(reflection_class, getConstants)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
@@ -2863,7 +2861,7 @@ ZEND_METHOD(reflection_class, getConstant)
char *name;
int name_len;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2884,7 +2882,7 @@ static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
RETVAL_BOOL(ce->ce_flags & mask);
}
@@ -2897,9 +2895,9 @@ ZEND_METHOD(reflection_class, isInstantiable)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_ABSTRACT)) {
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
RETURN_FALSE;
}
@@ -2944,7 +2942,7 @@ ZEND_METHOD(reflection_class, getModifiers)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_LONG(ce->ce_flags);
@@ -2959,7 +2957,7 @@ ZEND_METHOD(reflection_class, isInstance)
zend_class_entry *ce;
zval *object;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
return;
}
@@ -2977,7 +2975,7 @@ ZEND_METHOD(reflection_class, newInstance)
zend_class_entry *ce;
int argc = ZEND_NUM_ARGS();
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
GET_REFLECTION_OBJECT_PTR(ce);
object_init_ex(return_value, ce);
@@ -3035,7 +3033,7 @@ ZEND_METHOD(reflection_class, getInterfaces)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
/* Return an empty array if this class implements no interfaces */
@@ -3061,7 +3059,7 @@ ZEND_METHOD(reflection_class, getParentClass)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->parent) {
@@ -3080,7 +3078,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
zend_class_entry *ce, **pce, *class_ce;
zval *class_name;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &class_name) == FAILURE) {
@@ -3126,7 +3124,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
zend_class_entry *ce, *interface_ce, **pce;
zval *interface;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &interface) == FAILURE) {
@@ -3175,7 +3173,7 @@ ZEND_METHOD(reflection_class, isIterateable)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->get_iterator != NULL);
@@ -3189,7 +3187,7 @@ ZEND_METHOD(reflection_class, getExtension)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->module) {
@@ -3205,7 +3203,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_class_ptr);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->module) {
@@ -3310,7 +3308,7 @@ ZEND_METHOD(reflection_property, __construct)
ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
zend_unmangle_property_name(property_info->name, &class_name, &prop_name);
zend_unmangle_property_name_ex(property_info->name, property_info->name_length, &class_name, &prop_name);
MAKE_STD_ZVAL(propname);
ZVAL_STRING(propname, prop_name, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &propname, sizeof(zval *), NULL);
@@ -3332,7 +3330,7 @@ ZEND_METHOD(reflection_property, __toString)
property_reference *ref;
string str;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ref);
string_init(&str);
_property_string(&str, ref->prop, NULL, "" TSRMLS_CC);
@@ -3344,7 +3342,7 @@ ZEND_METHOD(reflection_property, __toString)
Returns the class' name */
ZEND_METHOD(reflection_property, getName)
{
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -3354,7 +3352,7 @@ static void _property_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
reflection_object *intern;
property_reference *ref;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ref);
RETURN_BOOL(ref->prop->flags & mask);
}
@@ -3406,7 +3404,7 @@ ZEND_METHOD(reflection_property, getModifiers)
reflection_object *intern;
property_reference *ref;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ref);
RETURN_LONG(ref->prop->flags);
@@ -3422,7 +3420,7 @@ ZEND_METHOD(reflection_property, getValue)
zval *object;
zval **member= NULL;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_property_ptr);
GET_REFLECTION_OBJECT_PTR(ref);
if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) {
@@ -3448,6 +3446,7 @@ ZEND_METHOD(reflection_property, getValue)
*return_value= **member;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
/* }}} */
@@ -3464,7 +3463,7 @@ ZEND_METHOD(reflection_property, setValue)
zval *tmp;
HashTable *prop_table;
METHOD_NOTSTATIC;
METHOD_NOTSTATIC(reflection_property_ptr);
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->prop->flags & ~(ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)) {
@@ -3478,6 +3477,7 @@ ZEND_METHOD(reflection_property, setValue)
return;
}
}
zend_update_class_constants(intern->ce TSRMLS_CC);
prop_table = intern->ce->static_members;
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) {
@@ -3522,7 +3522,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
reflection_object *intern;
property_reference *ref;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ref);
zend_reflection_class_factory(ref->ce, return_value TSRMLS_CC);
@@ -3535,7 +3535,7 @@ ZEND_METHOD(reflection_property, getDocComment)
reflection_object *intern;
property_reference *ref;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->prop->doc_comment) {
RETURN_STRINGL(ref->prop->doc_comment, ref->prop->doc_comment_len, 1);
@@ -3598,7 +3598,7 @@ ZEND_METHOD(reflection_extension, __toString)
zend_module_entry *module;
string str;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
GET_REFLECTION_OBJECT_PTR(module);
string_init(&str);
_extension_string(&str, module, "" TSRMLS_CC);
@@ -3610,7 +3610,7 @@ ZEND_METHOD(reflection_extension, __toString)
Returns this extension's name */
ZEND_METHOD(reflection_extension, getName)
{
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -3622,7 +3622,7 @@ ZEND_METHOD(reflection_extension, getVersion)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
GET_REFLECTION_OBJECT_PTR(module);
/* An extension does not necessarily have a version number */
@@ -3641,7 +3641,7 @@ ZEND_METHOD(reflection_extension, getFunctions)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
@@ -3689,7 +3689,7 @@ ZEND_METHOD(reflection_extension, getConstants)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
@@ -3721,7 +3721,7 @@ ZEND_METHOD(reflection_extension, getINIEntries)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
@@ -3757,7 +3757,7 @@ ZEND_METHOD(reflection_extension, getClasses)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
@@ -3772,7 +3772,7 @@ ZEND_METHOD(reflection_extension, getClassNames)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(0);
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
+111 -67
View File
@@ -13,6 +13,8 @@
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
@@ -1051,7 +1053,7 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|CV)
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2;
@@ -1075,13 +1077,17 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|CV)
ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2;
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
zval *dim;
if (OP2_TYPE == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(type), dim, IS_OP2_TMP_FREE(), type TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
@@ -1092,6 +1098,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2;
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET);
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
/* Not needed in DIM_UNSET
@@ -1099,7 +1106,12 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
}
*/
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET), dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC);
if (OP1_TYPE == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -1257,12 +1269,18 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2, free_res;
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_R);
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_R), property, BP_VAR_R TSRMLS_CC);
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_R TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
zval_ptr_dtor(&property);
} else {
@@ -1615,7 +1633,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
int function_name_strlen;
zend_free_op free_op1, free_op2;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
@@ -1626,8 +1644,6 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
function_name_strval = function_name->value.str.val;
function_name_strlen = function_name->value.str.len;
EX(calling_scope) = EG(scope);
EX(object) = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
if (EX(object) && EX(object)->type == IS_OBJECT) {
@@ -1658,12 +1674,6 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
}
}
if (EX(fbc)->type == ZEND_USER_FUNCTION) {
EX(calling_scope) = EX(fbc)->common.scope;
} else {
EX(calling_scope) = NULL;
}
FREE_OP2();
FREE_OP1_IF_VAR();
@@ -1676,7 +1686,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
zval *function_name;
zend_class_entry *ce;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
ce = EX_T(opline->op1.u.var).class_entry;
if(OP2_TYPE != IS_UNUSED) {
@@ -1711,8 +1721,6 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
EX(fbc) = ce->constructor;
}
EX(calling_scope) = EX(fbc)->common.scope;
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
@@ -1733,7 +1741,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
int function_name_strlen;
zend_free_op free_op2;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
if (OP2_TYPE == IS_CONST) {
function_name_strval = opline->op2.u.constant.value.str.val;
@@ -1759,7 +1767,6 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
FREE_OP2();
}
EX(calling_scope) = function->common.scope;
EX(object) = NULL;
EX(fbc) = function;
@@ -1776,6 +1783,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
zval *current_this;
int return_value_used = RETURN_VALUE_USED(opline);
zend_bool should_change_scope;
zend_op *ctor_opline;
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
@@ -1792,7 +1800,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
current_this = EG(This);
EG(This) = EX(object);
current_scope = EG(scope);
EG(scope) = EX(calling_scope);
EG(scope) = (EX(function_state).function->type == ZEND_USER_FUNCTION || !EX(object)) ? EX(function_state).function->common.scope : NULL;
} else {
should_change_scope = 0;
}
@@ -1814,6 +1822,8 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
}
}
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
unsigned char return_reference = EX(function_state).function->common.return_reference;
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr));
@@ -1838,16 +1848,20 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
}
EG(current_execute_data) = EXECUTE_DATA;
/* We shouldn't fix bad extensions here,
because it can break proper ones (Bug #34045)
if (!EX(function_state).function->common.return_reference) {
EX_T(opline->result.u.var).var.ptr->is_ref = 0;
EX_T(opline->result.u.var).var.ptr->refcount = 1;
}
*/
if (!return_value_used) {
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
} else {
EX_T(opline->result.u.var).var.fcall_returned_reference = return_reference;
}
} else if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
HashTable *calling_symbol_table;
EX_T(opline->result.u.var).var.ptr = NULL;
if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
/*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
@@ -1857,7 +1871,6 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0);
/*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/
}
calling_symbol_table = EG(active_symbol_table);
EG(active_symbol_table) = EX(function_state).function_symbol_table;
original_return_value = EG(return_value_ptr_ptr);
EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr;
@@ -1887,7 +1900,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
zend_hash_clean(EX(function_state).function_symbol_table);
*(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table;
}
EG(active_symbol_table) = calling_symbol_table;
EG(active_symbol_table) = EX(symbol_table);
} else { /* ZEND_OVERLOADED_FUNCTION */
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr));
@@ -1912,16 +1925,18 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
}
}
ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack));
if (EG(This)) {
if (EG(exception) && EX(fbc) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
EG(This)->refcount--;
if (EG(exception) && ctor_opline) {
if (RETURN_VALUE_USED(ctor_opline)) {
EG(This)->refcount--;
}
if (EG(This)->refcount == 1) {
zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
}
if (should_change_scope && EG(This) != current_this) {
zval_ptr_dtor(&EG(This));
}
} else if (should_change_scope) {
}
if (should_change_scope) {
zval_ptr_dtor(&EG(This));
}
}
@@ -1930,7 +1945,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EG(This) = current_this;
EG(scope) = current_scope;
}
zend_ptr_stack_3_pop(&EG(arg_types_stack), (void**)&EX(calling_scope), (void**)&EX(object), (void**)&EX(fbc));
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
EX(function_state).function = (zend_function *) EX(op_array);
EG(function_state_ptr) = &EX(function_state);
@@ -1958,13 +1973,12 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
zend_free_op free_op1;
zval *fname = GET_OP1_ZVAL_PTR(BP_VAR_R);
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
zend_error_noreturn(E_ERROR, "Unknown function: %s()\n", fname->value.str.val);
zend_error_noreturn(E_ERROR, "Unknown function: %s()", fname->value.str.val);
}
EX(object) = NULL;
EX(calling_scope) = EX(function_state).function->common.scope;
FREE_OP1();
@@ -2163,6 +2177,9 @@ ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY)
ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *varptr;
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
@@ -2170,23 +2187,27 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
} else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
}
if ((opline->extended_value & ZEND_ARG_SEND_FUNCTION) &&
!EX_T(opline->op1.u.var).var.fcall_returned_reference) {
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
EX_T(opline->op1.u.var).var.fcall_returned_reference) &&
varptr != &EG(uninitialized_zval) &&
(PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
varptr->is_ref = 1;
varptr->refcount++;
zend_ptr_stack_push(&EG(argument_stack), varptr);
} else {
zval *varptr;
zend_free_op free_op1;
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
zval *valptr;
if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
varptr->is_ref = 1;
varptr->refcount++;
zend_ptr_stack_push(&EG(argument_stack), varptr);
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE();
zend_error(E_STRICT, "Only variables should be passed by reference");
ALLOC_ZVAL(valptr);
INIT_PZVAL_COPY(valptr, varptr);
if (!IS_OP1_TMP_FREE()) {
zval_copy_ctor(valptr);
}
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
zend_ptr_stack_push(&EG(argument_stack), valptr);
}
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE();
}
@@ -2414,17 +2435,12 @@ ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
EX_T(opline->result.u.var).var.ptr = object_zval;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), opline);
/* We are not handling overloaded classes right now */
EX(object) = object_zval;
EX(fbc) = constructor;
if (constructor->type == ZEND_USER_FUNCTION) { /* HACK!! */
EX(calling_scope) = constructor->common.scope;
} else {
EX(calling_scope) = NULL;
}
ZEND_VM_NEXT_OPCODE();
}
}
@@ -2718,7 +2734,6 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
if (inc_filename==&tmp_inc_filename) {
zval_dtor(&tmp_inc_filename);
}
FREE_OP1();
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
if (new_op_array) {
zval *saved_object;
@@ -2768,6 +2783,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
EX_T(opline->result.u.var).var.ptr->type = IS_BOOL;
}
}
FREE_OP1();
EG(return_value_ptr_ptr) = original_return_value;
ZEND_VM_NEXT_OPCODE();
}
@@ -2799,12 +2815,14 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY)
do {
int i;
for (i = 0; i < ex->op_array->last_var; i++) {
if (ex->op_array->vars[i].hash_value == hash_value &&
ex->op_array->vars[i].name_len == varname->value.str.len &&
!memcmp(ex->op_array->vars[i].name, varname->value.str.val, varname->value.str.len)) {
ex->CVs[i] = NULL;
break;
if (ex->op_array) {
for (i = 0; i < ex->op_array->last_var; i++) {
if (ex->op_array->vars[i].hash_value == hash_value &&
ex->op_array->vars[i].name_len == varname->value.str.len &&
!memcmp(ex->op_array->vars[i].name, varname->value.str.val, varname->value.str.len)) {
ex->CVs[i] = NULL;
break;
}
}
}
ex = ex->prev_execute_data;
@@ -2855,7 +2873,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
ulong hash_value = zend_inline_hash_func(offset->value.str.val, offset->value.str.len+1);
for (ex = EXECUTE_DATA; ex; ex = ex->prev_execute_data) {
if (ex->symbol_table == ht) {
if (ex->op_array && ex->symbol_table == ht) {
int i;
for (i = 0; i < ex->op_array->last_var; i++) {
@@ -3100,7 +3118,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
zend_hash_move_forward(fe_ht);
} while (key_type != HASH_KEY_IS_STRING || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
if (use_key) {
zend_unmangle_property_name(str_key, &class_name, &prop_name);
zend_unmangle_property_name_ex(str_key, str_key_len, &class_name, &prop_name);
str_key_len = strlen(prop_name);
str_key = estrndup(prop_name, str_key_len);
str_key_len++;
@@ -3415,10 +3433,16 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)
ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
{
zend_op *opline = EX(opline);
EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting);
EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
if (EX(old_error_reporting) == NULL) {
EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var;
}
if (EG(error_reporting)) {
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -3433,13 +3457,16 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
zend_op *opline = EX(opline);
zval restored_error_reporting;
if (!EG(error_reporting)) {
if (!EG(error_reporting) && EX_T(opline->op1.u.var).tmp_var.value.lval != 0) {
restored_error_reporting.type = IS_LONG;
restored_error_reporting.value.lval = EX_T(opline->op1.u.var).tmp_var.value.lval;
convert_to_string(&restored_error_reporting);
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
zendi_zval_dtor(restored_error_reporting);
}
if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) {
EX(old_error_reporting) = NULL;
}
ZEND_VM_NEXT_OPCODE();
}
@@ -3566,11 +3593,13 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
int i;
int encapsulating_block=-1;
zval **stack_zval_pp;
zval restored_error_reporting;
stack_zval_pp = (zval **) EG(argument_stack).top_element - 1;
while (*stack_zval_pp != NULL) {
zval_ptr_dtor(stack_zval_pp);
EG(argument_stack).top_element--;
EG(argument_stack).top--;
stack_zval_pp--;
}
@@ -3586,12 +3615,27 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
}
while (EX(fbc)) {
zend_op *ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack));
if (EX(object)) {
if (ctor_opline && RETURN_VALUE_USED(ctor_opline)) {
EX(object)->refcount--;
}
zval_ptr_dtor(&EX(object));
}
zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &EX(fbc));
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
}
/* restore previous error_reporting value */
if (!EG(error_reporting) && EX(old_error_reporting) != NULL && EX(old_error_reporting)->value.lval != 0) {
restored_error_reporting.type = IS_LONG;
restored_error_reporting.value.lval = EX(old_error_reporting)->value.lval;
convert_to_string(&restored_error_reporting);
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
zendi_zval_dtor(restored_error_reporting);
}
EX(old_error_reporting) = NULL;
if (encapsulating_block == -1) {
ZEND_VM_RETURN_FROM_EXECUTE_LOOP();
} else {
+420 -301
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -10,6 +10,7 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
/* Initialize execute_data */
EX(fbc) = NULL;
EX(object) = NULL;
EX(old_error_reporting) = NULL;
if (op_array->T < TEMP_VAR_STACK_LIMIT) {
EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T);
} else {
+21 -2
View File
@@ -1,4 +1,23 @@
<?php
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) 1998-2005 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: Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
$Id$
*/
$header_text = <<< DATA
/*
@@ -16,11 +35,11 @@ $header_text = <<< DATA
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
/* \$Id$ */
DATA;
+2 -2
View File
@@ -13,11 +13,11 @@
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#define ZEND_NOP 0
#define ZEND_ADD 1
#define ZEND_SUB 2
+81 -83
View File
@@ -255,14 +255,14 @@ dnl append to the array which has been dynamically chosen at m4 time
dnl choose the right compiler/flags/etc. for the source-file
case $ac_src in
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
esac
dnl create a rule for the object/source combo
cat >>Makefile.objects<<EOF
cat >>Makefile.objects<<EOF
$ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src
$ac_comp
EOF
@@ -301,27 +301,27 @@ dnl
AC_DEFUN([PHP_RUNPATH_SWITCH],[
AC_MSG_CHECKING([if compiler supports -R])
AC_CACHE_VAL(php_cv_cc_dashr,[
SAVE_LIBS=$LIBS
LIBS="-R /usr/$PHP_LIBDIR $LIBS"
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
LIBS=$SAVE_LIBS])
SAVE_LIBS=$LIBS
LIBS="-R /usr/$PHP_LIBDIR $LIBS"
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
LIBS=$SAVE_LIBS])
AC_MSG_RESULT([$php_cv_cc_dashr])
if test $php_cv_cc_dashr = "yes"; then
ld_runpath_switch=-R
ld_runpath_switch=-R
else
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
AC_CACHE_VAL(php_cv_cc_rpath,[
SAVE_LIBS=$LIBS
LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS"
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
LIBS=$SAVE_LIBS])
AC_MSG_RESULT([$php_cv_cc_rpath])
if test $php_cv_cc_rpath = "yes"; then
ld_runpath_switch=-Wl,-rpath,
else
dnl something innocuous
ld_runpath_switch=-L
fi
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
AC_CACHE_VAL(php_cv_cc_rpath,[
SAVE_LIBS=$LIBS
LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS"
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
LIBS=$SAVE_LIBS])
AC_MSG_RESULT([$php_cv_cc_rpath])
if test $php_cv_cc_rpath = "yes"; then
ld_runpath_switch=-Wl,-rpath,
else
dnl something innocuous
ld_runpath_switch=-L
fi
fi
])
@@ -854,13 +854,9 @@ AC_DEFUN([PHP_SHARED_MODULE],[
suffix=so
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -Wl,-G -o '$3'/$1.la -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) && mv -f '$3'/.libs/$1.so '$3'/$1.so'
;;
*darwin*[)]
suffix=so
link_cmd='ifelse($4,,[$(CC)],[$(CXX)]) -dynamic -flat_namespace -bundle -undefined suppress $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
;;
*netware*[)]
suffix=nlm
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) ifelse($1, php5lib, , -L$(top_builddir)/netware -lphp5lib) $(translit(ifelse($1, php5lib, $1, m4_substr($1, 3)),a-z_-,A-Z__)_SHARED_LIBADD)'
;;
*[)]
suffix=la
@@ -955,11 +951,13 @@ dnl ---------------------------------------------- Static module
dnl ---------------------------------------------- Shared module
PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
case $host_alias in
*netware*)
PHP_ADD_LIBRARY_WITH_PATH(php5lib, netware, translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
;;
*netware*[)]
PHP_SHARED_MODULE(php$1,shared_objects_$1, $ext_builddir, $6)
;;
*[)]
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
;;
esac
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
fi
fi
@@ -1240,16 +1238,16 @@ AC_DEFUN([PHP_READDIR_R_TYPE],[
#endif
main() {
DIR *dir;
char entry[sizeof(struct dirent)+PATH_MAX];
struct dirent *pentry = (struct dirent *) &entry;
DIR *dir;
char entry[sizeof(struct dirent)+PATH_MAX];
struct dirent *pentry = (struct dirent *) &entry;
dir = opendir("/");
if (!dir)
exit(1);
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
exit(0);
exit(1);
dir = opendir("/");
if (!dir)
exit(1);
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
exit(0);
exit(1);
}
],[
ac_cv_what_readdir_r=POSIX
@@ -1380,17 +1378,17 @@ AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[
AC_TRY_RUN([
#define NULL (0L)
main() {
char buf[20];
int res = 0;
res = res || (snprintf(buf, 2, "marcus") != 6);
res = res || (buf[1] != '\0');
/* Implementations may consider this as an encoding error */
snprintf(buf, 0, "boerger");
/* However, they MUST ignore the pointer */
res = res || (buf[0] != 'm');
res = res || (snprintf(NULL, 0, "boerger") != 7);
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
exit(res);
char buf[20];
int res = 0;
res = res || (snprintf(buf, 2, "marcus") != 6);
res = res || (buf[1] != '\0');
/* Implementations may consider this as an encoding error */
snprintf(buf, 0, "boerger");
/* However, they MUST ignore the pointer */
res = res || (buf[0] != 'm');
res = res || (snprintf(NULL, 0, "boerger") != 7);
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
exit(res);
}
],[
ac_cv_broken_snprintf=no
@@ -1421,14 +1419,16 @@ AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[
if test -n "$EXT_SHARED"; then
os=`uname -sr 2>/dev/null`
case $os in
"SunOS 5.6"|"SunOS 5.7"[)]
case $CC in
gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
*[)] CFLAGS="$CFLAGS -fpic";;
esac
AC_MSG_RESULT([yes]);;
*[)]
AC_MSG_RESULT([no]);;
"SunOS 5.6"|"SunOS 5.7"[)]
case $CC in
gcc*|egcs*)
CFLAGS="$CFLAGS -fPIC";;
*[)]
CFLAGS="$CFLAGS -fpic";;
esac
AC_MSG_RESULT([yes]);;
*[)]
AC_MSG_RESULT([no]);;
esac
else
AC_MSG_RESULT([no])
@@ -1562,10 +1562,10 @@ AC_DEFUN([PHP_BROKEN_GETCWD],[
os=`uname -sr 2>/dev/null`
case $os in
SunOS*[)]
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
AC_MSG_RESULT([yes]);;
*[)]
AC_MSG_RESULT([no]);;
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
AC_MSG_RESULT([yes]);;
*[)]
AC_MSG_RESULT([no]);;
esac
])
@@ -1585,8 +1585,8 @@ int main(int argc, char *argv[])
fp = fopen(filename, "w");
if (fp == NULL) {
perror("fopen");
exit(2);
perror("fopen");
exit(2);
}
fputs("foobar", fp);
fclose(fp);
@@ -1596,7 +1596,7 @@ int main(int argc, char *argv[])
fclose(fp);
unlink(filename);
if (position == 0)
return 1;
return 1;
return 0;
}
],
@@ -1614,10 +1614,10 @@ choke me
)])
if test "$have_broken_glibc_fopen_append" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
else
AC_MSG_RESULT(no)
AC_MSG_RESULT(no)
fi
])
@@ -1646,7 +1646,7 @@ AC_TRY_RUN([
#include <stdio.h>
struct cookiedata {
__off64_t pos;
__off64_t pos;
};
__ssize_t reader(void *cookie, char *buffer, size_t size)
@@ -1665,7 +1665,7 @@ main() {
FILE *fp = fopencookie(&g, "r", funcs);
if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
exit(0);
exit(0);
exit(1);
}
@@ -1899,14 +1899,14 @@ AC_DEFUN([PHP_C_BIGENDIAN],
[
int main(void)
{
short one = 1;
char *cp = (char *)&one;
short one = 1;
char *cp = (char *)&one;
if (*cp == 0) {
return(0);
} else {
return(1);
}
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])
])
@@ -2035,8 +2035,6 @@ AC_DEFUN([PHP_PROG_RE2C],[
php_cv_re2c_version="`echo "" | re2c --version | cut -d ' ' -f 2 2>/dev/null` (ok)"
fi
])
else
php_cv_re2c_version=none
fi
case $php_cv_re2c_version in
""|invalid[)]
@@ -2339,7 +2337,7 @@ AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
set $libxml_full_version
IFS=$ac_IFS
LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
if test "$LIBXML_VERSION" -ge "2006000"; then
if test "$LIBXML_VERSION" -ge "2006011"; then
LIBXML_LIBS=`$XML2_CONFIG --libs`
LIBXML_INCS=`$XML2_CONFIG --cflags`
PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
@@ -2362,7 +2360,7 @@ AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
fi
$2
else
AC_MSG_ERROR([libxml2 version 2.6.0 or greater required.])
AC_MSG_ERROR([libxml2 version 2.6.11 or greater required.])
fi
ifelse([$3],[],,[else $3])
fi
+4 -6
View File
@@ -42,7 +42,7 @@ AC_CONFIG_HEADER(main/php_config.h)
MAJOR_VERSION=5
MINOR_VERSION=1
RELEASE_VERSION=0
EXTRA_VERSION="-dev"
EXTRA_VERSION="RC4"
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
dnl Define where extension directories are located in the configure context
@@ -875,13 +875,11 @@ if test "$PHP_PEAR" != "no"; then
PEAR requires XML to be enabled. Add --enable-xml to the configure line. (or --without-pear)"
fi
dnl
dnl ext/xmlrpc is not really there yet to be a requirement..
dnl
dnl if test "$PHP_XMLRPC" = "no"; then
dnl pear_error_msg="$pear_error_msg
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)"
dnl fi
dnl fi
dnl
if test "$pear_error_msg"; then
@@ -1183,7 +1181,7 @@ INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
all_targets='$(OVERALL_TARGET) $(PHP_MODULES) $(PHP_CLI_TARGET)'
install_targets="$install_modules $install_pear install-build install-headers install-programs"
install_targets="$install_modules install-build install-headers install-programs $install_pear"
case $PHP_SAPI in
cgi)
@@ -1369,7 +1367,7 @@ X
fi
# Warn about linking Apache with libpthread if oci8 extension is enabled on linux.
if test "$PHP_OCI8" != "no" -o "$PHP_ORACLE" != "no"; then
if test "$PHP_OCI8" != "no"; then
if test "$PHP_SAPI" = "apache"; then
if test `uname` = "Linux"; then
cat <<X
+1 -1
View File
@@ -441,7 +441,7 @@ PHP_FUNCTION(bzdecompress)
char *source, *dest;
int source_len, error;
long small = 0;
#if defined(PHP_WIN32) && _MSC_VER < 1300
#if defined(PHP_WIN32)
unsigned __int64 size = 0;
#else
unsigned long long size = 0;
+23
View File
@@ -0,0 +1,23 @@
--TEST--
cal_days_in_month()
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003);
echo "There are $num days in August 2003\n";
$num = cal_days_in_month(CAL_GREGORIAN, 2, 2003);
echo "There are $num days in February 2003\n";
$num = cal_days_in_month(CAL_GREGORIAN, 2, 2004);
echo "There are $num days in February 2004\n";
$num = cal_days_in_month(CAL_GREGORIAN, -1, -2003);
echo "There are $num days in -1, -2003\n";
$num = cal_days_in_month(CAL_GREGORIAN, 12, 2034);
echo "There are $num days in December 2034\n";
?>
--EXPECT--
There are 31 days in August 2003
There are 28 days in February 2003
There are 29 days in February 2004
There are 990210 days in -1, -2003
There are 31 days in December 2034
+16
View File
@@ -0,0 +1,16 @@
--TEST--
cal_to_jd()
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
echo cal_to_jd(CAL_GREGORIAN, 8, 26, 74), "\n";
echo cal_to_jd(CAL_JULIAN, 8, 26, 74), "\n";
echo cal_to_jd(CAL_JEWISH, 8, 26, 74), "\n";
echo cal_to_jd(CAL_FRENCH, 8, 26, 74), "\n";
?>
--EXPECT--
1748326
1748324
374867
0
+14
View File
@@ -0,0 +1,14 @@
--TEST--
easter_days()
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
echo easter_days(1999), "\n";
echo easter_days(1492), "\n";
echo easter_days(1913), "\n";
?>
--EXPECT--
14
32
2
+16
View File
@@ -0,0 +1,16 @@
--TEST--
frenchtojd()
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
echo frenchtojd(-1,-1,-1), "\n";
echo frenchtojd(0,0,0), "\n";
echo frenchtojd(1,1,1), "\n";
echo frenchtojd(14,31,15), "\n";
?>
--EXPECT--
0
0
2375840
0
+4
View File
@@ -0,0 +1,4 @@
<?php
if(!extension_loaded("calendar"))
print "skip - CALENDAR extension not available";
?>
+25 -20
View File
@@ -92,34 +92,39 @@ PHP_MINFO_FUNCTION(ctype)
/* {{{ ctype
*/
#define CTYPE(iswhat) \
zval *c; \
zval *c, tmp; \
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \
return; \
switch (Z_TYPE_P(c)) { \
case IS_LONG: \
if (Z_TYPE_P(c) == IS_LONG) { \
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
} else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
} \
SEPARATE_ZVAL(&c); \
convert_to_string(c); \
case IS_STRING: \
{ \
char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c); \
if (e == p) { \
RETURN_FALSE; \
} \
while (p < e) { \
if(!iswhat((int)*(unsigned char *)(p++))) RETURN_FALSE; \
} \
RETURN_TRUE; \
} \
default: \
break; \
tmp = *c; \
zval_copy_ctor(&tmp); \
convert_to_string(&tmp); \
} else { \
tmp = *c; \
} \
RETURN_FALSE;
if (Z_TYPE(tmp) == IS_STRING) { \
char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \
if (e == p) { \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \
} \
while (p < e) { \
if(!iswhat((int)*(unsigned char *)(p++))) { \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \
} \
} \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_TRUE; \
} else { \
RETURN_FALSE; \
} \
/* }}} */
/* {{{ proto bool ctype_alnum(mixed c)
+11
View File
@@ -0,0 +1,11 @@
--TEST--
Bug #34645 (ctype corrupts memory when validating large numbers)
--FILE--
<?php
$id = 394829384;
var_dump(ctype_digit($id));
var_dump($id);
?>
--EXPECT--
bool(true)
int(394829384)
+33 -1
View File
@@ -36,7 +36,7 @@ if test "$PHP_CURL" != "no"; then
CURL_CONFIG=${CURL_DIR}/bin/curl-config
else
if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
CURL_CONFIG=${CURL_DIR}/curl-config
CURL_CONFIG=${CURL_DIR}/curl-config
fi
fi
@@ -48,6 +48,38 @@ if test "$PHP_CURL" != "no"; then
else
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
fi
AC_MSG_CHECKING([for SSL support in libcurl])
CURL_SSL=`$CURL_CONFIG --features | $EGREP SSL`
if test "$CURL_SSL" = "SSL"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
AC_MSG_CHECKING([for SSL library used])
CURL_SSL_FLAVOUR=
for i in $CURL_LIBS; do
if test "$i" = "-lssl"; then
CURL_SSL_FLAVOUR="openssl"
AC_MSG_RESULT([openssl])
AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
AC_CHECK_HEADERS([openssl/crypto.h])
break
elif test "$i" = "-lgnutls"; then
CURL_SSL_FLAVOUR="gnutls"
AC_MSG_RESULT([gnutls])
AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
AC_CHECK_HEADERS([gcrypt.h])
break
fi
done
if test -z "$CURL_SSL_FLAVOUR"; then
AC_MSG_RESULT([unknown!])
AC_MSG_WARN([Could not determine the type of SSL library used!])
AC_MSG_WARN([Building will fail in ZTS mode!])
fi
else
AC_MSG_RESULT([no])
fi
PHP_ADD_INCLUDE($CURL_DIR/include)
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
+1
View File
@@ -12,6 +12,7 @@ if (PHP_CURL != "no") {
CHECK_LIB("winmm.lib", "curl", PHP_CURL)) {
EXTENSION("curl", "interface.c multi.c streams.c");
AC_DEFINE('HAVE_CURL', 1, 'Have CURL library');
AC_DEFINE('HAVE_CURL_SSL', 1, 'Have SSL suppurt in CURL');
// TODO: check for curl_version_info
// AC_DEFINE('PHP_CURL_URL_WRAPPERS', 0, 'Use curl for URL wrappers [experimental]');
} else {
+158 -5
View File
@@ -44,6 +44,45 @@
#define HttpPost curl_httppost
#endif
/* {{{ cruft for thread safe SSL crypto locks */
#if defined(ZTS) && defined(HAVE_CURL_SSL)
# ifdef PHP_WIN32
# define PHP_CURL_NEED_SSL_TSL
# define PHP_CURL_NEED_OPENSSL_TSL
# include <openssl/crypto.h>
# else /* !PHP_WIN32 */
# if defined(HAVE_CURL_OPENSSL)
# if defined(HAVE_OPENSSL_CRYPTO_H)
# define PHP_CURL_NEED_SSL_TSL
# define PHP_CURL_NEED_OPENSSL_TSL
# include <openssl/crypto.h>
# else
# warning \
"libcurl was compiled with OpenSSL support, but configure could not find " \
"openssl/crypto.h; thus no SSL crypto locking callbacks will be set, which may " \
"cause random crashes on SSL requests"
# endif
# elif defined(HAVE_CURL_GNUTLS)
# if defined(HAVE_GCRYPT_H)
# define PHP_CURL_NEED_SSL_TSL
# define PHP_CURL_NEED_GNUTLS_TSL
# include <gcrypt.h>
# else
# warning \
"libcurl was compiled with GnuTLS support, but configure could not find " \
"gcrypt.h; thus no SSL crypto locking callbacks will be set, which may " \
"cause random crashes on SSL requests"
# endif
# else
# warning \
"libcurl was compiled with SSL support, but configure could not determine which" \
"library was used; thus no SSL crypto locking callbacks will be set, which may " \
"cause random crashes on SSL requests"
# endif /* HAVE_CURL_OPENSSL || HAVE_CURL_GNUTLS */
# endif /* PHP_WIN32 */
#endif /* ZTS && HAVE_CURL_SSL */
/* }}} */
#define SMART_STR_PREALLOC 4096
#include "ext/standard/php_smart_str.h"
@@ -55,6 +94,11 @@
int le_curl;
int le_curl_multi_handle;
#ifdef PHP_CURL_NEED_SSL_TSL
static inline void php_curl_ssl_init(void);
static inline void php_curl_ssl_cleanup(void);
#endif
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
@@ -65,7 +109,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
#define PHP_CURL_CHECK_OPEN_BASEDIR(str, len) \
if (PG(open_basedir) && *PG(open_basedir) && \
if (((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) && \
strncasecmp(str, "file://", sizeof("file://") - 1) == 0) \
{ \
php_url *tmp_url; \
@@ -75,7 +119,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
RETURN_FALSE; \
} \
\
if (php_check_open_basedir(tmp_url->path TSRMLS_CC) || \
if (tmp_url->query || php_check_open_basedir(tmp_url->path TSRMLS_CC) || \
(PG(safe_mode) && !php_checkuid(tmp_url->path, "rb+", CHECKUID_CHECK_MODE_PARAM)) \
) { \
php_url_free(tmp_url); \
@@ -403,6 +447,9 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLFTPAUTH_TLS);
#endif
#ifdef PHP_CURL_NEED_SSL_TSL
php_curl_ssl_init();
#endif
if (curl_global_init(CURL_GLOBAL_SSL) != CURLE_OK) {
return FAILURE;
}
@@ -440,7 +487,9 @@ PHP_MSHUTDOWN_FUNCTION(curl)
php_unregister_url_stream_wrapper("ldap" TSRMLS_CC);
#endif
curl_global_cleanup();
#ifdef PHP_CURL_NEED_SSL_TSL
php_curl_ssl_cleanup();
#endif
return SUCCESS;
}
/* }}} */
@@ -1146,10 +1195,15 @@ PHP_FUNCTION(curl_setopt)
* must be explicitly cast to long in curl_formadd
* use since curl needs a long not an int. */
if (*postval == '@') {
++postval;
/* safe_mode / open_basedir check */
if (php_check_open_basedir(postval TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(postval, "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key,
CURLFORM_NAMELENGTH, (long)string_key_len - 1,
CURLFORM_FILE, ++postval,
CURLFORM_FILE, postval,
CURLFORM_END);
} else {
error = curl_formadd(&first, &last,
@@ -1540,7 +1594,106 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
/* }}} */
#endif
#ifdef PHP_CURL_NEED_OPENSSL_TSL
/* {{{ */
static MUTEX_T *php_curl_openssl_tsl = NULL;
static void php_curl_ssl_lock(int mode, int n, const char * file, int line)
{
if (mode & CRYPTO_LOCK) {
tsrm_mutex_lock(php_curl_openssl_tsl[n]);
} else {
tsrm_mutex_unlock(php_curl_openssl_tsl[n]);
}
}
static unsigned long php_curl_ssl_id(void)
{
return (unsigned long) tsrm_thread_id();
}
static inline void php_curl_ssl_init(void)
{
int i, c = CRYPTO_num_locks();
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
for (i = 0; i < c; ++i) {
php_curl_openssl_tsl[i] = tsrm_mutex_alloc();
}
CRYPTO_set_id_callback(php_curl_ssl_id);
CRYPTO_set_locking_callback(php_curl_ssl_lock);
}
static inline void php_curl_ssl_cleanup(void)
{
if (php_curl_openssl_tsl) {
int i, c = CRYPTO_num_locks();
CRYPTO_set_id_callback(NULL);
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < c; ++i) {
tsrm_mutex_free(php_curl_openssl_tsl[i]);
}
free(php_curl_openssl_tsl);
php_curl_openssl_tsl = NULL;
}
}
#endif /* PHP_CURL_NEED_OPENSSL_TSL */
/* }}} */
#ifdef PHP_CURL_NEED_GNUTLS_TSL
/* {{{ */
static int php_curl_ssl_mutex_create(void **m)
{
if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) {
return SUCCESS;
} else {
return FAILURE;
}
}
static int php_curl_ssl_mutex_destroy(void **m)
{
tsrm_mutex_free(*((MUTEX_T *) m));
return SUCCESS;
}
static int php_curl_ssl_mutex_lock(void **m)
{
return tsrm_mutex_lock(*((MUTEX_T *) m));
}
static int php_curl_ssl_mutex_unlock(void **m)
{
return tsrm_mutex_unlock(*((MUTEX_T *) m));
}
static struct gcry_thread_cbs php_curl_gnutls_tsl = {
GCRY_THREAD_OPTIONS_USER,
NULL,
php_curl_ssl_mutex_create,
php_curl_ssl_mutex_destroy,
php_curl_ssl_mutex_lock,
php_curl_ssl_mutex_unlock
};
static inline void php_curl_ssl_init(void)
{
gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
}
static inline void php_curl_ssl_cleanup(void)
{
return;
}
#endif /* PHP_CURL_NEED_GNUTLS_TSL */
/* }}} */
#endif /* HAVE_CURL */
/*
* Local variables:
-2
View File
@@ -111,8 +111,6 @@ PHP_FUNCTION(curl_multi_remove_handle)
ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
zval_ptr_dtor(&z_ch);
--ch->uses;
RETURN_LONG((long) curl_multi_remove_handle(mh->multi, ch->cp));
+1 -1
View File
@@ -361,7 +361,7 @@ static php_stream_wrapper_ops php_curl_wrapper_ops = {
NULL, /* stream_stat: curl streams know how to stat themselves */
NULL, /* stat url */
NULL, /* opendir */
NULL, /* label */
"cURL", /* label */
NULL, /* unlink */
NULL, /* rename */
NULL, /* mkdir */
+4
View File
@@ -9,7 +9,11 @@ timelib_sources="lib/dow.c lib/parse_date.c lib/parse_tz.c
lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c"
PHP_NEW_EXTENSION(date, php_date.c $timelib_sources, no,, $PHP_DATE_CFLAGS)
PHP_ADD_BUILD_DIR([$ext_builddir/lib], 1)
PHP_ADD_INCLUDE([$ext_builddir/lib])
PHP_ADD_INCLUDE([$ext_srcdir/lib])
PHP_INSTALL_HEADERS([ext/date], [php_date.h lib/timelib.h lib/timelib_structs.h lib/timelib_config.h])
cat > $ext_builddir/lib/timelib_config.h <<EOF
+20 -4
View File
@@ -31,9 +31,9 @@ static timelib_sll century_value(timelib_sll j)
return c < 0 ? c + 7 : c;
}
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_sll d, int iso)
{
timelib_sll c1, y1, m1;
timelib_sll c1, y1, m1, dow;
/* Only valid for Gregorian calendar */
if (y < 1753) {
@@ -42,7 +42,23 @@ timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
c1 = century_value(y / 100);
y1 = (y % 100);
m1 = timelib_is_leap(y) ? m_table_leap[m] : m_table_common[m];
return (c1 + y1 + m1 + (y1 / 4) + d) % 7;
dow = (c1 + y1 + m1 + (y1 / 4) + d) % 7;
if (iso) {
if (dow == 0) {
dow = 7;
}
}
return dow;
}
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
{
return timelib_day_of_week_ex(y, m, d, 0);
}
timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
{
return timelib_day_of_week_ex(y, m, d, 1);
}
/* jan feb mar apr may jun jul aug sep oct nov dec */
@@ -91,7 +107,7 @@ void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
int i;
i = y_leap ? 366 : 365;
if ((i - doy) < (4 - weekday)) {
if ((i - (doy - y_leap)) < (4 - weekday)) {
*iy = y + 1;
*iw = 1;
return;
+40
View File
@@ -0,0 +1,40 @@
{ "sst", 0, -11, "Pacific/Apia" },
{ "hst", 0, -10, "Pacific/Honolulu" },
{ "akst", 0, -9, "America/Anchorage" },
{ "akdt", 1, -8, "America/Anchorage" },
{ "pst", 0, -8, "America/Los_Angeles" },
{ "pdt", 1, -7, "America/Los_Angeles" },
{ "mst", 0, -7, "America/Denver" },
{ "mdt", 1, -6, "America/Denver" },
{ "cst", 0, -6, "America/Chicago" },
{ "cdt", 1, -5, "America/Chicago" },
{ "est", 0, -5, "America/New_York" },
{ "edt", 1, -4, "America/New_York" },
{ "ast", 0, -4, "America/Halifax" },
{ "adt", 1, -3, "America/Halifax" },
{ "brt", 0, -3, "America/Sao_Paulo" },
{ "brst", 1, -2, "America/Sao_Paulo" },
{ "azost", 0, -1, "Atlantic/Azores" },
{ "azodt", 1, 0, "Atlantic/Azores" },
{ "gmt", 0, 0, "Europe/London" },
{ "bst", 1, 1, "Europe/London" },
{ "cet", 0, 1, "Europe/Paris" },
{ "cest", 1, 2, "Europe/Paris" },
{ "eet", 0, 2, "Europe/Helsinki" },
{ "eest", 1, 3, "Europe/Helsinki" },
{ "msk", 0, 3, "Europe/Moscow" },
{ "msd", 1, 4, "Europe/Moscow" },
{ "gst", 0, 4, "Asia/Dubai" },
{ "pkt", 0, 5, "Asia/Karachi" },
{ "ist", 0, 5.5, "Asia/Calcutta" },
{ "npt", 0, 5.75, "Asia/Katmandu" },
{ "yekt", 1, 6, "Asia/Yekaterinburg" },
{ "novst", 1, 7, "Asia/Novosibirsk" },
{ "krat", 0, 7, "Asia/Krasnoyarsk" },
{ "krast", 1, 8, "Asia/Krasnoyarsk" },
{ "jst", 0, 9, "Asia/Tokyo" },
{ "est", 0, 10, "Australia/Melbourne" },
{ "cst", 1, 10.5, "Australia/Adelaide" },
{ "est", 1, 11, "Australia/Melbourne" },
{ "nzst", 0, 12, "Pacific/Auckland" },
{ "nzdt", 1, 13, "Pacific/Auckland" },
+5364 -4749
View File
File diff suppressed because it is too large. Load diff
+129 -164
View File
@@ -100,7 +100,7 @@ typedef unsigned char uchar;
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; s->time->relative.weekday_behavior = 0; }
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_weekday_relative = 1; }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { return TIMELIB_ERROR; } else { s->time.have_zone = 1; } }
@@ -142,6 +142,7 @@ typedef struct Scanner {
int errors;
struct timelib_time *time;
timelib_tzdb *tzdb;
} Scanner;
typedef struct _timelib_lookup_table {
@@ -160,108 +161,13 @@ typedef struct _timelib_relunit {
/* The timezone table. */
static timelib_tz_lookup_table timelib_timezone_lookup[] = {
{ "a", 0, HOUR (- 1), NULL },
{ "adt", 1, HOUR ( 4), "America/Halifax" }, /* Atlantic Daylight */
{ "ahst", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska-Hawaii Standard */
{ "akdt", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska Daylight */
{ "akst", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska Standard */
{ "ast", 0, HOUR ( 4), "America/Halifax" }, /* Atlantic Standard */
{ "at", 0, HOUR ( 2), "Atlantic/Azores" }, /* Azores */
{ "b", 0, HOUR (- 2), NULL },
{ "bst", 1, HOUR ( 0), "Europe/London" }, /* British Summer */
{ "bt", 0, -HOUR ( 3), "Asia/Baghdad" }, /* Baghdad, USSR Zone 2 */
{ "c", 0, HOUR (- 3), NULL },
{ "cadt", 1, -HOUR (9.5), "Australia/Adelaide" }, /* Central Australian Daylight */
{ "cast", 0, -HOUR (9.5), "Australia/Adelaide" }, /* Central Australian Standard */
{ "cat", 0, HOUR ( 10), "America/Anchorage" }, /* Central Alaska */
{ "cct", 0, -HOUR ( 8), "Asia/Shanghai" }, /* China Coast, USSR Zone 7 */
{ "cdt", 1, HOUR ( 6), "America/Chicago" }, /* Central Daylight */
{ "cest", 1, -HOUR ( 1), "Europe/Berlin" }, /* Central European Summer */
{ "cet", 0, -HOUR ( 1), "Europe/Berlin" }, /* Central European */
{ "cst", 0, HOUR ( 6), "America/Chicago" }, /* Central Standard */
{ "d", 0, HOUR (- 4), NULL },
{ "e", 0, HOUR (- 5), NULL },
{ "eadt", 1, -HOUR ( 10), "Australia/Sydney" }, /* Eastern Australian Daylight */
{ "east", 0, -HOUR ( 10), "Australia/Sydney" }, /* Eastern Australian Standard */
{ "edt", 1, HOUR ( 5), "America/New_York" }, /* Eastern Daylight */
{ "eest", 1, HOUR ( 2), "Europe/Helsinki" }, /* Eastern European Summer */
{ "eet", 0, -HOUR ( 2), "Europe/Bucharest" }, /* Eastern Europe, USSR Zone 1 */
{ "est", 0, HOUR ( 5), "America/New_York" }, /* Eastern Standard */
{ "f", 0, HOUR (- 6), NULL },
{ "fst", 1, -HOUR ( 1), "Europe/Paris" }, /* French Summer */
{ "fwt", 0, -HOUR ( 1), "Europe/Paris" }, /* French Winter */
{ "g", 0, HOUR (- 7), NULL },
{ "gmt", 0, HOUR ( 0), "GMT" }, /* Greenwich Mean */
{ "gst", 0, -HOUR ( 10), "Pacific/Guam" }, /* Guam Standard, USSR Zone 9 */
{ "h", 0, HOUR (- 8), NULL },
{ "hdt", 1, HOUR ( 10), "Pacific/Honolulu" }, /* Hawaii Daylight */
{ "hst", 0, HOUR ( 10), "Pacific/Honolulu" }, /* Hawaii Standard */
{ "i", 0, HOUR (- 9), NULL },
{ "idle", 0, -HOUR ( 12), "NZ" }, /* International Date Line East */
{ "idlw", 0, HOUR ( 12), NULL }, /* International Date Line West */
{ "ist", 0, -HOUR (5.5), "Asia/Calcutta" }, /* Indian Standard */
{ "it", 0, -HOUR (3.5), "Asia/Tehran" }, /* Iran */
{ "jst", 0, -HOUR ( 9), "Asia/Tokyo" }, /* Japan Standard, USSR Zone 8 */
{ "jt", 0, -HOUR (7.5), NULL }, /* Java (3pm in Cronusland!) */
{ "k", 0, HOUR (-10), NULL },
{ "l", 0, HOUR (-11), NULL },
{ "m", 0, HOUR (-12), NULL },
{ "mdt", 1, HOUR ( 7), "America/Phoenix" }, /* Mountain Daylight */
{ "mest", 1, -HOUR ( 1), "MET" }, /* Middle European Summer */
{ "mesz", 1, -HOUR ( 1), "MET" }, /* Middle European Summer */
{ "met", 0, -HOUR ( 1), "MET" }, /* Middle European */
{ "mewt", 0, -HOUR ( 1), "MET" }, /* Middle European Winter */
{ "msd", 1, HOUR ( 3), "Europe/Moscow" }, /* Moscow Summer */
{ "msk", 0, HOUR ( 3), "Europe/Moscow" }, /* Moscow */
{ "mst", 0, HOUR ( 7), "America/Phoenix" }, /* Mountain Standard */
{ "n", 0, HOUR ( 1), NULL },
{ "ndt", 1, HOUR (3.5), "America/St_Johns" }, /* Newfoundland Daylight */
{ "nft", 0, HOUR (3.5), "America/St_Johns" }, /* Newfoundland */
{ "nst", 0, HOUR (3.5), "America/St_Johns" }, /* Newfoundland Standard */
{ "nt", 0, HOUR ( 11), NULL }, /* Nome */
{ "nzdt", 1, -HOUR ( 12), "NZ" }, /* New Zealand Daylight */
{ "nzst", 0, -HOUR ( 12), "NZ" }, /* New Zealand Standard */
{ "nzt", 0, -HOUR ( 12), "NZ" }, /* New Zealand */
{ "o", 0, HOUR ( 2), NULL },
{ "p", 0, HOUR ( 3), NULL },
{ "pdt", 1, HOUR ( 8), "America/Los_Angeles" }, /* Pacific Daylight */
{ "pst", 0, HOUR ( 8), "America/Los_Angeles" }, /* Pacific Standard */
{ "q", 0, HOUR ( 4), NULL },
{ "r", 0, HOUR ( 5), NULL },
{ "s", 0, HOUR ( 6), NULL },
{ "slst", 1, -HOUR ( 1), "Europe/Oslo" }, /* Skien Local Summer Time */
{ "slt", 0, -HOUR ( 1), "Europe/Oslo" }, /* Skien Local Time */
{ "sst", 1, -HOUR ( 1), "Europe/Stockholm" }, /* Swedish Summer */
{ "swt", 0, -HOUR ( 1), "Europe/Stockholm" }, /* Swedish Winter */
{ "t", 0, HOUR ( 7), NULL },
{ "u", 0, HOUR ( 8), NULL },
{ "ut", 0, HOUR ( 0), "UTC" }, /* Universal (Coordinated) */
{ "utc", 0, HOUR ( 0), "UTC" },
{ "v", 0, HOUR ( 9), NULL },
{ "w", 0, HOUR ( 10), NULL },
{ "wadt", 1, -HOUR ( 7), "Australia/Perth" }, /* West Australian Daylight */
{ "wast", 0, -HOUR ( 7), "Australia/Perth" }, /* West Australian Standard */
{ "wat", 0, HOUR ( 1), "Africa/Dakar" }, /* West Africa */
{ "wet", 0, HOUR ( 0), "Europe/London" }, /* Western European */
{ "x", 0, HOUR ( 11), NULL },
{ "y", 0, HOUR ( 12), NULL },
{ "ydt", 1, HOUR ( 9), "America/Anchorage" }, /* Yukon Daylight */
{ "yst", 0, HOUR ( 9), "America/Anchorage" }, /* Yukon Standard */
{ "z", 0, HOUR ( 0), NULL },
{ "zp4", 0, -HOUR ( 4), NULL }, /* USSR Zone 3 */
{ "zp5", 0, -HOUR ( 5), NULL }, /* USSR Zone 4 */
{ "zp6", 0, -HOUR ( 6), NULL }, /* USSR Zone 5 */
#if 0
/* For completeness. BST is also British Summer, and GST is
* also Guam Standard. */
{ "bst", 0, HOUR ( 3), NULL }, /* Brazil Standard */
{ "gst", 0, HOUR ( 3), NULL }, /* Greenland Standard */
#include "timezonemap.h"
{ NULL, 0, 0, NULL },
};
/* For completeness. NST is also Newfoundland Standard, and SST is
* also Swedish Summer. */
{ "nst", 0, -HOUR (6.5), NULL },/* North Sumatra */
{ "sst", 0, -HOUR (7), NULL }, /* South Sumatra, USSR Zone 6 */
#endif
static timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
#include "fallbackmap.h"
{ NULL, 0, 0, NULL },
};
static timelib_relunit const timelib_relunit_lookup[] = {
@@ -316,8 +222,8 @@ static timelib_lookup_table const timelib_reltext_lookup[] = {
{ "twelfth", 0, 12 },
{ "last", 0, -1 },
{ "previous", 0, -1 },
{ "this", 0, 0 },
{ NULL, 0, 0 }
{ "this", 1, 0 },
{ NULL, 1, 0 }
};
/* The month table. */
@@ -533,7 +439,7 @@ static long timelib_parse_tz_cor(char **ptr)
return 0;
}
static timelib_sll timelib_lookup_relative_text(char **ptr)
static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
{
char *word;
char *begin = *ptr, *end;
@@ -550,6 +456,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr)
for (tp = timelib_reltext_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
value = tp->value;
*behavior = tp->type;
}
}
@@ -557,12 +464,12 @@ static timelib_sll timelib_lookup_relative_text(char **ptr)
return value;
}
static timelib_sll timelib_get_relative_text(char **ptr)
static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
{
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
++*ptr;
}
return timelib_lookup_relative_text(ptr);
return timelib_lookup_relative_text(ptr, behavior);
}
static long timelib_lookup_month(char **ptr)
@@ -628,7 +535,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
return value;
}
static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, Scanner *s)
{
const timelib_relunit* relunit;
@@ -646,28 +553,42 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
TIMELIB_UNHAVE_TIME();
s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
s->time->relative.weekday = relunit->multiplier;
s->time->relative.weekday_behavior = behavior;
break;
}
}
static timelib_tz_lookup_table* zone_search(const char *word, int left, int right)
static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
{
int mid, cmp;
if (left > right) {
return NULL; /* not found */
int first_found = 0;
timelib_tz_lookup_table *tp, *first_found_elem;
timelib_tz_lookup_table *fmp;
for (tp = timelib_timezone_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
if (!first_found) {
first_found = 1;
first_found_elem = tp;
if (gmtoffset == -1) {
return tp;
}
}
if (tp->gmtoffset == gmtoffset) {
return tp;
}
}
}
mid = (left + right) / 2;
cmp = strcasecmp(word, timelib_timezone_lookup[mid].name);
if (cmp < 0) {
return zone_search(word, left, mid - 1);
} else if (cmp > 0) {
return zone_search(word, mid + 1, right);
} else { /* (cmp == 0) */
return (timelib_tz_lookup_table*)&timelib_timezone_lookup[mid];
if (first_found) {
return first_found_elem;
}
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
return fmp;
}
}
return NULL;
}
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
@@ -684,9 +605,10 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
word = calloc(1, end - begin + 1);
memcpy(word, begin, end - begin);
if ((tp = zone_search(word, 0, sizeof(timelib_timezone_lookup)/sizeof(*timelib_timezone_lookup)-1))) {
value = tp->value;
if ((tp = zone_search(word, -1, 0))) {
value = -tp->gmtoffset / 60;
*dst = tp->type;
value += tp->type * 60;
*found = 1;
} else {
*found = 0;
@@ -696,7 +618,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
return value;
}
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found)
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, timelib_tzdb *tzdb)
{
timelib_tzinfo *res;
@@ -710,6 +632,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
*tz_not_found = 0;
t->dst = 0;
return -1 * timelib_parse_tz_cor(ptr);
} else if (**ptr == '-') {
@@ -717,6 +640,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
*tz_not_found = 0;
t->dst = 0;
return timelib_parse_tz_cor(ptr);
} else {
@@ -736,7 +660,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
#endif
/* If we have a TimeZone identifier to start with, use it */
if (strstr(tz_abbr, "/")) {
if ((res = timelib_parse_tzfile(tz_abbr)) != NULL) {
if ((res = timelib_parse_tzfile(tz_abbr, tzdb)) != NULL) {
t->tz_info = res;
t->zone_type = TIMELIB_ZONETYPE_ID;
found++;
@@ -810,15 +734,16 @@ monthroman = "I" | "II" | "III" | "IV" | "V" | "VI" | "VII" | "VIII" | "IX" | "X
monthtext = monthfull | monthabbr | monthroman;
/* Time formats */
timeshort12 = hour12[:]minutelz space? meridian;
timelong12 = hour12[:]minute[:]secondlz space? meridian;
timetiny12 = hour12 space? meridian;
timeshort12 = hour12[:.]minutelz space? meridian;
timelong12 = hour12[:.]minute[:.]secondlz space? meridian;
timeshort24 = hour24[:]minute;
timelong24 = hour24[:]minute[:]second;
iso8601long = hour24 [:] minute [:] second frac;
timeshort24 = hour24[:.]minute;
timelong24 = hour24[:.]minute[:.]second;
iso8601long = hour24 [:.] minute [:.] second frac;
/* iso8601shorttz = hour24 [:] minutelz space? (tzcorrection | tz); */
iso8601normtz = hour24 [:] minute [:] secondlz space? (tzcorrection | tz);
iso8601normtz = hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz);
/* iso8601longtz = hour24 [:] minute [:] secondlz frac space? (tzcorrection | tz); */
gnunocolon = hour24lz minutelz;
@@ -830,6 +755,7 @@ iso8601nocolon = hour24lz minutelz secondlz;
americanshort = month "/" day;
american = month "/" day "/" year;
iso8601dateslash = year4 "/" monthlz "/" daylz "/"?;
dateslash = year4 "/" month "/" day;
gnudateshort = year "-" month "-" day;
iso8601date = year4 "-" monthlz "-" daylz;
pointeddate = day "." month "." year;
@@ -898,9 +824,21 @@ relativetext = (reltextnumber space? reltextunit)+;
return TIMELIB_RELATIVE;
}
"today"
"noon"
{
DEBUG_OUTPUT("today");
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
TIMELIB_UNHAVE_TIME();
TIMELIB_HAVE_TIME();
s->time->h = 12;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
"midnight" | "today"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
TIMELIB_UNHAVE_TIME();
@@ -944,15 +882,17 @@ relativetext = (reltextnumber space? reltextunit)+;
return TIMELIB_RELATIVE;
}
timeshort12 | timelong12
timetiny12 | timeshort12 | timelong12
{
DEBUG_OUTPUT("timeshort12 | timelong12");
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':') {
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':' || *ptr == '.') {
s->time->i = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':' || *ptr == '.') {
s->time->s = timelib_get_nr((char **) &ptr, 2);
}
}
s->time->h += timelib_meridian((char **) &ptr, s->time->h);
TIMELIB_DEINIT;
@@ -967,7 +907,7 @@ relativetext = (reltextnumber space? reltextunit)+;
TIMELIB_HAVE_TIME();
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':') {
if (*ptr == ':' || *ptr == '.') {
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == '.') {
@@ -976,7 +916,7 @@ relativetext = (reltextnumber space? reltextunit)+;
}
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
@@ -1014,7 +954,7 @@ relativetext = (reltextnumber space? reltextunit)+;
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = timelib_get_nr((char **) &ptr, 2);
s->time->s = 0;
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb);
break;
case 1:
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1039,7 +979,7 @@ relativetext = (reltextnumber space? reltextunit)+;
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
@@ -1048,6 +988,7 @@ relativetext = (reltextnumber space? reltextunit)+;
americanshort | american
{
DEBUG_OUTPUT("americanshort | american");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_nr((char **) &ptr, 2);
@@ -1060,8 +1001,9 @@ relativetext = (reltextnumber space? reltextunit)+;
return TIMELIB_AMERICAN;
}
iso8601date | iso8601dateslash
iso8601date | iso8601dateslash | dateslash
{
DEBUG_OUTPUT("iso8601date | iso8601dateslash | dateslash");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1073,6 +1015,7 @@ relativetext = (reltextnumber space? reltextunit)+;
gnudateshort
{
DEBUG_OUTPUT("gnudateshort");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1085,6 +1028,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datefull
{
DEBUG_OUTPUT("datefull");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->d = timelib_get_nr((char **) &ptr, 2);
@@ -1097,6 +1041,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pointeddate
{
DEBUG_OUTPUT("pointed date");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->d = timelib_get_nr((char **) &ptr, 2);
@@ -1109,6 +1054,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenoday
{
DEBUG_OUTPUT("datenoday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1121,6 +1067,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenodayrev
{
DEBUG_OUTPUT("datenodayrev");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1133,6 +1080,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datetextual | datenoyear
{
DEBUG_OUTPUT("datetextual | datenoyear");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1145,6 +1093,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenoyearrev
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->d = timelib_get_nr((char **) &ptr, 2);
@@ -1155,6 +1104,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenocolon
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1167,6 +1117,7 @@ relativetext = (reltextnumber space? reltextunit)+;
xmlrpc | xmlrpcnocolon | soap | wddx
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
TIMELIB_HAVE_DATE();
@@ -1178,7 +1129,7 @@ relativetext = (reltextnumber space? reltextunit)+;
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == '.') {
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
@@ -1187,6 +1138,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pgydotd
{
DEBUG_OUTPUT("pgydotd");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1200,7 +1152,7 @@ relativetext = (reltextnumber space? reltextunit)+;
isoweekday
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
@@ -1219,7 +1171,7 @@ relativetext = (reltextnumber space? reltextunit)+;
isoweek
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
@@ -1237,6 +1189,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pgtextshort
{
DEBUG_OUTPUT("pgtextshort");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1249,6 +1202,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pgtextreverse
{
DEBUG_OUTPUT("pgtextreverse");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1262,6 +1216,7 @@ relativetext = (reltextnumber space? reltextunit)+;
clf
{
int tz_not_found;
DEBUG_OUTPUT("clf");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
TIMELIB_HAVE_DATE();
@@ -1271,7 +1226,7 @@ relativetext = (reltextnumber space? reltextunit)+;
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = timelib_get_nr((char **) &ptr, 2);
s->time->s = timelib_get_nr((char **) &ptr, 2);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
TIMELIB_DEINIT;
return TIMELIB_CLF;
@@ -1279,6 +1234,7 @@ relativetext = (reltextnumber space? reltextunit)+;
year4
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
s->time->y = timelib_get_nr((char **) &ptr, 4);
TIMELIB_DEINIT;
@@ -1287,6 +1243,7 @@ relativetext = (reltextnumber space? reltextunit)+;
ago
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
s->time->relative.y = 0 - s->time->relative.y;
s->time->relative.m = 0 - s->time->relative.m;
@@ -1302,14 +1259,15 @@ relativetext = (reltextnumber space? reltextunit)+;
relativetext
{
timelib_sll i;
int behavior;
DEBUG_OUTPUT("relativetext");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
while(*ptr) {
i = timelib_get_relative_text((char **) &ptr);
i = timelib_get_relative_text((char **) &ptr, &behavior);
timelib_eat_spaces((char **) &ptr);
timelib_set_relative((char **) &ptr, i, s);
timelib_set_relative((char **) &ptr, i, behavior, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
@@ -1318,7 +1276,7 @@ relativetext = (reltextnumber space? reltextunit)+;
dayfull
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("dayfull");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
TIMELIB_HAVE_WEEKDAY_RELATIVE();
@@ -1326,6 +1284,7 @@ relativetext = (reltextnumber space? reltextunit)+;
relunit = timelib_lookup_relunit((char**) &ptr);
s->time->relative.weekday = relunit->multiplier;
s->time->relative.weekday_behavior = 1;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
@@ -1333,14 +1292,16 @@ relativetext = (reltextnumber space? reltextunit)+;
dayabbr
{
DEBUG_OUTPUT("dayabbr");
goto std;
}
tzcorrection | tz
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
TIMELIB_INIT;
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
@@ -1349,6 +1310,7 @@ relativetext = (reltextnumber space? reltextunit)+;
dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1366,7 +1328,7 @@ relativetext = (reltextnumber space? reltextunit)+;
}
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
@@ -1376,14 +1338,14 @@ relativetext = (reltextnumber space? reltextunit)+;
relative
{
timelib_ull i;
DEBUG_OUTPUT("relative");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
while(*ptr) {
i = timelib_get_unsigned_nr((char **) &ptr, 24);
timelib_eat_spaces((char **) &ptr);
timelib_set_relative((char **) &ptr, i, s);
timelib_set_relative((char **) &ptr, i, 0, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
@@ -1411,16 +1373,16 @@ relativetext = (reltextnumber space? reltextunit)+;
/*!max:re2c */
timelib_time* timelib_strtotime(char *s, int *errors)
timelib_time* timelib_strtotime(char *s, int *errors, timelib_tzdb *tzdb)
{
Scanner in;
int t;
memset(&in, 0, sizeof(in));
in.str = malloc(strlen(s) + 25);
memset(in.str, 0, strlen(s) + 25);
in.str = malloc(strlen(s) + YYMAXFILL);
memset(in.str, 0, strlen(s) + YYMAXFILL);
memcpy(in.str, s, strlen(s));
in.lim = in.str + strlen(s) + 25;
in.lim = in.str + strlen(s) + YYMAXFILL;
in.cur = in.str;
in.time = timelib_time_ctor();
in.time->y = -1;
@@ -1433,10 +1395,13 @@ timelib_time* timelib_strtotime(char *s, int *errors)
in.time->z = -1;
in.time->dst = -1;
in.errors = 0;
in.tzdb = tzdb;
do {
t = scan(&in);
/* printf("%d\n", t); */
#ifdef DEBUG_PARSER
printf("%d\n", t);
#endif
} while(t != EOI);
free(in.str);
@@ -1479,11 +1444,11 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
char *timelib_timezone_id_from_abbr(const char *abbr)
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
{
timelib_tz_lookup_table *tp;
tp = zone_search(abbr, 0, sizeof(timelib_timezone_lookup) / sizeof(*timelib_timezone_lookup) - 1);
tp = zone_search(abbr, gmtoffset, isdst);
if (tp) {
return (tp->full_tz_name);
} else {
+48 -14
View File
@@ -164,6 +164,15 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
printf("Local types count: %lu\n", (unsigned long) tz->typecnt);
printf("Zone Abbr. count: %lu\n", (unsigned long) tz->charcnt);
printf ("%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
"", "", 0,
(long int) tz->type[0].offset,
tz->type[0].isdst,
tz->type[0].abbr_idx,
&tz->timezone_abbr[tz->type[0].abbr_idx],
tz->type[0].isstdcnt,
tz->type[0].isgmtcnt
);
for (i = 0; i < tz->timecnt; i++) {
printf ("%08X (%12d) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
tz->trans[i], tz->trans[i], tz->trans_idx[i],
@@ -183,7 +192,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
}
}
static int tz_search(char *timezone, int left, int right)
static int tz_search(char *timezone, int left, int right, timelib_tzdb *tzdb)
{
int mid, cmp;
@@ -193,41 +202,48 @@ static int tz_search(char *timezone, int left, int right)
mid = (left + right) / 2;
cmp = strcasecmp(timezone, timezonedb_idx[mid].id);
cmp = strcasecmp(timezone, tzdb->index[mid].id);
if (cmp < 0) {
return tz_search(timezone, left, mid - 1);
return tz_search(timezone, left, mid - 1, tzdb);
} else if (cmp > 0) {
return tz_search(timezone, mid + 1, right);
return tz_search(timezone, mid + 1, right, tzdb);
} else { /* (cmp == 0) */
return timezonedb_idx[mid].pos;
return tzdb->index[mid].pos;
}
}
static int seek_to_tz_position(char **tzf, char *timezone)
static int seek_to_tz_position(char **tzf, char *timezone, timelib_tzdb *tzdb)
{
int pos = tz_search(timezone, 0, sizeof(timezonedb_idx)/sizeof(*timezonedb_idx)-1);
int pos;
pos = tz_search(timezone, 0, tzdb->index_size, tzdb);
if (pos == -1) {
return 0;
}
(*tzf) = &timelib_timezone_db_data[pos + 20];
(*tzf) = &(tzdb->data[pos + 20]);
return 1;
}
timelib_tzdb_index_entry *timelib_timezone_identifiers_list(int *count)
timelib_tzdb *timelib_builtin_db(void)
{
*count = sizeof(timezonedb_idx) / sizeof(*timezonedb_idx);
return timezonedb_idx;
return &timezonedb_builtin;
}
timelib_tzinfo *timelib_parse_tzfile(char *timezone)
timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count)
{
*count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin);
return timezonedb_idx_builtin;
}
timelib_tzinfo *timelib_parse_tzfile(char *timezone, timelib_tzdb *tzdb)
{
char *tzf;
timelib_tzinfo *tmp;
if (seek_to_tz_position((char**) &tzf, timezone)) {
if (seek_to_tz_position((char**) &tzf, timezone, tzdb)) {
tmp = timelib_tzinfo_ctor(timezone);
read_header((char**) &tzf, tmp);
@@ -244,6 +260,8 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
{
uint32_t i;
/* If there is no transistion time, we pick the first one, if that doesn't
* exist we return NULL */
if (!tz->timecnt || !tz->trans) {
*transition_time = 0;
if (tz->typecnt == 1) {
@@ -252,10 +270,26 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
return NULL;
}
/* If the TS is lower than the first transistion time, then we scan over
* all the transistion times to find the first non-DST one, or the first
* one in case there are only DST entries. Not sure which smartass came up
* with this idea in the first though :) */
if (ts < tz->trans[0]) {
uint32_t j;
*transition_time = 0;
return &(tz->type[tz->trans_idx[tz->timecnt - 1]]);
j = 0;
while (j < tz->timecnt && tz->type[j].isdst) {
++j;
}
if (j == tz->timecnt) {
j = 0;
}
return &(tz->type[j]);
}
/* In all other cases we loop through the available transtion times to find
* the correct entry */
for (i = 0; i < tz->timecnt; i++) {
if (ts < tz->trans[i]) {
*transition_time = tz->trans[i - 1];
+129 -164
View File
@@ -100,7 +100,7 @@ typedef unsigned char uchar;
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; s->time->relative.weekday_behavior = 0; }
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_weekday_relative = 1; }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { return TIMELIB_ERROR; } else { s->time.have_zone = 1; } }
@@ -142,6 +142,7 @@ typedef struct Scanner {
int errors;
struct timelib_time *time;
timelib_tzdb *tzdb;
} Scanner;
typedef struct _timelib_lookup_table {
@@ -160,108 +161,13 @@ typedef struct _timelib_relunit {
/* The timezone table. */
static timelib_tz_lookup_table timelib_timezone_lookup[] = {
{ "a", 0, HOUR (- 1), NULL },
{ "adt", 1, HOUR ( 4), "America/Halifax" }, /* Atlantic Daylight */
{ "ahst", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska-Hawaii Standard */
{ "akdt", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska Daylight */
{ "akst", 0, HOUR ( 10), "America/Anchorage" }, /* Alaska Standard */
{ "ast", 0, HOUR ( 4), "America/Halifax" }, /* Atlantic Standard */
{ "at", 0, HOUR ( 2), "Atlantic/Azores" }, /* Azores */
{ "b", 0, HOUR (- 2), NULL },
{ "bst", 1, HOUR ( 0), "Europe/London" }, /* British Summer */
{ "bt", 0, -HOUR ( 3), "Asia/Baghdad" }, /* Baghdad, USSR Zone 2 */
{ "c", 0, HOUR (- 3), NULL },
{ "cadt", 1, -HOUR (9.5), "Australia/Adelaide" }, /* Central Australian Daylight */
{ "cast", 0, -HOUR (9.5), "Australia/Adelaide" }, /* Central Australian Standard */
{ "cat", 0, HOUR ( 10), "America/Anchorage" }, /* Central Alaska */
{ "cct", 0, -HOUR ( 8), "Asia/Shanghai" }, /* China Coast, USSR Zone 7 */
{ "cdt", 1, HOUR ( 6), "America/Chicago" }, /* Central Daylight */
{ "cest", 1, -HOUR ( 1), "Europe/Berlin" }, /* Central European Summer */
{ "cet", 0, -HOUR ( 1), "Europe/Berlin" }, /* Central European */
{ "cst", 0, HOUR ( 6), "America/Chicago" }, /* Central Standard */
{ "d", 0, HOUR (- 4), NULL },
{ "e", 0, HOUR (- 5), NULL },
{ "eadt", 1, -HOUR ( 10), "Australia/Sydney" }, /* Eastern Australian Daylight */
{ "east", 0, -HOUR ( 10), "Australia/Sydney" }, /* Eastern Australian Standard */
{ "edt", 1, HOUR ( 5), "America/New_York" }, /* Eastern Daylight */
{ "eest", 1, HOUR ( 2), "Europe/Helsinki" }, /* Eastern European Summer */
{ "eet", 0, -HOUR ( 2), "Europe/Bucharest" }, /* Eastern Europe, USSR Zone 1 */
{ "est", 0, HOUR ( 5), "America/New_York" }, /* Eastern Standard */
{ "f", 0, HOUR (- 6), NULL },
{ "fst", 1, -HOUR ( 1), "Europe/Paris" }, /* French Summer */
{ "fwt", 0, -HOUR ( 1), "Europe/Paris" }, /* French Winter */
{ "g", 0, HOUR (- 7), NULL },
{ "gmt", 0, HOUR ( 0), "GMT" }, /* Greenwich Mean */
{ "gst", 0, -HOUR ( 10), "Pacific/Guam" }, /* Guam Standard, USSR Zone 9 */
{ "h", 0, HOUR (- 8), NULL },
{ "hdt", 1, HOUR ( 10), "Pacific/Honolulu" }, /* Hawaii Daylight */
{ "hst", 0, HOUR ( 10), "Pacific/Honolulu" }, /* Hawaii Standard */
{ "i", 0, HOUR (- 9), NULL },
{ "idle", 0, -HOUR ( 12), "NZ" }, /* International Date Line East */
{ "idlw", 0, HOUR ( 12), NULL }, /* International Date Line West */
{ "ist", 0, -HOUR (5.5), "Asia/Calcutta" }, /* Indian Standard */
{ "it", 0, -HOUR (3.5), "Asia/Tehran" }, /* Iran */
{ "jst", 0, -HOUR ( 9), "Asia/Tokyo" }, /* Japan Standard, USSR Zone 8 */
{ "jt", 0, -HOUR (7.5), NULL }, /* Java (3pm in Cronusland!) */
{ "k", 0, HOUR (-10), NULL },
{ "l", 0, HOUR (-11), NULL },
{ "m", 0, HOUR (-12), NULL },
{ "mdt", 1, HOUR ( 7), "America/Phoenix" }, /* Mountain Daylight */
{ "mest", 1, -HOUR ( 1), "MET" }, /* Middle European Summer */
{ "mesz", 1, -HOUR ( 1), "MET" }, /* Middle European Summer */
{ "met", 0, -HOUR ( 1), "MET" }, /* Middle European */
{ "mewt", 0, -HOUR ( 1), "MET" }, /* Middle European Winter */
{ "msd", 1, HOUR ( 3), "Europe/Moscow" }, /* Moscow Summer */
{ "msk", 0, HOUR ( 3), "Europe/Moscow" }, /* Moscow */
{ "mst", 0, HOUR ( 7), "America/Phoenix" }, /* Mountain Standard */
{ "n", 0, HOUR ( 1), NULL },
{ "ndt", 1, HOUR (3.5), "America/St_Johns" }, /* Newfoundland Daylight */
{ "nft", 0, HOUR (3.5), "America/St_Johns" }, /* Newfoundland */
{ "nst", 0, HOUR (3.5), "America/St_Johns" }, /* Newfoundland Standard */
{ "nt", 0, HOUR ( 11), NULL }, /* Nome */
{ "nzdt", 1, -HOUR ( 12), "NZ" }, /* New Zealand Daylight */
{ "nzst", 0, -HOUR ( 12), "NZ" }, /* New Zealand Standard */
{ "nzt", 0, -HOUR ( 12), "NZ" }, /* New Zealand */
{ "o", 0, HOUR ( 2), NULL },
{ "p", 0, HOUR ( 3), NULL },
{ "pdt", 1, HOUR ( 8), "America/Los_Angeles" }, /* Pacific Daylight */
{ "pst", 0, HOUR ( 8), "America/Los_Angeles" }, /* Pacific Standard */
{ "q", 0, HOUR ( 4), NULL },
{ "r", 0, HOUR ( 5), NULL },
{ "s", 0, HOUR ( 6), NULL },
{ "slst", 1, -HOUR ( 1), "Europe/Oslo" }, /* Skien Local Summer Time */
{ "slt", 0, -HOUR ( 1), "Europe/Oslo" }, /* Skien Local Time */
{ "sst", 1, -HOUR ( 1), "Europe/Stockholm" }, /* Swedish Summer */
{ "swt", 0, -HOUR ( 1), "Europe/Stockholm" }, /* Swedish Winter */
{ "t", 0, HOUR ( 7), NULL },
{ "u", 0, HOUR ( 8), NULL },
{ "ut", 0, HOUR ( 0), "UTC" }, /* Universal (Coordinated) */
{ "utc", 0, HOUR ( 0), "UTC" },
{ "v", 0, HOUR ( 9), NULL },
{ "w", 0, HOUR ( 10), NULL },
{ "wadt", 1, -HOUR ( 7), "Australia/Perth" }, /* West Australian Daylight */
{ "wast", 0, -HOUR ( 7), "Australia/Perth" }, /* West Australian Standard */
{ "wat", 0, HOUR ( 1), "Africa/Dakar" }, /* West Africa */
{ "wet", 0, HOUR ( 0), "Europe/London" }, /* Western European */
{ "x", 0, HOUR ( 11), NULL },
{ "y", 0, HOUR ( 12), NULL },
{ "ydt", 1, HOUR ( 9), "America/Anchorage" }, /* Yukon Daylight */
{ "yst", 0, HOUR ( 9), "America/Anchorage" }, /* Yukon Standard */
{ "z", 0, HOUR ( 0), NULL },
{ "zp4", 0, -HOUR ( 4), NULL }, /* USSR Zone 3 */
{ "zp5", 0, -HOUR ( 5), NULL }, /* USSR Zone 4 */
{ "zp6", 0, -HOUR ( 6), NULL }, /* USSR Zone 5 */
#if 0
/* For completeness. BST is also British Summer, and GST is
* also Guam Standard. */
{ "bst", 0, HOUR ( 3), NULL }, /* Brazil Standard */
{ "gst", 0, HOUR ( 3), NULL }, /* Greenland Standard */
#include "timezonemap.h"
{ NULL, 0, 0, NULL },
};
/* For completeness. NST is also Newfoundland Standard, and SST is
* also Swedish Summer. */
{ "nst", 0, -HOUR (6.5), NULL },/* North Sumatra */
{ "sst", 0, -HOUR (7), NULL }, /* South Sumatra, USSR Zone 6 */
#endif
static timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
#include "fallbackmap.h"
{ NULL, 0, 0, NULL },
};
static timelib_relunit const timelib_relunit_lookup[] = {
@@ -316,8 +222,8 @@ static timelib_lookup_table const timelib_reltext_lookup[] = {
{ "twelfth", 0, 12 },
{ "last", 0, -1 },
{ "previous", 0, -1 },
{ "this", 0, 0 },
{ NULL, 0, 0 }
{ "this", 1, 0 },
{ NULL, 1, 0 }
};
/* The month table. */
@@ -533,7 +439,7 @@ static long timelib_parse_tz_cor(char **ptr)
return 0;
}
static timelib_sll timelib_lookup_relative_text(char **ptr)
static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
{
char *word;
char *begin = *ptr, *end;
@@ -550,6 +456,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr)
for (tp = timelib_reltext_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
value = tp->value;
*behavior = tp->type;
}
}
@@ -557,12 +464,12 @@ static timelib_sll timelib_lookup_relative_text(char **ptr)
return value;
}
static timelib_sll timelib_get_relative_text(char **ptr)
static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
{
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
++*ptr;
}
return timelib_lookup_relative_text(ptr);
return timelib_lookup_relative_text(ptr, behavior);
}
static long timelib_lookup_month(char **ptr)
@@ -628,7 +535,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
return value;
}
static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, Scanner *s)
{
const timelib_relunit* relunit;
@@ -646,28 +553,42 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
TIMELIB_UNHAVE_TIME();
s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
s->time->relative.weekday = relunit->multiplier;
s->time->relative.weekday_behavior = behavior;
break;
}
}
static timelib_tz_lookup_table* zone_search(const char *word, int left, int right)
static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
{
int mid, cmp;
if (left > right) {
return NULL; /* not found */
int first_found = 0;
timelib_tz_lookup_table *tp, *first_found_elem;
timelib_tz_lookup_table *fmp;
for (tp = timelib_timezone_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
if (!first_found) {
first_found = 1;
first_found_elem = tp;
if (gmtoffset == -1) {
return tp;
}
}
if (tp->gmtoffset == gmtoffset) {
return tp;
}
}
}
mid = (left + right) / 2;
cmp = strcasecmp(word, timelib_timezone_lookup[mid].name);
if (cmp < 0) {
return zone_search(word, left, mid - 1);
} else if (cmp > 0) {
return zone_search(word, mid + 1, right);
} else { /* (cmp == 0) */
return (timelib_tz_lookup_table*)&timelib_timezone_lookup[mid];
if (first_found) {
return first_found_elem;
}
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
return fmp;
}
}
return NULL;
}
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
@@ -684,9 +605,10 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
word = calloc(1, end - begin + 1);
memcpy(word, begin, end - begin);
if ((tp = zone_search(word, 0, sizeof(timelib_timezone_lookup)/sizeof(*timelib_timezone_lookup)-1))) {
value = tp->value;
if ((tp = zone_search(word, -1, 0))) {
value = -tp->gmtoffset / 60;
*dst = tp->type;
value += tp->type * 60;
*found = 1;
} else {
*found = 0;
@@ -696,7 +618,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
return value;
}
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found)
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, timelib_tzdb *tzdb)
{
timelib_tzinfo *res;
@@ -710,6 +632,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
*tz_not_found = 0;
t->dst = 0;
return -1 * timelib_parse_tz_cor(ptr);
} else if (**ptr == '-') {
@@ -717,6 +640,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
*tz_not_found = 0;
t->dst = 0;
return timelib_parse_tz_cor(ptr);
} else {
@@ -736,7 +660,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
#endif
/* If we have a TimeZone identifier to start with, use it */
if (strstr(tz_abbr, "/")) {
if ((res = timelib_parse_tzfile(tz_abbr)) != NULL) {
if ((res = timelib_parse_tzfile(tz_abbr, tzdb)) != NULL) {
t->tz_info = res;
t->zone_type = TIMELIB_ZONETYPE_ID;
found++;
@@ -810,15 +734,16 @@ monthroman = "I" | "II" | "III" | "IV" | "V" | "VI" | "VII" | "VIII" | "IX" | "X
monthtext = monthfull | monthabbr | monthroman;
/* Time formats */
timeshort12 = hour12[:]minutelz space? meridian;
timelong12 = hour12[:]minute[:]secondlz space? meridian;
timetiny12 = hour12 space? meridian;
timeshort12 = hour12[:.]minutelz space? meridian;
timelong12 = hour12[:.]minute[:.]secondlz space? meridian;
timeshort24 = hour24[:]minute;
timelong24 = hour24[:]minute[:]second;
iso8601long = hour24 [:] minute [:] second frac;
timeshort24 = hour24[:.]minute;
timelong24 = hour24[:.]minute[:.]second;
iso8601long = hour24 [:.] minute [:.] second frac;
/* iso8601shorttz = hour24 [:] minutelz space? (tzcorrection | tz); */
iso8601normtz = hour24 [:] minute [:] secondlz space? (tzcorrection | tz);
iso8601normtz = hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz);
/* iso8601longtz = hour24 [:] minute [:] secondlz frac space? (tzcorrection | tz); */
gnunocolon = hour24lz minutelz;
@@ -830,6 +755,7 @@ iso8601nocolon = hour24lz minutelz secondlz;
americanshort = month "/" day;
american = month "/" day "/" year;
iso8601dateslash = year4 "/" monthlz "/" daylz "/"?;
dateslash = year4 "/" month "/" day;
gnudateshort = year "-" month "-" day;
iso8601date = year4 "-" monthlz "-" daylz;
pointeddate = day "." month "." year;
@@ -898,9 +824,21 @@ relativetext = (reltextnumber space? reltextunit)+;
return TIMELIB_RELATIVE;
}
"today"
"noon"
{
DEBUG_OUTPUT("today");
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
TIMELIB_UNHAVE_TIME();
TIMELIB_HAVE_TIME();
s->time->h = 12;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
"midnight" | "today"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
TIMELIB_UNHAVE_TIME();
@@ -944,15 +882,17 @@ relativetext = (reltextnumber space? reltextunit)+;
return TIMELIB_RELATIVE;
}
timeshort12 | timelong12
timetiny12 | timeshort12 | timelong12
{
DEBUG_OUTPUT("timeshort12 | timelong12");
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':') {
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':' || *ptr == '.') {
s->time->i = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':' || *ptr == '.') {
s->time->s = timelib_get_nr((char **) &ptr, 2);
}
}
s->time->h += timelib_meridian((char **) &ptr, s->time->h);
TIMELIB_DEINIT;
@@ -967,7 +907,7 @@ relativetext = (reltextnumber space? reltextunit)+;
TIMELIB_HAVE_TIME();
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = timelib_get_nr((char **) &ptr, 2);
if (*ptr == ':') {
if (*ptr == ':' || *ptr == '.') {
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == '.') {
@@ -976,7 +916,7 @@ relativetext = (reltextnumber space? reltextunit)+;
}
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
@@ -1014,7 +954,7 @@ relativetext = (reltextnumber space? reltextunit)+;
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = timelib_get_nr((char **) &ptr, 2);
s->time->s = 0;
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb);
break;
case 1:
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1039,7 +979,7 @@ relativetext = (reltextnumber space? reltextunit)+;
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
@@ -1048,6 +988,7 @@ relativetext = (reltextnumber space? reltextunit)+;
americanshort | american
{
DEBUG_OUTPUT("americanshort | american");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_nr((char **) &ptr, 2);
@@ -1060,8 +1001,9 @@ relativetext = (reltextnumber space? reltextunit)+;
return TIMELIB_AMERICAN;
}
iso8601date | iso8601dateslash
iso8601date | iso8601dateslash | dateslash
{
DEBUG_OUTPUT("iso8601date | iso8601dateslash | dateslash");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1073,6 +1015,7 @@ relativetext = (reltextnumber space? reltextunit)+;
gnudateshort
{
DEBUG_OUTPUT("gnudateshort");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1085,6 +1028,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datefull
{
DEBUG_OUTPUT("datefull");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->d = timelib_get_nr((char **) &ptr, 2);
@@ -1097,6 +1041,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pointeddate
{
DEBUG_OUTPUT("pointed date");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->d = timelib_get_nr((char **) &ptr, 2);
@@ -1109,6 +1054,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenoday
{
DEBUG_OUTPUT("datenoday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1121,6 +1067,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenodayrev
{
DEBUG_OUTPUT("datenodayrev");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1133,6 +1080,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datetextual | datenoyear
{
DEBUG_OUTPUT("datetextual | datenoyear");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1145,6 +1093,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenoyearrev
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->d = timelib_get_nr((char **) &ptr, 2);
@@ -1155,6 +1104,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenocolon
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1167,6 +1117,7 @@ relativetext = (reltextnumber space? reltextunit)+;
xmlrpc | xmlrpcnocolon | soap | wddx
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
TIMELIB_HAVE_DATE();
@@ -1178,7 +1129,7 @@ relativetext = (reltextnumber space? reltextunit)+;
s->time->s = timelib_get_nr((char **) &ptr, 2);
if (*ptr == '.') {
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
@@ -1187,6 +1138,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pgydotd
{
DEBUG_OUTPUT("pgydotd");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1200,7 +1152,7 @@ relativetext = (reltextnumber space? reltextunit)+;
isoweekday
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
@@ -1219,7 +1171,7 @@ relativetext = (reltextnumber space? reltextunit)+;
isoweek
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
@@ -1237,6 +1189,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pgtextshort
{
DEBUG_OUTPUT("pgtextshort");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1249,6 +1202,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pgtextreverse
{
DEBUG_OUTPUT("pgtextreverse");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
@@ -1262,6 +1216,7 @@ relativetext = (reltextnumber space? reltextunit)+;
clf
{
int tz_not_found;
DEBUG_OUTPUT("clf");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
TIMELIB_HAVE_DATE();
@@ -1271,7 +1226,7 @@ relativetext = (reltextnumber space? reltextunit)+;
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = timelib_get_nr((char **) &ptr, 2);
s->time->s = timelib_get_nr((char **) &ptr, 2);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
TIMELIB_DEINIT;
return TIMELIB_CLF;
@@ -1279,6 +1234,7 @@ relativetext = (reltextnumber space? reltextunit)+;
year4
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
s->time->y = timelib_get_nr((char **) &ptr, 4);
TIMELIB_DEINIT;
@@ -1287,6 +1243,7 @@ relativetext = (reltextnumber space? reltextunit)+;
ago
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
s->time->relative.y = 0 - s->time->relative.y;
s->time->relative.m = 0 - s->time->relative.m;
@@ -1302,14 +1259,15 @@ relativetext = (reltextnumber space? reltextunit)+;
relativetext
{
timelib_sll i;
int behavior;
DEBUG_OUTPUT("relativetext");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
while(*ptr) {
i = timelib_get_relative_text((char **) &ptr);
i = timelib_get_relative_text((char **) &ptr, &behavior);
timelib_eat_spaces((char **) &ptr);
timelib_set_relative((char **) &ptr, i, s);
timelib_set_relative((char **) &ptr, i, behavior, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
@@ -1318,7 +1276,7 @@ relativetext = (reltextnumber space? reltextunit)+;
dayfull
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("dayfull");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
TIMELIB_HAVE_WEEKDAY_RELATIVE();
@@ -1326,6 +1284,7 @@ relativetext = (reltextnumber space? reltextunit)+;
relunit = timelib_lookup_relunit((char**) &ptr);
s->time->relative.weekday = relunit->multiplier;
s->time->relative.weekday_behavior = 1;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
@@ -1333,14 +1292,16 @@ relativetext = (reltextnumber space? reltextunit)+;
dayabbr
{
DEBUG_OUTPUT("dayabbr");
goto std;
}
tzcorrection | tz
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
TIMELIB_INIT;
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
@@ -1349,6 +1310,7 @@ relativetext = (reltextnumber space? reltextunit)+;
dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1366,7 +1328,7 @@ relativetext = (reltextnumber space? reltextunit)+;
}
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
@@ -1376,14 +1338,14 @@ relativetext = (reltextnumber space? reltextunit)+;
relative
{
timelib_ull i;
DEBUG_OUTPUT("relative");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
while(*ptr) {
i = timelib_get_unsigned_nr((char **) &ptr, 24);
timelib_eat_spaces((char **) &ptr);
timelib_set_relative((char **) &ptr, i, s);
timelib_set_relative((char **) &ptr, i, 0, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
@@ -1411,16 +1373,16 @@ relativetext = (reltextnumber space? reltextunit)+;
/*!max:re2c */
timelib_time* timelib_strtotime(char *s, int *errors)
timelib_time* timelib_strtotime(char *s, int *errors, timelib_tzdb *tzdb)
{
Scanner in;
int t;
memset(&in, 0, sizeof(in));
in.str = malloc(strlen(s) + 25);
memset(in.str, 0, strlen(s) + 25);
in.str = malloc(strlen(s) + YYMAXFILL);
memset(in.str, 0, strlen(s) + YYMAXFILL);
memcpy(in.str, s, strlen(s));
in.lim = in.str + strlen(s) + 25;
in.lim = in.str + strlen(s) + YYMAXFILL;
in.cur = in.str;
in.time = timelib_time_ctor();
in.time->y = -1;
@@ -1433,10 +1395,13 @@ timelib_time* timelib_strtotime(char *s, int *errors)
in.time->z = -1;
in.time->dst = -1;
in.errors = 0;
in.tzdb = tzdb;
do {
t = scan(&in);
/* printf("%d\n", t); */
#ifdef DEBUG_PARSER
printf("%d\n", t);
#endif
} while(t != EOI);
free(in.str);
@@ -1479,11 +1444,11 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
char *timelib_timezone_id_from_abbr(const char *abbr)
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
{
timelib_tz_lookup_table *tp;
tp = zone_search(abbr, 0, sizeof(timelib_timezone_lookup) / sizeof(*timelib_timezone_lookup) - 1);
tp = zone_search(abbr, gmtoffset, isdst);
if (tp) {
return (tp->full_tz_name);
} else {
+1 -1
View File
@@ -180,7 +180,7 @@ void timelib_dump_date(timelib_time *d, int options)
d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
}
if (d->have_weekday_relative) {
printf(" / %d", d->relative.weekday);
printf(" / %d.%d", d->relative.weekday, d->relative.weekday_behavior);
}
}
printf("\n");
Loaded 100 of 831 files, more files were not shown because too many files have changed in this diff. Show more