summaryrefslogtreecommitdiffstats
path: root/ice-3.4.2-php54.patch
blob: 215918b8b159b3a3a0508632952bf7b317ccb2aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
diff --git a/php/src/IcePHP/Communicator.cpp b/php/src/IcePHP/Communicator.cpp
index fced1eb..781e175 100644
--- a/php/src/IcePHP/Communicator.cpp
+++ b/php/src/IcePHP/Communicator.cpp
@@ -716,7 +716,8 @@ handleFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<CommunicatorInfoIPtr>* obj = static_cast<Wrapper<CommunicatorInfoIPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 #ifdef _WIN32
@@ -834,6 +835,7 @@ ZEND_FUNCTION(Ice_initialize)
 
     Ice::StringSeq seq;
     Ice::InitializationData initData;
+    zval* zvargs = 0;
     zval* zvinit = 0;
 
     //
@@ -853,6 +855,7 @@ ZEND_FUNCTION(Ice_initialize)
             {
                 RETURN_NULL();
             }
+            zvargs = *args[0];
             hasArgs = true;
             if(ZEND_NUM_ARGS() > 1)
             {
@@ -913,6 +916,15 @@ ZEND_FUNCTION(Ice_initialize)
     {
         RETURN_NULL();
     }
+
+    if(zvargs && PZVAL_IS_REF(zvargs))
+    {
+        zval_dtor(zvargs);
+        if(!createStringArray(zvargs, seq TSRMLS_CC))
+        {
+            RETURN_NULL();
+        }
+    }
 }
 
 ZEND_FUNCTION(Ice_register)
@@ -1092,11 +1104,11 @@ ZEND_FUNCTION(Ice_getProperties)
 //
 // Predefined methods for Communicator.
 //
-static function_entry _interfaceMethods[] =
+static zend_function_entry _interfaceMethods[] =
 {
     {0, 0, 0}
 };
-static function_entry _classMethods[] =
+static zend_function_entry _classMethods[] =
 {
     ZEND_ME(Ice_Communicator, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
     ZEND_ME(Ice_Communicator, destroy, NULL, ZEND_ACC_PUBLIC)
diff --git a/php/src/IcePHP/Communicator.h b/php/src/IcePHP/Communicator.h
index c3b928d..02610d0 100644
--- a/php/src/IcePHP/Communicator.h
+++ b/php/src/IcePHP/Communicator.h
@@ -25,24 +25,6 @@ ZEND_FUNCTION(Ice_find);
 ZEND_FUNCTION(Ice_getProperties);
 }
 
-#define ICEPHP_COMMUNICATOR_FUNCTIONS \
-    ZEND_FE(Ice_initialize, NULL) \
-    ZEND_FE(Ice_register, NULL) \
-    ZEND_FE(Ice_unregister, NULL) \
-    ZEND_FE(Ice_find, NULL) \
-    ZEND_FE(Ice_getProperties, NULL)
-
-#ifdef ICEPHP_USE_NAMESPACES
-#   define ICEPHP_COMMUNICATOR_NS_FUNCTIONS \
-    ZEND_NS_FALIAS("Ice", initialize, Ice_initialize, NULL) \
-    ZEND_NS_FALIAS("Ice", register, Ice_register, NULL) \
-    ZEND_NS_FALIAS("Ice", unregister, Ice_unregister, NULL) \
-    ZEND_NS_FALIAS("Ice", find, Ice_find, NULL) \
-    ZEND_NS_FALIAS("Ice", getProperties, Ice_getProperties, NULL)
-#else
-#   define ICEPHP_COMMUNICATOR_NS_FUNCTIONS
-#endif
-
 namespace IcePHP
 {
 
diff --git a/php/src/IcePHP/Connection.cpp b/php/src/IcePHP/Connection.cpp
index cd1784a..407a6fa 100644
--- a/php/src/IcePHP/Connection.cpp
+++ b/php/src/IcePHP/Connection.cpp
@@ -236,7 +236,8 @@ handleConnectionFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<Ice::ConnectionPtr>* obj = static_cast<Wrapper<Ice::ConnectionPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 #ifdef _WIN32
@@ -271,11 +272,11 @@ handleConnectionCompare(zval* zobj1, zval* zobj2 TSRMLS_DC)
 //
 // Predefined methods for Connection.
 //
-static function_entry _interfaceMethods[] =
+static zend_function_entry _interfaceMethods[] =
 {
     {0, 0, 0}
 };
-static function_entry _connectionClassMethods[] =
+static zend_function_entry _connectionClassMethods[] =
 {
     ZEND_ME(Ice_Connection, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
     ZEND_ME(Ice_Connection, __toString, NULL, ZEND_ACC_PUBLIC)
@@ -297,7 +298,7 @@ ZEND_METHOD(Ice_ConnectionInfo, __construct)
 //
 // Predefined methods for ConnectionInfo.
 //
-static function_entry _connectionInfoClassMethods[] =
+static zend_function_entry _connectionInfoClassMethods[] =
 {
     ZEND_ME(Ice_ConnectionInfo, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
     {0, 0, 0}
@@ -329,7 +330,8 @@ handleConnectionInfoFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<Ice::ConnectionInfoPtr>* obj = static_cast<Wrapper<Ice::ConnectionInfoPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 bool
diff --git a/php/src/IcePHP/Endpoint.cpp b/php/src/IcePHP/Endpoint.cpp
index de5fe61..4da2aff 100644
--- a/php/src/IcePHP/Endpoint.cpp
+++ b/php/src/IcePHP/Endpoint.cpp
@@ -115,7 +115,8 @@ handleEndpointFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<Ice::EndpointPtr>* obj = static_cast<Wrapper<Ice::EndpointPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 ZEND_METHOD(Ice_EndpointInfo, __construct)
@@ -213,10 +214,11 @@ handleEndpointInfoFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<Ice::EndpointInfoPtr>* obj = static_cast<Wrapper<Ice::EndpointInfoPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
-static function_entry _interfaceMethods[] =
+static zend_function_entry _interfaceMethods[] =
 {
     {0, 0, 0}
 };
@@ -224,7 +226,7 @@ static function_entry _interfaceMethods[] =
 //
 // Predefined methods for Endpoint.
 //
-static function_entry _endpointMethods[] =
+static zend_function_entry _endpointMethods[] =
 {
     ZEND_ME(Ice_Endpoint, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
     ZEND_ME(Ice_Endpoint, __toString, NULL, ZEND_ACC_PUBLIC)
@@ -236,7 +238,7 @@ static function_entry _endpointMethods[] =
 //
 // Predefined methods for EndpointInfo.
 //
-static function_entry _endpointInfoMethods[] =
+static zend_function_entry _endpointInfoMethods[] =
 {
     ZEND_ME(Ice_EndpointInfo, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
     ZEND_ME(Ice_EndpointInfo, type, NULL, ZEND_ACC_PUBLIC)
diff --git a/php/src/IcePHP/Init.cpp b/php/src/IcePHP/Init.cpp
index e6c5f49..918d822 100644
--- a/php/src/IcePHP/Init.cpp
+++ b/php/src/IcePHP/Init.cpp
@@ -22,10 +22,73 @@ using namespace IcePHP;
 
 ZEND_DECLARE_MODULE_GLOBALS(ice)
 
+ZEND_BEGIN_ARG_INFO(Ice_initialize_arginfo, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(Ice_createProperties_arginfo, 1)
+ZEND_END_ARG_INFO()
+
+#define ICEPHP_COMMUNICATOR_FUNCTIONS \
+    ZEND_FE(Ice_initialize, Ice_initialize_arginfo) \
+    ZEND_FE(Ice_register, NULL) \
+    ZEND_FE(Ice_unregister, NULL) \
+    ZEND_FE(Ice_find, NULL) \
+    ZEND_FE(Ice_getProperties, NULL)
+
+#ifdef ICEPHP_USE_NAMESPACES
+#   define ICEPHP_COMMUNICATOR_NS_FUNCTIONS \
+    ZEND_NS_FALIAS("Ice", initialize, Ice_initialize, Ice_initialize_arginfo) \
+    ZEND_NS_FALIAS("Ice", register, Ice_register, NULL) \
+    ZEND_NS_FALIAS("Ice", unregister, Ice_unregister, NULL) \
+    ZEND_NS_FALIAS("Ice", find, Ice_find, NULL) \
+    ZEND_NS_FALIAS("Ice", getProperties, Ice_getProperties, NULL)
+#else
+#   define ICEPHP_COMMUNICATOR_NS_FUNCTIONS
+#endif
+
+#define ICEPHP_OPERATION_FUNCTIONS \
+    ZEND_FE(IcePHP_defineOperation,  NULL)
+
+#define ICEPHP_PROPERTIES_FUNCTIONS \
+    ZEND_FE(Ice_createProperties, Ice_createProperties_arginfo)
+
+#ifdef ICEPHP_USE_NAMESPACES
+#   define ICEPHP_PROPERTIES_NS_FUNCTIONS \
+    ZEND_NS_FALIAS("Ice", createProperties, Ice_createProperties, Ice_createProperties_arginfo)
+#else
+#   define ICEPHP_PROPERTIES_NS_FUNCTIONS
+#endif
+
+#define ICEPHP_TYPE_FUNCTIONS \
+    ZEND_FE(IcePHP_defineEnum,          NULL) \
+    ZEND_FE(IcePHP_defineStruct,        NULL) \
+    ZEND_FE(IcePHP_defineSequence,      NULL) \
+    ZEND_FE(IcePHP_defineDictionary,    NULL) \
+    ZEND_FE(IcePHP_defineProxy,         NULL) \
+    ZEND_FE(IcePHP_declareClass,        NULL) \
+    ZEND_FE(IcePHP_defineClass,         NULL) \
+    ZEND_FE(IcePHP_defineException,     NULL) \
+    ZEND_FE(IcePHP_stringify,           NULL) \
+    ZEND_FE(IcePHP_stringifyException,  NULL)
+
+#define ICEPHP_UTIL_FUNCTIONS \
+    ZEND_FE(Ice_stringVersion, NULL) \
+    ZEND_FE(Ice_intVersion, NULL) \
+    ZEND_FE(Ice_generateUUID, NULL)
+
+#ifdef ICEPHP_USE_NAMESPACES
+#   define ICEPHP_UTIL_NS_FUNCTIONS \
+    ZEND_NS_FALIAS("Ice", stringVersion, Ice_stringVersion, NULL) \
+    ZEND_NS_FALIAS("Ice", intVersion, Ice_intVersion, NULL) \
+    ZEND_NS_FALIAS("Ice", generateUUID, Ice_generateUUID, NULL)
+#else
+#   define ICEPHP_UTIL_NS_FUNCTIONS
+#endif
+
 //
 // Entries for all global functions.
 //
-function_entry ice_functions[] =
+zend_function_entry ice_functions[] =
 {
     ICEPHP_COMMUNICATOR_FUNCTIONS
     ICEPHP_COMMUNICATOR_NS_FUNCTIONS
diff --git a/php/src/IcePHP/Logger.cpp b/php/src/IcePHP/Logger.cpp
index f9514a3..e6d52d0 100644
--- a/php/src/IcePHP/Logger.cpp
+++ b/php/src/IcePHP/Logger.cpp
@@ -210,7 +210,8 @@ handleFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<Ice::LoggerPtr>* obj = static_cast<Wrapper<Ice::LoggerPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 #ifdef _WIN32
@@ -226,11 +227,11 @@ handleClone(zval* zv TSRMLS_DC)
 //
 // Predefined methods for Logger.
 //
-static function_entry _interfaceMethods[] =
+static zend_function_entry _interfaceMethods[] =
 {
     {0, 0, 0}
 };
-static function_entry _classMethods[] =
+static zend_function_entry _classMethods[] =
 {
     ZEND_ME(Ice_Logger, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
     ZEND_ME(Ice_Logger, __toString, NULL, ZEND_ACC_PUBLIC)
diff --git a/php/src/IcePHP/Operation.cpp b/php/src/IcePHP/Operation.cpp
index 8a6fafe..3e062be 100644
--- a/php/src/IcePHP/Operation.cpp
+++ b/php/src/IcePHP/Operation.cpp
@@ -218,7 +218,7 @@ IcePHP::OperationI::~OperationI()
     if(_zendFunction)
     {
         delete []_zendFunction->arg_info;
-        efree(_zendFunction->function_name);
+        efree(const_cast<char*>(_zendFunction->function_name));
         efree(_zendFunction);
     }
 }
@@ -238,12 +238,16 @@ IcePHP::OperationI::function()
         for(p = inParams.begin(); p != inParams.end(); ++p, ++i)
         {
             getArgInfo(argInfo[i], *p, false);
+#if PHP_VERSION_ID < 50400
             argInfo[i].required_num_args = static_cast<zend_uint>(numParams);
+#endif
         }
         for(p = outParams.begin(); p != outParams.end(); ++p, ++i)
         {
             getArgInfo(argInfo[i], *p, true);
+#if PHP_VERSION_ID < 50400
             argInfo[i].required_num_args = static_cast<zend_uint>(numParams);
+#endif
         }
 
         string fixed = fixIdent(name);
@@ -255,9 +259,11 @@ IcePHP::OperationI::function()
         _zendFunction->prototype = 0;
         _zendFunction->num_args = static_cast<zend_uint>(numParams);
         _zendFunction->arg_info = argInfo;
-        _zendFunction->pass_rest_by_reference = 0;
         _zendFunction->required_num_args = _zendFunction->num_args;
+#if PHP_VERSION_ID < 50400
+        _zendFunction->pass_rest_by_reference = 0;
         _zendFunction->return_reference = 0;
+#endif
         _zendFunction->handler = ZEND_FN(IcePHP_Operation_call);
     }
 
@@ -293,15 +299,16 @@ IcePHP::OperationI::getArgInfo(zend_arg_info& arg, const TypeInfoPtr& info, bool
     arg.name = 0;
     arg.class_name = 0;
     arg.allow_null = 1;
-    if(SequenceInfoPtr::dynamicCast(info) || DictionaryInfoPtr::dynamicCast(info))
-    {
-        arg.array_type_hint = 1;
-    }
-    else
-    {
-        arg.array_type_hint = 0;
-    }
+
+    const bool isArray = SequenceInfoPtr::dynamicCast(info) || DictionaryInfoPtr::dynamicCast(info);
+
+#if PHP_VERSION_ID < 50400
+    arg.array_type_hint = isArray ? 1 : 0;
     arg.return_reference = 0;
+#else
+    arg.type_hint = isArray ? IS_ARRAY : 0;
+#endif
+
     arg.pass_by_reference = out ? 1 : 0;
 }
 
diff --git a/php/src/IcePHP/Operation.h b/php/src/IcePHP/Operation.h
index a1bb0eb..265cd6f 100644
--- a/php/src/IcePHP/Operation.h
+++ b/php/src/IcePHP/Operation.h
@@ -20,9 +20,6 @@ extern "C"
 ZEND_FUNCTION(IcePHP_defineOperation);
 }
 
-#define ICEPHP_OPERATION_FUNCTIONS \
-    ZEND_FE(IcePHP_defineOperation,  NULL)
-
 namespace IcePHP
 {
 
diff --git a/php/src/IcePHP/Properties.cpp b/php/src/IcePHP/Properties.cpp
index 9e7a67a..2c91abe 100644
--- a/php/src/IcePHP/Properties.cpp
+++ b/php/src/IcePHP/Properties.cpp
@@ -493,7 +493,8 @@ handleFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<Ice::PropertiesPtr>* obj = static_cast<Wrapper<Ice::PropertiesPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 #ifdef _WIN32
@@ -589,11 +590,11 @@ ZEND_FUNCTION(Ice_createProperties)
 //
 // Predefined methods for Properties.
 //
-static function_entry _interfaceMethods[] =
+static zend_function_entry _interfaceMethods[] =
 {
     {0, 0, 0}
 };
-static function_entry _classMethods[] =
+static zend_function_entry _classMethods[] =
 {
     ZEND_ME(Ice_Properties, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
     ZEND_ME(Ice_Properties, __toString, NULL, ZEND_ACC_PUBLIC)
diff --git a/php/src/IcePHP/Properties.h b/php/src/IcePHP/Properties.h
index 797edb5..001e288 100644
--- a/php/src/IcePHP/Properties.h
+++ b/php/src/IcePHP/Properties.h
@@ -20,16 +20,6 @@ extern "C"
 ZEND_FUNCTION(Ice_createProperties);
 }
 
-#define ICEPHP_PROPERTIES_FUNCTIONS \
-    ZEND_FE(Ice_createProperties, NULL)
-
-#ifdef ICEPHP_USE_NAMESPACES
-#   define ICEPHP_PROPERTIES_NS_FUNCTIONS \
-    ZEND_NS_FALIAS("Ice", createProperties, Ice_createProperties, NULL)
-#else
-#   define ICEPHP_PROPERTIES_NS_FUNCTIONS
-#endif
-
 namespace IcePHP
 {
 
diff --git a/php/src/IcePHP/Proxy.cpp b/php/src/IcePHP/Proxy.cpp
index 6aa8d38..89952c4 100644
--- a/php/src/IcePHP/Proxy.cpp
+++ b/php/src/IcePHP/Proxy.cpp
@@ -59,7 +59,11 @@ extern "C"
 static zend_object_value handleAlloc(zend_class_entry* TSRMLS_DC);
 static void handleFreeStorage(void* TSRMLS_DC);
 static zend_object_value handleClone(zval* TSRMLS_DC);
+#if PHP_VERSION_ID < 50400
 static union _zend_function* handleGetMethod(zval**, char*, int TSRMLS_DC);
+#else
+static union _zend_function* handleGetMethod(zval**, char*, int, const _zend_literal* TSRMLS_DC);
+#endif
 static int handleCompare(zval*, zval* TSRMLS_DC);
 }
 
@@ -1418,7 +1422,8 @@ handleFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<ProxyPtr>* obj = static_cast<Wrapper<ProxyPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 #ifdef _WIN32
@@ -1461,7 +1466,11 @@ handleClone(zval* zv TSRMLS_DC)
 extern "C"
 #endif
 static union _zend_function*
+#if PHP_VERSION_ID < 50400
 handleGetMethod(zval** zv, char* method, int len TSRMLS_DC)
+#else
+handleGetMethod(zval** zv, char* method, int len, const _zend_literal* key TSRMLS_DC)
+#endif
 {
     zend_function* result;
 
@@ -1470,7 +1479,11 @@ handleGetMethod(zval** zv, char* method, int len TSRMLS_DC)
     // any of our predefined proxy methods. If it returns 0, then we return a
     // function that will check the class definition.
     //
+#if PHP_VERSION_ID < 50400
     result = zend_get_std_object_handlers()->get_method(zv, method, len TSRMLS_CC);
+#else
+    result = zend_get_std_object_handlers()->get_method(zv, method, len, key TSRMLS_CC);
+#endif
     if(!result)
     {
         Wrapper<ProxyPtr>* obj = Wrapper<ProxyPtr>::extract(*zv TSRMLS_CC);
@@ -1532,7 +1545,7 @@ handleCompare(zval* zobj1, zval* zobj2 TSRMLS_DC)
 //
 // Predefined methods for ObjectPrx.
 //
-static function_entry _proxyMethods[] =
+static zend_function_entry _proxyMethods[] =
 {
     ZEND_ME(Ice_ObjectPrx, __construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
     ZEND_ME(Ice_ObjectPrx, __toString, NULL, ZEND_ACC_PUBLIC)
diff --git a/php/src/IcePHP/Types.cpp b/php/src/IcePHP/Types.cpp
index 464336f..6df610a 100644
--- a/php/src/IcePHP/Types.cpp
+++ b/php/src/IcePHP/Types.cpp
@@ -2405,7 +2405,8 @@ handleTypeInfoFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<TypeInfoPtr>* obj = static_cast<Wrapper<TypeInfoPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 static bool
@@ -2718,7 +2719,8 @@ handleExceptionInfoFreeStorage(void* p TSRMLS_DC)
 {
     Wrapper<ExceptionInfoPtr>* obj = static_cast<Wrapper<ExceptionInfoPtr>*>(p);
     delete obj->ptr;
-    zend_objects_free_object_storage(static_cast<zend_object*>(p) TSRMLS_CC);
+    zend_object_std_dtor(static_cast<zend_object*>(p) TSRMLS_CC);
+    efree(p);
 }
 
 
@@ -2853,7 +2855,7 @@ ZEND_FUNCTION(IcePHP_stringifyException)
 //
 // Predefined methods for IcePHP_TypeInfo.
 //
-static function_entry _typeInfoMethods[] =
+static zend_function_entry _typeInfoMethods[] =
 {
     {0, 0, 0}
 };
@@ -2861,7 +2863,7 @@ static function_entry _typeInfoMethods[] =
 //
 // Predefined methods for IcePHP_ExceptionInfo.
 //
-static function_entry _exceptionInfoMethods[] =
+static zend_function_entry _exceptionInfoMethods[] =
 {
     {0, 0, 0}
 };
diff --git a/php/src/IcePHP/Types.h b/php/src/IcePHP/Types.h
index 7a1352e..b21af72 100644
--- a/php/src/IcePHP/Types.h
+++ b/php/src/IcePHP/Types.h
@@ -33,18 +33,6 @@ ZEND_FUNCTION(IcePHP_stringify);
 ZEND_FUNCTION(IcePHP_stringifyException);
 }
 
-#define ICEPHP_TYPE_FUNCTIONS \
-    ZEND_FE(IcePHP_defineEnum,          NULL) \
-    ZEND_FE(IcePHP_defineStruct,        NULL) \
-    ZEND_FE(IcePHP_defineSequence,      NULL) \
-    ZEND_FE(IcePHP_defineDictionary,    NULL) \
-    ZEND_FE(IcePHP_defineProxy,         NULL) \
-    ZEND_FE(IcePHP_declareClass,        NULL) \
-    ZEND_FE(IcePHP_defineClass,         NULL) \
-    ZEND_FE(IcePHP_defineException,     NULL) \
-    ZEND_FE(IcePHP_stringify,           NULL) \
-    ZEND_FE(IcePHP_stringifyException,  NULL)
-
 namespace IcePHP
 {
 
diff --git a/php/src/IcePHP/Util.cpp b/php/src/IcePHP/Util.cpp
index 27abfb5..ef5f371 100644
--- a/php/src/IcePHP/Util.cpp
+++ b/php/src/IcePHP/Util.cpp
@@ -17,6 +17,7 @@ using namespace std;
 using namespace IcePHP;
 using namespace Slice::PHP;
 
+#if PHP_VERSION_ID < 50400
 #ifdef _WIN32
 extern "C"
 #endif
@@ -25,20 +26,25 @@ dtor_wrapper(void* p)
 {
     zval_ptr_dtor(static_cast<zval**>(p));
 }
+#endif
 
 void*
 IcePHP::createWrapper(zend_class_entry* ce, size_t sz TSRMLS_DC)
 {
     zend_object* obj;
-    zval* tmp;
 
     obj = static_cast<zend_object*>(emalloc(sz));
-    obj->ce = ce;
-    obj->guards = 0;
 
+    zend_object_std_init(obj, ce TSRMLS_CC);
+
+#if PHP_VERSION_ID < 50400
+    zval* tmp;
     obj->properties = static_cast<HashTable*>(emalloc(sizeof(HashTable)));
     zend_hash_init(obj->properties, 0, 0, dtor_wrapper, 0);
     zend_hash_copy(obj->properties, &ce->default_properties, (copy_ctor_func_t)zval_add_ref, &tmp, sizeof(zval*));
+#else
+    object_properties_init(obj, ce);
+#endif
 
     return obj;
 }
diff --git a/php/src/IcePHP/Util.h b/php/src/IcePHP/Util.h
index fbe4756..925c0ea 100644
--- a/php/src/IcePHP/Util.h
+++ b/php/src/IcePHP/Util.h
@@ -22,20 +22,6 @@ ZEND_FUNCTION(Ice_intVersion);
 ZEND_FUNCTION(Ice_generateUUID);
 }
 
-#define ICEPHP_UTIL_FUNCTIONS \
-    ZEND_FE(Ice_stringVersion, NULL) \
-    ZEND_FE(Ice_intVersion, NULL) \
-    ZEND_FE(Ice_generateUUID, NULL)
-
-#ifdef ICEPHP_USE_NAMESPACES
-#   define ICEPHP_UTIL_NS_FUNCTIONS \
-    ZEND_NS_FALIAS("Ice", stringVersion, Ice_stringVersion, NULL) \
-    ZEND_NS_FALIAS("Ice", intVersion, Ice_intVersion, NULL) \
-    ZEND_NS_FALIAS("Ice", generateUUID, Ice_generateUUID, NULL)
-#else
-#   define ICEPHP_UTIL_NS_FUNCTIONS
-#endif
-
 namespace IcePHP
 {
 
diff --git a/php/test/Ice/binding/Client.php b/php/test/Ice/binding/Client.php
index 1a36376..e4fcc58 100644
--- a/php/test/Ice/binding/Client.php
+++ b/php/test/Ice/binding/Client.php
@@ -525,7 +525,7 @@ function allTests($communicator)
     $com->shutdown();
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 allTests($communicator);
 $communicator->destroy();
 exit();
diff --git a/php/test/Ice/checksum/Client.php b/php/test/Ice/checksum/Client.php
index 2de5055..4b514a8 100755
--- a/php/test/Ice/checksum/Client.php
+++ b/php/test/Ice/checksum/Client.php
@@ -88,7 +88,7 @@ function allTests($communicator)
     return $checksum;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $checksum = allTests($communicator);
 $checksum->shutdown();
 $communicator->destroy();
diff --git a/php/test/Ice/exceptions/Client.php b/php/test/Ice/exceptions/Client.php
index f587cb4..543d5c9 100644
--- a/php/test/Ice/exceptions/Client.php
+++ b/php/test/Ice/exceptions/Client.php
@@ -378,7 +378,7 @@ function allTests($communicator)
     return $thrower;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $thrower = allTests($communicator);
 $thrower->shutdown();
 $communicator->destroy();
diff --git a/php/test/Ice/facets/Client.php b/php/test/Ice/facets/Client.php
index 00a16dc..6fcdb60 100644
--- a/php/test/Ice/facets/Client.php
+++ b/php/test/Ice/facets/Client.php
@@ -89,7 +89,7 @@ function allTests($communicator)
     return $gf;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $g = allTests($communicator);
 $g->shutdown();
 $communicator->destroy();
diff --git a/php/test/Ice/info/Client.php b/php/test/Ice/info/Client.php
index 719de4a..4679f1e 100644
--- a/php/test/Ice/info/Client.php
+++ b/php/test/Ice/info/Client.php
@@ -129,7 +129,7 @@ function allTests($communicator)
     return $testIntf;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $server = allTests($communicator);
 $server->shutdown();
 $communicator->destroy();
diff --git a/php/test/Ice/inheritance/Client.php b/php/test/Ice/inheritance/Client.php
index e3d9423..a086e24 100644
--- a/php/test/Ice/inheritance/Client.php
+++ b/php/test/Ice/inheritance/Client.php
@@ -236,7 +236,7 @@ function allTests($communicator)
     return $initial;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $initial = allTests($communicator);
 $initial->shutdown();
 $communicator->destroy();
diff --git a/php/test/Ice/objects/Client.php b/php/test/Ice/objects/Client.php
index 68b517d..e4589fd 100644
--- a/php/test/Ice/objects/Client.php
+++ b/php/test/Ice/objects/Client.php
@@ -391,7 +391,7 @@ function allTests($communicator)
     return $initial;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $factory = new MyObjectFactory();
 $communicator->addObjectFactory($factory, "::Test::B");
 $communicator->addObjectFactory($factory, "::Test::C");
diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php
index 90d73a8..6dc88f2 100644
--- a/php/test/Ice/operations/Client.php
+++ b/php/test/Ice/operations/Client.php
@@ -484,7 +484,7 @@ function allTests($communicator)
     return $cl;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 
 $myClass = allTests($communicator);
 
diff --git a/php/test/Ice/proxy/Client.php b/php/test/Ice/proxy/Client.php
index bb4df33..bb9b104 100644
--- a/php/test/Ice/proxy/Client.php
+++ b/php/test/Ice/proxy/Client.php
@@ -722,7 +722,7 @@ function allTests($communicator)
     return $cl;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $myClass = allTests($communicator);
 $myClass->shutdown();
 $communicator->destroy();
diff --git a/php/test/Ice/slicing/exceptions/Client.php b/php/test/Ice/slicing/exceptions/Client.php
index 5c671f6..ff114ac 100644
--- a/php/test/Ice/slicing/exceptions/Client.php
+++ b/php/test/Ice/slicing/exceptions/Client.php
@@ -315,7 +315,7 @@ function allTests($communicator)
     return $test;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $test = allTests($communicator);
 $test->shutdown();
 $communicator->destroy();
diff --git a/php/test/Ice/slicing/objects/Client.php b/php/test/Ice/slicing/objects/Client.php
index 6b96933..55d5ac1 100644
--- a/php/test/Ice/slicing/objects/Client.php
+++ b/php/test/Ice/slicing/objects/Client.php
@@ -830,7 +830,7 @@ function allTests($communicator)
     return $test;
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 $test = allTests($communicator);
 $test->shutdown();
 $communicator->destroy();
diff --git a/php/test/Slice/keyword/Client.php b/php/test/Slice/keyword/Client.php
index a88749f..b048543 100644
--- a/php/test/Slice/keyword/Client.php
+++ b/php/test/Slice/keyword/Client.php
@@ -96,7 +96,7 @@ function allTests($communicator)
     echo "ok\n";
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 allTests($communicator);
 $communicator->destroy();
 
diff --git a/php/test/Slice/structure/Client.php b/php/test/Slice/structure/Client.php
index 8cb1c03..0c73fae 100644
--- a/php/test/Slice/structure/Client.php
+++ b/php/test/Slice/structure/Client.php
@@ -225,7 +225,7 @@ function allTests($communicator)
     echo "ok\n";
 }
 
-$communicator = Ice_initialize(&$argv);
+$communicator = Ice_initialize($argv);
 allTests($communicator);
 $communicator->destroy();