1 (edited by carpegon 2009-12-30 2:39:53 PM)

Topic: Deprecated: Assigning the return value of new ... on line 360

Hello, its my first time here, thank you since the beginning and excuse for my bad english.

I've just download the xajax 5.0 standard and in my tests occurs this error message:

Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 360
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 1305

Fatal error: Call to undefined function registerFunction() in C:\wamp\www\ejemplo_xajax_01.php on line 14

(this last test is mine bat ocurrs the same in the xajax tests)

¿What do I may to do the framework runs?

Thanks

Re: Deprecated: Assigning the return value of new ... on line 360

Hi,

The deprecated warning is from php 5.x. XAJAX 0.5 is not php strict. The next version will be.
You can either preface these lines with the @ character or turn off the messages.

registerFunction() is v0.2 syntax. The current syntax is register(XAJAX_FUNCTION,"mufunc");

Hope this helps you out.  smile

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

3 (edited by carpegon 2010-01-02 2:12:54 PM)

Re: Deprecated: Assigning the return value of new ... on line 360

Thank you, and have a happy new decade!

OK and addAssign() now is assign(), processRequests() is processRequest()...

but, no test runs... neither examples. I have just writen '$xajax=register(XAJAX_FUNCTION, "si_no");' on the line 14 and returns:

Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 360

Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 1305

Fatal error: Call to undefined function register() in C:\wamp\www\ejemplo_xajax_01.php on line 14



This is the code of my example:

<?php
require('xajax_core/xajax.inc.php');         
$xajax = new xajax();                 
function si_no($entrada){
    if ($entrada=="true"){
        $salida = "Marcado";
    }else{
        $salida = "No marcado";
    }
    $respuesta = new xajaxResponse();       
    $respuesta=assign("respuesta","innerHTML",$salida);     
    return $respuesta;
}
$xajax=register(XAJAX_FUNCTION, "si_no");   
$xajax=processRequest();           

<html>
<head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
<title>Si / No en Ajax</title>

<?php
$xajax=printJavascript("xajax_core/");         
?>

</head>

<body>
<div id="respuesta"></div>
<form name="formulario">
    <input type="checkbox" name="si" value="1" onClick="xajax_si_no(document.formulario.si.checked)">
</form>

<script type="text/javascript">
xajax_si_no(document.formulario.si.checked);
</script>

</body>
</html>

Would you tell me please where am I wrong?

Carlos

Re: Deprecated: Assigning the return value of new ... on line 360

Try

$xajax->register(XAJAX_FUNCTION, "si_no");
$xajax->processRequest();
$xajax->printJavascript(...);

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

5 (edited by carpegon 2010-01-04 1:42:12 PM)

Re: Deprecated: Assigning the return value of new ... on line 360

Runs better but no runs.

I had a mistake in the path of javascript too, but the result is only quite diferent, now it says:

Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 360

Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 1305


The code now is:

<?php
require('xajax_core/xajax.inc.php');         
$xajax = new xajax();                 
function si_no($entrada){
    if ($entrada=="true"){
        $salida = "Marcado";
    }else{
        $salida = "No marcado";
    }
    $respuesta = new xajaxResponse();       
    $respuesta = assign("respuesta","innerHTML",$salida);     
    return $respuesta;
}
$xajax->register(XAJAX_FUNCTION, "si_no");   
$xajax->processRequest();           
?>

<html>
<head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
<title>Si / No en Ajax</title>

<?php
$xajax->printJavascript("../");         
?>

</head>

<body>
<div id="respuesta"></div>
<form name="formulario">
    <input type="checkbox" name="si" value="1" onClick="xajax_si_no(document.formulario.si.checked)">
</form>

<script type="text/javascript">
xajax_si_no(document.formulario.si.checked);
</script>

</body>
</html>


But I am worry because if I try the first test, for example, of the tests downloaded, it responses the same:

Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 360

Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 1305
xajax Tests
xajaxResponse Test

(and the button)

If I press the button a window says: undefined

(I have put all the folders downloaded in c:/wamp/www/ )

I think that I have tryed the other version and the results are quite different:

Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\xajax_core\xajax.inc.php on line 354

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


¿any idea?

Re: Deprecated: Assigning the return value of new ... on line 360

The deprecated messages are due to the fact that Xajax V0.5 is not PHP strict and you are using PHP 5.x. This is not an error but a warning that you can shut off by editing the xajax.inc.php and prefixing lines 360 and 1305 with an @ character.

The next release of Xajax is going to be PHP strict.

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Deprecated: Assigning the return value of new ... on line 360

Thank you very much Ed

Your follower,

Carlos

Re: Deprecated: Assigning the return value of new ... on line 360

What happens if you just remove the "&" from those lines?

Using xajax 0.5

Re: Deprecated: Assigning the return value of new ... on line 360

Hello friends,
here posteo the example working . Sorry my english!!

version xajax 0.5 standard 
URL: http://xajaxproject.org/en/download/

bye bye!

<?php 
//incluímos la clase ajax
require ('xajax_core/xajax.inc.php');
//instanciamos el objeto de la clase xajax
$xajax = new xajax();
function si_no($entrada){
if ($entrada=="true"){
$salida = "Marcado";
}else{
$salida = "No marcado";
}
//instanciamos el objeto para generar la respuesta con ajax
$respuesta = new xajaxResponse();
//escribimos en la capa con id="respuesta" el texto que aparece en $salida
$respuesta->assign("respuesta","innerHTML",$salida);
//tenemos que devolver la instanciación del objeto xajaxResponse
return $respuesta;
}
//asociamos la función creada anteriormente al objeto xajax
$xajax->register(XAJAX_FUNCTION,"si_no");
//El objeto xajax tiene que procesar cualquier petición
$xajax->processRequest();
?>
<html>
<head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
<title>Si / No en Ajax</title>
<?php
//En el <head> indicamos al objeto xajax se encargue de generar el javascript necesario
$xajax->printJavascript("./");
?>
</head>
<body>
<div id="respuesta"></div>
<form name="formulario">
<input type="checkbox" name="si" value="1" onclick="xajax_si_no(document.formulario.si.checked)">
</form>
<script type="text/javascript">
xajax_si_no(document.formulario.si.checked); /*Llamando inicialmente a la función xajax_si_no inicializamos el
valor de la capa con la respuesta*/
</script>
</body>
</html>

Re: Deprecated: Assigning the return value of new ... on line 360

I just faced the problem and found out that replaceing = & with = for PHP5 removed the error message but client side elements were not updated.
Suppressing the error messages with @ prefix also didn't help.

So this is the FIX, which worked for me:

use xajax v0.6 (beta 1 at the time of the writing of this feedback)

I happened to use Embarcadero HTML Builder 5, which includes xajax 0.5 by default.
I replaced the register function call with the new format: $xajax->register(XAJAX_FUNCTION, "ajaxProcess");

this change was in rpcl/forms.inc.php.

Then I replaced the rpcl/xajax folder contents with xajax v0.6 and magically everything works fine in PHP 5.6.21

Not sure if you need to change the syntax for other xajax function calls. It seems though that the xajax team did a good job with backwards compatibility in v0.6

cudos for the xajax team.

Thanks,

Re: Deprecated: Assigning the return value of new ... on line 360

Hello and welcome.

Glad that worked for you. There is a new version of Xajax in the works that will also work with PHP 7. See announcement in the anouncements section of the forum.

http://community.xajax-project.org/topi … x-is-cool/

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.