Comments (7)
Thanks for reporting! Would you like to send a pull request to fix the issue?
Please note that our support matrix still includes very old PHP versions down to 5.3, which actually require the $num_points
parameter to be present. Perhaps this can be solved with a conditional call to imagefilledpolygon()
: if the PHP_VERSION_MAJOR
constant is greater than/equal to 8, then call imagefilledpolygon()
without $num_points
, otherwise call imagefilledpolygon()
with $num_points
just as we are doing now. What do you think?
Documentation for PHP 5 can be found here: https://php-legacy-docs.zend.com/manual/php5/en/function.imagefilledpolygon
from php-svg.
As for the depreciation notice on passing null to trim()
I am wondering what the preferred solution would be:
- Look for all the instances of
trim()
in the repo. Check whether the parameter could potentially be null and if so add a condition that replaces null with an empty string. - Add a string helper/utility (e.g.
Str::trim()
) that replacesnull
with an empty string and then returnstrim()
. And replace all calls totrim()
in the repo withStr::trim()
.
The latter would probably have my preference as it doesn't "pollute" the code base with a lot of checks on null
. However I still have to check how many times this occurs. (Option 1 would be perfectly acceptable if it's only a couple of instances.)
from php-svg.
@Niellles I'd also prefer the second option. Probably a function call slightly degrades performance, especially in parts of the code that are called often, but honestly, the reduced complexity seems worth it. I've counted a about a dozen trim
calls, so it should be above the threshold.
from php-svg.
@meyfa Allright then, nice that we can agree on that. I'll submit a PR at a later point.
I couldn't find any calles to imagefilledpolygon()
by the way. So not sure where there 2nd notice comes from.
Remaining direct deprecation notices (2)
1x: trim(): Passing null to parameter #1 ($string) of type string is deprecated
1x: imagefilledpolygon(): Using the $num_points parameter is deprecated
Additionally I'm having some issues with running the test suite locally. PHP 8.1 and 8.0 both fail due to each()
being removed and it's required by PHPunit. PHP 7.4 runs the tests partially, but gives a bunch of deprecation notices on each()
among others. I can probably work around this (i.e. use an even lower PHP version). However I've noticed that the test suite ran successfully on my recent PR #140 on PHP 8.0. Anything special you did to get the tests to run?
from php-svg.
I couldn't find any calles to imagefilledpolygon() by the way.
Those were probably removed as part of still unreleased changes. That's why they aren't part of the code on GitHub, but can be seen on servers when using PHP-SVG via Composer.
I'm contemplating creating a v0.12.0 with reduced scope, i.e., with fewer features implemented than are on the v0.12.0 milestone to get some fixes released. I probably won't have any capacity to complete the missing features in the near term any way.
Additionally I'm having some issues with running the test suite locally.
For PHP 8, we need to load a bootstrap file that polyfills the each
function. On CI, this is done by configuring php.ini
, check out /.github/workflows/php.yml
. On the command line, invoking PHPUnit as ./vendor/bin/phpunit --bootstrap tests/bootstrap.php
should work.
from php-svg.
Those were probably removed as part of still unreleased changes. That's why they aren't part of the code on GitHub, but can be seen on servers when using PHP-SVG via Composer.
Since the part above is no longer relevant (i.e. upgrading to a newer release should remove the notice). This remaining part of the issue (i.e. regarding trim(null)
) should be fixed with #177.
For PHP 8, we need to load a bootstrap file that polyfills the each function. On CI, this is done by configuring php.ini, check out /.github/workflows/php.yml. On the command line, invoking PHPUnit as ./vendor/bin/phpunit --bootstrap tests/bootstrap.php should work.
Makes sense. How about adding it via the composer-autoloader though? (Probably as a development dependency as only PHPUnit seems to care about it.)
from php-svg.
This remaining part of the issue (i.e. regarding trim(null)) should be fixed with #177.
I agree. Closing this issue.
Regarding bootstrapping, I've opened #178 to discuss solutions, since it's off-topic here -- but I agree that we need to improve the situation.
from php-svg.
Related Issues (20)
- Fonts are not working on SVG HOT 1
- External fonts not working for text object HOT 1
- [feature request] generate sprite from an array of svg HOT 2
- I am facing an issue, to centralize the icon, text, and tagline in the SVG viewBox.
- Running PHPUnit tests on PHP 8 HOT 3
- Dropping support for PHP versions < 7.3 HOT 8
- SVGImage cannot be rasterised to PNG or JPG HOT 5
- SVGStyleParser::parseCss cannot handle duplicate selectors
- Error if font-size not set explicitly
- Issue while rendering `rect` without `x` or `y` attributes
- Does not use internal CSS
- Support SVG `<pattern>`
- SVGTextPath node not being rasterized when added as child of SVGText HOT 4
- Drop unmaintained PHP, publish a release HOT 14
- Buggy rasterization image
- Security options HOT 5
- Migrate to PHP-CS-Fixer
- Deprecated: Implicit conversion from float to int loses precision
- Rendering 'italic' or 'oblique' text misses fonts with 'Oblique' subfamily HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-svg.