Giter VIP home page Giter VIP logo

Comments (12)

gasperkol avatar gasperkol commented on July 19, 2024 1

@DragonBe Yes I upgraded to 1.0.6 and 1.0.9 and now everything works without warnings ๐Ÿ˜ƒ

Thank you for time and debugging.

And thank you for this package is a real time saver ๐Ÿ˜‰

from vies.

DragonBe avatar DragonBe commented on July 19, 2024

Hey @gasperkol,

I'll look into this immediately! Should not require a lots of time to fix.

from vies.

DragonBe avatar DragonBe commented on July 19, 2024

OK @gasperkol , it looks I need some additional information here as the constant SOAP_1_1 and SOAP_1_2 are not giving me any errors or warnings.

php -derror_reporting=32767 -ddisplay_errors=1 -ddisplay_startup_errors=1 -r "echo SOAP_1_2 . PHP_EOL;"
2

Also the SoapClient documentation is not giving any hints that these constants will be removed any time soon.

That aside, if this issue is keep giving you warnings, we already provided a way to provide your own SoapClient with your custom settings.

$vies = new Vies();
$soapClient = new SoapClient($vies->getWsdl(), ['soap_version' => 2]);
$vies->setSoapClient($soapClient);

Or you can just provide the correct options directly:

$vies = new Vies();
$vies->setOptions(['soap_version' => 2]);

I hope this will help you sort out the issue. If not, provide me some additional information so I can better analyse where PHP is generating that warning.

from vies.

gasperkol avatar gasperkol commented on July 19, 2024

Thanks for so quick reply!

Sorry for incomplete information.
So I've been using Symfony 3 and as I noticed now this is "Context check" from Symfony.

Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Warning: Use of undefined constant SOAP_1_2 - assumed 'SOAP_1_2' (this will throw an Error in a future version of PHP)"

So this warning still shows up because this version is set in _construct of Vies() and if I init this class this warning is triggered.

We can ignore this but if you can change this would be perfect!

If you need some additional information feel free to ask.

Thank you! @DragonBe

from vies.

DragonBe avatar DragonBe commented on July 19, 2024

@gasperkol which version of this Vies package are you using?

from vies.

DragonBe avatar DragonBe commented on July 19, 2024

@gasperkol OK, I was able to reproduce the warning even though I am not sure where we used the constant SOAP_1_2โ€ฆ but I'll figure it out! ๐Ÿ˜ธ

<?php
// File: /tmp/test.php
error_reporting(E_ALL|E_NOTICE|E_DEPRECATED);
ini_set('display_errors', 1);

var_dump(SOAP_1_1, SOAP_1_2);

When executing it with php /tmp/test.php I got the warning.

php /tmp/test.php
PHP Warning:  Use of undefined constant SOAP_2_1 - assumed 'SOAP_2_1' (this will throw an Error in a future version of PHP) in /tmp/test.php on line 8

Warning: Use of undefined constant SOAP_2_1 - assumed 'SOAP_2_1' (this will throw an Error in a future version of PHP) in /tmp/test.php on line 8
int(1)
int(2)

Interesting note: it only throws this warning for version 2, not for 1โ€ฆ not sure why ๐Ÿค”

from vies.

gasperkol avatar gasperkol commented on July 19, 2024

@DragonBe I use version 1.0.1.

If I understand correctly this warning is thrown when some global constant is not set and its become string....
So if you find this SOAP_1_2 constant (and I know you will ๐Ÿ˜ธ) where you use it then you can check why is not set.

** Sory to bother with this warning but in Symfony is annoying when you have warning in DEV ENV ๐Ÿ˜‰

from vies.

DragonBe avatar DragonBe commented on July 19, 2024

Very strange situation which I need to investigate further, but once I've instantiated SoapClient with a specific version, the error I was able to reproduce was no longer there. I assume that somewhere it became defined (this is what I need to investigate ๐Ÿงfurther).

@gasperkol can I ask something of you? I have a branch where the unit tests are digging deeper into this subject (see https://github.com/DragonBe/vies/tree/michelangelo/issue-60-warning-for-not-defined-soap-version). Can you check this branch out and run ./vendor/bin/phpunit. The output is what I'm interested in.

If you have issues running PHPUnit, I've included docker containers to make life easier: I've got them for PHP 7.0, 7.1, 7.2 and 7.3.

Getting started quickly:

docker build -t phpunit:7.1 .docker/php7.1

  <<<building container here>>>

docker run --rm -t -i phpunit:7.1 ./vendor/bin/phpunit

When I ran it, no issues were reported even though I've been testing all sorts of usages of these constants converting the notices and warnings into exceptions.

PHPUnit 7.5.0 by Sebastian Bergmann and contributors.

...............................................................  63 / 210 ( 30%)
............................................................... 126 / 210 ( 60%)
............................................................... 189 / 210 ( 90%)
.....................                                           210 / 210 (100%)

Time: 8.11 seconds, Memory: 12.00MB

OK (210 tests, 404 assertions)

Generating code coverage report in Clover XML format ... done

Generating code coverage report in HTML format ... done

from vies.

gasperkol avatar gasperkol commented on July 19, 2024

@DragonBe Now I played with my code and settings and I noticed that only in Vies version 1.0.1 this warning shows up. In any others versions everything is ok.

And this version where you added this tests works without warning ๐Ÿ˜„ ..

And test result:
screen shot 2018-12-12 at 07 05 48

So for me, a solution is to update to latest 1.X or 2.X version and everything works.
If you still need some additional information please let me know.

Thank you!

from vies.

DragonBe avatar DragonBe commented on July 19, 2024

OK, thank you for your feedback @gasperkol. Let me know if you were able to upgrade and if those warnings no longer appear.

To be on the safe side, I will include those additional tests in the code base in case future versions of PHP might break things.

For your reference, I'm running this package on PHP 7.3.0 and it works like a charm ๐ŸŒŸ

from vies.

DragonBe avatar DragonBe commented on July 19, 2024

Merged in the additional unit tests for this use case in commit c7d4d0a.

from vies.

DragonBe avatar DragonBe commented on July 19, 2024

@gasperkol you're very welcome. Thank you for reporting it, this way I learn about the things I don't know and makes me wiser along the way.

Have a nice day ๐Ÿ˜„

from vies.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.