views:

41

answers:

2

i have a php script that runs perfectly but i get 2 errors:

    Warning: The magic method __set() must have public visibility
 and cannot be static in C:\wamp\www\class.XMLHttpRequest.php on line 63

    Warning: The magic method __get() must have public visibility
 and cannot be static in C:\wamp\www\class.XMLHttpRequest.php on line 89

is this important? can i make it dissapear? or fix ?

thanks in advance!

A: 

Post the corresponding code.

You can fix the issue by removing the keyword static and replace private with public on the lines 63 and 89. But even if a private static __set() or __get() method is invalid PHP and doesn't make much sense, maybe the guy who wrote the code had a reason to do so. Check nearby comments for hints.

svens
line 63 : private function __set($property, $value), line 89 : private function __get($property)
adam
youre right removing the "private" from both resolves the thing, thanks !
adam
Oh, didn't catch the public visibility problem. If the programmer made the method private, he probably didn't want external code to be able to access the class.
svens
great insight ! thanks man
adam
A: 

line 63 : private function __set($property, $value), line 89 : private function __get($property)

The source of the error may lie in the code that are calling these functions. How many parts of the website call __set and __get? (perform a file recursive search for this)

I would say it might be risky to suddenly change a private to public without seeing overall what that affects first. MVCs can be tricky to figure out.

Talvi Watia