Commit Graph

318 Commits

Author SHA1 Message Date
Dmitry Stogov
17d027ed47 Split IS_BOOL into IS_FALSE and IS_TRUE 2014-04-30 18:32:42 +04:00
Dmitry Stogov
f9927a6c97 Merge mainstream 'master' branch into refactoring
During merge I had to revert:
	Nikita's patch for php_splice() (it probably needs to be applyed again)
	Bob Weinand's patches related to constant expression handling (we need to review them carefully)
	I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway)

Conflicts:
	Zend/zend.h
	Zend/zend_API.c
	Zend/zend_ast.c
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_constants.c
	Zend/zend_exceptions.c
	Zend/zend_execute.c
	Zend/zend_execute.h
	Zend/zend_execute_API.c
	Zend/zend_hash.c
	Zend/zend_highlight.c
	Zend/zend_language_parser.y
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner_defs.h
	Zend/zend_variables.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	ext/date/php_date.c
	ext/dom/documenttype.c
	ext/hash/hash.c
	ext/iconv/iconv.c
	ext/mbstring/tests/zend_multibyte-10.phpt
	ext/mbstring/tests/zend_multibyte-11.phpt
	ext/mbstring/tests/zend_multibyte-12.phpt
	ext/mysql/php_mysql.c
	ext/mysqli/mysqli.c
	ext/mysqlnd/mysqlnd_reverse_api.c
	ext/mysqlnd/php_mysqlnd.c
	ext/opcache/ZendAccelerator.c
	ext/opcache/zend_accelerator_util_funcs.c
	ext/opcache/zend_persist.c
	ext/opcache/zend_persist_calc.c
	ext/pcre/php_pcre.c
	ext/pdo/pdo_dbh.c
	ext/pdo/pdo_stmt.c
	ext/pdo_pgsql/pgsql_driver.c
	ext/pgsql/pgsql.c
	ext/reflection/php_reflection.c
	ext/session/session.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
	ext/standard/array.c
	ext/standard/basic_functions.c
	ext/standard/html.c
	ext/standard/mail.c
	ext/standard/php_array.h
	ext/standard/proc_open.c
	ext/standard/streamsfuncs.c
	ext/standard/user_filters.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	main/php_variables.c
	sapi/phpdbg/phpdbg.c
	sapi/phpdbg/phpdbg_bp.c
	sapi/phpdbg/phpdbg_frame.c
	sapi/phpdbg/phpdbg_help.c
	sapi/phpdbg/phpdbg_list.c
	sapi/phpdbg/phpdbg_print.c
	sapi/phpdbg/phpdbg_prompt.c
2014-04-26 00:32:51 +04:00
Dmitry Stogov
e96073b1e4 Moved zend_literal->cache_slot right into zval.
It should be accessed using Z_CACHE_SLOT() macro.
zend_literal structure is removed.
API functions that accepted pointer to zend_literal now accept pointer to zval or cache_slot directly.
Calls of such functiond that now accept cache_slot need to be changed to pass -1 instead of NULL.
2014-04-17 15:40:45 +04:00
Dmitry Stogov
050d7e38ad Cleanup (1-st round) 2014-04-15 15:40:40 +04:00
Nikita Popov
20f2e5986e Fix ZTS build
This only makes it compile, it doesn't actually work, presumably
because interned strings are assumed in some places.
2014-04-09 23:41:16 +02:00
Dmitry Stogov
7402af380b Fixed destruction of objects and iterators on unclean request shutdown and GC (few cases are still unfixed).
Now we destroy objects it two steps. At first - object properties of all objects and only then the objects their selves.
2014-04-09 01:50:15 +04:00
Dmitry Stogov
76cc99fe60 Refactored ZVAL flags usage to simplify various checks (e.g. Z_REFCOUNTED(), candidate for GC, etc) 2014-04-03 15:26:23 +04:00
Dmitry Stogov
ea85451b65 Refactored data structures to keep zend_object* instead of a whole zval in some places 2014-03-28 02:11:22 +04:00
Dmitry Stogov
b7938ab1bd Refactored GC (incomplete) 2014-03-19 17:00:28 +04:00
Xinchen Hui
b78bbe93ca Fixed segfault (invalid free handling) 2014-03-16 22:05:38 +08:00
Xinchen Hui
b264e96497 Fixed bug codes in SplFileInfo::getExtension 2014-03-15 22:17:55 +08:00
Xinchen Hui
9d4dca0880 Refactor Spl_Directory to fixed bug after default_properties changed 2014-03-15 22:07:40 +08:00
Tjerk Meesters
777831a24b Merge branch 'PHP-5.6' 2014-03-07 19:24:50 +08:00
Tjerk Meesters
8d3f4b647b Merge branch 'PHP-5.5' into PHP-5.6 2014-03-07 19:24:02 +08:00
Tjerk Meesters
972935cd95 Fixed null termination 2014-03-07 19:23:46 +08:00
Tjerk Meesters
7137775ec2 Merge branch 'PHP-5.6' 2014-03-07 19:01:53 +08:00
Tjerk Meesters
64906cdc38 Merge branch 'PHP-5.5' into PHP-5.6 2014-03-07 18:57:36 +08:00
datibbaw
3c673fed34 Add fread(length) method
Fixed off-by-one write bug

