Commit Graph

255 Commits

Author SHA1 Message Date
Sascha Schumann
c947a0739e Clean up the serializer by modularizing some of its code. That also
enables us to serialize hash indices without creating zvals for them.
Due to its nature, this patch also includes some whitespace changes.
2001-08-04 03:30:38 +00:00
Sascha Schumann
723bbcbea0 Do the nul'ifiying of php_var_serialize's result at the right place 2001-08-03 11:00:16 +00:00
Sascha Schumann
3459f05a07 NUL-terminate string 2001-08-03 09:35:33 +00:00
Sascha Schumann
4dfa91543c Convert serializer to smart_str.. avoids lots of sprintf's and
copying of data.
2001-08-03 07:25:27 +00:00
Zeev Suraski
c43806f415 Zend compatibility patch 2001-07-30 08:24:42 +00:00
Zeev Suraski
7b1c400631 More TSRMLS_FETCH annihilation (Zend compatibility patch) 2001-07-30 04:58:07 +00:00
Andi Gutmans
b99a590be3 - More object macros 2001-07-29 08:14:29 +00:00
Zeev Suraski
d87cc976e1 Redesigned thread safety mechanism - nua nua 2001-07-28 11:36:37 +00:00
Zeev Suraski
fe6f8712a4 - Get rid of ELS_*(), and use TSRMLS_*() instead.
- Move to the new ts_allocate_id() API
This patch is *bound* to break some files, as I must have had typos somewhere.
If you use any uncommon extension, please try to build it...
2001-07-27 10:16:41 +00:00
Zeev Suraski
2edcf835ed Update cast 2001-07-15 22:49:25 +00:00
Zeev Suraski
85b4df53c0 Improved interactive mode - it is now available in all builds, without any significant slowdown 2001-07-15 14:08:58 +00:00
Stanislav Malyshev
adc98200d6 More correct pseudo-fix
# This is not really a fix. This thing is still broken. I will think on
# how to really fix it. Any suggestion is *welcome*.
2001-07-11 11:45:05 +00:00
Shane Caraveo
ff4dfc56f2 prevent php from crashing when serializing circular data.
This script produced the crash.
<?
$hash["test_key"] = "test_value";
$hash["hash_key"] = &$hash;
echo serialize($hash);
?>
2001-07-11 05:57:18 +00:00
Thies C. Arntzen
1be0975dff added test for serialize
changed var.c to use Z_* macros
2001-07-09 09:03:06 +00:00
Daniel Beulshausen
4aa6ae493e PHPAPI-ize php_var_* functions
# need this for shm*
2001-07-01 20:18:51 +00:00
Rasmus Lerdorf
81e2cf03ac Fix folding and clean up some extensions 2001-06-06 13:06:12 +00:00
Rasmus Lerdorf
25c3a3a39d vim-6 does folding - clean up a bunch of missing folding tags plus
some misguided RINIT and RSHUTDOWN calls in a few fringe extensions
2001-06-05 13:12:10 +00:00
Stanislav Malyshev
ca8c8264db Fix the reference serializer
# Hope now it is right...
2001-05-29 13:19:24 +00:00
Andi Gutmans
eb6ba01d1c - Fix copyright notices with 2001 2001-02-26 06:11:02 +00:00
Sascha Schumann
dbb3402c0f php_add_var_hash() uses sizeof(id) in the calls to zend_hash_*, implying
that all bytes in the character array have been set (they are used
to compute the hash value using hashpjw).

The function assumes that sprintf's %p modifier would always prefix
the output with "0x".  On HPUX, this is not the case.  Hence, not
all bytes may be properly initialized before being read.

This has been addressed by using only initialized bytes as the key.
2001-01-09 05:49:37 +00:00
Sascha Schumann
3a16dc1cac Fix segfault introduced through recent zend_hash_get_current_key* changes. 2000-12-24 15:50:39 +00:00
Zeev Suraski
aa6d2ac5d0 Heads up people!
Updated the get_current_key() API - the relevant authors, please take
a look at the updated code and make sure it's ok...
2000-12-22 12:57:09 +00:00
Zeev Suraski
be895bcb96 Fix call_user_function() with objects - it could leak under certain circumstances 2000-12-13 22:50:10 +00:00
Stanislav Malyshev
a1c20a04ff Fix serializer bug that prevented serializer from working on any
variable that had non-reference copies of the same zval
2000-12-11 14:29:25 +00:00
Thies C. Arntzen
889b717a4c fix #6348 2000-12-11 12:52:52 +00:00
Stanislav Malyshev
c9e39592b5 Andi says it should be zval_ptr_dtor 2000-11-07 15:06:43 +00:00
Stanislav Malyshev
cde5c779dc And now the right fix - should add it still 2000-11-06 18:19:05 +00:00
Stanislav Malyshev
7f1dc85574 Serialize as reference only if it's a true reference 2000-11-06 18:09:51 +00:00
Stanislav Malyshev
c31faf0bd9 Add support for serializing references.
@- Add support for serializing references (Stas)
# WDDX and shared memory functions not covered yet
2000-10-30 17:10:06 +00:00
Thies C. Arntzen
825457ae64 update my email. 2000-10-29 09:14:55 +00:00
Andrei Zmievski
7b4983c8f8 Mega-patch to get better resource information for modules.
* Fixed a bug in zend_rsrc_list_get_rsrc_type()
  * Switched register_list_destructors() to use
    zend_register_list_destructors_ex() instead
  * Updated all relevant modules to provide the resource type name
    to register_list_destructors() call
  * Updated var_dump() to output resource type name instead of number

@- Made resource type names visible, e.g. var_dump() and
@  get_resource_type() display "file" for file resources. (Andrei)
2000-10-20 18:25:16 +00:00
Sascha Schumann
9f71179ca9 Back out circular references protection patch.
This causes problems with serializing regular variables and object
properties.

We need a smarter way to tell whether we have serialized one node
already.

PR: #7291, #7294
2000-10-18 18:32:32 +00:00
Sascha Schumann
4b89b67d1c Don't try to serialize references.
Circular references would otherwise kill PHP, as the serializer
would overrun the stack.
2000-09-29 18:48:40 +00:00
Thies C. Arntzen
b1d4fcb33c fix var_dump()s "}"-indention 2000-08-29 11:09:20 +00:00
Stanislav Malyshev
740fc2f5de Lowercase class name before looking for it 2000-06-29 14:49:23 +00:00
Sascha Schumann
1702067ac0 API change: Use zval * instead of zval ** 2000-06-23 16:58:30 +00:00
Sascha Schumann
091dc3840d Move the incomplete class stuff into its own file, so that we can
make it easier accessible to WDDX.
2000-06-23 16:46:04 +00:00
Sascha Schumann
2297f670b1 Change the serialization semantics to:
* if a certain object is of class INCOMPLETE_CLASS, the serializer will
    lookup the previously stored original class name of that object, and
    use that class name to serialize the object.

Change the deserialization semantics to:

  * if the class of an object, which is to be instantiated, is not found
    in the current context, the class name will be stored for later
    retrieval, and the class of that object is changed to INCOMPLETE_CLASS.

All function calls, property gets, and property sets operating on an
object of class INCOMPLETE_CLASS cause the execution to halt and to
output an informative error message.
2000-06-23 16:21:31 +00:00
Sascha Schumann
9d640cc990 Revert earlier commit. 2000-06-21 18:35:54 +00:00
Thies C. Arntzen
bc8d0782dd unserialize() and wddx_deserialize() now create an empty class if they enconter
a class which's code is yet unknown. this makes sessionized data retain the
class name of objects even if you visited pages that don't have the classes
code available.
2000-06-21 18:22:22 +00:00
Thies C. Arntzen
405d07de96 (serialize) no longer touches the internal array-pointer 2000-06-18 10:25:39 +00:00
Zeev Suraski
da66298659 - Fix a couple of wranings in the FTP code and in parsedate.y
- Be safer with LC_MESSAGES
- Align with the latest Zend change in call_user_function_ex()
2000-06-17 16:49:03 +00:00
Andrei Zmievski
6e1dee8c1e Have to use zval_ptr_dtor() on values returned from user functions. 2000-06-17 15:53:33 +00:00
Andrei Zmievski
39aa0c4d3a Just to make extra sure. 2000-06-16 19:55:51 +00:00
Andrei Zmievski
f14961b005 Plug a memory leak: retval_ptr should be destroyed. 2000-06-16 19:53:06 +00:00
Andrei Zmievski
71d4206074 Typo. 2000-06-16 18:36:30 +00:00
Sascha Schumann
6caf633cf7 Proper casts 2000-06-13 09:17:06 +00:00
Zeev Suraski
d975678006 @- Fixed var_dump() not to modify the internal order of array elements (Zeev)
Fixed the buffer overflow as well
2000-06-09 15:13:36 +00:00
Andi Gutmans
3701bc4207 - ARG_COUNT(ht) -> ZEND_NUM_ARGS() mega patch 2000-06-05 19:47:54 +00:00
Zeev Suraski
e043439ff6 Update the license with the new clause 6 2000-05-18 15:34:45 +00:00
Hartmut Holzgraefe
d7779d8bdf proto takeover from php3 2000-05-17 19:42:08 +00:00
Thies C. Arntzen
6e2bf336f6 (var_dump) cleaned up some weird & buggy stuff 2000-04-04 15:14:23 +00:00
Thies C. Arntzen
7db7884e8c (var_dump) removed "refcount-hack" - comiles without warning again (&works). 2000-03-19 11:08:07 +00:00
Thies C. Arntzen
e4df84a8da (serialize/unserialize) _sleep_() -> __sleep(), _wakeup_() -> __wakeup() rename. 2000-03-18 15:04:02 +00:00
Sam Ruby
74169f5fc4 restore compilation on ZTS enabled environments (like Windows) 2000-03-16 18:24:43 +00:00
Thies C. Arntzen
0fe5aef05e @- serialize()/unserialize() now call _sleep_() and _wakeup_() when
@  working on objects. (Thies)
@- renamed to_string() method to _string_value_() for consistency.
@  (Thies, Zend library)
2000-03-16 02:15:41 +00:00
Thies C. Arntzen
49cc8a7805 @- fixed possible crash in unserialize if the serailized data was
@  damaged. (Thies)
2000-03-14 07:49:42 +00:00
Zeev Suraski
86fa2aade2 the pipe is breaking all the time 2000-02-19 23:41:32 +00:00
Thies C. Arntzen
de0774041c @- Made the output of var_dump() more informative. (Thies) 2000-02-07 18:00:16 +00:00
Thies C. Arntzen
3ccff40306 use FREE_ZVAL where appropiate 2000-02-02 11:31:37 +00:00
Andi Gutmans
bdefd5da15 - Change IS_UNSET -> IS_NULL 2000-01-04 13:22:58 +00:00
Thies C. Arntzen
953bf8bbf6 (var_dump, serialize, unserialize) support NULL
@- Added new NULL constant (Zeev, Zend library)
2000-01-02 11:49:27 +00:00
Sascha Schumann
43ae2bffbb Happy Y2K patch! Happy new year (or the new millennium, depending on whether
you start counting at 0 or 1).
2000-01-01 01:32:05 +00:00
Zeev Suraski
235386b245 Change ALLOC_ZVAL() semantics 1999-12-26 21:21:33 +00:00
Andi Gutmans
3bf1b04cb4 - Move more stuff to ALLOC_ZVAL(). We need to add those FREE_ZVAL()'s now. 1999-12-24 17:39:27 +00:00
Andrei Zmievski
80bab9d939 We're using ZVAL's now. 1999-12-21 17:14:31 +00:00
Zeev Suraski
a1ad2872ee - The tree compiles again 1999-12-18 22:40:35 +00:00
Zeev Suraski
3ee4e65c95 More php3_ annihilation 1999-12-18 04:01:20 +00:00
Thies C. Arntzen
0489895d0b (unserialize) closed mem-leak 1999-12-09 11:24:51 +00:00
Thies C. Arntzen
276c0a378d (unserialize) now cleans up better on failure! 1999-12-08 14:40:46 +00:00
Sascha Schumann
5b983c944f Clean up php3.*\.h files. The files itself are renamed, and references in all
.*\.[ch] files were changed. There is a slight chance that my script missed
a few changes, please correct them manually.
1999-12-04 19:19:57 +00:00
Thies C. Arntzen
c6b05b2e6b (PHP var_dump, serialize) now use php.ini's precision size when displying/serializing doubles
@- serialize() and var_dump() now honor the precision as set in php.ini
@  for doubles. (Thies)
1999-11-06 08:16:25 +00:00
Thies C. Arntzen
3e307aacc4 unserialize no longer complaints about unserializing empty-strings (started that just a few days ago) 1999-10-22 06:59:05 +00:00
Thies C. Arntzen
41b87a238e (PHP var_dump, serialize) fixed mem_leak. 1999-10-20 14:34:16 +00:00
Thies C. Arntzen
4f013f8e2d @- unserialize() now gives a notice when passed invalid data. (Thies) 1999-10-18 17:46:33 +00:00
Thies C. Arntzen
cf1134787a (PHP unserialize) - fixed mem-leak. 1999-10-18 15:03:29 +00:00
Andrey Hristov
54fed6c652 Extended var_dump to handle IS_RESOURCE somewhat. 1999-09-24 18:57:02 +00:00
Andrey Hristov
f84ba1b039 - Upgraded var_dump() to take multiple arguments
- php3api_ is changed to php_
1999-09-20 14:14:26 +00:00
Thies C. Arntzen
22d6f64f54 new API for var_dump 1999-09-20 09:34:39 +00:00
Thies C. Arntzen
6ecd417b34 php4 now deserialized php3 objects correctly!
php3 will ignore objects serialized by php4 (that's the price we have to pay!)
small fix in deserializing objects with static initializers (thanx boris)
1999-09-16 08:05:17 +00:00
Thies C. Arntzen
de73bd0123 when unserializing classes:
if the class is not known the standard class (no methods) will be used.
if the class is known - the created object will functional again!
1999-09-15 15:03:06 +00:00
Andrey Hristov
b287aa2cf4 Fixed printf format. 1999-09-15 13:37:11 +00:00
Thies C. Arntzen
e7ad3bbec2 use new API in var.c 1999-09-15 11:42:28 +00:00
Thies C. Arntzen
21a0c57cb1 i love id-strings 1999-09-15 11:09:32 +00:00
Thies C. Arntzen
3491633aa0 made serialize/unserialize work with classes! (also made the code "shorter")
CHANGES:
- the serialized string now also contains the class name (was not available in PHP3)!
- when unserializing php will create a fully working object of that class again
  therby the class has to be defined when unserializing - else you get a warning!
1999-09-15 11:08:25 +00:00
Thies C. Arntzen
d5bafdaa20 ported oci8 to use new class API
var_dump no longer tries to traverse avr->value.ht for objects but uses var->value.obj.properties instead
1999-09-13 10:52:54 +00:00
Zeev Suraski
3cb1eb0471 Removed '3' from key functions in PHP (maintained compatibility through
php3_compat.h)
1999-08-02 19:17:14 +00:00
Zeev Suraski
c5724cbd14 License update 1999-07-16 13:13:16 +00:00
Zeev Suraski
c43c235427 Don't touch refcount and EA directly 1999-07-09 20:45:55 +00:00
Zeev Suraski
5f62c347c7 Step 2:
Rename is_ref to EA
1999-07-09 17:44:41 +00:00
Thies C. Arntzen
fe4efa91c3 changed boolean behaviour:
var_dump(
1999-07-01 09:26:05 +00:00
Sascha Schumann
2e690ac4b5 some additional consts 1999-07-01 05:47:06 +00:00
Stig Bakken
336392ea6c * now using php4.ini instead of php3.ini
* re-imported fopen-wrappers, fsock and string code from php3
  NB!  I have not tested all of the imported functions yet.
1999-06-15 17:06:22 +00:00
Sascha Schumann
be14ccadf1 it's obj.properties, not ht 1999-06-11 19:29:10 +00:00
Andrey Hristov
8c43c5f708 Fix up var.c a bit. 1999-06-11 15:54:06 +00:00
Sascha Schumann
83de88e90c make serialize work
unserialize does not work yet
1999-06-10 15:34:20 +00:00
Andrey Hristov
2bb01b6f81 Fixing serialize a bit. 1999-06-10 15:13:26 +00:00
Sascha Schumann
dfce358a5b that seems to fix it 1999-05-28 21:41:17 +00:00
Sascha Schumann
7401ef12fb Either I'm playing the EG(symbol_table) game wrong or var.c leaks memory
when unserializing arrays/objects. Still testing
1999-05-28 21:27:19 +00:00
Thies C. Arntzen
9cace18e10 serialize & unserialize working (with mem-leak) 1999-04-25 12:41:18 +00:00
Thies C. Arntzen
992e6a429d made var_dump zend-aware....
<?
$ar = array("hallo" => "tubu");

var_dump($ar);
?>
works again!!!

zeev, andi -> please review what i've done!!!

(no i can start "debugging" other stuff, as i often use var_dump)
1999-04-24 18:39:41 +00:00
Zeev Suraski
6f7c0edee3 Remove tls.[ch] 1999-04-23 20:06:01 +00:00
Stig Bakken
2c0ad3ee25 last bunch of extensions moving to ext/
fhttpd module taken out of functions, functions is ready to go.
The only extensions I have tested are gd+freetype and odbc(solid).
Please try compiling in your favourite extensions and let me know how it
works.
1999-04-22 02:48:28 +00:00
Zeev Suraski
5e8c322859 Make Win32 happy with the recent changes. 1999-04-18 15:58:27 +00:00
Stig Bakken
257de2bade First commit of re-structuring phase one. We have started using automake in
sub-directories and started to move extension code into ext/<name>.  For now,
I have moved the "standard" extension (which is quite a mix of everything
right now) and the GD extension into their own subdirs in ext/.
The configure script now also runs configure in the libzend directory
automatically and makes sure php4 and libzend use the same config.cache file.
To avoid running configure in libzend, use the --no-recursion option.
"make" in php4 also builds libzend now.
The Apache module doesn't compile right now, but a fix for that is
coming up.
1999-04-17 00:37:12 +00:00