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

PHP 7.4 with Pug 2.7.5 minor correction #232

Closed
dadajuice opened this issue Jan 31, 2020 · 3 comments
Closed

PHP 7.4 with Pug 2.7.5 minor correction #232

dadajuice opened this issue Jan 31, 2020 · 3 comments

Comments

@dadajuice
Copy link

Hello,

I recently updated PHP to 7.4 for one of my project which runs on Pug 2.7.5 and everything seems to work fine except a minor thing. It triggers the following warning:

Warning: include() [function.include0]: Jade\Stream\Template::stream_set_option is not implemented! in /var/www/quickloc/vendor/pug-php/pug/src/Jade/Jade.php on line 166

Once the page is cached, the warning no longer appears.

Looking at the code I tracked down the origin of the problem which is, I think, in Template.php class (/Jade/Stream/Template.php). It seems this class is used as a "streamWrapper" and maybe PHP 7.4 is now enforcing all interface methods to be implemented and its missing the stream_set_option method as stated in the warning.

So, as a test, I just went on and added the method (based on the PHP.net documentation https://www.php.net/manual/en/streamwrapper.stream-set-option) in the Template.php class simply returning true and it silenced the warning and all went well.

public function stream_set_option (int $option , int $arg1 , int $arg2)
{
    return true;
}

So I don't know if there's more than meets the eye to this apparently easy issue, but if you can simply add this to the build it would be very appreciated :) I know I could just configure my .htaccess to silence warnings, but I'm testing my luck here and see if you have time to check this :)

Thank you very much for your time!

@kylekatarnls
Copy link
Member

Yes this method is required in PHP 7.4 and I implemented it in Pug-php 3:
phug-php/renderer@5b27d5f

You can open a pull-request to add it in Pug-php 2 too. But it needs to keep the actual compatibility so don't put the type hints that are not supported in PHP 5.

dadajuice added a commit to dadajuice/pug that referenced this issue Feb 3, 2020
@dadajuice
Copy link
Author

Thank you for your prompt answer! I did a quick PR following your contribute documentation. I sent it into the version-2.next branch as it seems the best and the most logical one for my merge.

Have a nice day!

kylekatarnls added a commit that referenced this issue Feb 3, 2020
#232 Fix by adding missing StreamWrapper interface method
@kylekatarnls
Copy link
Member

Thanks. Version 2.7.6 released.

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