Skip to content
16 changes: 16 additions & 0 deletions my.bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

// Core stuff.
require_once __DIR__ . '/wp-test-config.php';
wp_cache_init();
require_wp_db();

require_once __DIR__ . '/tests/phpunit/includes/phpunit-adapter-testcase.php';
require_once __DIR__ . '/tests/phpunit/includes/abstract-testcase.php';
require_once __DIR__ . '/tests/phpunit/includes/testcase.php';
require_once __DIR__ . '/tests/phpunit/includes/functions.php';

if ( ! defined( 'DIR_TESTDATA' ) ) {
define( 'DIR_TESTDATA', __DIR__ . '/tests/phpunit/data' );
}

23 changes: 23 additions & 0 deletions my.phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.2/phpunit.xsd"
bootstrap="my.bootstrap.php"
testdox="true"
colors="true"
>
<php>
<const name="WP_TESTS_DOMAIN" value="example.org"/>
</php>
<testsuites>
<testsuite name="formatting">
<directory suffix=".php">tests/phpunit/tests/formatting</directory>
</testsuite>
<testsuite name="kses">
<file>tests/phpunit/tests/kses.php</file>
</testsuite>
<testsuite name="html-api">
<directory suffix=".php">tests/phpunit/tests/html-api</directory>
</testsuite>
</testsuites>
</phpunit>
26 changes: 14 additions & 12 deletions src/wp-includes/html-api/class-wp-html-attribute-token.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
*/
class WP_HTML_Attribute_Token {
/**
* Attribute name.
* Byte length of attribute name.
*
* @since 6.2.0
* @since 6.5.0
*
* @var string
* @var int
*/
public $name;
public $name_length;

/**
* Attribute value.
Expand Down Expand Up @@ -97,16 +98,17 @@ class WP_HTML_Attribute_Token {
*
* @since 6.2.0
* @since 6.5.0 Replaced `end` with `length` to more closely match `substr()`.
*
* @param string $name Attribute name.
* @param int $value_start Attribute value.
* @param int $value_length Number of bytes attribute value spans.
* @param int $start The string offset where the attribute name starts.
* @param int $length Byte length of the entire attribute name or name and value pair expression.
* @param bool $is_true Whether the attribute is a boolean attribute with true value.
* Replaced `name` with `name_length` to avoid string allocation.
*
* @param int $name_length Byte length of attribute name.
* @param int $value_start Attribute value.
* @param int $value_length Number of bytes attribute value spans.
* @param int $start The string offset where the attribute name starts.
* @param int $length Byte length of the entire attribute name or name and value pair expression.
* @param bool $is_true Whether the attribute is a boolean attribute with true value.
*/
public function __construct( $name, $value_start, $value_length, $start, $length, $is_true ) {
$this->name = $name;
public function __construct( $name_length, $value_start, $value_length, $start, $length, $is_true ) {
$this->name_length = $name_length;
$this->value_starts_at = $value_start;
$this->value_length = $value_length;
$this->start = $start;
Expand Down
Loading
Loading