473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

class automatically extended ?

11
in end of nusoap.php io have this code:
Expand|Select|Wrap|Line Numbers
  1. if (!extension_loaded('soap')) {
  2. echo "not loaded";
  3.         class soapclient extends nusoap_client {}
  4. }
  5. else {
  6. echo "loaded";
  7.         class soap_client extends nusoap_client {}
  8. }
  9. $x = new soap_client;
  10.  
RESULT :
not loaded
Warning: Missing argument 1 for nusoap_client::nusoap_client(), called in nusoap2.php on line 7996 and defined in nusoap2.php on line 7112
line 7112 is first function of class nusoap_client.

when i run ths script i get "not loaded" , mean extension not loaded. but class soap_client also will load !!! .
in cli it will not load but in cgi it will load. so i think there is something in php.ini that cause class extend automatically.

What is the cause for it ?
Mar 9 '10 #1

✓ answered by ehsanch

Finally i found the cause after 1 full day.
this was because of XCache !
removing it solve problem.
hope save someones time...

10 2995
Atli
5,058 Expert 4TB
Hey.

I don't know NuSOAP very well, but PHP does have it's own soapclient class, and it appears that your code checks whether or not the extension containing that class is loaded or not, and if it isn't, assumes the soapclient class name for it's nusoap_client class.

The warning is issued because, apparently, the nusoap_client class - which is extended your code on line #7 as soap_client - is being used on line #9, but the code fails to provide it with any parameters, and it seems it is expecting at least one. -- Note that this is just a warning. The code can go on without it being fixed. If you turn of the error messages it will be silenced. - However, it is usually best not to ignore warnings.
Mar 9 '10 #2
ehsanch
11
Problem is that soap extension is not loaded and commands in else will not execute... but soap_client class will load!
i must get an undefined class error.... but class exist!
Mar 9 '10 #3
Atli
5,058 Expert 4TB
If the class exists it is being defined somewhere, and if you are getting "not loaded" printed from the snipped above, it's not happening there. - It must be happening somewhere else in the code. Perhaps NuSOAP creates the "alias" earlier, when it creates the class itself?
Mar 9 '10 #4
ehsanch
11
... ...
Mar 9 '10 #5
ehsanch
11
i create another simple php script :
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. class newclass {
  3.     public function newfunc() {
  4.         echo 'class exist';
  5.     }
  6. }
  7.  
  8. if (true) {
  9.     class myclass1 extends newclass {}
  10. }
  11. else {
  12.     class myclass2 extends newclass {}
  13. }
  14.  
  15. $test = new myclass2;
  16. $test->newfunc();
  17.  
in browser i get
class exist
, but in cli i get
Fatal error: Class 'myclass2' not found in test.php on line 15
--------------------run with php vs php-cgi--------------------
[root@server]# php test.php
Fatal error: Class 'myclass2' not found in test.php on line 15

[root@server]# php-cgi test.php
X-Powered-By: PHP/5.2.6
Content-type: text/html
class exist

im astonished!
Mar 9 '10 #6
Atli
5,058 Expert 4TB
That's odd.
Using your code on my Ubuntu setup, I get this:
atli@atli-desktop:~$ php /var/www/test/test.php
Fatal error: Class 'myclass2' not found in /var/www/test/test.php on line 15
atli@atli-desktop:~$ php-cgi /var/www/test/test.php
X-Powered-By: PHP/5.2.10-2ubuntu6.4
Content-type: text/html; charset=utf-8

Fatal error: Class 'myclass2' not found in /var/www/test/test.php on line 15
(Note the first one is a custom built version 5.3.1, but the second the php5-cgi package from the Ubuntu repositories.)

I can't seem to find any configuration options that would cause this. PHP should not be defining the "myclass2" class in this code.

Perhaps this was a bug that has now been fixed? Have you considered updating your PHP version? (You seem to be lagging a few versions behind.)
Mar 9 '10 #7
ehsanch
11
i upgrade php to 5.2.13 and first it didnt solved ! but after refresh the page it solved suddenly !!!

note that it worked before ... today i found this bug in a program that worked as expected for 1 year!

very bad headache :(
Mar 9 '10 #8
ehsanch
11
i tested in another server with 5.2.6 version and work as expected on that server....
i didint find the cause of it!
Mar 9 '10 #9
ehsanch
11
Finally i found the cause after 1 full day.
this was because of XCache !
removing it solve problem.
hope save someones time...
Mar 9 '10 #10
Atli
5,058 Expert 4TB
Ahh ok. It had to be something like that. It just didn't make any sense :)

Glad you got it all worked out!
Mar 9 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Phil Powell | last post by:
Consider this: class ActionHandler { ...
3
by: M Shafaat | last post by:
Hi! I want to make a base class with some base properties and then derive different other classes from that in which I want to override the base properties to get specialized behaviour unique for...
5
by: needin4mation | last post by:
Hi, I read this in a book about the Xml classes in c#: "These classes are abstract and therefore must be extended." I just wanted to know what this statement means. I know it is not in...
4
by: Danny Tuppeny | last post by:
Hi all, The next few paragraphs put my question in context, but feel free to skip down to the end if you don't care *why* I need the answer! :) **************************************** ***...
8
by: SpotNet | last post by:
Hello NewsGroup, I have a base class and six classes that inherit from this base class. All members in the base class are used in it's extended classes except, in one of the extended class one...
7
by: D. Patrick | last post by:
I need to duplicate the functionality of a java applet, and how it connects to a remote server. But, I don't have the protocol information or the java source code which was written years ago. ...
11
by: Martin Höfling | last post by:
Hi there, is it possible to put the methods of a class in different files? I just want to order them and try to keep the files small. Regards Martin
14
by: lovecreatesbea... | last post by:
Could you tell me how many class members the C++ language synthesizes for a class type? Which members in a class aren't derived from parent classes? I have read the book The C++ Programming...
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
61
by: Sanders Kaufman | last post by:
I'm wondering if I'm doing this right, as far as using another class object as a PHP class property. class my_baseclass { var $Database; var $ErrorMessage; var $TableName; var $RecordSet;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.