Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get override_function to work on PHP7 #4

Closed
ericol opened this issue Oct 26, 2016 · 0 comments
Closed

Cannot get override_function to work on PHP7 #4

ericol opened this issue Oct 26, 2016 · 0 comments

Comments

@ericol
Copy link

ericol commented Oct 26, 2016

I compiled the extension just fine on PHP7:

php -v
PHP 7.0.10-1~dotdeb+8.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Better Function Replacer (BFR) v0.1, Copyright (C) 2015, by Lukas Rist

I'm using this code to test:

<?php
$ren=rename_function('strlen', 'old_strlen');
$ovr=override_function('strlen', '$string', 'return override_lenstr($string);');
function override_strlen($string) {
        return 'THIS TEXT IS ADDED '.old_strlen($string);
}
echo "Results of rename and replace: |{$ren}|{$ovr}|\n";
$var='some string to be measured';
echo "The length of '{$var}' is (override) ".strlen($var)."\n";
echo "The length of '{$var}' is (rename) ".old_strlen($var)."\n";

This is the result:

Results of rename and replace: |1||
The length of 'some string to be measured' is (override) 26
The length of 'some string to be measured' is (rename) 26

As a side note, if I remove line 3 of above (the override_function line) strlen is still available.
Also, override_function never returns true.

Regards.

@glaslos glaslos closed this as completed Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants