Compare commits

...
460 Commits
Author SHA1 Message Date
SVN Migration 096ec90b49 This commit was manufactured by cvs2svn to create tag 'php_5_1_0RC2'. 2005-10-14 15:35:57 +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
620 changed files with 42067 additions and 42480 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
+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)" \
+161 -3
View File
@@ -1,26 +1,165 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2005, PHP 5.1
- Updated bundled libraries in Windows distribution. (Edin)
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 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). (Nuno)
- 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 +168,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 +420,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
+7 -1
View File
@@ -14,4 +14,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
)
+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
+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
+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
+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)
+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;
+224 -5
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;
}
@@ -1965,7 +2005,7 @@ 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)
return 1;
@@ -2028,7 +2068,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);
@@ -2126,7 +2166,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 +2314,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 +2442,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 +2468,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 +2589,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
+17
View File
@@ -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);
+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;
}
+102 -39
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));
@@ -3927,17 +3995,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 -3
View File
@@ -294,6 +294,7 @@ struct _zend_execute_data {
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 +523,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 +585,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 +650,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 +663,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 {
+20 -8
View File
@@ -750,7 +750,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 +908,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 +936,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 +1004,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 +1334,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 +1361,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;
}
+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;
+1 -1
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:
+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
+2 -1
View File
@@ -820,6 +820,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 +832,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;
+92 -89
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);
}
@@ -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,7 +1733,7 @@ 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) {
@@ -1760,7 +1761,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 +1775,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 +1789,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 +1803,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 +1818,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 +1845,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 +1865,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 +1954,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 +1977,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 +2081,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 +2224,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 +2240,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 +2253,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 +2267,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 +2351,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 +2437,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 +2457,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 +2483,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 +2495,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 +2507,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 +2520,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 +2533,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 +2549,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 +2565,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 +2581,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 +2597,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 +2617,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 +2644,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 +2690,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 +2717,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 +2751,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 +2798,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 +2824,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 +2846,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 +2864,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 +2885,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 +2898,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 +2945,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 +2960,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 +2978,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 +3036,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 +3062,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 +3081,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 +3127,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 +3176,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 +3190,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 +3206,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 +3311,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 +3333,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 +3345,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 +3355,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 +3407,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 +3423,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 +3449,7 @@ ZEND_METHOD(reflection_property, getValue)
*return_value= **member;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
/* }}} */
@@ -3464,7 +3466,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 +3480,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 +3525,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 +3538,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 +3601,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 +3613,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 +3625,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 +3644,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 +3692,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 +3724,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 +3760,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 +3775,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);
+77 -25
View File
@@ -1051,7 +1051,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 +1075,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 +1096,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 +1104,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 +1267,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 {
@@ -1814,6 +1830,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,12 +1856,18 @@ 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;
@@ -1961,7 +1985,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
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;
@@ -2163,6 +2187,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 +2197,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();
}
@@ -2718,7 +2749,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 +2798,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();
}
@@ -3100,7 +3131,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 +3446,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 +3470,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 +3606,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--;
}
@@ -3592,6 +3634,16 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &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 {
+329 -75
View File
@@ -39,6 +39,7 @@ ZEND_API void execute(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 {
@@ -163,6 +164,8 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
}
}
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));
@@ -187,12 +190,18 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
}
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;
@@ -419,10 +428,16 @@ static int ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
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();
}
@@ -511,11 +526,13 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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--;
}
@@ -537,6 +554,16 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &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 {
@@ -1573,7 +1600,7 @@ static int ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
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;
@@ -1894,7 +1921,6 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (inc_filename==&tmp_inc_filename) {
zval_dtor(&tmp_inc_filename);
}
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
if (new_op_array) {
zval *saved_object;
@@ -1944,6 +1970,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
EX_T(opline->result.u.var).var.ptr->type = IS_BOOL;
}
}
EG(return_value_ptr_ptr) = original_return_value;
ZEND_VM_NEXT_OPCODE();
}
@@ -4311,7 +4338,6 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (inc_filename==&tmp_inc_filename) {
zval_dtor(&tmp_inc_filename);
}
zval_dtor(free_op1.var);
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
if (new_op_array) {
zval *saved_object;
@@ -4361,6 +4387,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
EX_T(opline->result.u.var).var.ptr->type = IS_BOOL;
}
}
zval_dtor(free_op1.var);
EG(return_value_ptr_ptr) = original_return_value;
ZEND_VM_NEXT_OPCODE();
}
@@ -4610,13 +4637,16 @@ static int ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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();
}
@@ -7086,6 +7116,9 @@ static int zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
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)) {
return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -7093,23 +7126,27 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
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_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
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_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
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);
if (free_op1.var) {zval_ptr_dtor(&free_op1.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 (!0) {
zval_copy_ctor(valptr);
}
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
zend_ptr_stack_push(&EG(argument_stack), valptr);
}
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
ZEND_VM_NEXT_OPCODE();
}
@@ -7331,7 +7368,6 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (inc_filename==&tmp_inc_filename) {
zval_dtor(&tmp_inc_filename);
}
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
if (new_op_array) {
zval *saved_object;
@@ -7381,6 +7417,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
EX_T(opline->result.u.var).var.ptr->type = IS_BOOL;
}
}
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
EG(return_value_ptr_ptr) = original_return_value;
ZEND_VM_NEXT_OPCODE();
}
@@ -7591,7 +7628,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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++;
@@ -8525,8 +8562,12 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_op *opline = EX(opline);
zend_free_op free_op1;
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim = &opline->op2.u.constant;
zval *dim;
if (IS_CONST == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = &opline->op2.u.constant;
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, type TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -8537,6 +8578,7 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *dim = &opline->op2.u.constant;
/* Not needed in DIM_UNSET
@@ -8544,7 +8586,12 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_UNSET TSRMLS_CC);
if (IS_VAR == 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, 0, BP_VAR_UNSET TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -8702,12 +8749,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_res;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *property = &opline->op2.u.constant;
if (IS_VAR == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -9941,8 +9994,12 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
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_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
zval *dim;
if (IS_TMP_VAR == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 1, type TSRMLS_CC);
zval_dtor(free_op2.var);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -9953,6 +10010,7 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
/* Not needed in DIM_UNSET
@@ -9960,7 +10018,12 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 1, BP_VAR_UNSET TSRMLS_CC);
if (IS_VAR == 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, 1, BP_VAR_UNSET TSRMLS_CC);
zval_dtor(free_op2.var);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -10118,12 +10181,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2, free_res;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (IS_VAR == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), 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 (1) {
zval_ptr_dtor(&property);
} else {
@@ -11360,8 +11429,12 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
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_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
zval *dim;
if (IS_VAR == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, type TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -11372,6 +11445,7 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
/* Not needed in DIM_UNSET
@@ -11379,7 +11453,12 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_UNSET TSRMLS_CC);
if (IS_VAR == 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, 0, BP_VAR_UNSET TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -11537,12 +11616,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2, free_res;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (IS_VAR == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -12355,6 +12440,35 @@ static int ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_NEXT_OPCODE();
}
static int ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *dim = NULL;
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
ZEND_VM_NEXT_OPCODE();
}
static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim;
if (IS_UNUSED == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = NULL;
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, type TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
ZEND_VM_NEXT_OPCODE();
}
static int ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
@@ -13195,8 +13309,12 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_op *opline = EX(opline);
zend_free_op free_op1;
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
zval *dim;
if (IS_CV == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, type TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -13207,6 +13325,7 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
/* Not needed in DIM_UNSET
@@ -13214,7 +13333,12 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), dim, 0, BP_VAR_UNSET TSRMLS_CC);
if (IS_VAR == 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, 0, BP_VAR_UNSET TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -13372,12 +13496,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_res;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (IS_VAR == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -14568,12 +14698,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
{
zend_op *opline = EX(opline);
zend_free_op free_res;
zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
zval *property = &opline->op2.u.constant;
if (IS_UNUSED == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -15647,12 +15783,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
zend_op *opline = EX(opline);
zend_free_op free_op2, free_res;
zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (IS_UNUSED == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), 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 (1) {
zval_ptr_dtor(&property);
} else {
@@ -16687,12 +16829,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
zend_op *opline = EX(opline);
zend_free_op free_op2, free_res;
zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (IS_UNUSED == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -18092,12 +18240,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_res;
zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (IS_UNUSED == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_obj_zval_ptr_ptr_unused(TSRMLS_C), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -19134,6 +19288,9 @@ static int zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
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)) {
return zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -19141,23 +19298,27 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
return zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
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_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
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;
varptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
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);
ZEND_VM_NEXT_OPCODE();
zend_error(E_STRICT, "Only variables should be passed by reference");
ALLOC_ZVAL(valptr);
INIT_PZVAL_COPY(valptr, varptr);
if (!0) {
zval_copy_ctor(valptr);
}
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
zend_ptr_stack_push(&EG(argument_stack), valptr);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -19371,7 +19532,6 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (inc_filename==&tmp_inc_filename) {
zval_dtor(&tmp_inc_filename);
}
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
if (new_op_array) {
zval *saved_object;
@@ -19421,6 +19581,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
EX_T(opline->result.u.var).var.ptr->type = IS_BOOL;
}
}
EG(return_value_ptr_ptr) = original_return_value;
ZEND_VM_NEXT_OPCODE();
}
@@ -20420,8 +20581,12 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_op *opline = EX(opline);
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim = &opline->op2.u.constant;
zval *dim;
if (IS_CONST == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = &opline->op2.u.constant;
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 0, type TSRMLS_CC);
@@ -20432,6 +20597,7 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC);
zval *dim = &opline->op2.u.constant;
/* Not needed in DIM_UNSET
@@ -20439,7 +20605,12 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC), dim, 0, BP_VAR_UNSET TSRMLS_CC);
if (IS_CV == 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, 0, BP_VAR_UNSET TSRMLS_CC);
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -20596,12 +20767,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_res;
zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
zval *property = &opline->op2.u.constant;
if (IS_CV == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -21828,8 +22005,12 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_op *opline = EX(opline);
zend_free_op free_op2;
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
zval *dim;
if (IS_TMP_VAR == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 1, type TSRMLS_CC);
zval_dtor(free_op2.var);
@@ -21840,6 +22021,7 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op2;
zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC);
zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
/* Not needed in DIM_UNSET
@@ -21847,7 +22029,12 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC), dim, 1, BP_VAR_UNSET TSRMLS_CC);
if (IS_CV == 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, 1, BP_VAR_UNSET TSRMLS_CC);
zval_dtor(free_op2.var);
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -22004,12 +22191,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op2, free_res;
zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (IS_CV == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), 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 (1) {
zval_ptr_dtor(&property);
} else {
@@ -23239,8 +23432,12 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_op *opline = EX(opline);
zend_free_op free_op2;
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
zval *dim;
if (IS_VAR == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 0, type TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
@@ -23251,6 +23448,7 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op2;
zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC);
zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
/* Not needed in DIM_UNSET
@@ -23258,7 +23456,12 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC), dim, 0, BP_VAR_UNSET TSRMLS_CC);
if (IS_CV == 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, 0, BP_VAR_UNSET TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -23415,12 +23618,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op2, free_res;
zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
zval *property = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (IS_CV == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -24225,6 +24434,35 @@ static int ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_NEXT_OPCODE();
}
static int ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zval *dim = NULL;
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC), dim, 0, BP_VAR_RW TSRMLS_CC);
ZEND_VM_NEXT_OPCODE();
}
static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim;
if (IS_UNUSED == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = NULL;
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 0, type TSRMLS_CC);
ZEND_VM_NEXT_OPCODE();
}
static int ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
@@ -25064,8 +25302,12 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_op *opline = EX(opline);
int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R;
zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
zval *dim;
if (IS_CV == IS_UNUSED && type == BP_VAR_R) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), type TSRMLS_CC), dim, 0, type TSRMLS_CC);
@@ -25076,6 +25318,7 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC);
zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
/* Not needed in DIM_UNSET
@@ -25083,7 +25326,12 @@ static int ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
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_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_UNSET TSRMLS_CC), dim, 0, BP_VAR_UNSET TSRMLS_CC);
if (IS_CV == 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, 0, BP_VAR_UNSET TSRMLS_CC);
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -25240,12 +25488,18 @@ static int ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_res;
zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (IS_CV == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC), 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 (0) {
zval_ptr_dtor(&property);
} else {
@@ -27979,7 +28233,7 @@ void zend_init_opcodes_handlers()
ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER,
ZEND_FETCH_DIM_RW_SPEC_VAR_TMP_HANDLER,
ZEND_FETCH_DIM_RW_SPEC_VAR_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER,
ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -27989,7 +28243,7 @@ void zend_init_opcodes_handlers()
ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HANDLER,
ZEND_FETCH_DIM_RW_SPEC_CV_TMP_HANDLER,
ZEND_FETCH_DIM_RW_SPEC_CV_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER,
ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -28129,7 +28383,7 @@ void zend_init_opcodes_handlers()
ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -28139,7 +28393,7 @@ void zend_init_opcodes_handlers()
ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
+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 {
+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="RC2"
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
+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)
+7 -2
View File
@@ -65,7 +65,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; \
@@ -1146,10 +1146,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,
-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;
+34
View File
@@ -0,0 +1,34 @@
{ "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", 0, -3, "America/Halifax" },
{ "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" },
{ "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" },
+5350 -4739
View File
File diff suppressed because it is too large. Load diff
+115 -154
View File
@@ -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[] = {
@@ -650,24 +556,37 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
}
}
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 +603,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 +616,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 +630,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 +638,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 +658,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 +732,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 +753,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 +822,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 +880,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 +905,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 +914,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 +952,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 +977,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 +986,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 +999,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 +1013,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 +1026,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 +1039,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 +1052,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenoday
{
DEBUG_OUTPUT("datenoday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1121,6 +1065,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 +1078,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 +1091,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 +1102,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 +1115,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 +1127,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 +1136,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 +1150,7 @@ relativetext = (reltextnumber space? reltextunit)+;
isoweekday
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
@@ -1219,7 +1169,7 @@ relativetext = (reltextnumber space? reltextunit)+;
isoweek
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
@@ -1237,6 +1187,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pgtextshort
{
DEBUG_OUTPUT("pgtextshort");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1249,6 +1200,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 +1214,7 @@ relativetext = (reltextnumber space? reltextunit)+;
clf
{
int tz_not_found;
DEBUG_OUTPUT("clf");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
TIMELIB_HAVE_DATE();
@@ -1271,7 +1224,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 +1232,7 @@ relativetext = (reltextnumber space? reltextunit)+;
year4
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
s->time->y = timelib_get_nr((char **) &ptr, 4);
TIMELIB_DEINIT;
@@ -1287,6 +1241,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,7 +1257,7 @@ relativetext = (reltextnumber space? reltextunit)+;
relativetext
{
timelib_sll i;
DEBUG_OUTPUT("relativetext");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
@@ -1318,7 +1273,7 @@ relativetext = (reltextnumber space? reltextunit)+;
dayfull
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("dayfull");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
TIMELIB_HAVE_WEEKDAY_RELATIVE();
@@ -1333,14 +1288,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 +1306,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 +1324,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,7 +1334,7 @@ relativetext = (reltextnumber space? reltextunit)+;
relative
{
timelib_ull i;
DEBUG_OUTPUT("relative");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
@@ -1411,16 +1369,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 +1391,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 +1440,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];
+115 -154
View File
@@ -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[] = {
@@ -650,24 +556,37 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
}
}
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 +603,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 +616,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 +630,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 +638,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 +658,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 +732,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 +753,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 +822,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 +880,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 +905,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 +914,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 +952,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 +977,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 +986,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 +999,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 +1013,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 +1026,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 +1039,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 +1052,7 @@ relativetext = (reltextnumber space? reltextunit)+;
datenoday
{
DEBUG_OUTPUT("datenoday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1121,6 +1065,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 +1078,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 +1091,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 +1102,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 +1115,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 +1127,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 +1136,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 +1150,7 @@ relativetext = (reltextnumber space? reltextunit)+;
isoweekday
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
@@ -1219,7 +1169,7 @@ relativetext = (reltextnumber space? reltextunit)+;
isoweek
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
@@ -1237,6 +1187,7 @@ relativetext = (reltextnumber space? reltextunit)+;
pgtextshort
{
DEBUG_OUTPUT("pgtextshort");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->m = timelib_get_month((char **) &ptr);
@@ -1249,6 +1200,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 +1214,7 @@ relativetext = (reltextnumber space? reltextunit)+;
clf
{
int tz_not_found;
DEBUG_OUTPUT("clf");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
TIMELIB_HAVE_DATE();
@@ -1271,7 +1224,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 +1232,7 @@ relativetext = (reltextnumber space? reltextunit)+;
year4
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
s->time->y = timelib_get_nr((char **) &ptr, 4);
TIMELIB_DEINIT;
@@ -1287,6 +1241,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,7 +1257,7 @@ relativetext = (reltextnumber space? reltextunit)+;
relativetext
{
timelib_sll i;
DEBUG_OUTPUT("relativetext");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
@@ -1318,7 +1273,7 @@ relativetext = (reltextnumber space? reltextunit)+;
dayfull
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("dayfull");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
TIMELIB_HAVE_WEEKDAY_RELATIVE();
@@ -1333,14 +1288,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 +1306,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 +1324,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,7 +1334,7 @@ relativetext = (reltextnumber space? reltextunit)+;
relative
{
timelib_ull i;
DEBUG_OUTPUT("relative");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
@@ -1411,16 +1369,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 +1391,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 +1440,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 {
+8 -5
View File
@@ -34,21 +34,22 @@
#define LONG_MIN (- LONG_MAX - 1)
#endif
#if defined(_MSC_VER)
#if defined(_MSC_VER) && !defined(strcasecmp)
#define strcasecmp stricmp
#endif
/* From dow.c */
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d);
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d);
timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
/* From parse_date.re */
timelib_time *timelib_strtotime(char *s, int *errors);
timelib_time *timelib_strtotime(char *s, int *errors, timelib_tzdb *tzdb);
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 *timelib_timezone_abbreviations_list(void);
/* From tm2unixtime.c */
@@ -62,11 +63,12 @@ void timelib_update_from_sse(timelib_time *tm);
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
/* From parse_tz.c */
timelib_tzinfo *timelib_parse_tzfile(char *timezone);
timelib_tzinfo *timelib_parse_tzfile(char *timezone, timelib_tzdb *tzdb);
int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz);
void timelib_dump_tzinfo(timelib_tzinfo *tz);
timelib_tzdb_index_entry *timelib_timezone_identifiers_list(int *count);
timelib_tzdb *timelib_builtin_db(void);
timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count);
/* From timelib.c */
timelib_tzinfo* timelib_tzinfo_ctor();
@@ -76,6 +78,7 @@ void timelib_tzinfo_dtor(timelib_tzinfo *tz);
timelib_tzinfo* timelib_tzinfo_clone(timelib_tzinfo *tz);
timelib_time* timelib_time_ctor();
void timelib_time_set_option(timelib_time* tm, int option, void* option_value);
void timelib_time_dtor(timelib_time* t);
timelib_time_offset* timelib_time_offset_ctor();
+8 -1
View File
@@ -149,7 +149,7 @@ typedef struct timelib_time {
typedef struct _timelib_tz_lookup_table {
char *name;
int type;
int value;
int gmtoffset;
char *full_tz_name;
} timelib_tz_lookup_table;
@@ -158,6 +158,13 @@ typedef struct _timelib_tzdb_index_entry {
unsigned int pos;
} timelib_tzdb_index_entry;
typedef struct _timelib_tzdb {
char *version;
int index_size;
timelib_tzdb_index_entry *index;
char *data;
} timelib_tzdb;
#define TIMELIB_ZONETYPE_OFFSET 1
#define TIMELIB_ZONETYPE_ABBR 2
#define TIMELIB_ZONETYPE_ID 3
+16404 -14821
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+193 -49
View File
@@ -24,6 +24,7 @@
#include "php_globals.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/php_versioning.h"
#include "php_date.h"
#include "lib/timelib.h"
#include <time.h>
@@ -55,6 +56,10 @@ function_entry date_functions[] = {
PHP_FE(date_timezone_set, NULL)
PHP_FE(date_offset_get, NULL)
PHP_FE(date_time_set, NULL)
PHP_FE(date_date_set, NULL)
PHP_FE(date_isodate_set, NULL)
PHP_FE(timezone_open, NULL)
PHP_FE(timezone_name_get, NULL)
PHP_FE(timezone_offset_get, NULL)
@@ -76,6 +81,9 @@ function_entry date_funcs_date[] = {
ZEND_NAMED_FE(getTimezone, ZEND_FN(date_timezone_get), NULL)
ZEND_NAMED_FE(setTimezone, ZEND_FN(date_timezone_set), NULL)
ZEND_NAMED_FE(getOffset, ZEND_FN(date_offset_get), NULL)
ZEND_NAMED_FE(setTime, ZEND_FN(date_time_set), NULL)
ZEND_NAMED_FE(setDate, ZEND_FN(date_date_set), NULL)
ZEND_NAMED_FE(setISODate, ZEND_FN(date_isodate_set), NULL)
{NULL, NULL, NULL}
};
@@ -88,15 +96,21 @@ function_entry date_funcs_timezone[] = {
{NULL, NULL, NULL}
};
static void date_register_classes(void);
# define DATE_REGISTER_CLASSES date_register_classes()
static void date_register_classes(TSRMLS_D);
# define DATE_REGISTER_CLASSES date_register_classes(TSRMLS_C)
#else
# define DATE_REGISTER_CLASSES /* */
#endif
static char* guess_timezone(TSRMLS_D);
/* }}} */
ZEND_DECLARE_MODULE_GLOBALS(date)
/* True global */
timelib_tzdb *php_date_global_timezone_db;
int php_date_global_timezone_db_enabled;
/* {{{ INI Settings */
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("date.timezone", "", PHP_INI_ALL, OnUpdateString, default_timezone, zend_date_globals, date_globals)
@@ -171,6 +185,14 @@ static void php_date_init_globals(zend_date_globals *date_globals)
}
/* }}} */
static void _php_date_tzinfo_dtor(void *tzinfo)
{
timelib_tzinfo **tzi = (timelib_tzinfo **)tzinfo;
timelib_tzinfo_dtor(*tzi);
}
/* {{{ PHP_RINIT_FUNCTION */
PHP_RINIT_FUNCTION(date)
{
@@ -178,6 +200,7 @@ PHP_RINIT_FUNCTION(date)
efree(DATEG(timezone));
}
DATEG(timezone) = NULL;
zend_hash_init(&DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0);
return SUCCESS;
}
@@ -190,11 +213,14 @@ PHP_RSHUTDOWN_FUNCTION(date)
efree(DATEG(timezone));
}
DATEG(timezone) = NULL;
zend_hash_destroy(&DATEG(tzcache));
return SUCCESS;
}
/* }}} */
#define DATE_TIMEZONEDB php_date_global_timezone_db ? php_date_global_timezone_db : timelib_builtin_db()
#define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sO"
#define DATE_FORMAT_RFC1036 "l, d-M-y H:i:s T"
#define DATE_FORMAT_RFC1123 "D, d M Y H:i:s T"
@@ -219,6 +245,9 @@ PHP_MINIT_FUNCTION(date)
REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
php_date_global_timezone_db = NULL;
php_date_global_timezone_db_enabled = 0;
return SUCCESS;
}
/* }}} */
@@ -235,12 +264,35 @@ PHP_MSHUTDOWN_FUNCTION(date)
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(date)
{
timelib_tzdb *tzdb = DATE_TIMEZONEDB;
php_info_print_table_start();
php_info_print_table_row(2, "date/time support", "enabled");
php_info_print_table_row(2, "Timezone Database Version", tzdb->version);
php_info_print_table_row(2, "Timezone Database", php_date_global_timezone_db_enabled ? "external" : "internal");
php_info_print_table_row(2, "Default timezone", guess_timezone(TSRMLS_C));
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
/* }}} */
/* {{{ Timezone Cache functions */
static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, timelib_tzdb *tzdb TSRMLS_DC)
{
timelib_tzinfo *tzi, **ptzi;
if (zend_hash_find(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void **) &ptzi) == SUCCESS) {
return *ptzi;
}
tzi = timelib_parse_tzfile(formal_tzname, tzdb);
if (tzi) {
zend_hash_add(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL);
}
return tzi;
}
/* }}} */
/* {{{ Helper functions */
static char* guess_timezone(TSRMLS_D)
@@ -269,12 +321,44 @@ static char* guess_timezone(TSRMLS_D)
the_time = time(NULL);
ta = php_localtime_r(&the_time, &tmbuf);
tzid = timelib_timezone_id_from_abbr(ta->tm_zone);
tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
if (! tzid) {
tzid = "UTC";
}
php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use '%s' for '%s' instead.", tzid, ta->tm_zone);
php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use '%s' for '%s/%.1f/%s' instead.", tzid, ta->tm_zone, (float) (ta->tm_gmtoff / 3600), ta->tm_isdst ? "DST" : "no DST");
return tzid;
}
#endif
#ifdef PHP_WIN32
{
char *tzid;
TIME_ZONE_INFORMATION tzi;
switch (GetTimeZoneInformation(&tzi))
{
case TIME_ZONE_ID_UNKNOWN:
/* we have no clue what it is, return UTC */
php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use 'UTC' instead.");
tzid = "UTC";
break;
case TIME_ZONE_ID_STANDARD:
tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.StandardBias) * -60, 0);
if (! tzid) {
tzid = "UTC";
}
php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use '%s' for '%.1f/no DST' instead.", tzid, (float) ((tzi.Bias + tzi.StandardBias) / -60));
break;
case TIME_ZONE_ID_DAYLIGHT:
tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.DaylightBias) * -60, 1);
if (! tzid) {
tzid = "UTC";
}
php_error_docref(NULL TSRMLS_CC, E_STRICT, "It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use '%s' for '%.1f/DST' instead.", tzid, (float) ((tzi.Bias + tzi.DaylightBias) / -60));
break;
}
return tzid;
}
#endif
@@ -288,10 +372,10 @@ static timelib_tzinfo *get_timezone_info(TSRMLS_D)
timelib_tzinfo *tzi;
tz = guess_timezone(TSRMLS_C);
tzi = timelib_parse_tzfile(tz);
tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC);
if (! tzi) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Timezone setting (date.timezone) or TZ environment variable contains an unknown timezone.");
tzi = timelib_parse_tzfile("UTC");
tzi = php_date_parse_tzfile("UTC", DATE_TIMEZONEDB TSRMLS_CC);
if (! tzi) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Timezone database is corrupt - this should *never* happen!");
@@ -323,7 +407,7 @@ static char *day_short_names[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
static char *english_suffix(int number)
static char *english_suffix(timelib_sll number)
{
if (number >= 10 && number <= 19) {
return "th";
@@ -384,10 +468,11 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
case 'l': snprintf(buffer, 32, "%s", day_full_names[timelib_day_of_week(t->y, t->m, t->d)]); break;
case 'S': snprintf(buffer, 32, "%s", english_suffix(t->d)); break;
case 'w': snprintf(buffer, 32, "%d", (int) timelib_day_of_week(t->y, t->m, t->d)); break;
case 'N': snprintf(buffer, 32, "%d", (int) timelib_iso_day_of_week(t->y, t->m, t->d)); break;
case 'z': snprintf(buffer, 32, "%d", (int) timelib_day_of_year(t->y, t->m, t->d)); break;
/* week */
case 'W': snprintf(buffer, 32, "%d", (int) isoweek); break; /* iso weeknr */
case 'W': snprintf(buffer, 32, "%02d", (int) isoweek); break; /* iso weeknr */
case 'o': snprintf(buffer, 32, "%d", (int) isoyear); break; /* iso year */
/* month */
@@ -464,11 +549,14 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
{
char *format;
int format_len;
long ts = time(NULL);
char *string;
char *format;
int format_len;
time_t ts;
char *string;
if (ZEND_NUM_ARGS() == 1) {
ts = time(NULL);
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
RETURN_FALSE;
}
@@ -479,7 +567,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
}
/* }}} */
PHPAPI char *php_format_date(char *format, int format_len, long ts, int localtime TSRMLS_DC) /* {{{ */
PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC) /* {{{ */
{
timelib_time *t;
timelib_tzinfo *tzi;
@@ -497,10 +585,6 @@ PHPAPI char *php_format_date(char *format, int format_len, long ts, int localtim
string = date_format(format, format_len, t, localtime);
if (localtime) {
timelib_tzinfo_dtor(tzi);
}
timelib_time_dtor(t);
return string;
}
@@ -522,6 +606,17 @@ PHP_FUNCTION(gmdate)
}
/* }}} */
/* {{{ php_date_set_tzdb - NOT THREADSAFE */
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
{
timelib_tzdb *builtin = timelib_builtin_db();
if (php_version_compare(tzdb->version, builtin->version) > 0) {
php_date_global_timezone_db = tzdb;
php_date_global_timezone_db_enabled = 1;
}
}
/* }}} */
/* {{{ php_parse_date: Backwards compability function */
signed long php_parse_date(char *string, signed long *now)
@@ -530,7 +625,7 @@ signed long php_parse_date(char *string, signed long *now)
int error1, error2;
signed long retval;
parsed_time = timelib_strtotime(string, &error1);
parsed_time = timelib_strtotime(string, &error1, DATE_TIMEZONEDB);
timelib_update_ts(parsed_time, NULL);
retval = timelib_date_to_int(parsed_time, &error2);
timelib_time_dtor(parsed_time);
@@ -561,7 +656,7 @@ PHP_FUNCTION(strtotime)
initial_ts = emalloc(25);
snprintf(initial_ts, 24, "@%lu", preset_ts);
t = timelib_strtotime(initial_ts, &error1); /* we ignore the error here, as this should never fail */
t = timelib_strtotime(initial_ts, &error1, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */
timelib_update_ts(t, tzi);
timelib_unixtime2local(now, t->sse, tzi);
timelib_time_dtor(t);
@@ -571,11 +666,10 @@ PHP_FUNCTION(strtotime)
now = timelib_time_ctor();
timelib_unixtime2local(now, (timelib_sll) time(NULL), tzi);
} else {
timelib_tzinfo_dtor(tzi);
RETURN_FALSE;
}
t = timelib_strtotime(times, &error1);
t = timelib_strtotime(times, &error1, DATE_TIMEZONEDB);
timelib_fill_holes(t, now, 0);
timelib_update_ts(t, tzi);
ts = timelib_date_to_int(t, &error2);
@@ -588,7 +682,6 @@ PHP_FUNCTION(strtotime)
timelib_tzinfo_dtor(t->tz_info);
}
timelib_tzinfo_dtor(tzi);
timelib_time_dtor(now);
timelib_time_dtor(t);
@@ -682,9 +775,6 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
ts = timelib_date_to_int(now, &error);
ts += adjust_seconds;
timelib_time_dtor(now);
if (!gmt) {
timelib_tzinfo_dtor(tzi);
}
if (error) {
RETURN_FALSE;
@@ -788,10 +878,6 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
#endif
}
if (!gmt) {
timelib_tzinfo_dtor(tzi);
}
buf = (char *) emalloc(buf_len);
while ((real_len=strftime(buf, buf_len, format, &ta))==buf_len || real_len==0) {
buf_len *= 2;
@@ -881,7 +967,6 @@ PHP_FUNCTION(localtime)
add_next_index_long(return_value, ts->dst);
}
timelib_tzinfo_dtor(tzi);
timelib_time_dtor(ts);
}
/* }}} */
@@ -916,7 +1001,6 @@ PHP_FUNCTION(getdate)
add_assoc_string(return_value, "month", mon_full_names[ts->m - 1], 1);
add_index_long(return_value, 0, timestamp);
timelib_tzinfo_dtor(tzi);
timelib_time_dtor(ts);
}
/* }}} */
@@ -925,7 +1009,6 @@ PHP_FUNCTION(getdate)
static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC)
{
php_date_obj *intern;
zval *tmp;
zend_object_value retval;
intern = emalloc(sizeof(php_date_obj));
@@ -941,7 +1024,6 @@ static zend_object_value date_object_new_date(zend_class_entry *class_type TSRML
static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC)
{
php_timezone_obj *intern;
zval *tmp;
zend_object_value retval;
intern = emalloc(sizeof(php_timezone_obj));
@@ -970,12 +1052,10 @@ static void date_object_free_storage_timezone(void *object TSRMLS_DC)
{
php_timezone_obj *intern = (php_timezone_obj *)object;
timelib_tzinfo_dtor(intern->tz);
efree(object);
}
static void date_register_classes(void)
static void date_register_classes(TSRMLS_D)
{
zend_class_entry ce_date, ce_timezone;
@@ -1014,7 +1094,7 @@ PHP_FUNCTION(date_create)
timelib_time *now;
timelib_tzinfo *tzi;
char *time_str;
int time_str_len = 0;
int time_str_len = 0, free_tzi = 0;;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
@@ -1022,15 +1102,17 @@ PHP_FUNCTION(date_create)
date_instanciate(date_ce_date, return_value TSRMLS_CC);
dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", &error);
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", &error, DATE_TIMEZONEDB);
if (timezone_object) {
php_timezone_obj *tzobj;
tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC);
tzi = timelib_tzinfo_clone(tzobj->tz);
free_tzi = 1;
} else if (dateobj->time->tz_info) {
tzi = timelib_tzinfo_clone(dateobj->time->tz_info);
free_tzi = 1;
} else {
tzi = get_timezone_info(TSRMLS_C);
}
@@ -1044,7 +1126,9 @@ PHP_FUNCTION(date_create)
if (now->tz_info != tzi) {
timelib_tzinfo_dtor(now->tz_info);
}
timelib_tzinfo_dtor(now->tz_info);
if (free_tzi) {
timelib_tzinfo_dtor(tzi);
}
timelib_time_dtor(now);
}
@@ -1076,7 +1160,7 @@ PHP_FUNCTION(date_modify)
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
tmp_time = timelib_strtotime(modify, &error);
tmp_time = timelib_strtotime(modify, &error, DATE_TIMEZONEDB);
dateobj->time->relative.y = tmp_time->relative.y;
dateobj->time->relative.m = tmp_time->relative.m;
dateobj->time->relative.d = tmp_time->relative.d;
@@ -1151,6 +1235,57 @@ PHP_FUNCTION(date_offset_get)
}
}
PHP_FUNCTION(date_time_set)
{
zval *object;
php_date_obj *dateobj;
long h, i, s = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
dateobj->time->h = h;
dateobj->time->i = i;
dateobj->time->s = s;
timelib_update_ts(dateobj->time, NULL);
}
PHP_FUNCTION(date_date_set)
{
zval *object;
php_date_obj *dateobj;
long y, m, d;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_date, &y, &m, &d) == FAILURE) {
RETURN_FALSE;
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
dateobj->time->y = y;
dateobj->time->m = m;
dateobj->time->d = d;
timelib_update_ts(dateobj->time, NULL);
}
PHP_FUNCTION(date_isodate_set)
{
zval *object;
php_date_obj *dateobj;
long y, w, d = 1;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &y, &w, &d) == FAILURE) {
RETURN_FALSE;
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
dateobj->time->y = y;
dateobj->time->m = 1;
dateobj->time->d = 1;
dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
dateobj->time->have_relative = 1;
timelib_update_ts(dateobj->time, NULL);
}
PHP_FUNCTION(timezone_open)
{
@@ -1166,14 +1301,14 @@ PHP_FUNCTION(timezone_open)
if (!tzi) {
char *tzid;
tzid = timelib_timezone_id_from_abbr(tz);
tzid = timelib_timezone_id_from_abbr(tz, -1, 0);
if (tzid) {
tzi = timelib_parse_tzfile(tzid);
tzi = php_date_parse_tzfile(tzid, DATE_TIMEZONEDB TSRMLS_CC);
}
}
/* Try finding the tz information as "Timezone Identifier" */
if (!tzi) {
tzi = timelib_parse_tzfile(tz);
tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC);
}
/* If we find it we instantiate the object otherwise, well, we don't and return false */
if (tzi) {
@@ -1243,10 +1378,13 @@ PHP_FUNCTION(timezone_transistions_get)
PHP_FUNCTION(timezone_identifiers_list)
{
timelib_tzdb *tzdb;
timelib_tzdb_index_entry *table;
int i, item_count;
table = timelib_timezone_identifiers_list(&item_count);
tzdb = DATE_TIMEZONEDB;
item_count = tzdb->index_size;
table = tzdb->index;
array_init(return_value);
@@ -1258,7 +1396,7 @@ PHP_FUNCTION(timezone_identifiers_list)
PHP_FUNCTION(timezone_abbreviations_list)
{
timelib_tz_lookup_table *table, *entry;
zval *element;
zval *element, **abbr_array_pp, *abbr_array;
table = timelib_timezone_abbreviations_list();
array_init(return_value);
@@ -1268,14 +1406,21 @@ PHP_FUNCTION(timezone_abbreviations_list)
MAKE_STD_ZVAL(element);
array_init(element);
add_assoc_bool(element, "dst", entry->type);
add_assoc_long(element, "offset", - entry->value * 60);
add_assoc_long(element, "offset", entry->gmtoffset);
if (entry->full_tz_name) {
add_assoc_string(element, "timezone_id", entry->full_tz_name, 1);
} else {
add_assoc_null(element, "timezone_id");
}
add_assoc_zval(return_value, entry->name, element);
if (zend_hash_find(HASH_OF(return_value), entry->name, strlen(entry->name) + 1, (void **) &abbr_array_pp) == FAILURE) {
MAKE_STD_ZVAL(abbr_array);
array_init(abbr_array);
add_assoc_zval(return_value, entry->name, abbr_array);
} else {
abbr_array = *abbr_array_pp;
}
add_next_index_zval(abbr_array, element);
entry++;
} while (entry->name);
}
@@ -1309,7 +1454,6 @@ PHP_FUNCTION(date_default_timezone_get)
default_tz = get_timezone_info(TSRMLS_C);
RETVAL_STRING(default_tz->name, 1);
timelib_tzinfo_dtor(default_tz);
}
/* }}} */
+14 -3
View File
@@ -21,6 +21,9 @@
#ifndef PHP_DATE_H
#define PHP_DATE_H
#include "lib/timelib.h"
#include "Zend/zend_hash.h"
extern zend_module_entry date_module_entry;
#define phpext_date_ptr &date_module_entry
@@ -51,6 +54,10 @@ PHP_FUNCTION(date_timezone_get);
PHP_FUNCTION(date_timezone_set);
PHP_FUNCTION(date_offset_get);
PHP_FUNCTION(date_time_set);
PHP_FUNCTION(date_date_set);
PHP_FUNCTION(date_isodate_set);
PHP_FUNCTION(timezone_open);
PHP_FUNCTION(timezone_name_get);
PHP_FUNCTION(timezone_offset_get);
@@ -70,8 +77,9 @@ PHP_MSHUTDOWN_FUNCTION(date);
PHP_MINFO_FUNCTION(date);
ZEND_BEGIN_MODULE_GLOBALS(date)
char *default_timezone;
char *timezone;
char *default_timezone;
char *timezone;
HashTable tzcache;
ZEND_END_MODULE_GLOBALS(date)
#ifdef ZTS
@@ -87,6 +95,9 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
#define _php_strftime php_strftime
PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
#endif
PHPAPI char *php_format_date(char *format, int format_len, long ts, int localtime TSRMLS_DC);
PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC);
/* Mechanism to set new TZ database */
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
#endif /* PHP_DATE_H */
+4 -4
View File
@@ -87,7 +87,7 @@ wanted=Tuesday 00:00:00
TZ=America/Port-au-Prince - wrong day.
tStamp=Monday 2005-03-28 17:17:17 EST 0
result=Monday 2005-04-04 00:00:00 EST 0
result=Monday 2005-04-04 00:00:00 EDT 1
wanted=Monday 00:00:00
TZ=Pacific/Enderbury - wrong day, off by 2 days.
@@ -102,12 +102,12 @@ wanted=Monday 00:00:00
TZ=America/Managua - wrong day.
tStamp=Tuesday 2005-04-05 17:17:17 CST 0
result=Tuesday 2005-04-12 00:00:00 CST 0
result=Tuesday 2005-04-12 00:00:00 CDT 1
wanted=Tuesday 00:00:00
TZ=Pacific/Pitcairn - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 PST 0
result=Wednesday 1970-01-06 00:00:00 PST 0
tStamp=Thursday 1970-01-01 17:17:17 PNT 0
result=Wednesday 1970-01-07 00:00:00 PNT 0
wanted=Wednesday 00:00:00
TZ=Pacific/Fakaofo - wrong day.
+103
View File
@@ -0,0 +1,103 @@
--TEST--
Bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number)
--FILE--
<?php
date_default_timezone_set("UTC");
for ($i = 14; $i <= 31; $i++) {
echo "1992-12-$i ", date("W", strtotime("1992-12-$i")), "\n";
}
for ($i = 1; $i <= 8; $i++) {
echo "1993-01-$i ", date("W", strtotime("1993-01-$i")), "\n";
}
echo "----\n";
echo " ";
foreach (range(1992, 2019) as $year) {
echo "$year ";
}
echo "\n";
for ($i = 14; $i <= 31; $i++) {
echo " (12-$i) ";
foreach (range(1992, 2019) as $year) {
echo sprintf(" %02d-", date("W", strtotime("$year-12-$i")));
echo sprintf("%04d ", date("o", strtotime("$year-12-$i")));
}
echo "\n";
}
for ($i = 1; $i <= 18; $i++) {
printf("+1 (01-%02d) ", $i);
foreach (range(1993, 2020) as $year) {
echo sprintf(" %02d-", date("W", strtotime("$year-1-$i")));
echo sprintf("%04d ", date("o", strtotime("$year-1-$i")));
}
echo "\n";
}
echo "----\n";
?>
--EXPECT--
1992-12-14 51
1992-12-15 51
1992-12-16 51
1992-12-17 51
1992-12-18 51
1992-12-19 51
1992-12-20 51
1992-12-21 52
1992-12-22 52
1992-12-23 52
1992-12-24 52
1992-12-25 52
1992-12-26 52
1992-12-27 52
1992-12-28 53
1992-12-29 53
1992-12-30 53
1992-12-31 53
1993-01-1 53
1993-01-2 53
1993-01-3 53
1993-01-4 01
1993-01-5 01
1993-01-6 01
1993-01-7 01
1993-01-8 01
----
1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
(12-14) 51-1992 50-1993 50-1994 50-1995 50-1996 50-1997 51-1998 50-1999 50-2000 50-2001 50-2002 50-2003 51-2004 50-2005 50-2006 50-2007 50-2008 51-2009 50-2010 50-2011 50-2012 50-2013 50-2014 51-2015 50-2016 50-2017 50-2018 50-2019
(12-15) 51-1992 50-1993 50-1994 50-1995 50-1996 51-1997 51-1998 50-1999 50-2000 50-2001 50-2002 51-2003 51-2004 50-2005 50-2006 50-2007 51-2008 51-2009 50-2010 50-2011 50-2012 50-2013 51-2014 51-2015 50-2016 50-2017 50-2018 50-2019
(12-16) 51-1992 50-1993 50-1994 50-1995 51-1996 51-1997 51-1998 50-1999 50-2000 50-2001 51-2002 51-2003 51-2004 50-2005 50-2006 50-2007 51-2008 51-2009 50-2010 50-2011 50-2012 51-2013 51-2014 51-2015 50-2016 50-2017 50-2018 51-2019
(12-17) 51-1992 50-1993 50-1994 50-1995 51-1996 51-1997 51-1998 50-1999 50-2000 51-2001 51-2002 51-2003 51-2004 50-2005 50-2006 51-2007 51-2008 51-2009 50-2010 50-2011 51-2012 51-2013 51-2014 51-2015 50-2016 50-2017 51-2018 51-2019
(12-18) 51-1992 50-1993 50-1994 51-1995 51-1996 51-1997 51-1998 50-1999 51-2000 51-2001 51-2002 51-2003 51-2004 50-2005 51-2006 51-2007 51-2008 51-2009 50-2010 50-2011 51-2012 51-2013 51-2014 51-2015 50-2016 51-2017 51-2018 51-2019
(12-19) 51-1992 50-1993 51-1994 51-1995 51-1996 51-1997 51-1998 50-1999 51-2000 51-2001 51-2002 51-2003 51-2004 51-2005 51-2006 51-2007 51-2008 51-2009 50-2010 51-2011 51-2012 51-2013 51-2014 51-2015 51-2016 51-2017 51-2018 51-2019
(12-20) 51-1992 51-1993 51-1994 51-1995 51-1996 51-1997 51-1998 51-1999 51-2000 51-2001 51-2002 51-2003 52-2004 51-2005 51-2006 51-2007 51-2008 51-2009 51-2010 51-2011 51-2012 51-2013 51-2014 51-2015 51-2016 51-2017 51-2018 51-2019
(12-21) 52-1992 51-1993 51-1994 51-1995 51-1996 51-1997 52-1998 51-1999 51-2000 51-2001 51-2002 51-2003 52-2004 51-2005 51-2006 51-2007 51-2008 52-2009 51-2010 51-2011 51-2012 51-2013 51-2014 52-2015 51-2016 51-2017 51-2018 51-2019
(12-22) 52-1992 51-1993 51-1994 51-1995 51-1996 52-1997 52-1998 51-1999 51-2000 51-2001 51-2002 52-2003 52-2004 51-2005 51-2006 51-2007 52-2008 52-2009 51-2010 51-2011 51-2012 51-2013 52-2014 52-2015 51-2016 51-2017 51-2018 51-2019
(12-23) 52-1992 51-1993 51-1994 51-1995 52-1996 52-1997 52-1998 51-1999 51-2000 51-2001 52-2002 52-2003 52-2004 51-2005 51-2006 51-2007 52-2008 52-2009 51-2010 51-2011 51-2012 52-2013 52-2014 52-2015 51-2016 51-2017 51-2018 52-2019
(12-24) 52-1992 51-1993 51-1994 51-1995 52-1996 52-1997 52-1998 51-1999 51-2000 52-2001 52-2002 52-2003 52-2004 51-2005 51-2006 52-2007 52-2008 52-2009 51-2010 51-2011 52-2012 52-2013 52-2014 52-2015 51-2016 51-2017 52-2018 52-2019
(12-25) 52-1992 51-1993 51-1994 52-1995 52-1996 52-1997 52-1998 51-1999 52-2000 52-2001 52-2002 52-2003 52-2004 51-2005 52-2006 52-2007 52-2008 52-2009 51-2010 51-2011 52-2012 52-2013 52-2014 52-2015 51-2016 52-2017 52-2018 52-2019
(12-26) 52-1992 51-1993 52-1994 52-1995 52-1996 52-1997 52-1998 51-1999 52-2000 52-2001 52-2002 52-2003 52-2004 52-2005 52-2006 52-2007 52-2008 52-2009 51-2010 52-2011 52-2012 52-2013 52-2014 52-2015 52-2016 52-2017 52-2018 52-2019
(12-27) 52-1992 52-1993 52-1994 52-1995 52-1996 52-1997 52-1998 52-1999 52-2000 52-2001 52-2002 52-2003 53-2004 52-2005 52-2006 52-2007 52-2008 52-2009 52-2010 52-2011 52-2012 52-2013 52-2014 52-2015 52-2016 52-2017 52-2018 52-2019
(12-28) 53-1992 52-1993 52-1994 52-1995 52-1996 52-1997 53-1998 52-1999 52-2000 52-2001 52-2002 52-2003 53-2004 52-2005 52-2006 52-2007 52-2008 53-2009 52-2010 52-2011 52-2012 52-2013 52-2014 53-2015 52-2016 52-2017 52-2018 52-2019
(12-29) 53-1992 52-1993 52-1994 52-1995 52-1996 01-1998 53-1998 52-1999 52-2000 52-2001 52-2002 01-2004 53-2004 52-2005 52-2006 52-2007 01-2009 53-2009 52-2010 52-2011 52-2012 52-2013 01-2015 53-2015 52-2016 52-2017 52-2018 52-2019
(12-30) 53-1992 52-1993 52-1994 52-1995 01-1997 01-1998 53-1998 52-1999 52-2000 52-2001 01-2003 01-2004 53-2004 52-2005 52-2006 52-2007 01-2009 53-2009 52-2010 52-2011 52-2012 01-2014 01-2015 53-2015 52-2016 52-2017 52-2018 01-2020
(12-31) 53-1992 52-1993 52-1994 52-1995 01-1997 01-1998 53-1998 52-1999 52-2000 01-2002 01-2003 01-2004 53-2004 52-2005 52-2006 01-2008 01-2009 53-2009 52-2010 52-2011 01-2013 01-2014 01-2015 53-2015 52-2016 52-2017 01-2019 01-2020
+1 (01-01) 53-1992 52-1993 52-1994 01-1996 01-1997 01-1998 53-1998 52-1999 01-2001 01-2002 01-2003 01-2004 53-2004 52-2005 01-2007 01-2008 01-2009 53-2009 52-2010 52-2011 01-2013 01-2014 01-2015 53-2015 52-2016 01-2018 01-2019 01-2020
+1 (01-02) 53-1992 52-1993 01-1995 01-1996 01-1997 01-1998 53-1998 52-1999 01-2001 01-2002 01-2003 01-2004 53-2004 01-2006 01-2007 01-2008 01-2009 53-2009 52-2010 01-2012 01-2013 01-2014 01-2015 53-2015 01-2017 01-2018 01-2019 01-2020
+1 (01-03) 53-1992 01-1994 01-1995 01-1996 01-1997 01-1998 53-1998 01-2000 01-2001 01-2002 01-2003 01-2004 01-2005 01-2006 01-2007 01-2008 01-2009 53-2009 01-2011 01-2012 01-2013 01-2014 01-2015 53-2015 01-2017 01-2018 01-2019 01-2020
+1 (01-04) 01-1993 01-1994 01-1995 01-1996 01-1997 01-1998 01-1999 01-2000 01-2001 01-2002 01-2003 01-2004 01-2005 01-2006 01-2007 01-2008 01-2009 01-2010 01-2011 01-2012 01-2013 01-2014 01-2015 01-2016 01-2017 01-2018 01-2019 01-2020
+1 (01-05) 01-1993 01-1994 01-1995 01-1996 01-1997 02-1998 01-1999 01-2000 01-2001 01-2002 01-2003 02-2004 01-2005 01-2006 01-2007 01-2008 02-2009 01-2010 01-2011 01-2012 01-2013 01-2014 02-2015 01-2016 01-2017 01-2018 01-2019 01-2020
+1 (01-06) 01-1993 01-1994 01-1995 01-1996 02-1997 02-1998 01-1999 01-2000 01-2001 01-2002 02-2003 02-2004 01-2005 01-2006 01-2007 01-2008 02-2009 01-2010 01-2011 01-2012 01-2013 02-2014 02-2015 01-2016 01-2017 01-2018 01-2019 02-2020
+1 (01-07) 01-1993 01-1994 01-1995 01-1996 02-1997 02-1998 01-1999 01-2000 01-2001 02-2002 02-2003 02-2004 01-2005 01-2006 01-2007 02-2008 02-2009 01-2010 01-2011 01-2012 02-2013 02-2014 02-2015 01-2016 01-2017 01-2018 02-2019 02-2020
+1 (01-08) 01-1993 01-1994 01-1995 02-1996 02-1997 02-1998 01-1999 01-2000 02-2001 02-2002 02-2003 02-2004 01-2005 01-2006 02-2007 02-2008 02-2009 01-2010 01-2011 01-2012 02-2013 02-2014 02-2015 01-2016 01-2017 02-2018 02-2019 02-2020
+1 (01-09) 01-1993 01-1994 02-1995 02-1996 02-1997 02-1998 01-1999 01-2000 02-2001 02-2002 02-2003 02-2004 01-2005 02-2006 02-2007 02-2008 02-2009 01-2010 01-2011 02-2012 02-2013 02-2014 02-2015 01-2016 02-2017 02-2018 02-2019 02-2020
+1 (01-10) 01-1993 02-1994 02-1995 02-1996 02-1997 02-1998 01-1999 02-2000 02-2001 02-2002 02-2003 02-2004 02-2005 02-2006 02-2007 02-2008 02-2009 01-2010 02-2011 02-2012 02-2013 02-2014 02-2015 01-2016 02-2017 02-2018 02-2019 02-2020
+1 (01-11) 02-1993 02-1994 02-1995 02-1996 02-1997 02-1998 02-1999 02-2000 02-2001 02-2002 02-2003 02-2004 02-2005 02-2006 02-2007 02-2008 02-2009 02-2010 02-2011 02-2012 02-2013 02-2014 02-2015 02-2016 02-2017 02-2018 02-2019 02-2020
+1 (01-12) 02-1993 02-1994 02-1995 02-1996 02-1997 03-1998 02-1999 02-2000 02-2001 02-2002 02-2003 03-2004 02-2005 02-2006 02-2007 02-2008 03-2009 02-2010 02-2011 02-2012 02-2013 02-2014 03-2015 02-2016 02-2017 02-2018 02-2019 02-2020
+1 (01-13) 02-1993 02-1994 02-1995 02-1996 03-1997 03-1998 02-1999 02-2000 02-2001 02-2002 03-2003 03-2004 02-2005 02-2006 02-2007 02-2008 03-2009 02-2010 02-2011 02-2012 02-2013 03-2014 03-2015 02-2016 02-2017 02-2018 02-2019 03-2020
+1 (01-14) 02-1993 02-1994 02-1995 02-1996 03-1997 03-1998 02-1999 02-2000 02-2001 03-2002 03-2003 03-2004 02-2005 02-2006 02-2007 03-2008 03-2009 02-2010 02-2011 02-2012 03-2013 03-2014 03-2015 02-2016 02-2017 02-2018 03-2019 03-2020
+1 (01-15) 02-1993 02-1994 02-1995 03-1996 03-1997 03-1998 02-1999 02-2000 03-2001 03-2002 03-2003 03-2004 02-2005 02-2006 03-2007 03-2008 03-2009 02-2010 02-2011 02-2012 03-2013 03-2014 03-2015 02-2016 02-2017 03-2018 03-2019 03-2020
+1 (01-16) 02-1993 02-1994 03-1995 03-1996 03-1997 03-1998 02-1999 02-2000 03-2001 03-2002 03-2003 03-2004 02-2005 03-2006 03-2007 03-2008 03-2009 02-2010 02-2011 03-2012 03-2013 03-2014 03-2015 02-2016 03-2017 03-2018 03-2019 03-2020
+1 (01-17) 02-1993 03-1994 03-1995 03-1996 03-1997 03-1998 02-1999 03-2000 03-2001 03-2002 03-2003 03-2004 03-2005 03-2006 03-2007 03-2008 03-2009 02-2010 03-2011 03-2012 03-2013 03-2014 03-2015 02-2016 03-2017 03-2018 03-2019 03-2020
+1 (01-18) 03-1993 03-1994 03-1995 03-1996 03-1997 03-1998 03-1999 03-2000 03-2001 03-2002 03-2003 03-2004 03-2005 03-2006 03-2007 03-2008 03-2009 03-2010 03-2011 03-2012 03-2013 03-2014 03-2015 03-2016 03-2017 03-2018 03-2019 03-2020
----
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #34087 (strtotime() does not work with date format "Y/m/d")
--FILE--
<?php
date_default_timezone_set("UTC");
echo "Y/m/d: ", strtotime("2005/8/12"), "\n";
echo "Y-m-d: ", strtotime("2005-8-12"), "\n";
echo date(DATE_ISO8601, strtotime("2005/1/2")), "\n";
echo date(DATE_ISO8601, strtotime("2005/01/02")), "\n";
echo date(DATE_ISO8601, strtotime("2005/01/2")), "\n";
echo date(DATE_ISO8601, strtotime("2005/1/02")), "\n";
?>
--EXPECT--
Y/m/d: 1123804800
Y-m-d: 1123804800
2005-01-02T00:00:00+0000
2005-01-02T00:00:00+0000
2005-01-02T00:00:00+0000
2005-01-02T00:00:00+0000
+11
View File
@@ -0,0 +1,11 @@
--TEST--
Bug #34304 ()
--FILE--
<?php
date_default_timezone_set("UTC");
echo date('o\-\WW\-N', strtotime('2 January 2005')), "\n";
echo date('o\-\WW\-N', strtotime('9 January 2005')), "\n";
?>
--EXPECT--
2004-W53-7
2005-W01-7
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #34676 (missing support for strtotime("midnight") and strtotime("noon"))
--FILE--
<?php
date_default_timezone_set("UTC");
$tests = array(
'noon', 'midnight'
);
foreach ($tests as $test) {
$t = strtotime("2005-12-22 ". $test);
printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
}
?>
--EXPECT--
noon => 2005-12-22T12:00:00+0000
midnight => 2005-12-22T00:00:00+0000
+32
View File
@@ -0,0 +1,32 @@
--TEST--
Bug #34771 (strtotime() fails with 1-12am/pm)
--FILE--
<?php
date_default_timezone_set("UTC");
$tests = array(
'12am', '1am', '1pm',
'12a.m.', '1a.m.', '1p.m.',
'12:00am', '1:00am', '1:00pm',
'12:00a.m.', '1:00a.m.', '1:00p.m.'
);
foreach ($tests as $test) {
$t = strtotime("2005-12-22 ". $test);
printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
}
?>
--EXPECT--
12am => 2005-12-22T00:00:00+0000
1am => 2005-12-22T01:00:00+0000
1pm => 2005-12-22T13:00:00+0000
12a.m. => 2005-12-22T00:00:00+0000
1a.m. => 2005-12-22T01:00:00+0000
1p.m. => 2005-12-22T13:00:00+0000
12:00am => 2005-12-22T00:00:00+0000
1:00am => 2005-12-22T01:00:00+0000
1:00pm => 2005-12-22T13:00:00+0000
12:00a.m. => 2005-12-22T00:00:00+0000
1:00a.m. => 2005-12-22T01:00:00+0000
1:00p.m. => 2005-12-22T13:00:00+0000
@@ -6,7 +6,11 @@ date.timezone=
<?php
putenv('TZ=');
echo date_default_timezone_get(), "\n";
echo date('e'), "\n";
?>
--EXPECTF--
Strict Standards: date_default_timezone_get(): It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use 'UTC' for 'UTC' instead. in %sdate_default_timezone_get-1.php on line 3
UTC
Strict Standards: date_default_timezone_get(): It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use 'Europe/London' for 'UTC/0.0/no DST' instead. in %sdate_default_timezone_get-1.php on line 3
Europe/London
Strict Standards: date(): It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use 'Europe/London' for 'UTC/0.0/no DST' instead. in %sdate_default_timezone_get-1.php on line 4
Europe/London
@@ -5,16 +5,24 @@ date.timezone=
--FILE--
<?php
putenv("TZ=");
$date1 = strtotime("2005-07-12 08:00:00");
date_default_timezone_set("America/Indiana/Knox");
$date1 = strtotime("2005-01-12 08:00:00");
$date2 = strtotime("2005-07-12 08:00:00");
date_default_timezone_set("America/Indiana/Knox");
$date3 = strtotime("2005-01-12 08:00:00");
$date4 = strtotime("2005-07-12 08:00:00");
echo date_default_timezone_get(), "\n";
echo date(DATE_ISO8601, $date1), "\n";
echo date(DATE_ISO8601, $date2), "\n";
echo date(DATE_ISO8601, $date3), "\n";
echo date(DATE_ISO8601, $date4), "\n";
?>
--EXPECTF--
Strict Standards: strtotime(): It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use 'UTC' for 'UTC' instead. in %sdate_default_timezone_set-1.php on line 3
Strict Standards: strtotime(): It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use 'Europe/London' for 'UTC/0.0/no DST' instead. in %sdate_default_timezone_set-1.php on line 3
Strict Standards: strtotime(): It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We use 'Europe/London' for 'UTC/0.0/no DST' instead. in %sdate_default_timezone_set-1.php on line 4
America/Indiana/Knox
2005-07-12T03:00:00-0500
2005-01-12T03:00:00-0500
2005-07-12T02:00:00-0500
2005-01-12T08:00:00-0500
2005-07-12T08:00:00-0500
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
mktime()
mktime() [2]
--INI--
error_reporting=2047
--FILE--
+1 -1
View File
@@ -262,7 +262,7 @@ AC_ARG_WITH(db4,
break
fi
done
PHP_DBA_DB_CHECK(4, db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
PHP_DBA_DB_CHECK(4, db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
fi
])
AC_DBA_STD_RESULT(db4,Berkeley DB4)
+29 -9
View File
@@ -1503,9 +1503,8 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int optio
if (keep_blanks == 0 && ! (options & XML_PARSE_NOBLANKS)) {
options |= XML_PARSE_NOBLANKS;
}
if (options > 0) {
xmlCtxtUseOptions(ctxt, options);
}
xmlCtxtUseOptions(ctxt, options);
#else
ctxt->validate = validate;
ctxt->loadsubset = (resolve_externals * XML_COMPLETE_ATTRS);
@@ -1625,12 +1624,13 @@ PHP_FUNCTION(dom_document_save)
{
zval *id;
xmlDoc *docp;
int file_len = 0, bytes, format;
int file_len = 0, bytes, format, saveempty;
dom_object *intern;
dom_doc_props *doc_props;
char *file;
long options = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
return;
}
@@ -1645,8 +1645,14 @@ PHP_FUNCTION(dom_document_save)
doc_props = dom_get_doc_props(intern->document);
format = doc_props->formatoutput;
if (options & LIBXML_SAVE_NOEMPTYTAG) {
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
}
bytes = xmlSaveFormatFileEnc(file, docp, NULL, format);
if (options & LIBXML_SAVE_NOEMPTYTAG) {
xmlSaveNoEmptyTags = saveempty;
}
if (bytes == -1) {
RETURN_FALSE;
}
@@ -1667,9 +1673,10 @@ PHP_FUNCTION(dom_document_savexml)
xmlChar *mem;
dom_object *intern, *nodeobj;
dom_doc_props *doc_props;
int size, format;
int size, format, saveempty;
long options = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O", &id, dom_document_class_entry, &nodep, dom_node_class_entry) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!l", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) {
return;
}
@@ -1690,8 +1697,14 @@ PHP_FUNCTION(dom_document_savexml)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch buffer");
RETURN_FALSE;
}
if (options & LIBXML_SAVE_NOEMPTYTAG) {
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
}
xmlNodeDump(buf, docp, node, 0, format);
if (options & LIBXML_SAVE_NOEMPTYTAG) {
xmlSaveNoEmptyTags = saveempty;
}
mem = (xmlChar*) xmlBufferContent(buf);
if (!mem) {
xmlBufferFree(buf);
@@ -1700,8 +1713,15 @@ PHP_FUNCTION(dom_document_savexml)
RETVAL_STRING(mem, 1);
xmlBufferFree(buf);
} else {
if (options & LIBXML_SAVE_NOEMPTYTAG) {
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
}
/* Encoding is handled from the encoding property set on the document */
xmlDocDumpFormatMemory(docp, &mem, &size, format);
if (options & LIBXML_SAVE_NOEMPTYTAG) {
xmlSaveNoEmptyTags = saveempty;
}
if (!size) {
RETURN_FALSE;
}
+51 -2
View File
@@ -501,6 +501,42 @@ PHP_FUNCTION(dom_element_get_attribute_ns)
}
/* }}} end dom_element_get_attribute_ns */
static xmlNsPtr _dom_new_reconNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
xmlNsPtr def;
xmlChar prefix[50];
int counter = 1;
if ((tree == NULL) || (ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) {
return NULL;
}
/* Code taken from libxml2 (2.6.20) xmlNewReconciliedNs
*
* Find a close prefix which is not already in use.
* Let's strip namespace prefixes longer than 20 chars !
*/
if (ns->prefix == NULL)
snprintf((char *) prefix, sizeof(prefix), "default");
else
snprintf((char *) prefix, sizeof(prefix), "%.20s", (char *)ns->prefix);
def = xmlSearchNs(doc, tree, prefix);
while (def != NULL) {
if (counter > 1000) return(NULL);
if (ns->prefix == NULL)
snprintf((char *) prefix, sizeof(prefix), "default%d", counter++);
else
snprintf((char *) prefix, sizeof(prefix), "%.20s%d",
(char *)ns->prefix, counter++);
def = xmlSearchNs(doc, tree, prefix);
}
/*
* OK, now we are ready to create a new one.
*/
def = xmlNewNs(tree, ns->href, prefix);
return(def);
}
/* {{{ proto void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAttrNS
@@ -550,8 +586,21 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
nsptr = dom_get_nsdecl(elemp, localname);
} else {
nsptr = xmlSearchNsByHref(elemp->doc, elemp, uri);
while (nsptr && nsptr->prefix == NULL) {
nsptr = nsptr->next;
if (nsptr && nsptr->prefix == NULL) {
xmlNsPtr tmpnsptr;
tmpnsptr = nsptr->next;
while (tmpnsptr) {
if ((tmpnsptr->prefix != NULL) && (tmpnsptr->href != NULL) &&
(xmlStrEqual(tmpnsptr->href, (xmlChar *) uri))) {
nsptr = tmpnsptr;
break;
}
tmpnsptr = tmpnsptr->next;
}
if (tmpnsptr == NULL) {
nsptr = _dom_new_reconNs(elemp->doc, elemp, nsptr);
}
}
}
+2 -1
View File
@@ -295,6 +295,7 @@ zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
if (ret == SUCCESS) {
/* ensure we're creating a temporary variable */
retval->refcount = 0;
retval->is_ref = 0;
} else {
retval = EG(uninitialized_zval_ptr);
}
@@ -1199,7 +1200,7 @@ zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval *
break;
}
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported node type: %d\n", Z_TYPE_P(obj));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported node type: %d", Z_TYPE_P(obj));
ZVAL_NULL(wrapper);
return wrapper;
}
+43
View File
@@ -0,0 +1,43 @@
--TEST--
Bug # 34276: setAttributeNS and default namespace
--SKIPIF--
<?php require_once('skipif.php'); ?>
--FILE--
<?php
$xml = <<<HERE
<?xml version="1.0" encoding="ISO-8859-1" ?>
<foo xmlns="http://www.example.com/ns/foo"
xmlns:fubar="http://www.example.com/ns/fubar" attra="attra" />
HERE;
function dump($elems) {
foreach ($elems as $elem) {
var_dump($elem->nodeName);
dump($elem->childNodes);
}
}
$dom = new DOMDocument();
$dom->loadXML($xml);
$foo = $dom->documentElement;
var_dump($foo->hasAttributeNS('http://www.example.com/ns/foo', 'attra'));
var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attra'));
$foo->setAttributeNS('http://www.example.com/ns/foo', 'attra', 'attranew');
$foo->setAttributeNS('http://www.example.com/ns/fubar', 'attrb', 'attrbnew');
$foo->setAttributeNS('http://www.example.com/ns/foo', 'attrc', 'attrc');
var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attra'));
var_dump($foo->getAttributeNS('http://www.example.com/ns/fubar', 'attrb'));
var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attrc'));
print $dom->saveXML();
?>
--EXPECT--
bool(false)
string(0) ""
string(8) "attranew"
string(8) "attrbnew"
string(5) "attrc"
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo xmlns="http://www.example.com/ns/foo" xmlns:fubar="http://www.example.com/ns/fubar" xmlns:default="http://www.example.com/ns/foo" attra="attra" default:attra="attranew" fubar:attrb="attrbnew" default:attrc="attrc"/>
-2
View File
@@ -1,2 +0,0 @@
enchant
Pierre-Alain Joye, Ilia Alshanetsky
-36
View File
@@ -1,36 +0,0 @@
dnl
dnl $Id$
dnl
PHP_ARG_WITH(enchant,for ENCHANT support,
[ --with-enchant[=DIR] Include enchant support.
GNU Aspell version 1.1.3 or higher required.])
if test "$PHP_ENCHANT" != "no"; then
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
if test "$PHP_ENCHANT" != "yes"; then
ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
else
ENCHANT_SEARCH_DIRS="/usr/local /usr"
fi
for i in $ENCHANT_SEARCH_DIRS; do
if test -f $i/include/enchant/enchant.h; then
ENCHANT_DIR=$i
ENCHANT_INCDIR=$i/include/enchant
elif test -f $i/include/enchant.h; then
ENCHANT_DIR=$i
ENCHANT_INCDIR=$i/include
fi
done
if test -z "$ENCHANT_DIR"; then
AC_MSG_ERROR(Cannot find enchant)
fi
ENCHANT_LIBDIR=$ENCHANT_DIR/lib
AC_DEFINE(HAVE_ENCHANT,1,[ ])
PHP_SUBST(ENCHANT_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
PHP_ADD_INCLUDE($ENCHANT_INCDIR)
fi
-13
View File
@@ -1,13 +0,0 @@
// $Id$
// vim:ft=javascript
ARG_ENABLE("enchant", "Enchant Support", "no");
if (PHP_ENCHANT == "yes") {
if (CHECK_HEADER_ADD_INCLUDE("enchant.h", "CFLAGS_ENCHANT", PHP_ENCHANT)) {
EXTENSION("enchant", "enchant.c");
AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
} else {
WARNING('Could not find enchant.h; skipping');
}
}
-25
View File
@@ -1,25 +0,0 @@
<?php
$tag = 'en_US';
$r = enchant_broker_init();
$bprovides = enchant_broker_describe($r);
echo "Current broker provides the following backend(s):\n";
print_r($bprovides);
if (enchant_broker_dict_exists($r,$tag)) {
$d = enchant_broker_request_dict($r, $tag);
$dprovides = enchant_dict_describe($d);
echo "dictionary $tag provides:\n";
$spellerrors = enchant_dict_check($d, "soong");
print_r($dprovides);
echo "found $spellerrors spell errors\n";
if ($spellerrors) {
$suggs = enchant_dict_suggest($d, "soong");
echo "Suggestions for 'soong':";
print_r($suggs);
}
enchant_broker_free_dict($d);
} else {
}
enchant_broker_free($r);
?>
-731
View File
@@ -1,731 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Pierre-Alain Joye <paj@pearfr.org> |
| Ilia Alshanetsky <ilia@prohost.org> |
+----------------------------------------------------------------------+
$Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "enchant.h"
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_enchant.h"
typedef EnchantBroker * EnchantBrokerPtr;
typedef struct _broker_struct enchant_broker;
typedef struct _dict_struct enchant_dict;
typedef enchant_broker * enchant_brokerPtr;
typedef enchant_dict * enchant_dictPtr;
typedef struct _broker_struct {
EnchantBroker *pbroker;
enchant_dict **dict;
unsigned int dictcnt;
zval *rsrc_id;
} _enchant_broker;
typedef struct _dict_struct {
unsigned int id;
EnchantDict *pdict;
enchant_broker *pbroker;
zval *rsrc_id;
enchant_dict *next;
enchant_dict *prev;
} _enchant_dict;
/* True global resources - no need for thread safety here */
static int le_enchant_broker;
static int le_enchant_dict;
/* If you declare any globals in php_enchant.h uncomment this:*/
/*ZEND_DECLARE_MODULE_GLOBALS(enchant)*/
/* {{{ enchant_functions[]
*
* Every user visible function must have an entry in enchant_functions[].
*/
function_entry enchant_functions[] = {
PHP_FE(enchant_broker_init, NULL)
PHP_FE(enchant_broker_free, NULL)
PHP_FE(enchant_broker_get_error, NULL)
PHP_FE(enchant_broker_request_dict, NULL)
PHP_FE(enchant_broker_request_pwl_dict, NULL)
PHP_FE(enchant_broker_free_dict, NULL)
PHP_FE(enchant_broker_dict_exists, NULL)
PHP_FE(enchant_broker_set_ordering, NULL)
PHP_FE(enchant_broker_describe, NULL)
PHP_FE(enchant_dict_check, NULL)
PHP_FE(enchant_dict_suggest, NULL)
PHP_FE(enchant_dict_add_to_personal, NULL)
PHP_FE(enchant_dict_add_to_session, NULL)
PHP_FE(enchant_dict_is_in_session, NULL)
PHP_FE(enchant_dict_store_replacement, NULL)
PHP_FE(enchant_dict_get_error, NULL)
PHP_FE(enchant_dict_describe, NULL)
PHP_FE(enchant_dict_quick_check, third_arg_force_ref)
{NULL, NULL, NULL} /* Must be the last line in enchant_functions[] */
};
/* }}} */
/* {{{ enchant_module_entry
*/
zend_module_entry enchant_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
"enchant",
enchant_functions,
PHP_MINIT(enchant),
PHP_MSHUTDOWN(enchant),
NULL, /* Replace with NULL if there's nothing to do at request start */
NULL, /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(enchant),
#if ZEND_MODULE_API_NO >= 20010901
"0.1", /* Replace with version number for your extension */
#endif
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_ENCHANT
ZEND_GET_MODULE(enchant)
#endif
static void
enumerate_providers_fn (const char * const name,
const char * const desc,
const char * const file,
void * ud)
{
zval *zdesc = (zval *) ud;
zval *tmp_array;
MAKE_STD_ZVAL(tmp_array);
array_init(tmp_array);
add_assoc_string(tmp_array, "name", (char *)name, 1);
add_assoc_string(tmp_array, "desc", (char *)desc, 1);
add_assoc_string(tmp_array, "file", (char *)file, 1);
if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
array_init(zdesc);
}
add_next_index_zval(zdesc, tmp_array);
}
static void
describe_dict_fn (const char * const lang,
const char * const name,
const char * const desc,
const char * const file,
void * ud)
{
zval *zdesc = (zval *) ud;
array_init(zdesc);
add_assoc_string(zdesc, "lang", (char *)lang, 1);
add_assoc_string(zdesc, "name", (char *)name, 1);
add_assoc_string(zdesc, "desc", (char *)desc, 1);
add_assoc_string(zdesc, "file", (char *)file, 1);
}
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
if (rsrc->ptr) {
enchant_broker *broker = (enchant_broker *)rsrc->ptr;
if (broker) {
if (broker->pbroker) {
if (broker->dictcnt && broker->dict) {
if (broker->dict) {
int total, tofree;
tofree = total = broker->dictcnt-1;
do {
zend_list_delete(Z_RESVAL_P(broker->dict[total]->rsrc_id));
efree(broker->dict[total]);
total--;
} while (total>=0);
}
efree(broker->dict);
broker->dict = NULL;
}
enchant_broker_free(broker->pbroker);
}
efree(broker);
}
}
}
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
if (rsrc->ptr) {
enchant_dict *pdict = (enchant_dict *)rsrc->ptr;
if (pdict) {
if (pdict->pdict && pdict->pbroker) {
enchant_broker_free_dict(pdict->pbroker->pbroker, pdict->pdict);
}
if (pdict->id) {
pdict->pbroker->dict[pdict->id-1]->next = NULL;
}
}
}
}
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(enchant)
{
le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant broker", module_number);
le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant dict", module_number);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(enchant)
{
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
static void __enumerate_providers_fn (const char * const name,
const char * const desc,
const char * const file,
void * ud)
{
php_info_print_table_row(3, name, desc, file);
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(enchant)
{
EnchantBroker *pbroker;
pbroker = enchant_broker_init();
php_info_print_table_start();
php_info_print_table_header(2, "enchant support", "enabled");
php_info_print_table_row(2, "Version", "@version@");
php_info_print_table_row(2, "Revision", "$Revision$");
php_info_print_table_end();
php_info_print_table_start();
enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL);
php_info_print_table_end();
enchant_broker_free(pbroker);
}
/* }}} */
#define PHP_ENCHANT_GET_BROKER \
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant_broker", le_enchant_broker); \
if (!pbroker || !pbroker->pbroker) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Resource broker invalid"); \
RETURN_FALSE; \
}
#define PHP_ENCHANT_GET_DICT \
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict); \
if (!pdict || !pdict->pdict) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Invalid dictionary resource."); \
RETURN_FALSE; \
}
/* {{{ proto resource enchant_broker_init()
create a new broker object capable of requesting */
PHP_FUNCTION(enchant_broker_init)
{
enchant_broker *broker;
EnchantBroker *pbroker;
if (ZEND_NUM_ARGS()) {
ZEND_WRONG_PARAM_COUNT();
}
pbroker = enchant_broker_init();
if (pbroker) {
broker = (enchant_broker *) emalloc(sizeof(enchant_broker));
broker->pbroker = pbroker;
broker->dict = NULL;
broker->dictcnt = 0;
ZEND_REGISTER_RESOURCE(return_value, broker, le_enchant_broker);
broker->rsrc_id = return_value;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto boolean enchant_free(resource broker)
Destroys the broker object and its dictionnaries */
PHP_FUNCTION(enchant_broker_free)
{
zval *broker;
enchant_broker *pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
zend_list_delete(Z_RESVAL_P(broker));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string enchant_broker_get_error(resource broker)
Returns the last error of the broker */
PHP_FUNCTION(enchant_broker_get_error)
{
zval *broker;
enchant_broker *pbroker;
char *msg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
msg = enchant_broker_get_error(pbroker->pbroker);
if (msg) {
RETURN_STRING((char *)msg, 1);
}
RETURN_FALSE;
}
/* }}} */
/* {{{ proto resource enchant_broker_request_dict(resource broker, string tag)
create a new dictionary using tag, the non-empty language tag you wish to request
a dictionary for ("en_US", "de_DE", ...) */
PHP_FUNCTION(enchant_broker_request_dict)
{
zval *broker;
enchant_broker *pbroker;
enchant_dict *dict;
EnchantDict *d;
char *tag;
int taglen;
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
if (d) {
if (pbroker->dictcnt) {
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
pos = pbroker->dictcnt++;
} else {
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
pos = 0;
pbroker->dictcnt++;
}
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
dict->id = pos;
dict->pbroker = pbroker;
dict->pdict = d;
dict->rsrc_id = return_value;
dict->prev = pos ? pbroker->dict[pos-1] : NULL;
dict->next = NULL;
pbroker->dict[pos] = dict;
if (pos) {
pbroker->dict[pos-1]->next = dict;
}
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto resource enchant_broker_request_pwl_dict(resource dict, string filename)
creates a dictionary using a PWL file. A PWL file is personal word file one word per line.
It must exist before the call.*/
PHP_FUNCTION(enchant_broker_request_pwl_dict)
{
zval *broker;
enchant_broker *pbroker;
enchant_dict *dict;
EnchantDict *d;
char *pwl;
int pwllen;
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &pwl, &pwllen) == FAILURE) {
RETURN_FALSE;
}
if ((PG(safe_mode) && (!php_checkuid(pwl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(pwl TSRMLS_CC)) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
if (d) {
if (pbroker->dictcnt) {
pos = pbroker->dictcnt++;
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
} else {
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
pos = 0;
pbroker->dictcnt++;
}
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
dict->id = pos;
dict->pbroker = pbroker;
dict->pdict = d;
dict->rsrc_id = return_value;
dict->prev = pos?pbroker->dict[pos-1]:NULL;
dict->next = NULL;
pbroker->dict[pos] = dict;
if (pos) {
pbroker->dict[pos-1]->next = dict;
}
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto resource enchant_broker_free_dict(resource dict)
Free the dictionary resource */
PHP_FUNCTION(enchant_broker_free_dict)
{
zval *dict;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
zend_list_delete(Z_RESVAL_P(dict));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool enchant_broker_dict_exists(resource broker, string tag)
Wether a dictionary exists or not. Using non-empty tag */
PHP_FUNCTION(enchant_broker_dict_exists)
{
zval *broker;
char *tag;
int taglen;
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
RETURN_BOOL(enchant_broker_dict_exists(pbroker->pbroker, tag));
}
/* }}} */
/* {{{ proto bool enchant_broker_set_ordering(resource broker, string tag, string ordering)
Declares a preference of dictionaries to use for the language
described/referred to by 'tag'. The ordering is a comma delimited
list of provider names. As a special exception, the "*" tag can
be used as a language tag to declare a default ordering for any
language that does not explictly declare an ordering. */
PHP_FUNCTION(enchant_broker_set_ordering)
{
zval *broker;
char *pordering;
int porderinglen;
char *ptag;
int ptaglen;
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
enchant_broker_set_ordering(pbroker->pbroker, ptag, pordering);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto array enchant_broker_describe(resource broker)
Enumerates the Enchant providers and tells
you some rudimentary information about them. The same info is provided through phpinfo() */
PHP_FUNCTION(enchant_broker_describe)
{
EnchantBrokerDescribeFn describetozval = enumerate_providers_fn;
zval *broker;
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
enchant_broker_describe(pbroker->pbroker, describetozval, (void *)return_value);
}
/* }}} */
/* {{{ proto bool enchant_dict_quick_check(resource dict, string word [, array &suggestions])
If the word is correctly spelled return true, otherwise return false, if suggestions variable
is provided, fill it with spelling alternatives. */
PHP_FUNCTION(enchant_dict_quick_check)
{
zval *dict, *sugg = NULL;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &dict, &word, &wordlen, &sugg) == FAILURE) {
RETURN_FALSE;
}
if (sugg) {
zval_dtor(sugg);
}
PHP_ENCHANT_GET_DICT;
if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
if (!sugg && ZEND_NUM_ARGS() == 2) {
RETURN_FALSE;
}
int n_sugg;
char **suggs;
array_init(sugg);
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
if (suggs && n_sugg) {
int i;
for (i = 0; i < n_sugg; i++) {
add_next_index_string(sugg, suggs[i], 1);
}
enchant_dict_free_suggestions(pdict->pdict, suggs);
}
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool enchant_dict_check(resource dict, string word)
If the word is correctly spelled return true, otherwise return false */
PHP_FUNCTION(enchant_dict_check)
{
zval *dict;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
RETURN_BOOL(!enchant_dict_check(pdict->pdict, word, wordlen));
}
/* }}} */
/* {{{ proto array enchant_dict_suggest(resource dict, string word)
Will return a list of values if any of those pre-conditions are not met.*/
PHP_FUNCTION(enchant_dict_suggest)
{
zval *dict;
char *word;
int wordlen;
char **suggs;
enchant_dict *pdict;
int n_sugg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
if (suggs && n_sugg) {
int i;
array_init(return_value);
for (i = 0; i < n_sugg; i++) {
add_next_index_string(return_value, suggs[i], 1);
}
enchant_dict_free_suggestions(pdict->pdict, suggs);
}
}
/* }}} */
/* {{{ proto void enchant_dict_add_to_personal(resource dict, string word)
add 'word' to personal word list */
PHP_FUNCTION(enchant_dict_add_to_personal)
{
zval *dict;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
enchant_dict_add_to_personal(pdict->pdict, word, wordlen);
}
/* }}} */
/* {{{ proto void enchant_dict_add_to_session(resource dict, string word)
add 'word' to this spell-checking session */
PHP_FUNCTION(enchant_dict_add_to_session)
{
zval *dict;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
enchant_dict_add_to_session(pdict->pdict, word, wordlen);
}
/* }}} */
/* {{{ proto bool enchant_dict_is_in_session(resource dict, string word)
whether or not 'word' exists in this spelling-session */
PHP_FUNCTION(enchant_dict_is_in_session)
{
zval *dict;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
RETURN_BOOL(enchant_dict_is_in_session(pdict->pdict, word, wordlen));
}
/* }}} */
/* {{{ proto void enchant_dict_store_replacement(resource dict, string mis, string cor)
add a correction for 'mis' using 'cor'.
Notes that you replaced @mis with @cor, so it's possibly more likely
that future occurrences of @mis will be replaced with @cor. So it might
bump @cor up in the suggestion list.*/
PHP_FUNCTION(enchant_dict_store_replacement)
{
zval *dict;
char *mis, *cor;
int mislen, corlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
enchant_dict_store_replacement(pdict->pdict, mis, mislen, cor, corlen);
}
/* }}} */
/* {{{ proto string enchant_dict_get_error(resource dict)
Returns the last error of the current spelling-session */
PHP_FUNCTION(enchant_dict_get_error)
{
zval *dict;
enchant_dict *pdict;
char *msg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
msg = enchant_dict_get_error(pdict->pdict);
if (msg) {
RETURN_STRING((char *)msg, 1);
}
RETURN_FALSE;
}
/* }}} */
/* {{{ proto array enchant_dict_describe(resource dict)
Describes an individual dictionary 'dict' */
PHP_FUNCTION(enchant_dict_describe)
{
zval *dict;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
enchant_dict_describe(pdict->pdict, describe_dict_fn, (void *)return_value);
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
Loaded 100 of 620 files, more files were not shown because too many files have changed in this diff. Show more