Problem/Motivation

error after ugrading::

Fatal error: Trait 'Drupal\serialization\Normalizer\TimeStampItemNormalizerTrait' not found in D:\wamp64\www\workbench\workbench_d9_test1\modules\contrib\smart_date\src\Normalizer\SmartDateNormalizer.php on line 14

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

bmustafa created an issue. See original summary.

mandclu’s picture

Status: Active » Needs review
StatusFileSize
new966 bytes

Thanks for identifying this. The serialization module seems to be enabled by default, which is how I missed this. Please advise if the attached patch resolves you issue. If so, I'll get out a new release quickly.

bmustafa’s picture

Good day,

i have applied patch -- see following verbose:::

  - Installing drupal/smart_date (3.0.0-rc1): Reading C:/Users/Captain/AppData/Local/Composer/files/drupal/smart_date/b0a156ffdb4916d19e35171aebbfc57c32b1a4d9.zip from cache
Loading from cache
 Extracting archive    REASON: Required by the root package: Install command rule (install drupal/smart_date 3.0.0-alpha1|install drupal/smart_date 3.0.0-alpha2|install drupal/smart_date 3.0.x-dev|install drupal/smart_date 3.0.0-beta1|install drupal/smart_date 3.0.0-beta2|install drupal/smart_date 3.0.0-rc1|install drupal/smart_date 3.0.0-alpha1|install drupal/smart_date 3.0.0-alpha2|install drupal/smart_date 3.0.x-dev|install drupal/smart_date 3.0.0-beta1|install drupal/smart_date 3.0.0-beta2|install drupal/smart_date 3.0.0-rc1)

  - Applying patches for drupal/smart_date
Checked CA file C:\Users\Captain\AppData\Local\Temp\ope172A.tmp: valid
    https://www.drupal.org/files/issues/2020-09-09/smart_date-serialization-error-3169882-2.patch (d9_fix_smart_date)
Downloading https://www.drupal.org/files/issues/2020-09-09/smart_date-serialization-error-3169882-2.patch
patch "-p1" --no-backup-if-mismatch -d "modules/contrib/smart_date" < "C:\Users\Captain\AppData\Local\Temp/5f5b6b2d465a2.patch"
Executing command (CWD): patch "-p1" --no-backup-if-mismatch -d "modules/contrib/smart_date" < "C:\Users\Captain\AppData\Local\Temp/5f5b6b2d465a2.patch"
patching file src/SmartDateServiceProvider.php

.....
Writing lock file
Generating autoload files
Hardening vendor directory with .htaccess and web.config files.
38 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Cleaning vendor directory.
 
Executing command (D:\wamp64\www\workbench\workbench_d9_test1/.): git ls-files --error-unmatch "D:\wamp64\www\workbench\workbench_d9_test1/.//autoload.php"
Executing command (D:\wamp64\www\workbench\workbench_d9_test1): git rev-parse --show-toplevel
Captain@LAPTOP-JHQCG93K /d/wamp64/www/workbench/workbench_d9_test1 $<strong> drush cr</strong>

<h4>Fatal error: Trait 'Drupal\serialization\Normalizer\TimeStampItemNormalizerTrait' not found in D:\wamp64\www\workbench\workbench_d9_test1\modules\contrib\smart_date\src\Normalizer\SmartDateNormalizer.php on line 14
 [warning] Drush command terminated abnormally.</h4>

notice the final result is still negative

bmustafa’s picture

StatusFileSize
new140.39 KB

see error still exhibits, i have installed the dev release and applied patch on it.
my first attempt was to apply patch on rc1 release..
both fail so far... needs more work.
best regards

mandclu’s picture

Category: Bug report » Support request
Priority: Critical » Normal

I'm going to need some additional information on how to reproduce your problem. What version of Drupal are you using? Are the HAL and serialization modules installed or no? Did you have any other patches applied to Smart Date?

I just tried upgraded Smart Date from 8.x-2.9 to 3.0.0-rc1 on a fresh install of Drupal 9, and it works without error. No errors for me on cache clear or use of a Smart Date field, with or without the HAL and serialization modules enabled.

One other note, I didn't realize when I wrote the patch above that serialization is a requirement for the HAL module, so the extra check provided by the patch likely isn't needed or useful.

I understand and appreciate that this is a critical error for you, but considering I can't reproduce this on a clean install of Drupal, changing this to a support request until I know what parameters are needed to reproduce the problem.

mandclu’s picture

Status: Needs review » Active
bmustafa’s picture

StatusFileSize
new2.17 KB

Am attaching a copy of my compsoer.json, it will inform a lot of info about my setup.
all is butter smooth with my installation except for when trying to upgrade to latest smartdate.

for now, i have reverted back to the last stable release prior to r3

interesingly when i downgrade, i get this error

The website encountered an unexpected error. Please try again later.
Error: Class 'Drupal\smart_date\Normalizer\SmartDateNormalizer' not found in Drupal\Component\DependencyInjection\Container->createService() (line 257 of core\lib\Drupal\Component\DependencyInjection\Container.php).


[11-Sep-2020 17:24:42 UTC] Error: Class 'Drupal\smart_date\Normalizer\SmartDateNormalizer' not found in D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php on line 257 #0 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(447): Drupal\Component\DependencyInjection\Container->createService(Array, 'private__YAB9IS...')
#1 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(460): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#2 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(235): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#3 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(171): Drupal\Component\DependencyInjection\Container->createService(Array, 'serializer')
#4 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(432): Drupal\Component\DependencyInjection\Container->get('serializer', 1)
#5 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(271): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#6 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(171): Drupal\Component\DependencyInjection\Container->createService(Array, 'jsonapi.seriali...')
#7 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(432): Drupal\Component\DependencyInjection\Container->get('jsonapi.seriali...', 1)
#8 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(235): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#9 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\DependencyInjection\Container.php(171): Drupal\Component\DependencyInjection\Container->createService(Array, 'jsonapi.resourc...')
#10 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher.php(148): Drupal\Component\DependencyInjection\Container->get('jsonapi.resourc...')
#11 D:\wamp64\www\workbench\workbench_d9_test1\vendor\symfony\event-dispatcher\LegacyEventDispatcherProxy.php(121): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->getListeners('kernel.response')
#12 D:\wamp64\www\workbench\workbench_d9_test1\vendor\symfony\event-dispatcher\LegacyEventDispatcherProxy.php(71): Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy->getListeners('kernel.response')
#13 D:\wamp64\www\workbench\workbench_d9_test1\vendor\symfony\http-kernel\HttpKernel.php(191): Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy->dispatch(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response')
#14 D:\wamp64\www\workbench\workbench_d9_test1\vendor\symfony\http-kernel\HttpKernel.php(179): Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object(Drupal\Core\Render\HtmlResponse), Object(Symfony\Component\HttpFoundation\Request), 1)
#15 D:\wamp64\www\workbench\workbench_d9_test1\vendor\symfony\http-kernel\HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#16 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\StackMiddleware\Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 D:\wamp64\www\workbench\workbench_d9_test1\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\DrupalKernel.php(705): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 D:\wamp64\www\workbench\workbench_d9_test1\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#25 {main}

which is showing different line number 257 rather than 14.

however, this post-downgrade error goes away once i do 'drush cr'

bmustafa’s picture

And yes i have this module as enabled already on my site:

HAL
Serializes entities using Hypertext Application Language.
Machine name: hal
Version: 9.0.5
Requires: Serialization
Required by: Layout Components - Commands (disabled)

mandclu’s picture

You'll have to forgive me, but I'll leery of downloading zip files from unknown sources. The composer.json should be enough to tell me what you have downloaded, but not necessary what has actually been installed/activated.

That said, I'm not sure this information will really help me reproduce the problem. Can you reproduce it using a fresh install of Drupal and Smart Date, upgrading between versions? If so, what steps are needed to reproduce it?

  • mandclu committed bed94ab on 3.0.x
    Issue #3169882 by mandclu: Fatal error: Trait 'Drupal\serialization\...
mandclu’s picture

Version: 3.0.0-rc1 » 3.0.x-dev
Status: Active » Fixed

As it turns out, with some additional testing I was able to reproduce this. For me it only appeared intermittently but I was able to identify that the TimeStampItemNormalizerTrait was deprecated as of Drupal 8.7 and removed from Drupal 9. It doesn't appear to be needed anyway, so removed references to it.

mandclu’s picture

Category: Support request » Bug report
bmustafa’s picture

Thanks for the update - i just returned back to station after a little merry go round.
Keep up the good work

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.