Added test
2014-03-07 18:50:33 +08:00
Dmitry Stogov
19670c2bbc Fixied calling object closures from internal functions 2014-03-05 01:54:21 +04:00
Xinchen Hui
237dbd972e Fixed uninilized intern 2014-02-28 22:55:59 +08:00
Xinchen Hui
2a82660923 Temporary fix zcontext 2014-02-28 22:21:51 +08:00
Xinchen Hui
990c923ef4 Refactored spl_filesystem_iterator 2014-02-28 19:07:54 +08:00
Xinchen Hui
b353d5abe9 Fixed un-initilized iterator in DirectoyItrator 2014-02-28 16:06:47 +08:00
Xinchen Hui
1265850fef Add zend_iterator_dtor 2014-02-28 15:03:43 +08:00
Xinchen Hui
a5ce7d526e Revert "Move zend_objects_store_put out of zend_object_std_init"
This reverts commit 8ced4f0ac9.
2014-02-28 13:59:07 +08:00
Xinchen Hui
8ced4f0ac9 Move zend_objects_store_put out of zend_object_std_init 2014-02-28 12:59:51 +08:00
Xinchen Hui
0817cee164 Fixed object creating (std_init calls store_put now) 2014-02-27 22:47:30 +08:00
Xinchen Hui
382b0dfdb7 Refactoring zend_iterator (incompleted) 2014-02-27 19:19:02 +08:00
Xinchen Hui
c0aba2c641 Refactor basename using zend_string 2014-02-23 18:08:35 +08:00
Dmitry Stogov
2b9b9afa7a Use better data structures (incomplete) 2014-02-17 17:59:18 +04:00
Xinchen Hui
ad1838d248 Use better data structures (incomplete) 2014-02-16 22:27:31 +08:00
Xinchen Hui
34aefa5604 Use better data structures (incomplete) 2014-02-15 23:21:09 +08:00
Xinchen Hui
6cb316cf5d Use better data structures (incomplete) 2014-02-14 23:11:40 +08:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04:00
Xinchen Hui
0f53e37494 Merge branch 'PHP-5.6' 2014-01-03 11:09:07 +08:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Xinchen Hui
47c9027772 Bump year 2014-01-03 11:06:16 +08:00
Xinchen Hui
c0d060f5c0 Bump year 2014-01-03 11:04:26 +08:00
Kalle Sommer Nielsen
d14670ccdb Eliminate another TSRMLS_FETCH() in i_zend_is_true()
# Affected extensions have all been updated, ext/opcache and ext/zip
# both have macros for cross version compatibility
2013-12-18 07:25:05 +01:00
Nikita Popov
0d7a638866 Implement variadic function syntax
As per RFC: https://wiki.php.net/rfc/variadics
2013-09-26 18:39:17 +02:00
Nikita Popov
ad976d8240 Fix bug #64782: SplFileObject constructor make $context optional 2013-09-12 17:46:14 +02:00
Xinchen Hui
c2cfc242c4 Merge branch 'PHP-5.4' into PHP-5.5 2013-06-27 12:38:13 +08:00
Xinchen Hui
fa8611c81e Fixed bug #65136 (RecursiveDirectoryIterator segfault) 2013-06-27 12:37:57 +08:00
Xinchen Hui
9d9ec2a90e Merge branch 'PHP-5.4' into PHP-5.5 2013-06-25 13:38:50 +08:00
Xinchen Hui
38eb909d06 Fixed Bug #61828 (Memleak when calling Directory(Recursive)Iterator/Spl(Temp)FileObject ctor twice) 2013-06-25 13:38:27 +08:00
Nikita Popov
fcc6611de9 Add support for non-scalar Iterator keys in foreach
RFC: https://wiki.php.net/rfc/foreach-non-scalar-keys
2013-03-12 17:27:31 +01:00
Gustavo Lopes
b8b3bb08b2 Merge branch 'bug64023' into PHP-5.4
* bug64023:
  Fix bug #64023 (__toString() & SplFileInfo)

Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2013-01-22 12:24:33 +01:00
Gustavo Lopes
aa0adce47d Fix bug #64023 (__toString() & SplFileInfo)
Defining a __toString() method was having no effect when concatenating
the object. This was because the cast_object() handler would ignore
__toString().

