0

I have created a website 3 month ago. I uploaded it to internet and it worked(it still works there). Now I installed it in my local computer and trying to access it. However it prints the following error messages multiple times:

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ptr\xajax\xajax_core\xajax.inc.php on line 1258

Strict Standards: Only variables should be assigned by reference in C:\xampp\htdocs\ptr\xajax\xajax_core\xajaxPluginManager.inc.php on line 269

I am using XAJAX framework and the errors have something to do with this framework. Since I haven't changed anything in the library files, I don't understand what the problem can be. Please help... I am freaking out

Azad Salahli
  • 876
  • 3
  • 14
  • 30
  • You have different versions of PHP, one which supported returning the value of new by reference, and one that no longer does. If you want it to run as if it's on your web server, use the same PHP version. – nickb Nov 13 '11 at 20:32
  • 3
    I tried xajax once. Only good thing... No, there was no good thing. You should use "true" AJAX instead! – MatTheCat Nov 13 '11 at 20:33

4 Answers4

2

Unfortunately this kind of statement are deprecated from PHP 5. In your local machine you're running a version which is 5.3 while your server is running an older version. Thus, on your machine is thrown a E_STRICT error. To avoid this problem, you have to change lines like:

$node_obj =& new someClass($somearg, $moreargs);

into

$node_obj = new someClass($somearg, $moreargs);
Aurelio De Rosa
  • 21,856
  • 8
  • 48
  • 71
2

The framework you are using seems to be a little bit outdated and uses such constructs

$x = & new Classname();

The & before new is deprecated since PHP 5.0 (which is several years old now). With the introduction of E_DEPRECATED- and E_STRICT-messages it throws such a message now.

KingCrunch
  • 128,817
  • 21
  • 151
  • 173
  • Can I fix this problem without switching back to PHP4? – Azad Salahli Nov 13 '11 at 20:55
  • Ensure you use the latest version of the framework, maybe an update already solves your problem. If not, of course you can fix the errors yourself. Have a look at the messages: Both filename and line are provided. On the other side `E_STRICT` and `E_DEPRECATED` are notices and not errors, thus you _could_ even ignore them. However, I for myself would not rely on a framework, that is not able to make itself compatible to a 7 year old version. The latest version of Xajax itself is over a year old and its marked as "beta". Don't think something will happen there... – KingCrunch Nov 13 '11 at 21:00
  • Thank you for the help. I can't change the framework itself since, it would require a lot of work to do. – Azad Salahli Nov 13 '11 at 21:06
1

Xajax 0.6 targets this and a couple of other issues. When the development on xajax 0.5 started many users were still trapped on PHP4 Webservers and this syntax helped maintain compatibility for PHP4 up to 5.2.x. Xajax 0.6 can be found on https://github.com/Xajax/Xajax-Project Though it's still beta, it's already pretty solid. Many deprecated function were dropped and the core was shrinked & optimized.

Steffen
  • 589
  • 6
  • 16
0

Previous comments fully explain the source of those warnings. Your website will work fine despite of them. But you can disable PHP error reporting, if you want to hide these messages - this manual may help you: http://complete-concrete-concise.com/web-tools/how-to-turn-off-display_errors-in-xampp (UPD: For your local version only of course)

Eugene
  • 3,280
  • 21
  • 17