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

Am I doing something stupid? #81

Closed
royjr opened this issue Jul 21, 2017 · 3 comments
Closed

Am I doing something stupid? #81

royjr opened this issue Jul 21, 2017 · 3 comments

Comments

@royjr
Copy link

royjr commented Jul 21, 2017

Q A
Bug report? maybe
Feature request? no
BC Break report? no
RFC? / Specification yes
Library version 9.0

Code..

<?php
use OTPHP\TOTP;
$otp = TOTP::create();

Error..
Fatal error: Uncaught Error: Call to undefined method OTPHP\TOTP::create() in /Applications/XAMPP/xamppfiles/htdocs/1log/test.php:7 Stack trace: #0 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/1log/test.php on line 7

Am I doing something stupid? Thanks

PHP version.. 7.1.7

Composer Latest Version..

Using version ^9.0 for spomky-labs/otphp
  - Installing christian-riesen/base32 (1.3.1) Loading from cache
  - Installing beberlei/assert (v2.7.6) Loading from cache
  - Installing spomky-labs/otphp (v9.0.0) Downloading: 100%    
@Spomky
Copy link
Member

Spomky commented Jul 21, 2017

It looks like you forgot to include the autoload.php file generated by composer (see in the vendor directory).

<?php

include_once(__DIR__.'/vendor/autoload.php');

use OTPHP\TOTP;
$otp = TOTP::create();

@royjr
Copy link
Author

royjr commented Jul 21, 2017

Silly me.. I actually had the autoload, but forgot to include that here..
require 'vendor/autoload.php';
and
include_once(__DIR__.'/vendor/autoload.php');

still same error..
Fatal error: Uncaught Error: Call to undefined method OTPHP\TOTP::create() ...

The following works fine for me..
$totp = new TOTP('test',$mySecret,30,'sha1',6);

So it seems as if your changes to 9.0 are not being recognized. To help with some background info.. I used composer to install before realizing I only had php7.0.. so I reinstalled XAMPP completely, verified its using the right php directory and that it was the correct version.. composer update.. and this is where im stuck at. oh wait!

found this in composer's installed.json..
"name": "spomky-labs/otphp", "version": "v8.3.0", "version_normalized": "8.3.0.0",

Yes.. I was doing something stupid. So.. I used a symbolic link before upgrading XAMPP.. and I imported a new htdocs directory.. so I upgraded composer in my backup directory =/

Well, all seems to be working now. Great Work!

@Spomky
Copy link
Member

Spomky commented Jul 27, 2017

Closing as it seems that you found how to solve that.
Feel free to reopen if needed.

Thanks.

@Spomky Spomky closed this as completed Jul 27, 2017
Spomky pushed a commit that referenced this issue Jul 17, 2018
Use Doctrine's more generic ObjectManager interface
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