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

Replace array_push calls behaving as $array[] since it works faster than invoking functions in PHP #9207

Merged
merged 1 commit into from Jun 27, 2018

Conversation

Projects
None yet
7 participants
@lfluvisotto
Contributor

lfluvisotto commented Jun 23, 2018

Questions Answers
Branch? develop
Description? http://php.net/manual/en/function.array-push.php > Note: If you use array_push() to add one element to the array, it's better to use $array[] = because in that way there is no overhead of calling a function.
Type? improvement
Category? CO
BC breaks? no
Deprecations? no
Fixed ticket? no
How to test? Run the store

This change is Reviewable

@@ -13178,7 +13178,7 @@ public function validate($aIP, $config, $context)
}
while (count($first) < 8) {
array_push($first, '0');
$first[] = '0';

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Jun 25, 2018

Member

Although I agree with the content of this PR, I'd prefer to leave this file untouched as we deal with an external lib.

This comment has been minimized.

@mickaelandrieu

mickaelandrieu Jun 25, 2018

Contributor

As we use it directly, it's not an issue (doing this, it's like we have a fork).

Can we plan to use the composer dependency instead?

This comment has been minimized.

@lfluvisotto

lfluvisotto Jun 25, 2018

Contributor

As HTML Purifier is a third party module it's better use via composer.

http://htmlpurifier.org/download#Composer

https://github.com/ezyang/htmlpurifier

This comment has been minimized.

@mickaelandrieu

mickaelandrieu Jun 25, 2018

Contributor

Sure, but we need to plan it in another contribution (and check we didn't change anything in it, too :/ )

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Jun 25, 2018

Member

It seems we already altered the lib, which is an issue :/

@mickaelandrieu mickaelandrieu merged commit 290a97c into PrestaShop:develop Jun 27, 2018

2 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@mickaelandrieu

This comment has been minimized.

Contributor

mickaelandrieu commented Jun 27, 2018

Thanks @lfluvisotto!

@eternoendless eternoendless changed the title from CO: array_push calls behaving as $array[] works faster than invoking functions in PHP to array_push calls behaving as $array[] works faster than invoking functions in PHP Aug 10, 2018

@eternoendless eternoendless added this to the 1.7.5.0 milestone Aug 10, 2018

@jolelievre jolelievre changed the title from array_push calls behaving as $array[] works faster than invoking functions in PHP to Replace array_push calls behaving as $array[] since it works faster than invoking functions in PHP Oct 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment