0

I tried to run a sample PHP code that comes with JasperServer. When I load index.php, I got the following message:

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\HTTP\Request.php on line 412

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\HTTP\Request.php on line 736

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\HTTP\Request.php on line 749

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\HTTP\Request.php on line 794

Strict Standards: Redefining already defined constructor for class Net_URL in C:\xampp\php\pear\Net\URL.php on line 124

Notice: Undefined index: username in C:\xampp\htdocs\registration\php-sample\index.php on line 12

Notice: Undefined index: password in C:\xampp\htdocs\registration\php-sample\index.php on line 13

How can I fix the problem?

I'm using JasperServer 4.7 with PHP 5.4.7 (XAMPP 1.8.1).

Community
  • 1
  • 1
wannik
  • 12,212
  • 11
  • 46
  • 58
  • 1
    @BogdanBurim, Surely you're joking... – Brad Oct 31 '12 at 17:35
  • As you see he didn't provide any code we can fix. – Bogdan Burym Oct 31 '12 at 17:38
  • Check this http://stackoverflow.com/questions/1086539/assigning-the-return-value-of-new-by-reference-is-deprecated – Bogdan Burym Oct 31 '12 at 17:44
  • I just tried the code in https://gist.github.com/26205 and http://sneakybits.blogspot.com/2008/11/php-client-for-jasperserver-via-soap.html It worked. But I still wonder why the sample code is not working. – wannik Oct 31 '12 at 19:28
  • Problem in a PEAR package? Notify its author or file a bug report. You can fix the last two errors yourself. – Salman A Nov 01 '12 at 15:04

2 Answers2

0

You can change PHP's error_reporting settings to not show deprecated/strict warnings. http://php.net/manual/en/function.error-reporting.php

cweiske
  • 30,033
  • 14
  • 133
  • 194
0

This error:

Redefining already defined constructor for class Net_URL in C:\xampp\php\pear\Net\URL.php on line 124

Is because the Net_URL PEAR package has a PHP4 compatibility in it that causes the error on more recent versions. The best thing to do is replace Net_URL with something a bit more modern (e.g. NET_URL2) - but if you need a quick fix to get legacy code working just edit the file URL.php (get the location from the error message) and remove or comment out the following block:

/**
* PHP4 Constructor
*
* @see __construct()
*/
function Net_URL($url = null, $useBrackets = true)
{
    $this->__construct($url, $useBrackets);
}
Eborbob
  • 1,905
  • 1
  • 15
  • 30