Using echo() directly would actually use __toString(), but this was a
bug: the ECHO handler would try zend_std_cast_object_tostring() before
cast_object(), but cast_object() should have priority as
zend_std_cast_object_tostring() assumes an object with a
zend_class_entry.
2013-01-22 11:33:29 +01:00
Xinchen Hui
0a7395e009 Happy New Year 2013-01-01 16:28:54 +08:00
Xinchen Hui
a2045ff332 Happy New Year~ 2013-01-01 16:02:16 +08:00
Xinchen Hui
6284ef112e Fixed bug #63236 (Executable permission on various source files) 2012-10-09 13:28:31 +08:00
Xinchen Hui
e4a8fa6a15 Merge branch 'PHP-5.3' into PHP-5.4 2012-10-09 13:29:51 +08:00
Felipe Pena
2497bb97e7 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  - Value stored to var is never used
2012-08-19 12:55:43 -03:00
Felipe Pena
6cd0e446dd - Value stored to var is never used 2012-08-19 12:55:38 -03:00
Xinchen Hui
be4053cea0 Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to dot files). 2012-07-02 11:33:38 +08:00
Johannes Schlüter
b025b9d0cf Fix #62432 ReflectionMethod random corrupt memory on high concurrent
This fixes the same issue in multiple extensions. This isn't needed
in later branches as 5.4 introduced object_properties_init()
2012-06-27 23:26:33 +02:00
Anatoliy Belsky
adfb4c62b7 Fix bug 61671 ext\spl\tests\fileobject_003.phpt fails
The solution was already introduced in 5.4 by Etienne Kneuss and
Pierre but wasn't merged back into 5.3 . SplFileObject should
not be used with directories. So just putting together all the
necessary pieces from 5.4
2012-04-19 11:33:12 +02:00
Gustavo André dos Santos Lopes
0cf70b1a42 Merge branch '5.3' into 5.4 2012-03-23 11:32:20 +00:00
Gustavo André dos Santos Lopes
3960def881 Fixed bug #61482, caused by the fix to bug #61418.
Turns out I'd forgotten to also update the destructor for the iterator
returned by DirectoryIterator.
The iterator for DirectoryIterator maintains the same ->current pointer
throughout its existence (the DirectoryIterator itself) and returns it
(the same object) everytime a value is requested from the iterator.
Moving forward the iterator only changes the object. Previous code
added two references to the object in get_iterator on the account of
1) the iterator memory living in its DirectoryIterator object and
2) the object being stored in iterator->current. This seems to be
unnecessary. Iterators are not responsible for incrementing the refcount
of the values they yield, that's up to the caller (the engine). What
matters for the iterator is that the object exists as long as the
iterator exists and this can be guaranteed by incremented the refcount
only once. Consequently, I only add one reference in get_iterator
(and reclaim it in the iterator destructor).
2012-03-23 11:19:19 +00:00
Gustavo André dos Santos Lopes
85725337d5 Revert "Revert "- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or" - causes bug #61482"
This reverts commit a89c4a34ee.
2012-03-23 09:40:27 +00:00
Stanislav Malyshev
bcc15b5633 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Revert "- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or" - causes bug #61482
  Add initialization tests for SQLT_INT binds
  Fix NEWS
