Skip to content
This repository has been archived by the owner on Oct 24, 2020. It is now read-only.

ModelAccessorValidator::validate always fails in method createForwardingAddress of PaymentForwardClient #3

Closed
rtarnaud opened this issue Nov 10, 2015 · 4 comments
Labels

Comments

@rtarnaud
Copy link

Hi,

I think there's a problem with ModelAccessorValidator::validate, especially the first line:

$mode = BlockCypherConfigManager::getInstance()->get('validation.level');

$mode is set to an empty array and therefore, the subsequent check in the method fail and lead to returning false.

Have you noticed that problem too?

Thanks!

@josecelano
Copy link
Contributor

Thanks for your feedback @rtarnaud. I will check it asap.

@josecelano
Copy link
Contributor

Hi @rtarnaud could you post you sdk_config.ini file in the section?:

[validation]
validation.level = disable

It seems you could have an invalid option in that section. Anyway I think I should return true at the end of the method. I think I am going to change it and I will return an exception if $mode value is an invalid option and return true at the end of the method. Does that make sense for you?

@rtarnaud
Copy link
Author

Hi @josecelano,

As far as I understand, there should be a configuration file sdk_config.ini in the library in order to provide various settings, validation.level being one of them.
However, I searched the whole package for this file and only find it in the sample and tests directory.
Should I create my own copy of this file and put it somewhere in the package or in my own project perhaps? (I saw that the file is expected to be found in BC_CONFIG_PATH but I don't know where that is)

Regarding your proposed change, I think you are right: ModelAccessorValidator::validate checks whether the called method actually exists which is unusual. It is rather up to the API user to know what methods are available in the API, hence this validation could be considered as an optional level of safety.

@josecelano
Copy link
Contributor

Sorry for the delay @rtarnaud I have been very busy. Regarding config file you can put it when you want. You only have to define this define BC_CONFIG_PATH with its path.

Samples in this library use a bootstrap file and it contains both ways for setting up the library: config array and config file. Define is in this line:

https://github.com/blockcypher/php-client/blob/master/sample/bootstrap.php#L90

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants