Anything that lives in /core/lib/Drupal/Component should function independently without having Drupal installed or available. However, digitalfire has discovered that Drupal\Component\Uuid\Com (which would only be used on Windows) calls drupal_strtolower().:
class Com implements UuidInterface {
public function generate() {
// Remove {} wrapper and make lower case to keep result consistent.
return drupal_strtolower(trim(com_create_guid(), '{}'));
}
}
Grepping in Component found the following function calls in violation:
Archiver/ArchiveTar.php: @drupal_unlink($this->_temp_tarname);
Archiver/ArchiveTar.php: @drupal_unlink($this->_temp_tarname);
Archiver/ArchiveTar.php: @drupal_unlink($this->_temp_tarname);
Archiver/ArchiveTar.php: @drupal_unlink($this->_tarname);
Archiver/ArchiveTar.php: // Changed the code to use drupal_mkdir() instead of mkdir().
Archiver/ArchiveTar.php: if (!@drupal_mkdir($v_header['filename'], 0777)) {
Archiver/ArchiveTar.php: @drupal_unlink($v_header['filename']);
Archiver/ArchiveTar.php: if (!@drupal_unlink($this->_tarname.".tmp")) {
Archiver/ArchiveTar.php: // Changed the code to use drupal_mkdir() instead of mkdir().
Archiver/ArchiveTar.php: if (!@drupal_mkdir($p_dir, 0777)) {
Diff/DiffEngine.php: if (drupal_strlen($line) > $this->MAX_XREF_LENGTH()) {
Diff/DiffEngine.php: $word = drupal_substr($word, 1);
Diff/DiffEngine.php: if ( drupal_strlen( $line ) > $this->MAX_LINE_LENGTH() ) {
Diff/DiffEngine.php: if (strpos($piece, '<') === 0 && drupal_substr($piece, drupal_strlen($piece) - 1) === '>') {
Diff/DiffEngine.php: if ($piece === ' ' || (strpos($piece, '<') === 0 && drupal_substr($piece, drupal_strlen($piece) - 1) === '>' && drupal_strtolower(drupal_substr($piece, 1, 3)) != 'img')) {
Diff/DiffEngine.php: if (strpos($piece, '<') === 0 && drupal_substr($piece, drupal_strlen($piece) - 1) === '>') {
Diff/DiffEngine.php: elseif (isset($next) && strpos($next, '<') === 0 && drupal_substr($next, drupal_strlen($next) - 1) === '>') {
Uuid/Com.php: return drupal_strtolower(trim(com_create_guid(), '{}'));
Uuid/Php.php: $hex = substr(hash('sha256', drupal_random_bytes(16)), 0, 32);
Issues filed for individual components:
#1929282: Undefined function: drupal_strtolower() in com.php
#1929288: Move cryptographic functions to Crypt component
#2017345: Drupal\Component\Gettext\PoStreamReader calls get_t()
#2033193: Move PhpStorageFactory to Core
#2043773: Replace php function wrappers in file.inc with a Drupal\Core\File\FileSystem class
#2043757: Remove drupal_(string) methods out of diffengine
#2102499: Convert DiffEngine to settings
Comments
Comment #1
tim.plunkettComment #2
catchAdjusting status a bit. This is very silly but it's not a functional bug.
It'd be good if we could move these PHP wrapper functions to a component rather than move the components to Core. That also might mean less files to load by _drupal_bootstrap_code() in the end.
Comment #3
podarok#2 sounds reasonable !!!
Comment #3.0
podarokAdding linked issues.
Comment #3.1
ParisLiakos CreditAttribution: ParisLiakos commentedadded PoStreamReader
Comment #3.2
catchAdding PhpStorage
Comment #4
msonnabaum CreditAttribution: msonnabaum commentedWhen appropriate, these just need to be in Component. Pretty sure our strtolower is already.
Comment #5
dawehnerJust one subissue: #2043757: Remove drupal_(string) methods out of diffengine
The problem is that on the longrun we have to accept that for example the diffengine relies on drupal_render, which will never be a component. Components are only allowed to use other components code.
Comment #6
dawehner#2043773: Replace php function wrappers in file.inc with a Drupal\Core\File\FileSystem class
Comment #6.0
dawehnerAdd issue.
Comment #6.1
catchUpdated issue summary.
Comment #6.2
catchUpdated image summary.
Comment #6.3
catchUpdated issue summary.
Comment #7
catchCommitted #2043757: Remove drupal_(string) methods out of diffengine just now.
#2113621: Convert PhpStorageFactory from global $conf to settings is related but #2033193: Move PhpStorageFactory to Core is RTBC which moves it to Core at least.
That leaves #2043773: Replace php function wrappers in file.inc with a Drupal\Core\File\FileSystem class which I'll bump to critical now, closing this as duplicate.
Comment #8
ParisLiakos CreditAttribution: ParisLiakos commentedAfter #1848266: Convert Diff into a proper, PSR-0-compatible PHP component went in, everything is finally in order.
how about a test to avoid future regressions though?
#2282673: Add a PHPunit test for not using Drupal\Core code in Drupal\Component