yabacon / paystack-php

A PHP Wrapper for Paystack API - https://www.paystack.com
MIT License
109 stars 70 forks source link

improvement to autoload.php #12

Closed dedayoa closed 6 years ago

dedayoa commented 6 years ago

Problem/Motivation

Trying to get paystack-php to work with a PHP 5.3 framework...because I have no choice, really. So while running autoload.php, I get Parse error: syntax error, unexpected '[', expecting ')'...

Proposed resolution

The problem is on L11. str_replace expects either a string or an array as per http://php.net/manual/en/function.str-replace.php. Switching it out with $file .= str_replace(array('Yabacon\\', '\\'), array('', DIRECTORY_SEPARATOR), $class_name) . '.php'; seems to fix my problem. My wild guess is that this modification shouldn't break anything for newer versions of PHP.

Is that a list in PHP?

Repeatable

Always

This is not really a bug, say a tinny winny improvement.

dedayoa commented 6 years ago

Turns out this is not tinny winny rara...I'll just use the APIs

ibrahimlawal commented 6 years ago

@dedayoa Sorry bro. I feel your pain about the PHP version. Just insist you need an update. Coding against a deprecated PHP version is unrecommended for security reasons. http://php.net/supported-versions.php

ibrahimlawal commented 6 years ago

At the very worst, use 5.6 (which is also close to End of life actually). https://secure.php.net/eol.php .

dedayoa commented 6 years ago

Thanks @Ibrahim,

Things eventually worked out with 5.4. The project is based on codeigniter2, so anything higher failed to work - first because of mysql_connect etc.

Thanks!

On 1/26/2018 6:42 AM, Ibrahim Lawal wrote:

At the very worst, use 5.6 (which is also close to End of life actually). https://secure.php.net/eol.php .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yabacon/paystack-php/issues/12#issuecomment-360689659, or mute the thread https://github.com/notifications/unsubscribe-auth/AC1YKpJW17t40JJfUpUZgjov-befoOIVks5tOWWvgaJpZM4Rr8gJ.