mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Make sanitize_custom_id more correct
This commit is contained in:
parent
3b98d8300b
commit
f23df0b91c
1 changed files with 4 additions and 1 deletions
|
@ -31,7 +31,10 @@ trait PrefixTrait {
|
||||||
*/
|
*/
|
||||||
private function sanitize_custom_id( string $custom_id ): int {
|
private function sanitize_custom_id( string $custom_id ): int {
|
||||||
|
|
||||||
$id = str_replace( $this->prefix, '', $custom_id );
|
$id = $custom_id;
|
||||||
|
if ( strlen( $this->prefix ) > 0 && 0 === strpos( $id, $this->prefix ) ) {
|
||||||
|
$id = substr( $id, strlen( $this->prefix ) );
|
||||||
|
}
|
||||||
return (int) $id;
|
return (int) $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue