File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ static zend_object* ftp_object_create(zend_class_entry* ce) {
82
82
return zobj ;
83
83
}
84
84
85
+ static zend_function * ftp_object_get_constructor (zend_object * zobj ) {
86
+ zend_throw_error (NULL , "Cannot directly construct FTPConnection, use ftp_connect() or ftp_ssl_connect() instead" );
87
+ return NULL ;
88
+ }
89
+
85
90
static void ftp_object_destroy (zend_object * zobj ) {
86
91
php_ftp_object * obj = ftp_object_from_zend_object (zobj );
87
92
@@ -114,6 +119,7 @@ PHP_MINIT_FUNCTION(ftp)
114
119
115
120
memcpy (& ftp_object_handlers , & std_object_handlers , sizeof (zend_object_handlers ));
116
121
ftp_object_handlers .offset = XtOffsetOf (php_ftp_object , std );
122
+ ftp_object_handlers .get_constructor = ftp_object_get_constructor ;
117
123
ftp_object_handlers .dtor_obj = ftp_object_destroy ;
118
124
ftp_object_handlers .clone_obj = NULL ;
119
125
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Attempt to instantiate a FTPConnection directly
3
+ --SKIPIF--
4
+ <?php
5
+ require 'skipif.inc ' ;
6
+ --FILE --
7
+ <?php
8
+ require 'server.inc ' ;
9
+
10
+ try {
11
+ new FTPConnection ();
12
+ } catch (Error $ ex ) {
13
+ echo "Exception: " , $ ex ->getMessage (), "\n" ;
14
+ }
15
+ --EXPECT --
16
+ Exception: Cannot directly construct FTPConnection, use ftp_connect () or ftp_ssl_connect () instead
You can’t perform that action at this time.
0 commit comments