2012-03-22 22:30:51 -07:00
Stanislav Malyshev
a89c4a34ee Revert "- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or" - causes bug #61482
This reverts commit 714f1ff4b3.
2012-03-22 22:29:50 -07:00
Dmitry Stogov
672fe54a00 Revert "Fixed reference counting"
This reverts commit 14af1fe692.
2012-03-22 15:51:58 +04:00
Dmitry Stogov
14af1fe692 Fixed reference counting 2012-03-22 15:03:16 +04:00
Joshua Thijssen
91f2d3809e Issue-60742: Added FilesystemIterator::OTHER_MODE_MASK 2012-03-19 21:48:55 +01:00
Gustavo André dos Santos Lopes
d870a41118 - Fixed bug #61418 (Segmentation fault when DirectoryIterator's or
FilesystemIterator's iterators are requested more than once without
  having had its dtor callback called in between).
2012-03-18 15:07:20 +00:00
Gustavo André dos Santos Lopes
714f1ff4b3 - Fixed bug #61418 (Segmentation fault when DirectoryIterator's or
FilesystemIterator's iterators are requested more than once without
  having had its dtor callback called in between).
2012-03-18 15:07:20 +00:00
Felipe Pena
af2fc625df - Fixed memory leak when calling SplFileInfo's constructor twice 2012-03-11 15:42:57 +00:00
Felipe Pena
80cb6e56f6 - Fixed memory leak when calling SplFileInfo's constructor twice 2012-03-11 15:42:57 +00:00
Felipe Pena
e4ca0ed09f - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
4e19825281 - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
c1e510aea8 - Fixed bug #60261 (phar dos null pointer) 2011-11-11 21:39:11 +00:00
Felipe Pena
72a133f155 - Fixed bug #60261 (phar dos null pointer) 2011-11-11 21:39:11 +00:00
Peter Cowburn
9b86852d6e add 3rd parameter to arg info for splfileobject fgetcsv/setcsvcontrol (bug #60201) 2011-11-02 13:24:46 +00:00
Gustavo André dos Santos Lopes
32f7337bd4 - Reverted changes that required constructor overrides to invoke the parent
constructor in several SPL classes and applied 5.3 fixes instead.
  Related bugs: #54384, #55175 and #55300
2011-10-29 23:17:18 +00:00
Hannes Magnusson
3dabada846 Use the default stream context for FilesystemIterator, GlobIterator and (Recursive)DirectoryIterator 2011-09-30 14:12:26 +00:00
Pierre Joye
7a3d89a9aa - nuke unused var 2011-09-09 07:57:29 +00:00
Pierre Joye
2d9f758435 - improve r316420, function must return a value 2011-09-09 07:56:42 +00:00
Pierre Joye
de12ac023c - improve r316420 (SplFileObject cannot and should not accept directories) 2011-09-08 23:12:32 +00:00
Etienne Kneuss
1e04e19a37 MFH: adapt check for __construct bypass 2011-09-08 23:10:40 +00:00
Pierre Joye
38c698c062 - improve r316420 (SplFileObject cannot and should not accept directories) 2011-09-08 23:07:48 +00:00
Etienne Kneuss
5cc7663098 SplFileObject does not accept directories. It did not check for that and blindly opened the directory, which works on linux but fails on windows. Now SplFileObject uses a stat() call to make sure it isn't a directory, if it is, it fails with an exception. Tests have been changed accordingly. 2011-09-08 15:52:59 +00:00
Etienne Kneuss
cf2db20123 Fix CID 547, make static analyzer happy 2011-08-12 21:57:54 +00:00
Pierre Joye
5107df2d04 - use cwd_expand now 2011-07-26 07:30:41 +00:00
Felipe Pena
23e438594d - Make usage of new PHP_FE_END macro 2011-07-25 11:42:53 +00:00
Felipe Pena
4b30846b50 - Make usage of new PHP_FE_END macro 2011-07-25 11:35:02 +00:00
Pierre Joye
9805e1674a - remove magic quotes support, functions are kept (see the NEWS entry for the details) for BC reasons but do not allow to set enable MQ 2011-07-22 11:25:30 +00:00
Felipe Pena
32b5f8a1a3 - Added new parameter parsing option (p - for valid path (string without null byte in the middle))
# The tests will be fixed in the next commits
2011-06-06 21:28:16 +00:00
Gustavo André dos Santos Lopes
cd2cdd256a - Make SplFileInfo::_bad_state_ex final. 2011-04-05 08:38:09 +00:00
Gustavo André dos Santos Lopes
2975308e1a - Fixed bug #54384 (Dual iterators, GlobIterator, SplFileObject and
SplTempFileObject crash when user-space classes don't call the paren
  constructor).
2011-04-04 02:50:27 +00:00
Gustavo André dos Santos Lopes
f7b7b6aa9e - Improved upon r309729.
- Extented strategy to remaining the classes on spl_directory.c, even those that don't crash.
- UPGRADING.
- Better bug54384.phpt, with all the classes covered.
2011-03-27 22:44:34 +00:00
Gustavo André dos Santos Lopes
c2fe893985 - Fixed bug #54384: Several SPL classes crash when parent constructor is
not called.
#Merge to 5.3 pending (slight BC break on AppendIterator, as it's no
#longer possible to defer the call to the parent constructor until
#after the constructor is performed).
#Bugs fixed in an atypical way for SPL. The parent constructor call
#check is performed at construction time by using a wrapper constructor
#instead of a check on the beginning of each instance method.
#Perhaps this should be uniformized in trunk; this method was mainly
#applied only to the ones crashing, except a few iterators (at least
#AppendIterator and RecursiveIteratorIterator).
2011-03-27 04:21:06 +00:00
Felipe Pena
39e0aa4dc6 - Fixed bug #54292 (Wrong parameter causes crash in SplFileObject::__construct()) 2011-03-23 22:46:04 +00:00
Felipe Pena
0ab7f1cebf - Fixed bug #54292 (Wrong parameter causes crash in SplFileObject::__construct()) 2011-03-23 22:46:04 +00:00
Gustavo André dos Santos Lopes
f06e3ba5c1 - Fixed bug #54291 (Crash iterating DirectoryIterator for dir name starting
with \0).
2011-03-19 23:15:04 +00:00
Gustavo André dos Santos Lopes
8deb11c0c3 - Fixed bug #54291 (Crash iterating DirectoryIterator for dir name starting
with \0).
2011-03-19 23:15:04 +00:00
Felipe Pena
67fa13a3ca - Fixed bug #49608 (Using CachingIterator on DirectoryIterator instance segfaults) 2011-03-08 19:56:29 +00:00
Felipe Pena
c7e7de3485 - Fixed bug #49608 (Using CachingIterator on DirectoryIterator instance segfaults) 2011-03-08 19:56:29 +00:00
Felipe Pena
54a7e5d7c3 - Fixed memory leak in DirectoryIterator::getExtension() and SplFileInfo::getExtension() 2011-02-20 16:33:53 +00:00
Felipe Pena
a47eb9a4d6 - Fixed memory leak in DirectoryIterator::getExtension() and SplFileInfo::getExtension() 2011-02-20 16:33:53 +00:00