John Davidson

Replacing a line of PHP using ansible

0 comments
Message:


I am trying to remove this error:


PHP Fatal error:  Can't use method return value in write context in /usr/share/phoronix-test-suite/pts-core/objects/client/pts_installed_test.php on line 105

The issue was that i am using an old version of PHP, so I had to change:


if($this->get_runtime_errors() && !empty($this->get_runtime_errors()))

to:


if($this->runtime_errors && !empty($this->runtime_errors))

I want to automatically implement this change. I wrote an ansible script:


- name: Make new PHP file compatable
lineinfile:
path: /usr/share/phoronix-test-suite/pts-core/objects/client/pts_installed_test.php
regexp: 'if($this->get_runtime_errors() && !empty($this->get_runtime_errors()))'
line: "if($this->runtime_errors && !empty($this->runtime_errors))"
backrefs: yes

However even though the process reports okay, no change is implemented.



My Answer:
>getTestInstallPath() !== false) {
to
if($this->getTestInstallPath() != false) {

Rate this post

5 of 5 based on 1775 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us