Author Topic: Battle.php ....again  (Read 2898 times)

ShadowRaven

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
    • ShadowGuard: DragonLore
Battle.php ....again
« on: February 28, 2016, 05:01:09 am »
Hi! Don't know if you still come here, but I decided to get back into this and installed your 1.2.5 version. Mostly working great, except fighting. when seeking I get this:

Fatal error: Call-time pass-by-reference has been removed in /..../.../.../battle.php on line 209

server is running php 5.5.32-pl0-gentoo

edit: Found at https://www.mikemackintosh.com/php-fatal-error-call-time-pass-by-reference-has-been-removed-in/

"Starting in PHP 5.3.0, a lot of people began having issues with code written for previous versions. The reason for this is because a feature known as call-time pass-by-reference was deprecated. For the sake of consistency, the ability to add the reference symbol (&) to a function call (myFunc( &$a )) was deprecated.

    There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. As of PHP 5.3.0, you will get a warning saying that call-time pass-by-reference is deprecated when you use & in foo(&$a);.

When you work with a large code-base, and you required the reference to be passed at the function call level, your resulting variable will be skewed if you don't reference the variable on call. By moving the reference notation to the function definition, you remove the possibility of user error when calling your function, ensuring the reference is passed every time the function is called.

Examples

Notice the difference as to where the reference (&) is placed.
Good
Code: [Select]
// PHP 5.3 and newer
function myFunc( &$arg ) {
    // do something
}

myFunc( $var );

Bad
Code: [Select]
// Pre-PHP 5.3
function myFunc($arg) {
    // do something
}
myFunc( &$var );
"

I am just not sure where the actual function is to fix it
« Last Edit: February 28, 2016, 05:59:20 am by ShadowRaven »

ShadowRaven

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
    • ShadowGuard: DragonLore
Re: Battle.php ....again
« Reply #1 on: February 28, 2016, 10:16:42 pm »
I fix it.

Files to replace are attached below
the files are:
lib/extended-battle.php
lib/battle-skills
battle.php

Make sure to pay attention to file structure when uploading

Edit:
For some reason, it cant find the upload path for the attachment, so you can download the zip here:

Battle fix
« Last Edit: March 12, 2016, 04:51:53 am by ShadowRaven »